first commit
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
(function(e){e.fn.priceFormat=function(t){var n={prefix:"US$ ",suffix:"",centsSeparator:".",thousandsSeparator:",",limit:false,centsLimit:2,clearPrefix:false,clearSufix:false,allowNegative:false,insertPlusSign:false,clearOnEmpty:false};var t=e.extend(n,t);return this.each(function(){function m(e){if(n.is("input"))n.val(e);else n.html(e)}function g(){if(n.is("input"))r=n.val();else r=n.html();return r}function y(e){var t="";for(var n=0;n<e.length;n++){char_=e.charAt(n);if(t.length==0&&char_==0)char_=false;if(char_&&char_.match(i)){if(f){if(t.length<f)t=t+char_}else{t=t+char_}}}return t}function b(e){while(e.length<l+1)e="0"+e;return e}function w(t,n){if(!n&&(t===""||t==w("0",true))&&v)return"";var r=b(y(t));var i="";var f=0;if(l==0){u="";c=""}var c=r.substr(r.length-l,l);var h=r.substr(0,r.length-l);r=l==0?h:h+u+c;if(a||e.trim(a)!=""){for(var m=h.length;m>0;m--){char_=h.substr(m-1,1);f++;if(f%3==0)char_=a+char_;i=char_+i}if(i.substr(0,1)==a)i=i.substring(1,i.length);r=l==0?i:i+u+c}if(p&&(h!=0||c!=0)){if(t.indexOf("-")!=-1&&t.indexOf("+")<t.indexOf("-")){r="-"+r}else{if(!d)r=""+r;else r="+"+r}}if(s)r=s+r;if(o)r=r+o;return r}function E(e){var t=e.keyCode?e.keyCode:e.which;var n=String.fromCharCode(t);var i=false;var s=r;var o=w(s+n);if(t>=48&&t<=57||t>=96&&t<=105)i=true;if(t==8)i=true;if(t==9)i=true;if(t==13)i=true;if(t==46)i=true;if(t==37)i=true;if(t==39)i=true;if(p&&(t==189||t==109||t==173))i=true;if(d&&(t==187||t==107||t==61))i=true;if(!i){e.preventDefault();e.stopPropagation();if(s!=o)m(o)}}function S(){var e=g();var t=w(e);if(e!=t)m(t);if(parseFloat(e)==0&&v)m("")}function x(){n.val(s+g())}function T(){n.val(g()+o)}function N(){if(e.trim(s)!=""&&c){var t=g().split(s);m(t[1])}}function C(){if(e.trim(o)!=""&&h){var t=g().split(o);m(t[0])}}var n=e(this);var r="";var i=/[0-9]/;if(n.is("input"))r=n.val();else r=n.html();var s=t.prefix;var o=t.suffix;var u=t.centsSeparator;var a=t.thousandsSeparator;var f=t.limit;var l=t.centsLimit;var c=t.clearPrefix;var h=t.clearSuffix;var p=t.allowNegative;var d=t.insertPlusSign;var v=t.clearOnEmpty;if(d)p=true;n.bind("keydown.price_format",E);n.bind("keyup.price_format",S);n.bind("focusout.price_format",S);if(c){n.bind("focusout.price_format",function(){N()});n.bind("focusin.price_format",function(){x()})}if(h){n.bind("focusout.price_format",function(){C()});n.bind("focusin.price_format",function(){T()})}if(g().length>0){S();N();C()}})};e.fn.unpriceFormat=function(){return e(this).unbind(".price_format")};e.fn.unmask=function(){var t;var n="";if(e(this).is("input"))t=e(this).val();else t=e(this).html();for(var r in t){if(!isNaN(t[r])||t[r]=="-")n+=t[r]}return n}})(jQuery)
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
autosize 4.0.2
|
||||
license: MIT
|
||||
http://www.jacklmoore.com/autosize
|
||||
*/
|
||||
!function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,function(e,t){"use strict";var n,o,p="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return-1<n.indexOf(e)},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},delete:function(e){var t=n.indexOf(e);-1<t&&(n.splice(t,1),o.splice(t,1))}}),c=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){c=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function r(r){if(r&&r.nodeName&&"TEXTAREA"===r.nodeName&&!p.has(r)){var e,n=null,o=null,i=null,d=function(){r.clientWidth!==o&&a()},l=function(t){window.removeEventListener("resize",d,!1),r.removeEventListener("input",a,!1),r.removeEventListener("keyup",a,!1),r.removeEventListener("autosize:destroy",l,!1),r.removeEventListener("autosize:update",a,!1),Object.keys(t).forEach(function(e){r.style[e]=t[e]}),p.delete(r)}.bind(r,{height:r.style.height,resize:r.style.resize,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",l,!1),"onpropertychange"in r&&"oninput"in r&&r.addEventListener("keyup",a,!1),window.addEventListener("resize",d,!1),r.addEventListener("input",a,!1),r.addEventListener("autosize:update",a,!1),r.style.overflowX="hidden",r.style.wordWrap="break-word",p.set(r,{destroy:l,update:a}),"vertical"===(e=window.getComputedStyle(r,null)).resize?r.style.resize="none":"both"===e.resize&&(r.style.resize="horizontal"),n="content-box"===e.boxSizing?-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)):parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),isNaN(n)&&(n=0),a()}function s(e){var t=r.style.width;r.style.width="0px",r.offsetWidth,r.style.width=t,r.style.overflowY=e}function u(){if(0!==r.scrollHeight){var e=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(r),t=document.documentElement&&document.documentElement.scrollTop;r.style.height="",r.style.height=r.scrollHeight+n+"px",o=r.clientWidth,e.forEach(function(e){e.node.scrollTop=e.scrollTop}),t&&(document.documentElement.scrollTop=t)}}function a(){u();var e=Math.round(parseFloat(r.style.height)),t=window.getComputedStyle(r,null),n="content-box"===t.boxSizing?Math.round(parseFloat(t.height)):r.offsetHeight;if(n<e?"hidden"===t.overflowY&&(s("scroll"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight):"hidden"!==t.overflowY&&(s("hidden"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight),i!==n){i=n;var o=c("autosize:resized");try{r.dispatchEvent(o)}catch(e){}}}}function i(e){var t=p.get(e);t&&t.destroy()}function d(e){var t=p.get(e);t&&t.update()}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((l=function(e){return e}).destroy=function(e){return e},l.update=function(e){return e}):((l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return r(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],d),e}),t.default=l,e.exports=t.default});
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,363 @@
|
||||
/* ===========================================================
|
||||
* Bootstrap: inputmask.js v3.1.0
|
||||
* http://jasny.github.io/bootstrap/javascript/#inputmask
|
||||
*
|
||||
* Based on Masked Input plugin by Josh Bush (digitalbush.com)
|
||||
* ===========================================================
|
||||
* Copyright 2012-2014 Arnold Daniels
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ========================================================== */
|
||||
|
||||
+function ($) { "use strict";
|
||||
|
||||
var isIphone = (window.orientation !== undefined)
|
||||
var isAndroid = navigator.userAgent.toLowerCase().indexOf("android") > -1
|
||||
var isIE = window.navigator.appName == 'Microsoft Internet Explorer'
|
||||
|
||||
// INPUTMASK PUBLIC CLASS DEFINITION
|
||||
// =================================
|
||||
|
||||
var Inputmask = function (element, options) {
|
||||
if (isAndroid) return // No support because caret positioning doesn't work on Android
|
||||
|
||||
this.$element = $(element)
|
||||
this.options = $.extend({}, Inputmask.DEFAULTS, options)
|
||||
this.mask = String(this.options.mask)
|
||||
|
||||
this.init()
|
||||
this.listen()
|
||||
|
||||
this.checkVal() //Perform initial check for existing values
|
||||
}
|
||||
|
||||
Inputmask.DEFAULTS = {
|
||||
mask: "",
|
||||
placeholder: "_",
|
||||
definitions: {
|
||||
'9': "[0-9]",
|
||||
'a': "[A-Za-z]",
|
||||
'w': "[A-Za-z0-9]",
|
||||
'h': "[A-Fa-f0-9]",
|
||||
'*': "."
|
||||
}
|
||||
}
|
||||
|
||||
Inputmask.prototype.init = function() {
|
||||
var defs = this.options.definitions
|
||||
var len = this.mask.length
|
||||
|
||||
this.tests = []
|
||||
this.partialPosition = this.mask.length
|
||||
this.firstNonMaskPos = null
|
||||
|
||||
$.each(this.mask.split(""), $.proxy(function(i, c) {
|
||||
if (c == '?') {
|
||||
len--
|
||||
this.partialPosition = i
|
||||
} else if (defs[c]) {
|
||||
this.tests.push(new RegExp(defs[c]))
|
||||
if (this.firstNonMaskPos === null)
|
||||
this.firstNonMaskPos = this.tests.length - 1
|
||||
} else {
|
||||
this.tests.push(null)
|
||||
}
|
||||
}, this))
|
||||
|
||||
this.buffer = $.map(this.mask.split(""), $.proxy(function(c, i) {
|
||||
if (c != '?') return defs[c] ? this.options.placeholder : c
|
||||
}, this))
|
||||
|
||||
this.focusText = this.$element.val()
|
||||
|
||||
this.$element.data("rawMaskFn", $.proxy(function() {
|
||||
return $.map(this.buffer, function(c, i) {
|
||||
return this.tests[i] && c != this.options.placeholder ? c : null
|
||||
}).join('')
|
||||
}, this))
|
||||
}
|
||||
|
||||
Inputmask.prototype.listen = function() {
|
||||
if (this.$element.attr("readonly")) return
|
||||
|
||||
var pasteEventName = (isIE ? 'paste' : 'input') + ".bs.inputmask"
|
||||
|
||||
this.$element
|
||||
.on("unmask.bs.inputmask", $.proxy(this.unmask, this))
|
||||
|
||||
.on("focus.bs.inputmask", $.proxy(this.focusEvent, this))
|
||||
.on("blur.bs.inputmask", $.proxy(this.blurEvent, this))
|
||||
|
||||
.on("keydown.bs.inputmask", $.proxy(this.keydownEvent, this))
|
||||
.on("keypress.bs.inputmask", $.proxy(this.keypressEvent, this))
|
||||
|
||||
.on(pasteEventName, $.proxy(this.pasteEvent, this))
|
||||
}
|
||||
|
||||
//Helper Function for Caret positioning
|
||||
Inputmask.prototype.caret = function(begin, end) {
|
||||
if (this.$element.length === 0) return
|
||||
if (typeof begin == 'number') {
|
||||
end = (typeof end == 'number') ? end : begin
|
||||
return this.$element.each(function() {
|
||||
if (this.setSelectionRange) {
|
||||
this.setSelectionRange(begin, end)
|
||||
} else if (this.createTextRange) {
|
||||
var range = this.createTextRange()
|
||||
range.collapse(true)
|
||||
range.moveEnd('character', end)
|
||||
range.moveStart('character', begin)
|
||||
range.select()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (this.$element[0].setSelectionRange) {
|
||||
begin = this.$element[0].selectionStart
|
||||
end = this.$element[0].selectionEnd
|
||||
} else if (document.selection && document.selection.createRange) {
|
||||
var range = document.selection.createRange()
|
||||
begin = 0 - range.duplicate().moveStart('character', -100000)
|
||||
end = begin + range.text.length
|
||||
}
|
||||
return {
|
||||
begin: begin,
|
||||
end: end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Inputmask.prototype.seekNext = function(pos) {
|
||||
var len = this.mask.length
|
||||
while (++pos <= len && !this.tests[pos]);
|
||||
|
||||
return pos
|
||||
}
|
||||
|
||||
Inputmask.prototype.seekPrev = function(pos) {
|
||||
while (--pos >= 0 && !this.tests[pos]);
|
||||
|
||||
return pos
|
||||
}
|
||||
|
||||
Inputmask.prototype.shiftL = function(begin,end) {
|
||||
var len = this.mask.length
|
||||
|
||||
if (begin < 0) return
|
||||
|
||||
for (var i = begin, j = this.seekNext(end); i < len; i++) {
|
||||
if (this.tests[i]) {
|
||||
if (j < len && this.tests[i].test(this.buffer[j])) {
|
||||
this.buffer[i] = this.buffer[j]
|
||||
this.buffer[j] = this.options.placeholder
|
||||
} else
|
||||
break
|
||||
j = this.seekNext(j)
|
||||
}
|
||||
}
|
||||
this.writeBuffer()
|
||||
this.caret(Math.max(this.firstNonMaskPos, begin))
|
||||
}
|
||||
|
||||
Inputmask.prototype.shiftR = function(pos) {
|
||||
var len = this.mask.length
|
||||
|
||||
for (var i = pos, c = this.options.placeholder; i < len; i++) {
|
||||
if (this.tests[i]) {
|
||||
var j = this.seekNext(i)
|
||||
var t = this.buffer[i]
|
||||
this.buffer[i] = c
|
||||
if (j < len && this.tests[j].test(t))
|
||||
c = t
|
||||
else
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Inputmask.prototype.unmask = function() {
|
||||
this.$element
|
||||
.unbind(".bs.inputmask")
|
||||
.removeData("bs.inputmask")
|
||||
}
|
||||
|
||||
Inputmask.prototype.focusEvent = function() {
|
||||
this.focusText = this.$element.val()
|
||||
var len = this.mask.length
|
||||
var pos = this.checkVal()
|
||||
this.writeBuffer()
|
||||
|
||||
var that = this
|
||||
var moveCaret = function() {
|
||||
if (pos == len)
|
||||
that.caret(0, pos)
|
||||
else
|
||||
that.caret(pos)
|
||||
}
|
||||
|
||||
moveCaret()
|
||||
setTimeout(moveCaret, 50)
|
||||
}
|
||||
|
||||
Inputmask.prototype.blurEvent = function() {
|
||||
this.checkVal()
|
||||
if (this.$element.val() !== this.focusText) {
|
||||
this.$element.trigger('change')
|
||||
this.$element.trigger('input')
|
||||
}
|
||||
}
|
||||
|
||||
Inputmask.prototype.keydownEvent = function(e) {
|
||||
var k = e.which
|
||||
|
||||
//backspace, delete, and escape get special treatment
|
||||
if (k == 8 || k == 46 || (isIphone && k == 127)) {
|
||||
var pos = this.caret(),
|
||||
begin = pos.begin,
|
||||
end = pos.end
|
||||
|
||||
if (end - begin === 0) {
|
||||
begin = k != 46 ? this.seekPrev(begin) : (end = this.seekNext(begin - 1))
|
||||
end = k == 46 ? this.seekNext(end) : end
|
||||
}
|
||||
this.clearBuffer(begin, end)
|
||||
this.shiftL(begin, end - 1)
|
||||
|
||||
return false
|
||||
} else if (k == 27) {//escape
|
||||
this.$element.val(this.focusText)
|
||||
this.caret(0, this.checkVal())
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Inputmask.prototype.keypressEvent = function(e) {
|
||||
var len = this.mask.length
|
||||
|
||||
var k = e.which,
|
||||
pos = this.caret()
|
||||
|
||||
if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {//Ignore
|
||||
return true
|
||||
} else if (k) {
|
||||
if (pos.end - pos.begin !== 0) {
|
||||
this.clearBuffer(pos.begin, pos.end)
|
||||
this.shiftL(pos.begin, pos.end - 1)
|
||||
}
|
||||
|
||||
var p = this.seekNext(pos.begin - 1)
|
||||
if (p < len) {
|
||||
var c = String.fromCharCode(k)
|
||||
if (this.tests[p].test(c)) {
|
||||
this.shiftR(p)
|
||||
this.buffer[p] = c
|
||||
this.writeBuffer()
|
||||
var next = this.seekNext(p)
|
||||
this.caret(next)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Inputmask.prototype.pasteEvent = function() {
|
||||
var that = this
|
||||
|
||||
setTimeout(function() {
|
||||
that.caret(that.checkVal(true))
|
||||
}, 0)
|
||||
}
|
||||
|
||||
Inputmask.prototype.clearBuffer = function(start, end) {
|
||||
var len = this.mask.length
|
||||
|
||||
for (var i = start; i < end && i < len; i++) {
|
||||
if (this.tests[i])
|
||||
this.buffer[i] = this.options.placeholder
|
||||
}
|
||||
}
|
||||
|
||||
Inputmask.prototype.writeBuffer = function() {
|
||||
return this.$element.val(this.buffer.join('')).val()
|
||||
}
|
||||
|
||||
Inputmask.prototype.checkVal = function(allow) {
|
||||
var len = this.mask.length
|
||||
//try to place characters where they belong
|
||||
var test = this.$element.val()
|
||||
var lastMatch = -1
|
||||
|
||||
for (var i = 0, pos = 0; i < len; i++) {
|
||||
if (this.tests[i]) {
|
||||
this.buffer[i] = this.options.placeholder
|
||||
while (pos++ < test.length) {
|
||||
var c = test.charAt(pos - 1)
|
||||
if (this.tests[i].test(c)) {
|
||||
this.buffer[i] = c
|
||||
lastMatch = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if (pos > test.length)
|
||||
break
|
||||
} else if (this.buffer[i] == test.charAt(pos) && i != this.partialPosition) {
|
||||
pos++
|
||||
lastMatch = i
|
||||
}
|
||||
}
|
||||
if (!allow && lastMatch + 1 < this.partialPosition) {
|
||||
this.$element.val("")
|
||||
this.clearBuffer(0, len)
|
||||
} else if (allow || lastMatch + 1 >= this.partialPosition) {
|
||||
this.writeBuffer()
|
||||
if (!allow) this.$element.val(this.$element.val().substring(0, lastMatch + 1))
|
||||
}
|
||||
return (this.partialPosition ? i : this.firstNonMaskPos)
|
||||
}
|
||||
|
||||
|
||||
// INPUTMASK PLUGIN DEFINITION
|
||||
// ===========================
|
||||
|
||||
var old = $.fn.inputmask
|
||||
|
||||
$.fn.inputmask = function (options) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.inputmask')
|
||||
|
||||
if (!data) $this.data('bs.inputmask', (data = new Inputmask(this, options)))
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.inputmask.Constructor = Inputmask
|
||||
|
||||
|
||||
// INPUTMASK NO CONFLICT
|
||||
// ====================
|
||||
|
||||
$.fn.inputmask.noConflict = function () {
|
||||
$.fn.inputmask = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// INPUTMASK DATA-API
|
||||
// ==================
|
||||
|
||||
$(document).on('focus.bs.inputmask.data-api', '[data-mask]', function (e) {
|
||||
var $this = $(this)
|
||||
if ($this.data('bs.inputmask')) return
|
||||
$this.inputmask($this.data())
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
||||
@@ -0,0 +1,10 @@
|
||||
/* ==========================================================
|
||||
*
|
||||
* bootstrap-maxlength.js v 1.7.0
|
||||
* Copyright 2014 Maurizio Napoleoni @mimonap
|
||||
* Licensed under MIT License
|
||||
* URL: https://github.com/mimo84/bootstrap-maxlength/blob/master/LICENSE
|
||||
*
|
||||
* ========================================================== */
|
||||
|
||||
!function(t){"use strict";t.event.special.destroyed||(t.event.special.destroyed={remove:function(t){t.handler&&t.handler()}}),t.fn.extend({maxlength:function(e,a){var n=t("body");function o(t){var e=t.charCodeAt();return e?e<128?1:e<2048?2:3:0}function s(t){return t.split("").map(o).concat(0).reduce(function(t,e){return t+e})}function r(t){var a=t.val();a=e.twoCharLinebreak?a.replace(/\r(?!\n)|\n(?!\r)/g,"\r\n"):a.replace(new RegExp("\r?\n","g"),"\n");return e.utf8?s(a):a.length}function i(t,e){return e-r(t)}function l(t,e){e.css({display:"block"}),t.trigger("maxlength.shown")}function c(t,a,n){var o="";return e.message?o="function"==typeof e.message?e.message(t,a):e.message.replace("%charsTyped%",n).replace("%charsRemaining%",a-n).replace("%charsTotal%",a):(e.preText&&(o+=e.preText),e.showCharsTyped?o+=n:o+=a-n,e.showMaxLength&&(o+=e.separator+a),e.postText&&(o+=e.postText)),o}function p(t,a,n,o){var s,i,p,h,f,d;o&&(o.html(c(a.val(),n,n-t)),t>0?(p=a,h=e.threshold,f=n,d=!0,!e.alwaysShow&&f-r(p)>h&&(d=!1),d?l(a,o.removeClass(e.limitReachedClass).addClass(e.warningClass)):(s=a,i=o,e.alwaysShow||(i.css({display:"none"}),s.trigger("maxlength.hidden")))):l(a,o.removeClass(e.warningClass).addClass(e.limitReachedClass))),e.customMaxAttribute&&(t<0?a.addClass("overmax"):a.removeClass("overmax"))}function h(a,n){var o,s,r=(s=(o=a)[0],t.extend({},"function"==typeof s.getBoundingClientRect?s.getBoundingClientRect():{width:s.offsetWidth,height:s.offsetHeight},o.offset()));if("function"!==t.type(e.placement))if(t.isPlainObject(e.placement))!function(a,n){if(a&&n){var o={};t.each(["top","bottom","left","right","position"],function(t,a){var n=e.placement[a];void 0!==n&&(o[a]=n)}),n.css(o)}}(e.placement,n);else{var i=a.outerWidth(),l=n.outerWidth(),c=n.width(),p=n.height();switch(e.appendToParent&&(r.top-=a.parent().offset().top,r.left-=a.parent().offset().left),e.placement){case"bottom":n.css({top:r.top+r.height,left:r.left+r.width/2-c/2});break;case"top":n.css({top:r.top-p,left:r.left+r.width/2-c/2});break;case"left":n.css({top:r.top+r.height/2-p/2,left:r.left-c});break;case"right":n.css({top:r.top+r.height/2-p/2,left:r.left+r.width});break;case"bottom-right":n.css({top:r.top+r.height,left:r.left+r.width});break;case"top-right":n.css({top:r.top-p,left:r.left+i});break;case"top-left":n.css({top:r.top-p,left:r.left-l});break;case"bottom-left":n.css({top:r.top+a.outerHeight(),left:r.left-l});break;case"centered-right":n.css({top:r.top+p/2,left:r.left+i-l-3});break;case"bottom-right-inside":n.css({top:r.top+r.height,left:r.left+r.width-l});break;case"top-right-inside":n.css({top:r.top-p,left:r.left+i-l});break;case"top-left-inside":n.css({top:r.top-p,left:r.left});break;case"bottom-left-inside":n.css({top:r.top+a.outerHeight(),left:r.left})}}else e.placement(a,n,r)}function f(t){var a=t.attr("maxlength")||e.customMaxAttribute;if(e.customMaxAttribute&&!e.allowOverMax){var n=t.attr(e.customMaxAttribute);(!a||n<a)&&(a=n)}return a||(a=t.attr("size")),a}return t.isFunction(e)&&!a&&(a=e,e={}),e=t.extend({showOnReady:!1,alwaysShow:!1,threshold:10,warningClass:"badge badge-success",limitReachedClass:"badge badge-danger",separator:" / ",preText:"",postText:"",showMaxLength:!0,placement:"bottom",message:null,showCharsTyped:!0,validate:!1,utf8:!1,appendToParent:!1,twoCharLinebreak:!0,customMaxAttribute:null,allowOverMax:!1},e),this.each(function(){var a,r,l=t(this);function d(){var o=c(l.val(),a,"0");a=f(l),r||(r=t('<span class="bootstrap-maxlength"></span>').css({display:"none",position:"absolute",whiteSpace:"nowrap",zIndex:1099}).html(o)),l.is("textarea")&&(l.data("maxlenghtsizex",l.outerWidth()),l.data("maxlenghtsizey",l.outerHeight()),l.mouseup(function(){l.outerWidth()===l.data("maxlenghtsizex")&&l.outerHeight()===l.data("maxlenghtsizey")||h(l,r),l.data("maxlenghtsizex",l.outerWidth()),l.data("maxlenghtsizey",l.outerHeight())})),e.appendToParent?(l.parent().append(r),l.parent().css("position","relative")):n.append(r),p(i(l,f(l)),l,a,r),h(l,r)}t(window).resize(function(){r&&h(l,r)}),e.showOnReady?l.ready(function(){d()}):l.focus(function(){d()}),l.on("maxlength.reposition",function(){h(l,r)}),l.on("destroyed",function(){r&&r.remove()}),l.on("blur",function(){r&&!e.showOnReady&&r.remove()}),l.on("input",function(){var t=f(l),n=i(l,t),c=!0;return e.validate&&n<0?(!function(t,a){var n=t.val();if(e.twoCharLinebreak&&"\n"===(n=n.replace(/\r(?!\n)|\n(?!\r)/g,"\r\n"))[n.length-1]&&(a-=n.length%2),e.utf8){for(var r=n.split("").map(o),i=0,l=s(n)-a;i<l;i+=r.pop());a-=a-r.length}t.val(n.substr(0,a))}(l,t),c=!1):p(n,l,a,r),("bottom-right-inside"===e.placement||"top-right-inside"===e.placement||"function"==typeof e.placement||e.message&&"function"==typeof e.message)&&h(l,r),c})})}})}(jQuery);
|
||||
@@ -0,0 +1,13 @@
|
||||
Object.keys||(Object.keys=function(){"use strict";var t=Object.prototype.hasOwnProperty,r=!{toString:null}.propertyIsEnumerable("toString"),e=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],o=e.length;return function(n){if("object"!=typeof n&&("function"!=typeof n||null===n))throw new TypeError("Object.keys called on non-object");var c,l,p=[];for(c in n)t.call(n,c)&&p.push(c);if(r)for(l=0;o>l;l++)t.call(n,e[l])&&p.push(e[l]);return p}}());
|
||||
/*!
|
||||
* jQuery Passy
|
||||
* Generating and analazing passwords, realtime.
|
||||
*
|
||||
* Tim Severien
|
||||
* https://timseverien.github.io/passy/
|
||||
*
|
||||
* Copyright (c) 2013-2015 Tim Severien
|
||||
* Released under the MIT license.
|
||||
*
|
||||
*/
|
||||
!function(r){var e={character:{DIGIT:1,LOWERCASE:2,UPPERCASE:4,PUNCTUATION:8,EXTENDED:16},strength:{LOW:0,MEDIUM:1,HIGH:2,EXTREME:3},threshold:{medium:365,high:Math.pow(365,2),extreme:Math.pow(365,5)}};e.requirements={characters:[e.character.DIGIT,e.character.LOWERCASE,e.character.UPPERCASE,e.character.PUNCTUATION],length:{min:6,max:1/0}},e.charRanges={},e.charRanges[e.character.DIGIT]=[{min:48,max:57}],e.charRanges[e.character.LOWERCASE]=[{min:65,max:90}],e.charRanges[e.character.UPPERCASE]=[{min:97,max:122}],e.charRanges[e.character.PUNCTUATION]=[{min:32,max:47},{min:58,max:64},{min:91,max:96},{min:123,max:126}],e.charRanges[e.character.EXTENDED]=[{min:128,max:255}],Object.seal&&(Object.seal(e.character),Object.seal(e.charRanges),Object.seal(e.strength)),Object.freeze&&(Object.freeze(e.character),Object.freeze(e.charRanges),Object.freeze(e.strength)),e.getCharacterCount=function(){var r,a,t,n,c,h,i={};for(t in e.character){for(r=0,h=e.character[t],c=e.charRanges[h],a=0;a<c.length;a++)n=c[a],r+=n.max-n.min+1;i[h]=r}return i},e.analyze=function(r){var a=e.analyzeCharacters(r),t=Math.pow(a,r.length)/1e6;return e.analyzeScore(t/60/60/24)},e.analyzeCharacters=function(r){var a,t,n=e.getCharacterCount(),c=(r.length,0);for(a in e.character)t=e.character[a],e.contains(r,t)&&(c+=n[t]);return c},e.analyzeScore=function(r){return r>=e.threshold.extreme?e.strength.EXTREME:r>=e.threshold.high?e.strength.HIGH:r>=e.threshold.medium?e.strength.MEDIUM:e.strength.LOW},e.generate=function(r){var a,t,n=e.requirements.characters,c="",h=[];for(r=Math.max(r,e.requirements.length.min)||8,n=n||[e.character.DIGIT,e.character.LOWERCASE,e.character.UPPERCASE,e.character.PUNCTUATION],a=0;a<n.length;a++)h.push(n[a]);if(r>=1&&1/0>r)for(;h.length<r;)t=Math.floor(Math.random()*e.requirements.characters.length),h.push(e.requirements.characters[t]);for(h=h.sort(function(r,e){return Math.random()<.5}),a=0;a<h.length;a++)c+=e.generateCharacter(h[a]);return c},e.generateCharacter=function(r){var a,t,n=e.charRanges[r];return a=Math.floor(Math.random()*n.length),t=n[a],a=Math.floor(Math.random()*(t.max-t.min+1))+t.min,String.fromCharCode(a)},e.contains=function(r,a){var t=r.length;if(a===e.character.DIGIT)return/\d/.test(r);if(a===e.character.LOWERCASE)return/[a-z]/.test(r);if(a===e.character.UPPERCASE)return/[A-Z]/.test(r);if(a===e.character.PUNCTUATION||a===e.character.EXTENDED)for(;t--;)if(e.isCharacter(r.charAt(t),a))return!0;return!1},e.isCharacter=function(r,a){for(var t,n=r.charCodeAt(0),c=e.charRanges[a]||[],h=c.length;h--;)if(t=c[h],n>=t.min&&n<=t.max)return!0;return!1},e.valid=function(r){var a;if(!e.requirements)return!0;if(r.length<e.requirements.length.min||r.length>e.requirements.length.max)return!1;for(a in e.requirements.characters)if(!e.contains(r,e.requirements.characters[a]))return!1;return!0};var a={init:function(t){var n=r(this);n.each(function(n,c){var h=r(c);h.on("change keyup",function(){"function"==typeof t&&t.call(h,e.analyze(h.val()),a.valid.call(h))})})},generate:function(a){var t=r(this);t.each(function(t,n){var c=r(n);c.val(e.generate(a)),c.change()})},valid:function(){var a=r(this),t=!0;return a.each(function(a,n){var c=r(n);return e.valid(c.val())?void 0:(t=!1,!1)}),t}};r.fn.passy=function(r){var e=Array.prototype.slice.call(arguments),t=Array.prototype.slice.call(arguments,1);return a[r]&&"function"==typeof a[r]?a[r].apply(this,t):"function"==typeof r?a.init.apply(this,e):this},r.extend({passy:e})}(jQuery);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user