src/pyams_skin/resources/js/myams-core.min.js
changeset 470 1b985b52f866
parent 456 c09f55f777fa
child 486 48b7cea0d903
equal deleted inserted replaced
469:46e128be7e1c 470:1b985b52f866
     1 "use strict";!function(s,e){var t=e.console;String.prototype.startsWith=function(t){var e=this.length,n=t.length;return!(e<n)&&this.substr(0,n)===t},String.prototype.endsWith=function(t){var e=this.length,n=t.length;return!(e<n)&&this.substr(e-n)===t},String.prototype.unserialize=function(t){for(var e=decodeURIComponent(this).split("&"),n={},r=0;r<e.length;r++){var i=e[r].split("=",2);n[i[0]]=i[1]}return n},Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var n=this.length;for((e=(e=Number(e)||0)<0?Math.ceil(e):Math.floor(e))<0&&(e+=n);e<n;e++)if(e in this&&this[e]===t)return e;return-1}),s.expr[":"].hasvalue=function(t,e,n){return""!==s(t).val()},s.expr[":"].econtains=function(t,e,n){return(t.textContent||t.innerText||s(t).text()||"").toLowerCase()===n[3].toLowerCase()},s.expr[":"].withtext=function(t,e,n){return(t.textContent||t.innerText||s(t).text()||"")===n[3]},s.expr[":"].parents=function(t,e,n){return 0<s(t).parents(n[3]).length},void 0===s.scrollbarWidth&&(s.scrollbarWidth=function(){var t=s('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),e=t.children(),n=e.innerWidth()-e.height(99).innerWidth();return t.remove(),n}),s.fn.extend({exists:function(){return 0<s(this).length},objectOrParentWithClass:function(t){return this.hasClass(t)?this:this.parents("."+t)},listattr:function(t){var e=[];return this.each(function(){e.push(s(this).attr(t))}),e},style:function(t,e,n){if(void 0!==this.get(0)){var r=this.get(0).style;return void 0!==t?void 0!==e?(n=void 0!==n?n:"",r.setProperty(t,e,n),this):r.getPropertyValue(t):r}},removeClassPrefix:function(r){return this.each(function(t,e){var n=e.className.split(" ").map(function(t){return t.startsWith(r)?"":t});e.className=s.trim(n.join(" "))}),this}}),void 0===e.MyAMS&&(e.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n,r=e.MyAMS,u=r;r.baseURL=(n=s('script[src*="/myams.js"], script[src*="/myams.min.js"]').attr("src"),u.devmode=n.indexOf(".min.js")<0,u.devext=u.devmode?"":".min",n.substring(0,n.lastIndexOf("/")+1)),r.log=function(){t&&t.debug&&t.debug(this,arguments)},r.getQueryVar=function(t,e){if(t.indexOf("?")<0)return!1;t.endsWith("&")||(t+="&");var n=new RegExp(".*?[&\\?]"+e+"=(.*?)&.*"),r=t.replace(n,"$1");return r!==t&&r},r.rgb2hex=function(t){return"#"+s.map(t.match(/\b(\d+)\b/g),function(t){return("0"+parseInt(t).toString(16)).slice(-2)}).join("")},r.generateId=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},r.generateUUID=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===t?e:3&e|8).toString(16)})},r.getObject=function(t,e){if(t){if("string"!=typeof t)return t;var n=t.split(".");e=null==e?window:e;for(var r=0;r<n.length;r++)try{e=e[n[r]]}catch(t){return}return e}},r.getFunctionByName=function(t,e){if(void 0!==t){if("function"==typeof t)return t;var n=t.split("."),r=n.pop();e=null==e?window:e;for(var i=0;i<n.length;i++)try{e=e[n[i]]}catch(t){return}try{return e[r]}catch(t){return}}},r.executeFunctionByName=function(t,e){var n=u.getFunctionByName(t,window);if("function"==typeof n){var r=Array.prototype.slice.call(arguments,2);return n.apply(e,r)}},r.isInDOM=function(t){return!!(t=s(t)).exists()&&e.document.body.contains(t[0])},r.getSource=function(t){return t.replace(/{[^{}]*}/g,function(t){return u.getFunctionByName(t.substr(1,t.length-2))})},r.getScript=function(t,e,n){"object"==typeof e&&(n=e,e=null),void 0===n&&(n={});var r={dataType:"script",url:u.getSource(t),success:e,error:u.error.show,cache:!u.devmode,async:void 0===n.async?"function"==typeof e:n.async},i=s.extend({},r,n);return s.ajax(i)},r.getCSS=function(t,e,n,r){n&&(n=u.getFunctionByName(n));var i=s("HEAD"),o=s('style[data-ams-id="'+e+'"]',i);if(0===o.length){if(o=s("<style>").attr("data-ams-id",e).text('@import "'+u.getSource(t)+'";'),n)var a=setInterval(function(){try{o[0].sheet.cssRules;n.call(window,!0,r),clearInterval(a)}catch(t){}},10);o.appendTo(i)}else n&&n.call(window,!1,r)}}(jQuery,this);
     1 "use strict";!function(t,e){var n=e.console;String.prototype.startsWith=function(t){var e=this.length,n=t.length;return!(e<n)&&this.substr(0,n)===t},String.prototype.endsWith=function(t){var e=this.length,n=t.length;return!(e<n)&&this.substr(e-n)===t},String.prototype.unserialize=function(t){for(var e=decodeURIComponent(this).split("&"),n={},r=0;r<e.length;r++){var i=e[r].split("=",2);n[i[0]]=i[1]}return n},Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var n=this.length;for((e=(e=Number(e)||0)<0?Math.ceil(e):Math.floor(e))<0&&(e+=n);e<n;e++)if(e in this&&this[e]===t)return e;return-1}),t.expr[":"].hasvalue=function(e,n,r){return""!==t(e).val()},t.expr[":"].econtains=function(e,n,r){return(e.textContent||e.innerText||t(e).text()||"").toLowerCase()===r[3].toLowerCase()},t.expr[":"].withtext=function(e,n,r){return(e.textContent||e.innerText||t(e).text()||"")===r[3]},t.expr[":"].parents=function(e,n,r){return t(e).parents(r[3]).length>0},void 0===t.scrollbarWidth&&(t.scrollbarWidth=function(){var e=t('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),n=e.children(),r=n.innerWidth()-n.height(99).innerWidth();return e.remove(),r}),t.fn.extend({exists:function(){return t(this).length>0},objectOrParentWithClass:function(t){return this.hasClass(t)?this:this.parents("."+t)},listattr:function(e){var n=[];return this.each(function(){n.push(t(this).attr(e))}),n},style:function(t,e,n){if(void 0!==this.get(0)){var r=this.get(0).style;return void 0!==t?void 0!==e?(n=void 0!==n?n:"",r.setProperty(t,e,n),this):r.getPropertyValue(t):r}},removeClassPrefix:function(e){return this.each(function(n,r){var i=r.className.split(" ").map(function(t){return t.startsWith(e)?"":t});r.className=t.trim(i.join(" "))}),this}}),void 0===e.MyAMS&&(e.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var r=e.MyAMS,i=r;r.baseURL=function(){var e=t('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"]').attr("src");return i.devmode=e.indexOf(".min.js")<0,i.devext=i.devmode?"":".min",e.substring(0,e.lastIndexOf("/")+1)}(),r.log=function(){n&&n.debug&&n.debug(this,arguments)},r.getQueryVar=function(t,e){if(t.indexOf("?")<0)return!1;t.endsWith("&")||(t+="&");var n=new RegExp(".*?[&\\?]"+e+"=(.*?)&.*"),r=t.replace(n,"$1");return r!==t&&r},r.rgb2hex=function(e){return"#"+t.map(e.match(/\b(\d+)\b/g),function(t){return("0"+parseInt(t).toString(16)).slice(-2)}).join("")},r.generateId=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},r.generateUUID=function(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)})},r.getObject=function(t,e){if(t){if("string"!=typeof t)return t;var n=t.split(".");e=void 0===e||null===e?window:e;for(var r=0;r<n.length;r++)try{e=e[n[r]]}catch(t){return}return e}},r.getFunctionByName=function(t,e){if(void 0!==t){if("function"==typeof t)return t;var n=t.split("."),r=n.pop();e=void 0===e||null===e?window:e;for(var i=0;i<n.length;i++)try{e=e[n[i]]}catch(t){return}try{return e[r]}catch(t){return}}},r.executeFunctionByName=function(t,e){var n=i.getFunctionByName(t,window);if("function"==typeof n){var r=Array.prototype.slice.call(arguments,2);return n.apply(e,r)}},r.isInDOM=function(n){return!!(n=t(n)).exists()&&e.document.body.contains(n[0])},r.getSource=function(t){return t.replace(/{[^{}]*}/g,function(t){return i.getFunctionByName(t.substr(1,t.length-2))})},r.getScript=function(e,n,r){"object"==typeof n&&(r=n,n=null),void 0===r&&(r={});var o={dataType:"script",url:i.getSource(e),success:n,error:i.error.show,cache:!i.devmode,async:void 0===r.async?"function"==typeof n:r.async},a=t.extend({},o,r);return t.ajax(a)},r.getCSS=function(e,n,r,o){r&&(r=i.getFunctionByName(r));var a=t("HEAD"),s=t('style[data-ams-id="'+n+'"]',a);if(0===s.length){if(s=t("<style>").attr("data-ams-id",n).text('@import "'+i.getSource(e)+'";'),r)var c=setInterval(function(){try{s[0].sheet.cssRules;r.call(window,!0,o),clearInterval(c)}catch(t){}},10);s.appendTo(a)}else r&&r.call(window,!1,o)}}(jQuery,this);