/* globals jQuery */ /*! * Waves v0.7.5 * http://fian.my.id/Waves * * Copyright 2014-2016 Alfiana E. Sibuea and other contributors * Released under the MIT license * https://github.com/fians/Waves/blob/master/LICENSE */ !function(a,b){"use strict";"function"==typeof define&&define.amd?define([],function(){return b.apply(a)}):"object"==typeof exports?module.exports=b.call(a):a.Waves=b.call(a)}("object"==typeof global?global:this,function(){"use strict";function a(a){return null!==a&&a===a.window}function b(b){return a(b)?b:9===b.nodeType&&b.defaultView}function c(a){var b=typeof a;return"function"===b||"object"===b&&!!a}function d(a){return c(a)&&a.nodeType>0}function e(a){var b=m.call(a);return"[object String]"===b?l(a):c(a)&&/^\[object (Array|HTMLCollection|NodeList|Object)\]$/.test(b)&&a.hasOwnProperty("length")?a:d(a)?[a]:[]}function f(a){var c,d,e={top:0,left:0},f=a&&a.ownerDocument;return c=f.documentElement,"undefined"!=typeof a.getBoundingClientRect&&(e=a.getBoundingClientRect()),d=b(f),{top:e.top+d.pageYOffset-c.clientTop,left:e.left+d.pageXOffset-c.clientLeft}}function g(a){var b="";for(var c in a)a.hasOwnProperty(c)&&(b+=c+":"+a[c]+";");return b}function h(a,b,c){if(c){c.classList.remove("waves-rippling");var d=c.getAttribute("data-x"),e=c.getAttribute("data-y"),f=c.getAttribute("data-scale"),h=c.getAttribute("data-translate"),i=Date.now()-Number(c.getAttribute("data-hold")),j=350-i;0>j&&(j=0),"mousemove"===a.type&&(j=150);var k="mousemove"===a.type?2500:o.duration;setTimeout(function(){var a={top:e+"px",left:d+"px",opacity:"0","-webkit-transition-duration":k+"ms","-moz-transition-duration":k+"ms","-o-transition-duration":k+"ms","transition-duration":k+"ms","-webkit-transform":f+" "+h,"-moz-transform":f+" "+h,"-ms-transform":f+" "+h,"-o-transform":f+" "+h,transform:f+" "+h};c.setAttribute("style",g(a)),setTimeout(function(){try{b.removeChild(c)}catch(a){return!1}},k)},j)}}function i(a){if(q.allowEvent(a)===!1)return null;for(var b=null,c=a.target||a.srcElement;c.parentElement;){if(!(c instanceof SVGElement)&&c.classList.contains("waves-effect")){b=c;break}c=c.parentElement}return b}function j(a){var b=i(a);if(null!==b){if(b.disabled||b.getAttribute("disabled")||b.classList.contains("disabled"))return;if(q.registerEvent(a),"touchstart"===a.type&&o.delay){var c=!1,d=setTimeout(function(){d=null,o.show(a,b)},o.delay),e=function(e){d&&(clearTimeout(d),d=null,o.show(a,b)),c||(c=!0,o.hide(e,b))},f=function(a){d&&(clearTimeout(d),d=null),e(a)};b.addEventListener("touchmove",f,!1),b.addEventListener("touchend",e,!1),b.addEventListener("touchcancel",e,!1)}else o.show(a,b),n&&(b.addEventListener("touchend",o.hide,!1),b.addEventListener("touchcancel",o.hide,!1)),b.addEventListener("mouseup",o.hide,!1),b.addEventListener("mouseleave",o.hide,!1)}}var k=k||{},l=document.querySelectorAll.bind(document),m=Object.prototype.toString,n="ontouchstart"in window,o={duration:750,delay:200,show:function(a,b,c){if(2===a.button)return!1;b=b||this;var d=document.createElement("div");d.className="waves-ripple waves-rippling",b.appendChild(d);var e=f(b),h=0,i=0;"touches"in a&&a.touches.length?(h=a.touches[0].pageY-e.top,i=a.touches[0].pageX-e.left):(h=a.pageY-e.top,i=a.pageX-e.left),i=i>=0?i:0,h=h>=0?h:0;var j="scale("+b.clientWidth/100*3+")",k="translate(0,0)";c&&(k="translate("+c.x+"px, "+c.y+"px)"),d.setAttribute("data-hold",Date.now()),d.setAttribute("data-x",i),d.setAttribute("data-y",h),d.setAttribute("data-scale",j),d.setAttribute("data-translate",k);var l={top:h+"px",left:i+"px"};d.classList.add("waves-notransition"),d.setAttribute("style",g(l)),d.classList.remove("waves-notransition"),l["-webkit-transform"]=j+" "+k,l["-moz-transform"]=j+" "+k,l["-ms-transform"]=j+" "+k,l["-o-transform"]=j+" "+k,l.transform=j+" "+k,l.opacity="1";var m="mousemove"===a.type?2500:o.duration;l["-webkit-transition-duration"]=m+"ms",l["-moz-transition-duration"]=m+"ms",l["-o-transition-duration"]=m+"ms",l["transition-duration"]=m+"ms",d.setAttribute("style",g(l))},hide:function(a,b){b=b||this;for(var c=b.getElementsByClassName("waves-rippling"),d=0,e=c.length;e>d;d++)h(a,b,c[d])}},p={input:function(a){var b=a.parentNode;if("i"!==b.tagName.toLowerCase()||!b.classList.contains("waves-effect")){var c=document.createElement("i");c.className=a.className+" waves-input-wrapper",a.className="waves-button-input",b.replaceChild(c,a),c.appendChild(a);var d=window.getComputedStyle(a,null),e=d.color,f=d.backgroundColor;c.setAttribute("style","color:"+e+";background:"+f),a.setAttribute("style","background-color:rgba(0,0,0,0);")}},img:function(a){var b=a.parentNode;if("i"!==b.tagName.toLowerCase()||!b.classList.contains("waves-effect")){var c=document.createElement("i");b.replaceChild(c,a),c.appendChild(a)}}},q={touches:0,allowEvent:function(a){var b=!0;return/^(mousedown|mousemove)$/.test(a.type)&&q.touches&&(b=!1),b},registerEvent:function(a){var b=a.type;"touchstart"===b?q.touches+=1:/^(touchend|touchcancel)$/.test(b)&&setTimeout(function(){q.touches&&(q.touches-=1)},500)}};return k.init=function(a){var b=document.body;a=a||{},"duration"in a&&(o.duration=a.duration),"delay"in a&&(o.delay=a.delay),n&&(b.addEventListener("touchstart",j,!1),b.addEventListener("touchcancel",q.registerEvent,!1),b.addEventListener("touchend",q.registerEvent,!1)),b.addEventListener("mousedown",j,!1)},k.attach=function(a,b){a=e(a),"[object Array]"===m.call(b)&&(b=b.join(" ")),b=b?" "+b:"";for(var c,d,f=0,g=a.length;g>f;f++)c=a[f],d=c.tagName.toLowerCase(),-1!==["input","img"].indexOf(d)&&(p[d](c),c=c.parentElement),-1===c.className.indexOf("waves-effect")&&(c.className+=" waves-effect"+b)},k.ripple=function(a,b){a=e(a);var c=a.length;if(b=b||{},b.wait=b.wait||0,b.position=b.position||null,c)for(var d,g,h,i={},j=0,k={type:"mousedown",button:1},l=function(a,b){return function(){o.hide(a,b)}};c>j;j++)if(d=a[j],g=b.position||{x:d.clientWidth/2,y:d.clientHeight/2},h=f(d),i.x=h.left+g.x,i.y=h.top+g.y,k.pageX=i.x,k.pageY=i.y,o.show(k,d),b.wait>=0&&null!==b.wait){var m={type:"mouseup",button:1};setTimeout(l(m,d),b.wait)}},k.calm=function(a){a=e(a);for(var b={type:"mouseup",button:1},c=0,d=a.length;d>c;c++)o.hide(b,a[c])},k.displayEffect=function(a){k.init(a)},k}); //# sourceMappingURL=waves.min.js.map (function ($) { // Selector to select only not already processed elements $.expr[":"].notmdproc = function (obj) { if ($(obj).data("mdproc")) { return false; } else { return true; } }; function _isChar(evt) { if (typeof evt.which == "undefined") { return true; } else if (typeof evt.which == "number" && evt.which > 0) { return ( !evt.ctrlKey && !evt.metaKey && !evt.altKey && evt.which != 8 // backspace && evt.which != 9 // tab && evt.which != 13 // enter && evt.which != 16 // shift && evt.which != 17 // ctrl && evt.which != 20 // caps lock && evt.which != 27 // escape ); } return false; } function _addFormGroupFocus(element) { var $element = $(element); if (!$element.prop('disabled')) { // this is showing as undefined on chrome but works fine on firefox?? $element.closest(".form-group").addClass("is-focused"); } } function _toggleDisabledState($element, state) { var $target; if ($element.hasClass('checkbox-inline') || $element.hasClass('radio-inline')) { $target = $element; } else { $target = $element.closest('.checkbox').length ? $element.closest('.checkbox') : $element.closest('.radio'); } return $target.toggleClass('disabled', state); } function _toggleTypeFocus($input) { var disabledToggleType = false; if ($input.is($.material.options.checkboxElements) || $input.is($.material.options.radioElements)) { disabledToggleType = true; } $input.closest('label').hover(function () { var $i = $(this).find('input'); var isDisabled = $i.prop('disabled'); // hack because the _addFormGroupFocus() wasn't identifying the property on chrome if (disabledToggleType) { _toggleDisabledState($(this), isDisabled); } if (!isDisabled) { _addFormGroupFocus($i); // need to find the input so we can check disablement } }, function () { _removeFormGroupFocus($(this).find('input')); }); } function _removeFormGroupFocus(element) { $(element).closest(".form-group").removeClass("is-focused"); // remove class from form-group } $.material = { "options": { // These options set what will be started by $.material.init() "validate": true, "input": true, "ripples": true, "checkbox": true, "togglebutton": true, "radio": true, "arrive": true, "autofill": false, "withRipples": [ ".btn:not(.btn-link)", ".list-group-item", ".card-image", ".navbar a:not(.withoutripple)", ".dropdown-menu a", ".nav-tabs a:not(.withoutripple)", ".withripple", ".pagination li:not(.active):not(.disabled) a:not(.withoutripple)" ].join(","), "inputElements": "input.form-control, textarea.form-control, select.form-control", "checkboxElements": ".checkbox > label > input[type=checkbox], label.checkbox-inline > input[type=checkbox]", "togglebuttonElements": ".togglebutton > label > input[type=checkbox]", "radioElements": ".radio > label > input[type=radio], label.radio-inline > input[type=radio]" }, "checkbox": function (selector) { // Add fake-checkbox to material checkboxes var $input = $((selector) ? selector : this.options.checkboxElements) .filter(":notmdproc") .data("mdproc", true) .after(""); _toggleTypeFocus($input); }, "togglebutton": function (selector) { // Add fake-checkbox to material checkboxes var $input = $((selector) ? selector : this.options.togglebuttonElements) .filter(":notmdproc") .data("mdproc", true) .after(""); _toggleTypeFocus($input); }, "radio": function (selector) { // Add fake-radio to material radios var $input = $((selector) ? selector : this.options.radioElements) .filter(":notmdproc") .data("mdproc", true) .after(""); _toggleTypeFocus($input); }, "input": function (selector) { $((selector) ? selector : this.options.inputElements) .filter(":notmdproc") .data("mdproc", true) .each(function () { var $input = $(this); // Requires form-group standard markup (will add it if necessary) var $formGroup = $input.closest(".form-group"); // note that form-group may be grandparent in the case of an input-group if ($formGroup.length === 0 && $input.attr('type') !== "hidden" && !$input.attr('hidden')) { $input.wrap("
"); $formGroup = $input.closest(".form-group"); // find node after attached (otherwise additional attachments don't work) } // Legacy - Add hint label if using the old shorthand data-hint attribute on the input if ($input.attr("data-hint")) { $input.after("

