tjadmin 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tjadmin/version.rb +1 -1
- data/vendor/assets/font/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff +0 -0
- data/vendor/assets/font/FontAwesome.otf +0 -0
- data/vendor/assets/font/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff +0 -0
- data/vendor/assets/font/fontawesome-webfont.eot +0 -0
- data/vendor/assets/font/fontawesome-webfont.svg +399 -0
- data/vendor/assets/font/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/font/fontawesome-webfont.woff +0 -0
- data/vendor/assets/javascripts/tjadmin/ace-elements.js +866 -0
- data/vendor/assets/javascripts/tjadmin/ace-extra.js +374 -0
- data/vendor/assets/javascripts/tjadmin/ace.js +310 -0
- data/vendor/assets/javascripts/tjadmin/additional-methods.js +617 -0
- data/vendor/assets/javascripts/tjadmin/bootbox.js +660 -0
- data/vendor/assets/javascripts/tjadmin/bootstrap-colorpicker.js +540 -0
- data/vendor/assets/javascripts/tjadmin/bootstrap-tag.js +206 -0
- data/vendor/assets/javascripts/tjadmin/bootstrap-wysiwyg.js +206 -0
- data/vendor/assets/javascripts/tjadmin/bootstrap.js +2280 -0
- data/vendor/assets/javascripts/tjadmin/chosen.jquery.js +1166 -0
- data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-datepicker.js +1016 -0
- data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-timepicker.js +888 -0
- data/vendor/assets/javascripts/tjadmin/date-time/daterangepicker.js +854 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.bg.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ca.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.cs.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.da.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.de.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.el.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.es.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fi.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fr.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.he.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hr.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hu.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.id.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.is.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.it.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ja.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.kr.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lt.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lv.js +16 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ms.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nb.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nl.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pl.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt-BR.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ro.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs-latin.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ru.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sk.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sl.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sv.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sw.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.th.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.tr.js +15 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.uk.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-CN.js +14 -0
- data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-TW.js +13 -0
- data/vendor/assets/javascripts/tjadmin/date-time/moment.js +1400 -0
- data/vendor/assets/javascripts/tjadmin/excanvas.js +1428 -0
- data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.js +3061 -0
- data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.pie.js +817 -0
- data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.resize.js +60 -0
- data/vendor/assets/javascripts/tjadmin/fuelux/data/fuelux.tree-sampledata.js +174 -0
- data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.spinner.js +201 -0
- data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.tree.js +173 -0
- data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.wizard.js +172 -0
- data/vendor/assets/javascripts/tjadmin/fullcalendar.js +5973 -0
- data/vendor/assets/javascripts/tjadmin/jquery-1.10.2.js +9789 -0
- data/vendor/assets/javascripts/tjadmin/jquery-2.0.3.js +8829 -0
- data/vendor/assets/javascripts/tjadmin/jquery-ui-1.10.3.custom.js +5423 -0
- data/vendor/assets/javascripts/tjadmin/jquery.autosize.js +242 -0
- data/vendor/assets/javascripts/tjadmin/jquery.colorbox.js +1063 -0
- data/vendor/assets/javascripts/tjadmin/jquery.dataTables.js +12099 -0
- data/vendor/assets/javascripts/tjadmin/jquery.easy-pie-chart.js +200 -0
- data/vendor/assets/javascripts/tjadmin/jquery.gritter.js +418 -0
- data/vendor/assets/javascripts/tjadmin/jquery.hotkeys.js +113 -0
- data/vendor/assets/javascripts/tjadmin/jquery.inputlimiter.1.3.1.js +172 -0
- data/vendor/assets/javascripts/tjadmin/jquery.knob.js +656 -0
- data/vendor/assets/javascripts/tjadmin/jquery.maskedinput.js +338 -0
- data/vendor/assets/javascripts/tjadmin/jquery.mobile.custom.js +1081 -0
- data/vendor/assets/javascripts/tjadmin/jquery.slimscroll.js +448 -0
- data/vendor/assets/javascripts/tjadmin/jquery.sparkline.js +3054 -0
- data/vendor/assets/javascripts/tjadmin/jquery.ui.touch-punch.js +160 -0
- data/vendor/assets/javascripts/tjadmin/jquery.validate.js +1231 -0
- data/vendor/assets/javascripts/tjadmin/markdown/bootstrap-markdown.js +993 -0
- data/vendor/assets/javascripts/tjadmin/markdown/markdown.js +1616 -0
- data/vendor/assets/javascripts/tjadmin/markdown/to-markdown.js +184 -0
- data/vendor/assets/javascripts/tjadmin/select2.js +3168 -0
- data/vendor/assets/javascripts/tjadmin/spin.js +349 -0
- data/vendor/assets/javascripts/tjadmin/x-editable/ace-editable.js +368 -0
- data/vendor/assets/javascripts/tjadmin/x-editable/bootstrap-editable.js +6827 -0
- data/vendor/assets/javascripts/tjadmin.js +5 -0
- data/vendor/assets/stylesheets/tjadmin/ace-fonts.css.scss +13 -0
- data/vendor/assets/stylesheets/tjadmin/ace-ie.css +293 -0
- data/vendor/assets/stylesheets/tjadmin/ace-responsive.css +1113 -0
- data/vendor/assets/stylesheets/tjadmin/ace-skins.css +1301 -0
- data/vendor/assets/stylesheets/tjadmin/ace.css +14701 -0
- data/vendor/assets/stylesheets/tjadmin/bootstrap-responsive.css +1109 -0
- data/vendor/assets/stylesheets/tjadmin/bootstrap.css +6167 -0
- data/vendor/assets/stylesheets/tjadmin/chosen.css +430 -0
- data/vendor/assets/stylesheets/tjadmin/font-awesome-ie7.css +1203 -0
- data/vendor/assets/stylesheets/tjadmin/font-awesome.css +1479 -0
- data/vendor/assets/stylesheets/tjadmin/jquery-ui-1.10.3.custom.css +223 -0
- data/vendor/assets/stylesheets/tjadmin.css +9 -0
- metadata +106 -1
@@ -0,0 +1,113 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Hotkeys Plugin
|
3
|
+
* Copyright 2010, John Resig
|
4
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
5
|
+
*
|
6
|
+
* Based upon the plugin by Tzury Bar Yochay:
|
7
|
+
* http://github.com/tzuryby/hotkeys
|
8
|
+
*
|
9
|
+
* Original idea by:
|
10
|
+
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
11
|
+
*/
|
12
|
+
|
13
|
+
/*
|
14
|
+
* One small change is: now keys are passed by object { keys: '...' }
|
15
|
+
* Might be useful, when you want to pass some other data to your handler
|
16
|
+
*/
|
17
|
+
|
18
|
+
(function(jQuery){
|
19
|
+
|
20
|
+
jQuery.hotkeys = {
|
21
|
+
version: "0.8",
|
22
|
+
|
23
|
+
specialKeys: {
|
24
|
+
8: "backspace", 9: "tab", 10: "return", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
|
25
|
+
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
|
26
|
+
37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
|
27
|
+
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
|
28
|
+
104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
|
29
|
+
112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
|
30
|
+
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 186: ";", 191: "/",
|
31
|
+
220: "\\", 222: "'", 224: "meta"
|
32
|
+
},
|
33
|
+
|
34
|
+
shiftNums: {
|
35
|
+
"`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
|
36
|
+
"8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
|
37
|
+
".": ">", "/": "?", "\\": "|"
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
function keyHandler( handleObj ) {
|
42
|
+
if (typeof handleObj.data == 'undefined') return;
|
43
|
+
|
44
|
+
if ( typeof handleObj.data === "string" ) {
|
45
|
+
handleObj.data = { keys: handleObj.data };
|
46
|
+
}
|
47
|
+
|
48
|
+
// Only care when a possible input has been specified
|
49
|
+
if ( !handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string" ) {
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
|
53
|
+
var origHandler = handleObj.handler,
|
54
|
+
keys = handleObj.data.keys.toLowerCase().split(" "),
|
55
|
+
textAcceptingInputTypes = ["text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime", "datetime-local", "search", "color", "tel"];
|
56
|
+
|
57
|
+
handleObj.handler = function( event ) {
|
58
|
+
// Don't fire in text-accepting inputs that we didn't directly bind to
|
59
|
+
if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
|
60
|
+
jQuery.inArray(event.target.type, textAcceptingInputTypes) > -1 ) ) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
|
64
|
+
var special = jQuery.hotkeys.specialKeys[ event.keyCode ],
|
65
|
+
// character codes are available only in keypress
|
66
|
+
character = (event.type === "keydown" || event.type === "keypress") && String.fromCharCode( event.which ).toLowerCase()
|
67
|
+
modif = "", possible = {};
|
68
|
+
|
69
|
+
// check combinations (alt|ctrl|shift+anything)
|
70
|
+
if ( event.altKey && special !== "alt" ) {
|
71
|
+
modif += "alt+";
|
72
|
+
}
|
73
|
+
|
74
|
+
if ( event.ctrlKey && special !== "ctrl" ) {
|
75
|
+
modif += "ctrl+";
|
76
|
+
}
|
77
|
+
|
78
|
+
// TODO: Need to make sure this works consistently across platforms
|
79
|
+
if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
|
80
|
+
modif += "meta+";
|
81
|
+
}
|
82
|
+
|
83
|
+
if ( event.shiftKey && special !== "shift" ) {
|
84
|
+
modif += "shift+";
|
85
|
+
}
|
86
|
+
|
87
|
+
if ( special ) {
|
88
|
+
possible[ modif + special ] = true;
|
89
|
+
}
|
90
|
+
|
91
|
+
if ( character ) {
|
92
|
+
possible[ modif + character ] = true;
|
93
|
+
possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
|
94
|
+
|
95
|
+
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
|
96
|
+
if ( modif === "shift+" ) {
|
97
|
+
possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
for ( var i = 0, l = keys.length; i < l; i++ ) {
|
102
|
+
if ( possible[ keys[i] ] ) {
|
103
|
+
return origHandler.apply( this, arguments );
|
104
|
+
}
|
105
|
+
}
|
106
|
+
};
|
107
|
+
}
|
108
|
+
|
109
|
+
jQuery.each([ "keydown", "keyup", "keypress" ], function() {
|
110
|
+
jQuery.event.special[ this ] = { add: keyHandler };
|
111
|
+
});
|
112
|
+
|
113
|
+
})( this.jQuery );
|
@@ -0,0 +1,172 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Input Limiter plugin 1.3.1
|
3
|
+
* http://rustyjeans.com/jquery-plugins/input-limiter/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2009 Russel Fones <russel@rustyjeans.com>
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person
|
8
|
+
* obtaining a copy of this software and associated documentation
|
9
|
+
* files (the "Software"), to deal in the Software without
|
10
|
+
* restriction, including without limitation the rights to use,
|
11
|
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
* copies of the Software, and to permit persons to whom the
|
13
|
+
* Software is furnished to do so, subject to the following
|
14
|
+
* conditions:
|
15
|
+
*
|
16
|
+
* The above copyright notice and this permission notice shall be
|
17
|
+
* included in all copies or substantial portions of the Software.
|
18
|
+
*
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
21
|
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
23
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
24
|
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
25
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
26
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
27
|
+
*/
|
28
|
+
|
29
|
+
(function ($) {
|
30
|
+
$.fn.inputlimiter = function (options) {
|
31
|
+
var opts = $.extend({}, $.fn.inputlimiter.defaults, options),
|
32
|
+
$elements = $(this);
|
33
|
+
if (opts.boxAttach && !$('#' + opts.boxId).length) {
|
34
|
+
$('<div/>').appendTo("body").attr({id: opts.boxId, 'class': opts.boxClass}).css({'position': 'absolute'}).hide();
|
35
|
+
// apply bgiframe if available
|
36
|
+
if ($.fn.bgiframe) {
|
37
|
+
$('#' + opts.boxId).bgiframe();
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
var inputlimiterKeyup = function (e) {
|
42
|
+
var $this = $(this),
|
43
|
+
count = counter($this.val());
|
44
|
+
if (!opts.allowExceed && count > opts.limit) {
|
45
|
+
$this.val(truncater($this.val()));
|
46
|
+
}
|
47
|
+
if (opts.boxAttach) {
|
48
|
+
$('#' + opts.boxId).css({
|
49
|
+
'width': $this.outerWidth() - ($('#' + opts.boxId).outerWidth() - $('#' + opts.boxId).width()) + 'px',
|
50
|
+
'left': $this.offset().left + 'px',
|
51
|
+
'top': ($this.offset().top + $this.outerHeight()) - 1 + 'px',
|
52
|
+
'z-index': 2000
|
53
|
+
});
|
54
|
+
}
|
55
|
+
var charsRemaining = (opts.limit - count > 0 ? opts.limit - count : 0),
|
56
|
+
remText = opts.remTextFilter(opts, charsRemaining),
|
57
|
+
limitText = opts.limitTextFilter(opts);
|
58
|
+
|
59
|
+
if (opts.limitTextShow) {
|
60
|
+
$('#' + opts.boxId).html(remText + ' ' + limitText);
|
61
|
+
// Check to see if the text is wrapping in the box
|
62
|
+
// If it is lets break it between the remaining test and the limit test
|
63
|
+
var textWidth = $("<span/>").appendTo("body").attr({id: '19cc9195583bfae1fad88e19d443be7a', 'class': opts.boxClass}).html(remText + ' ' + limitText).innerWidth();
|
64
|
+
$("#19cc9195583bfae1fad88e19d443be7a").remove();
|
65
|
+
if (textWidth > $('#' + opts.boxId).innerWidth()) {
|
66
|
+
$('#' + opts.boxId).html(remText + '<br />' + limitText);
|
67
|
+
}
|
68
|
+
// Show the limiter box
|
69
|
+
$('#' + opts.boxId).show();
|
70
|
+
} else {
|
71
|
+
$('#' + opts.boxId).html(remText).show();
|
72
|
+
}
|
73
|
+
},
|
74
|
+
|
75
|
+
inputlimiterKeypress = function (e) {
|
76
|
+
var count = counter($(this).val());
|
77
|
+
if (!opts.allowExceed && count > opts.limit) {
|
78
|
+
var modifierKeyPressed = e.ctrlKey || e.altKey || e.metaKey;
|
79
|
+
if (!modifierKeyPressed && (e.which >= 32 && e.which <= 122) && this.selectionStart === this.selectionEnd) {
|
80
|
+
return false;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
},
|
84
|
+
|
85
|
+
inputlimiterBlur = function () {
|
86
|
+
var $this = $(this);
|
87
|
+
count = counter($this.val());
|
88
|
+
if (!opts.allowExceed && count > opts.limit) {
|
89
|
+
$this.val(truncater($this.val()));
|
90
|
+
}
|
91
|
+
if (opts.boxAttach) {
|
92
|
+
$('#' + opts.boxId).fadeOut('fast');
|
93
|
+
} else if (opts.remTextHideOnBlur) {
|
94
|
+
var limitText = opts.limitText;
|
95
|
+
limitText = limitText.replace(/\%n/g, opts.limit);
|
96
|
+
limitText = limitText.replace(/\%s/g, (opts.limit === 1 ? '' : 's'));
|
97
|
+
$('#' + opts.boxId).html(limitText);
|
98
|
+
}
|
99
|
+
},
|
100
|
+
|
101
|
+
counter = function (value) {
|
102
|
+
if (opts.limitBy.toLowerCase() === "words") {
|
103
|
+
return (value.length > 0 ? $.trim(value).replace(/\ +(?= )/g, '').split(' ').length : 0);
|
104
|
+
}
|
105
|
+
var count = value.length,
|
106
|
+
newlines = value.match(/\n/g);
|
107
|
+
if (newlines && opts.lineReturnCount > 1) {
|
108
|
+
count += newlines.length * (opts.lineReturnCount - 1);
|
109
|
+
}
|
110
|
+
return count;
|
111
|
+
},
|
112
|
+
|
113
|
+
truncater = function (value) {
|
114
|
+
if (opts.limitBy.toLowerCase() === "words") {
|
115
|
+
return $.trim(value).replace(/\ +(?= )/g, '').split(' ').splice(0, opts.limit).join(' ') + ' ';
|
116
|
+
}
|
117
|
+
return value.substring(0, opts.limit);
|
118
|
+
};
|
119
|
+
|
120
|
+
$(this).each(function (i) {
|
121
|
+
var $this = $(this);
|
122
|
+
if ((!options || !options.limit) && opts.useMaxlength && parseInt($this.attr('maxlength')) > 0 && parseInt($this.attr('maxlength')) != opts.limit) {
|
123
|
+
$this.inputlimiter($.extend({}, opts, { limit: parseInt($this.attr('maxlength')) }));
|
124
|
+
} else {
|
125
|
+
if (!opts.allowExceed && opts.useMaxlength && opts.limitBy.toLowerCase() === "characters") {
|
126
|
+
$this.attr('maxlength', opts.limit);
|
127
|
+
}
|
128
|
+
$this.unbind('.inputlimiter');
|
129
|
+
$this.bind('keyup.inputlimiter', inputlimiterKeyup);
|
130
|
+
$this.bind('keypress.inputlimiter', inputlimiterKeypress);
|
131
|
+
$this.bind('blur.inputlimiter', inputlimiterBlur);
|
132
|
+
}
|
133
|
+
});
|
134
|
+
};
|
135
|
+
|
136
|
+
$.fn.inputlimiter.remtextfilter = function (opts, charsRemaining) {
|
137
|
+
var remText = opts.remText;
|
138
|
+
if (charsRemaining === 0 && opts.remFullText !== null) {
|
139
|
+
remText = opts.remFullText;
|
140
|
+
}
|
141
|
+
remText = remText.replace(/\%n/g, charsRemaining);
|
142
|
+
remText = remText.replace(/\%s/g, (opts.zeroPlural ? (charsRemaining === 1 ? '' : 's') : (charsRemaining <= 1 ? '' : 's')));
|
143
|
+
return remText;
|
144
|
+
};
|
145
|
+
|
146
|
+
$.fn.inputlimiter.limittextfilter = function (opts) {
|
147
|
+
var limitText = opts.limitText;
|
148
|
+
limitText = limitText.replace(/\%n/g, opts.limit);
|
149
|
+
limitText = limitText.replace(/\%s/g, (opts.limit <= 1 ? '' : 's'));
|
150
|
+
return limitText;
|
151
|
+
};
|
152
|
+
|
153
|
+
$.fn.inputlimiter.defaults = {
|
154
|
+
limit: 255,
|
155
|
+
boxAttach: true,
|
156
|
+
boxId: 'limiterBox',
|
157
|
+
boxClass: 'limiterBox',
|
158
|
+
remText: '%n character%s remaining.',
|
159
|
+
remTextFilter: $.fn.inputlimiter.remtextfilter,
|
160
|
+
remTextHideOnBlur: true,
|
161
|
+
remFullText: null,
|
162
|
+
limitTextShow: true,
|
163
|
+
limitText: 'Field limited to %n character%s.',
|
164
|
+
limitTextFilter: $.fn.inputlimiter.limittextfilter,
|
165
|
+
zeroPlural: true,
|
166
|
+
allowExceed: false,
|
167
|
+
useMaxlength: true,
|
168
|
+
limitBy: 'characters',
|
169
|
+
lineReturnCount: 1
|
170
|
+
};
|
171
|
+
|
172
|
+
})(jQuery);
|