mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-29 04:54:12 +03:00
fixed #264 and improved the arrive.js implementation and performances
This commit is contained in:
parent
a15e7abe43
commit
cd3a8f8daa
104
dist/js/material.js
vendored
104
dist/js/material.js
vendored
|
@ -21,6 +21,13 @@
|
|||
|
||||
$.material = {
|
||||
"options": {
|
||||
// These options set what will be started by $.material.init()
|
||||
"ripples": true,
|
||||
"checkbox": true,
|
||||
"togglebutton": true,
|
||||
"radio": true,
|
||||
"arrive": true,
|
||||
|
||||
"withRipples": [
|
||||
".btn:not(.btn-link)",
|
||||
".card-image",
|
||||
|
@ -128,53 +135,72 @@
|
|||
"ripples": function(selector) {
|
||||
$.ripples({"target": (selector) ? selector : this.options.withRipples});
|
||||
},
|
||||
"init": function() {
|
||||
if ($.ripples) {
|
||||
this.ripples();
|
||||
}
|
||||
this.input();
|
||||
this.checkbox();
|
||||
this.togglebutton();
|
||||
this.radio();
|
||||
"autofill": function() {
|
||||
|
||||
if (document.arrive) {
|
||||
document.arrive("input, textarea, select", function() {
|
||||
$.material.init();
|
||||
// This part of code will detect autofill when the page is loading (username and password inputs for example)
|
||||
var loading = setInterval(function() {
|
||||
$("input[type!=checkbox]").each(function() {
|
||||
if ($(this).val() && $(this).val() !== $(this).attr("value")) {
|
||||
$(this).trigger("change");
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 100);
|
||||
|
||||
// Detect autofill
|
||||
(function() {
|
||||
// This part of code will detect autofill when the page is loading (username and password inputs for example)
|
||||
var loading = setInterval(function() {
|
||||
$("input[type!=checkbox]").each(function() {
|
||||
if ($(this).val() && $(this).val() !== $(this).attr("value")) {
|
||||
// After 10 seconds we are quite sure all the needed inputs are autofilled then we can stop checking them
|
||||
setTimeout(function() {
|
||||
clearInterval(loading);
|
||||
}, 10000);
|
||||
// Now we just listen on inputs of the focused form (because user can select from the autofill dropdown only when the input has focus)
|
||||
var focused;
|
||||
$(document)
|
||||
.on("focus", "input", function() {
|
||||
var $inputs = $(this).parents("form").find("input").not("[type=file]");
|
||||
focused = setInterval(function() {
|
||||
$inputs.each(function() {
|
||||
if ($(this).val() !== $(this).attr("value")) {
|
||||
$(this).trigger("change");
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
// After 10 seconds we are quite sure all the needed inputs are autofilled then we can stop checking them
|
||||
setTimeout(function() {
|
||||
clearInterval(loading);
|
||||
}, 10000);
|
||||
// Now we just listen on inputs of the focused form (because user can select from the autofill dropdown only when the input has focus)
|
||||
var focused;
|
||||
$(document)
|
||||
.on("focus", "input", function() {
|
||||
var $inputs = $(this).parents("form").find("input").not("[type=file]");
|
||||
focused = setInterval(function() {
|
||||
$inputs.each(function() {
|
||||
if ($(this).val() !== $(this).attr("value")) {
|
||||
$(this).trigger("change");
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
})
|
||||
.on("blur", "input", function() {
|
||||
clearInterval(focused);
|
||||
});
|
||||
})
|
||||
.on("blur", "input", function() {
|
||||
clearInterval(focused);
|
||||
});
|
||||
},
|
||||
"init": function() {
|
||||
if ($.ripples && this.options.ripples) {
|
||||
this.ripples();
|
||||
}
|
||||
if (this.options.input) {
|
||||
this.input();
|
||||
}
|
||||
if (this.options.checkbox) {
|
||||
this.checkbox();
|
||||
}
|
||||
if (this.options.togglebutton) {
|
||||
this.togglebutton();
|
||||
}
|
||||
if (this.options.radio) {
|
||||
this.radio();
|
||||
}
|
||||
if (this.options.autofill) {
|
||||
this.autofill();
|
||||
}
|
||||
|
||||
})();
|
||||
if (document.arrive && this.options.arrive) {
|
||||
$(document).arrive(this.options.inputElements, function() {
|
||||
$.material.input($(this));
|
||||
});
|
||||
$(document).arrive(this.options.checkboxElements, function() {
|
||||
$.material.checkbox($(this));
|
||||
});
|
||||
$(document).arrive(this.options.radioElements, function() {
|
||||
$.material.radio($(this));
|
||||
});
|
||||
$(document).arrive(this.options.togglebuttonElements, function() {
|
||||
$.material.togglebutton($(this));
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
2
dist/js/material.min.js
vendored
2
dist/js/material.min.js
vendored
|
@ -1,2 +1,2 @@
|
|||
!function(a){function b(a){return"undefined"==typeof a.which?!0:"number"==typeof a.which&&a.which>0?!a.ctrlKey&&!a.metaKey&&!a.altKey&&8!=a.which:!1}a.expr[":"].notmdproc=function(b){return a(b).data("mdproc")?!1:!0},a.material={options:{withRipples:[".btn:not(.btn-link)",".card-image",".navbar a:not(.withoutripple)",".dropdown-menu a",".nav-tabs a:not(.withoutripple)",".withripple"].join(","),inputElements:"input.form-control, textarea.form-control, select.form-control",checkboxElements:".checkbox > label > input[type=checkbox]",togglebuttonElements:".togglebutton > label > input[type=checkbox]",radioElements:".radio > label > input[type=radio]"},checkbox:function(b){a(b?b:this.options.checkboxElements).filter(":notmdproc").data("mdproc",!0).after("<span class=ripple></span><span class=check></span>")},togglebutton:function(b){a(b?b:this.options.togglebuttonElements).filter(":notmdproc").data("mdproc",!0).after("<span class=toggle></span>")},radio:function(b){a(b?b:this.options.radioElements).filter(":notmdproc").data("mdproc",!0).after("<span class=circle></span><span class=check></span>")},input:function(c){a(c?c:this.options.inputElements).filter(":notmdproc").data("mdproc",!0).each(function(){var b=a(this);if(b.wrap("<div class=form-control-wrapper></div>"),b.after("<span class=material-input></span>"),b.hasClass("floating-label")){var c=b.attr("placeholder");b.attr("placeholder",null).removeClass("floating-label"),b.after("<div class=floating-label>"+c+"</div>")}if(b.attr("data-hint")&&b.after("<div class=hint>"+b.attr("data-hint")+"</div>"),(null===b.val()||"undefined"==b.val()||""===b.val())&&b.addClass("empty"),b.parent().next().is("[type=file]")){b.parent().addClass("fileinput");var d=b.parent().next().detach();b.after(d)}}),a(document).on("change",".checkbox input[type=checkbox]",function(){a(this).blur()}).on("keydown paste",".form-control",function(c){b(c)&&a(this).removeClass("empty")}).on("keyup change",".form-control",function(){var b=a(this);""===b.val()?b.addClass("empty"):b.removeClass("empty")}).on("focus",".form-control-wrapper.fileinput",function(){a(this).find("input").addClass("focus")}).on("blur",".form-control-wrapper.fileinput",function(){a(this).find("input").removeClass("focus")}).on("change",".form-control-wrapper.fileinput [type=file]",function(){var b="";a.each(a(this)[0].files,function(a,c){console.log(c),b+=c.name+", "}),b=b.substring(0,b.length-2),b?a(this).prev().removeClass("empty"):a(this).prev().addClass("empty"),a(this).prev().val(b)})},ripples:function(b){a.ripples({target:b?b:this.options.withRipples})},init:function(){a.ripples&&this.ripples(),this.input(),this.checkbox(),this.togglebutton(),this.radio(),document.arrive&&document.arrive("input, textarea, select",function(){a.material.init()}),function(){var b=setInterval(function(){a("input[type!=checkbox]").each(function(){a(this).val()&&a(this).val()!==a(this).attr("value")&&a(this).trigger("change")})},100);setTimeout(function(){clearInterval(b)},1e4);var c;a(document).on("focus","input",function(){var b=a(this).parents("form").find("input").not("[type=file]");c=setInterval(function(){b.each(function(){a(this).val()!==a(this).attr("value")&&a(this).trigger("change")})},100)}).on("blur","input",function(){clearInterval(c)})}()}}}(jQuery);
|
||||
!function(a){function b(a){return"undefined"==typeof a.which?!0:"number"==typeof a.which&&a.which>0?!a.ctrlKey&&!a.metaKey&&!a.altKey&&8!=a.which:!1}a.expr[":"].notmdproc=function(b){return a(b).data("mdproc")?!1:!0},a.material={options:{ripples:!0,checkbox:!0,togglebutton:!0,radio:!0,arrive:!0,withRipples:[".btn:not(.btn-link)",".card-image",".navbar a:not(.withoutripple)",".dropdown-menu a",".nav-tabs a:not(.withoutripple)",".withripple"].join(","),inputElements:"input.form-control, textarea.form-control, select.form-control",checkboxElements:".checkbox > label > input[type=checkbox]",togglebuttonElements:".togglebutton > label > input[type=checkbox]",radioElements:".radio > label > input[type=radio]"},checkbox:function(b){a(b?b:this.options.checkboxElements).filter(":notmdproc").data("mdproc",!0).after("<span class=ripple></span><span class=check></span>")},togglebutton:function(b){a(b?b:this.options.togglebuttonElements).filter(":notmdproc").data("mdproc",!0).after("<span class=toggle></span>")},radio:function(b){a(b?b:this.options.radioElements).filter(":notmdproc").data("mdproc",!0).after("<span class=circle></span><span class=check></span>")},input:function(c){a(c?c:this.options.inputElements).filter(":notmdproc").data("mdproc",!0).each(function(){var b=a(this);if(b.wrap("<div class=form-control-wrapper></div>"),b.after("<span class=material-input></span>"),b.hasClass("floating-label")){var c=b.attr("placeholder");b.attr("placeholder",null).removeClass("floating-label"),b.after("<div class=floating-label>"+c+"</div>")}if(b.attr("data-hint")&&b.after("<div class=hint>"+b.attr("data-hint")+"</div>"),(null===b.val()||"undefined"==b.val()||""===b.val())&&b.addClass("empty"),b.parent().next().is("[type=file]")){b.parent().addClass("fileinput");var d=b.parent().next().detach();b.after(d)}}),a(document).on("change",".checkbox input[type=checkbox]",function(){a(this).blur()}).on("keydown paste",".form-control",function(c){b(c)&&a(this).removeClass("empty")}).on("keyup change",".form-control",function(){var b=a(this);""===b.val()?b.addClass("empty"):b.removeClass("empty")}).on("focus",".form-control-wrapper.fileinput",function(){a(this).find("input").addClass("focus")}).on("blur",".form-control-wrapper.fileinput",function(){a(this).find("input").removeClass("focus")}).on("change",".form-control-wrapper.fileinput [type=file]",function(){var b="";a.each(a(this)[0].files,function(a,c){console.log(c),b+=c.name+", "}),b=b.substring(0,b.length-2),b?a(this).prev().removeClass("empty"):a(this).prev().addClass("empty"),a(this).prev().val(b)})},ripples:function(b){a.ripples({target:b?b:this.options.withRipples})},autofill:function(){var b=setInterval(function(){a("input[type!=checkbox]").each(function(){a(this).val()&&a(this).val()!==a(this).attr("value")&&a(this).trigger("change")})},100);setTimeout(function(){clearInterval(b)},1e4);var c;a(document).on("focus","input",function(){var b=a(this).parents("form").find("input").not("[type=file]");c=setInterval(function(){b.each(function(){a(this).val()!==a(this).attr("value")&&a(this).trigger("change")})},100)}).on("blur","input",function(){clearInterval(c)})},init:function(){a.ripples&&this.options.ripples&&this.ripples(),this.options.input&&this.input(),this.options.checkbox&&this.checkbox(),this.options.togglebutton&&this.togglebutton(),this.options.radio&&this.radio(),this.options.autofill&&this.autofill(),document.arrive&&this.options.arrive&&(a(document).arrive(this.options.inputElements,function(){a.material.input(a(this))}),a(document).arrive(this.options.checkboxElements,function(){a.material.checkbox(a(this))}),a(document).arrive(this.options.radioElements,function(){a.material.radio(a(this))}),a(document).arrive(this.options.togglebuttonElements,function(){a.material.togglebutton(a(this))}))}}}(jQuery);
|
||||
//# sourceMappingURL=material.min.js.map
|
||||
|
|
2
dist/js/material.min.js.map
vendored
2
dist/js/material.min.js.map
vendored
|
@ -1 +1 @@
|
|||
{"version":3,"file":"material.min.js","sources":["material.js"],"names":["$","_isChar","evt","which","ctrlKey","metaKey","altKey","expr","notmdproc","obj","data","material","options","withRipples","join","inputElements","checkboxElements","togglebuttonElements","radioElements","checkbox","selector","this","filter","after","togglebutton","radio","input","each","$this","wrap","hasClass","placeholder","attr","removeClass","val","addClass","parent","next","is","$input","detach","document","on","blur","e","find","value","files","i","file","console","log","name","substring","length","prev","ripples","target","init","arrive","loading","setInterval","trigger","setTimeout","clearInterval","focused","$inputs","parents","not","jQuery"],"mappings":"CAEA,SAAUA,GAUR,QAASC,GAAQC,GACf,MAAwB,mBAAbA,GAAIC,OACN,EACsB,gBAAbD,GAAIC,OAAqBD,EAAIC,MAAQ,GAC7CD,EAAIE,UAAYF,EAAIG,UAAYH,EAAII,QAAuB,GAAbJ,EAAIC,OAErD,EAdTH,EAAEO,KAAK,KAAKC,UAAY,SAASC,GAC/B,MAAIT,GAAES,GAAKC,KAAK,WACP,GAEA,GAaXV,EAAEW,UACAC,SACEC,aACE,sBACA,cACA,gCACA,mBACA,kCACA,eACAC,KAAK,KACPC,cAAiB,iEACjBC,iBAAoB,2CACpBC,qBAAwB,+CACxBC,cAAiB,sCAEnBC,SAAY,SAASC,GAEnBpB,EAAE,EAAaoB,EAAWC,KAAKT,QAAQI,kBACtCM,OAAO,cACPZ,KAAK,UAAU,GACfa,MAAM,wDAETC,aAAgB,SAASJ,GAEvBpB,EAAE,EAAaoB,EAAWC,KAAKT,QAAQK,sBACtCK,OAAO,cACPZ,KAAK,UAAU,GACfa,MAAM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3B,EAAEqB,MAAM,GAAG0B,MAAO,SAASC,EAAGC,GACnCC,QAAQC,IAAIF,GACZH,GAASG,EAAKG,KAAO,OAEvBN,EAAQA,EAAMO,UAAU,EAAGP,EAAMQ,OAAS,GACtCR,EACF9C,EAAEqB,MAAMkC,OAAOtB,YAAY,SAE3BjC,EAAEqB,MAAMkC,OAAOpB,SAAS,SAE1BnC,EAAEqB,MAAMkC,OAAOrB,IAAIY,MAGvBU,QAAW,SAASpC,GAClBpB,EAAEwD,SAASC,OAAU,EAAarC,EAAWC,KAAKT,QAAQC,eAE5D6C,KAAQ,WACF1D,EAAEwD,SACJnC,KAAKmC,UAEPnC,KAAKK,QACLL,KAAKF,WACLE,KAAKG,eACLH,KAAKI,QAEDgB,SAASkB,QACXlB,SAASkB,OAAO,0BAA2B,WACzC3D,EAAEW,SAAS+C,SAKf,WAEE,GAAIE,GAAUC,YAAY,WACxB7D,EAAE,yBAAyB2B,KAAK,WAC1B3B,EAAEqB,MAAMa,OAASlC,EAAEqB,MAAMa,QAAUlC,EAAEqB,MAAMW,KAAK,UAClDhC,EAAEqB,MAAMyC,QAAQ,aAGnB,IAEHC,YAAW,WACTC,cAAcJ,IACb,IAEH,IAAIK,EACJjE,GAAEyC,UACDC,GAAG,QAAS,QAAS,WACpB,GAAIwB,GAAUlE,EAAEqB,MAAM8C,QAAQ,QAAQtB,KAAK,SAASuB,IAAI,cACxDH,GAAUJ,YAAY,WACpBK,EAAQvC,KAAK,WACP3B,EAAEqB,MAAMa,QAAUlC,EAAEqB,MAAMW,KAAK,UACjChC,EAAEqB,MAAMyC,QAAQ,aAGnB,OAEJpB,GAAG,OAAQ,QAAS,WACnBsB,cAAcC,WAOrBI"}
|
||||
{"version":3,"file":"material.min.js","sources":["material.js"],"names":["$","_isChar","evt","which","ctrlKey","metaKey","altKey","expr","notmdproc","obj","data","material","options","ripples","checkbox","togglebutton","radio","arrive","withRipples","join","inputElements","checkboxElements","togglebuttonElements","radioElements","selector","this","filter","after","input","each","$this","wrap","hasClass","placeholder","attr","removeClass","val","addClass","parent","next","is","$input","detach","document","on","blur","e","find","value","files","i","file","console","log","name","substring","length","prev","target","autofill","loading","setInterval","trigger","setTimeout","clearInterval","focused","$inputs","parents","not","init","jQuery"],"mappings":"CAEA,SAAUA,GAUR,QAASC,GAAQC,GACf,MAAwB,mBAAbA,GAAIC,OACN,EACsB,gBAAbD,GAAIC,OAAqBD,EAAIC,MAAQ,GAC7CD,EAAIE,UAAYF,EAAIG,UAAYH,EAAII,QAAuB,GAAbJ,EAAIC,OAErD,EAdTH,EAAEO,KAAK,KAAKC,UAAY,SAASC,GAC/B,MAAIT,GAAES,GAAKC,KAAK,WACP,GAEA,GAaXV,EAAEW,UACAC,SAEEC,SAAW,EACXC,UAAY,EACZC,cAAgB,EAChBC,OAAS,EACTC,QAAU,EAEVC,aACE,sBACA,cACA,gCACA,mBACA,kCACA,eACAC,KAAK,KACPC,cAAiB,iEACjBC,iBAAoB,2CACpBC,qBAAwB,+CACxBC,cAAiB,sCAEnBT,SAAY,SAASU,GAEnBxB,EAAE,EAAawB,EAAWC,KAAKb,QAAQS,kBACtCK,OAAO,cACPhB,KAAK,UAAU,GACfiB,MAAM,wDAETZ,aAAgB,SAASS,GAEvBxB,EAAE,EAAawB,EAAWC,KAAKb,QAAQU,sBACtCI,OAAO,cACPhB,KAAK,UAAU,GACfiB,MAAM,+BAETX,MAAS,SAASQ,GAEhBxB,EAAE,EAAawB,EAAWC,KAAKb,QAAQW,eACtCG,OAAO,cACPhB,KAAK,UAAU,GACfiB,MAAM,wDAETC,MAAS,SAASJ,GAChBxB,EAAE,EAAawB,EAAWC,KAAKb,QAAQQ,eACtCM,OAAO,cACPhB,KAAK,UAAU,GACfmB,KAAM,WACL,GAAIC,GAAQ9B,EAAEyB,KAKd,IAJAK,EAAMC,KAAK,0CACXD,EAAMH,MAAM,sCAGRG,EAAME,SAAS,kBAAmB,CACpC,GAAIC,GAAcH,EAAMI,KAAK,cAC7BJ,GAAMI,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options": {
|
||||
// These options set what will be started by $.material.init()
|
||||
"ripples": true,
|
||||
"checkbox": true,
|
||||
"togglebutton": true,
|
||||
"radio": true,
|
||||
"arrive": true,
|
||||
|
||||
"withRipples": [
|
||||
".btn:not(.btn-link)",
|
||||
".card-image",
|
||||
|
@ -128,53 +135,72 @@
|
|||
"ripples": function(selector) {
|
||||
$.ripples({"target": (selector) ? selector : this.options.withRipples});
|
||||
},
|
||||
"init": function() {
|
||||
if ($.ripples) {
|
||||
this.ripples();
|
||||
}
|
||||
this.input();
|
||||
this.checkbox();
|
||||
this.togglebutton();
|
||||
this.radio();
|
||||
"autofill": function() {
|
||||
|
||||
if (document.arrive) {
|
||||
document.arrive("input, textarea, select", function() {
|
||||
$.material.init();
|
||||
// This part of code will detect autofill when the page is loading (username and password inputs for example)
|
||||
var loading = setInterval(function() {
|
||||
$("input[type!=checkbox]").each(function() {
|
||||
if ($(this).val() && $(this).val() !== $(this).attr("value")) {
|
||||
$(this).trigger("change");
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 100);
|
||||
|
||||
// Detect autofill
|
||||
(function() {
|
||||
// This part of code will detect autofill when the page is loading (username and password inputs for example)
|
||||
var loading = setInterval(function() {
|
||||
$("input[type!=checkbox]").each(function() {
|
||||
if ($(this).val() && $(this).val() !== $(this).attr("value")) {
|
||||
// After 10 seconds we are quite sure all the needed inputs are autofilled then we can stop checking them
|
||||
setTimeout(function() {
|
||||
clearInterval(loading);
|
||||
}, 10000);
|
||||
// Now we just listen on inputs of the focused form (because user can select from the autofill dropdown only when the input has focus)
|
||||
var focused;
|
||||
$(document)
|
||||
.on("focus", "input", function() {
|
||||
var $inputs = $(this).parents("form").find("input").not("[type=file]");
|
||||
focused = setInterval(function() {
|
||||
$inputs.each(function() {
|
||||
if ($(this).val() !== $(this).attr("value")) {
|
||||
$(this).trigger("change");
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
// After 10 seconds we are quite sure all the needed inputs are autofilled then we can stop checking them
|
||||
setTimeout(function() {
|
||||
clearInterval(loading);
|
||||
}, 10000);
|
||||
// Now we just listen on inputs of the focused form (because user can select from the autofill dropdown only when the input has focus)
|
||||
var focused;
|
||||
$(document)
|
||||
.on("focus", "input", function() {
|
||||
var $inputs = $(this).parents("form").find("input").not("[type=file]");
|
||||
focused = setInterval(function() {
|
||||
$inputs.each(function() {
|
||||
if ($(this).val() !== $(this).attr("value")) {
|
||||
$(this).trigger("change");
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
})
|
||||
.on("blur", "input", function() {
|
||||
clearInterval(focused);
|
||||
});
|
||||
})
|
||||
.on("blur", "input", function() {
|
||||
clearInterval(focused);
|
||||
});
|
||||
},
|
||||
"init": function() {
|
||||
if ($.ripples && this.options.ripples) {
|
||||
this.ripples();
|
||||
}
|
||||
if (this.options.input) {
|
||||
this.input();
|
||||
}
|
||||
if (this.options.checkbox) {
|
||||
this.checkbox();
|
||||
}
|
||||
if (this.options.togglebutton) {
|
||||
this.togglebutton();
|
||||
}
|
||||
if (this.options.radio) {
|
||||
this.radio();
|
||||
}
|
||||
if (this.options.autofill) {
|
||||
this.autofill();
|
||||
}
|
||||
|
||||
})();
|
||||
if (document.arrive && this.options.arrive) {
|
||||
$(document).arrive(this.options.inputElements, function() {
|
||||
$.material.input($(this));
|
||||
});
|
||||
$(document).arrive(this.options.checkboxElements, function() {
|
||||
$.material.checkbox($(this));
|
||||
});
|
||||
$(document).arrive(this.options.radioElements, function() {
|
||||
$.material.radio($(this));
|
||||
});
|
||||
$(document).arrive(this.options.togglebuttonElements, function() {
|
||||
$.material.togglebutton($(this));
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user