" + $input.attr("data-hint") + "

"); $input.removeAttr("data-hint"); } // Legacy - Change input-sm/lg to form-group-sm/lg instead (preferred standard and simpler css/less variants) var legacySizes = { "input-lg": "form-group-lg", "input-sm": "form-group-sm" }; $.each(legacySizes, function (legacySize, standardSize) { if ($input.hasClass(legacySize)) { $input.removeClass(legacySize); $formGroup.addClass(standardSize); } }); // Legacy - Add label-floating if using old shorthand if ($input.hasClass("floating-label")) { var placeholder = $input.attr("placeholder"); $input.attr("placeholder", null).removeClass("floating-label"); var id = $input.attr("id"); var forAttribute = ""; if (id) { forAttribute = "for='" + id + "'"; } $formGroup.addClass("label-floating"); $input.after(""); } // Set as empty if is empty (damn I must improve this...) if ($input.val() === null || $input.val() == "undefined" || $input.val() === "") { $formGroup.addClass("is-empty"); } // Support for file input if ($formGroup.find("input[type=file]").length > 0) { $formGroup.addClass("is-fileinput"); } }); }, "attachInputEventHandlers": function () { var validate = this.options.validate; $(document) .on("keydown paste", ".form-control", function (e) { if (_isChar(e)) { $(this).closest(".form-group").removeClass("is-empty"); } }) .on("keyup change", ".form-control", function () { var $input = $(this); var $formGroup = $input.closest(".form-group"); var isValid = (typeof $input[0].checkValidity === "undefined" || $input[0].checkValidity()); if ($input.val() === "") { $formGroup.addClass("is-empty"); } else { $formGroup.removeClass("is-empty"); } // Validation events do not bubble, so they must be attached directly to the input: http://jsfiddle.net/PEpRM/1/ // Further, even the bind method is being caught, but since we are already calling #checkValidity here, just alter // the form-group on change. // // NOTE: I'm not sure we should be intervening regarding validation, this seems better as a README and snippet of code. // BUT, I've left it here for backwards compatibility. if (validate) { if (isValid) { $formGroup.removeClass("has-error"); } else { $formGroup.addClass("has-error"); } } }) .on("focus", ".form-control, .form-group.is-fileinput", function () { _addFormGroupFocus(this); }) .on("blur", ".form-control, .form-group.is-fileinput", function () { _removeFormGroupFocus(this); }) // make sure empty is added back when there is a programmatic value change. // NOTE: programmatic changing of value using $.val() must trigger the change event i.e. $.val('x').trigger('change') .on("change", ".form-group input", function () { var $input = $(this); if ($input.attr("type") == "file") { return; } var $formGroup = $input.closest(".form-group"); var value = $input.val(); if (value) { $formGroup.removeClass("is-empty"); } else { $formGroup.addClass("is-empty"); } }) // set the fileinput readonly field with the name of the file .on("change", ".form-group.is-fileinput input[type='file']", function () { var $input = $(this); var $formGroup = $input.closest(".form-group"); var value = ""; $.each(this.files, function (i, file) { value += file.name + ", "; }); value = value.substring(0, value.length - 2); if (value) { $formGroup.removeClass("is-empty"); } else { $formGroup.addClass("is-empty"); } $formGroup.find("input.form-control[readonly]").val(value); }); }, "ripples": function (selector) { alert(0); }, "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 () { var $this = $(this); if ($this.val() && $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); }, "attachAutofillEventHandlers": function () { // 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 () { var $this = $(this); if ($this.val() !== $this.attr("value")) { $this.trigger("change"); } }); }, 100); }) .on("blur", ".form-group input", function () { clearInterval(focused); }); }, "init": function (options) { this.options = $.extend({}, this.options, options); var $document = $(document); if ($.fn.ripples && this.options.ripples) { alert("0"); } if (this.options.input) { this.input(); this.attachInputEventHandlers(); } if (this.options.checkbox) { this.checkbox(); } if (this.options.togglebutton) { this.togglebutton(); } if (this.options.radio) { this.radio(); } if (this.options.autofill) { this.autofill(); this.attachAutofillEventHandlers(); } Waves.attach('a', ['waves-block']); Waves.attach('.btn'); Waves.attach('.btn-fab',['waves-circle']); Waves.init(); if (document.arrive && this.options.arrive) { if ($.fn.ripples && this.options.ripples) { $document.arrive(this.options.withRipples, function () { alert(0); }); } if (this.options.input) { $document.arrive(this.options.inputElements, function () { $.material.input($(this)); }); } if (this.options.checkbox) { $document.arrive(this.options.checkboxElements, function () { $.material.checkbox($(this)); }); } if (this.options.radio) { $document.arrive(this.options.radioElements, function () { $.material.radio($(this)); }); } if (this.options.togglebutton) { $document.arrive(this.options.togglebuttonElements, function () { $.material.togglebutton($(this)); }); } } } }; })(jQuery); !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(a,c){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n||t)},u,u.exports,t,e,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function t(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function t(){var e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=o+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function t(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function t(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function t(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function t(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function t(){this.removeFake()}},{key:"action",set:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!==(void 0===e?"undefined":r(e))||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function t(){return this._target}}]),t}();t.exports=c})},{select:5}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if(void 0!==o)r(n,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,i.clipboardAction,i.tinyEmitter,i.goodListener),i.clipboard=a.exports}}(this,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var s=i(e),u=i(n),f=i(o),d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText,this.container="object"===d(e.container)?e.container:document.body}},{key:"listenClick",value:function t(e){var n=this;this.listener=(0,f.default)(e,"click",function(t){return n.onClick(t)})}},{key:"onClick",value:function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),container:this.container,trigger:n,emitter:this})}},{key:"defaultAction",value:function t(e){return l("action",e)}},{key:"defaultTarget",value:function t(e){var n=l("target",e);if(n)return document.querySelector(n)}},{key:"defaultText",value:function t(e){return l("text",e)}},{key:"destroy",value:function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],n="string"==typeof e?[e]:e,o=!!document.queryCommandSupported;return n.forEach(function(t){o=o&&!!document.queryCommandSupported(t)}),o}}]),e}(u.default);t.exports=p})},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)});