-
Notifications
You must be signed in to change notification settings - Fork 1
/
photon.min.js
28 lines (28 loc) · 7.59 KB
/
photon.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*!
* Photon JavaScript Library v3.5.1
* https://ksengine.github.io/photon/
*
* Copyright Kavindu Santhusa
* Released under the MIT license
* https://github.com/Ksengine/Photon/license
*
*/
/*!
* Ajax
*/
var XMLHttpRequest=void 0!==XMLHttpRequest&&XMLHttpRequest||void 0!==ActiveXObject("Msxml2.XMLHTTP")&&ActiveXObject("Msxml2.XMLHTTP")||void 0!==ActiveXObject("Microsoft.XMLHTTP")&&ActiveXObject("Microsoft.XMLHTTP"),arr=[];
/*!
* String
*/
String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")})
/*!
* Array
*/,Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t,r){var e,n;if(null==this)throw new TypeError(" this is null or not defined");var o=Object(this),i=o.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(arguments.length>1&&(e=r),n=0;n<i;){var f;n in o&&(f=o[n],t.call(e,f,n,o)),n++}}),Array.prototype.map||(Array.prototype.map=function(t){var r,e,n;if(null==this)throw new TypeError("this is null or not defined");var o=Object(this),i=o.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(arguments.length>1&&(r=arguments[1]),e=new Array(i),n=0;n<i;){var f,u;n in o&&(f=o[n],u=t.call(r,f,n,o),e[n]=u),n++}return e}),Array.prototype.filter||(Array.prototype.filter=function(t,r){"use strict";if("Function"!=typeof t&&"function"!=typeof t||!this)throw new TypeError;var e=this.length>>>0,n=new Array(e),o=this,i=0,f=-1;if(void 0===r)for(;++f!==e;)f in this&&t(o[f],f,o)&&(n[i++]=o[f]);else for(;++f!==e;)f in this&&t.call(r,o[f],f,o)&&(n[i++]=o[f]);return n.length=i,n}),Array.prototype.reduce||Object.defineProperty(Array.prototype,"reduce",{value:function(t){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof t)throw new TypeError(t+" is not a function");var r,e=Object(this),n=e.length>>>0,o=0;if(arguments.length>=2)r=arguments[1];else{for(;o<n&&!(o in e);)o++;if(o>=n)throw new TypeError("Reduce of empty array with no initial value");r=e[o++]}for(;o<n;)o in e&&(r=t(r,e[o],o,e)),o++;return r}}),"function"!=typeof Array.prototype.reduceRight&&(Array.prototype.reduceRight=function(t){"use strict";if(null==this)throw new TypeError("Array.prototype.reduceRight called on null or undefined");if("function"!=typeof t)throw new TypeError(t+" is not a function");var r,e=Object(this),n=(e.length>>>0)-1;if(arguments.length>=2)r=arguments[1];else{for(;n>=0&&!(n in e);)n--;if(n<0)throw new TypeError("reduceRight of empty array with no initial value");r=e[n--]}for(;n>=0;n--)n in e&&(r=t(r,e[n],n,e));return r}),Array.prototype.every||(Array.prototype.every=function(t,r){"use strict";var e,n;if(null==this)throw new TypeError("this is null or not defined");var o=Object(this),i=o.length>>>0;if("function"!=typeof t)throw new TypeError;for(arguments.length>1&&(e=r),n=0;n<i;){var f;if(n in o)if(f=o[n],!t.call(e,f,n,o))return!1;n++}return!0}),Array.prototype.some||(Array.prototype.some=function(t){"use strict";if(null==this)throw new TypeError("Array.prototype.some called on null or undefined");if("function"!=typeof t)throw new TypeError;for(var r=Object(this),e=r.length>>>0,n=arguments.length>=2?arguments[1]:void 0,o=0;o<e;o++)if(o in r&&t.call(n,r[o],o,r))return!0;return!1}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t,r){var e;if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),o=n.length>>>0;if(0===o)return-1;var i=+r||0;if(Math.abs(i)===1/0&&(i=0),i>=o)return-1;for(e=Math.max(i>=0?i:o-Math.abs(i),0);e<o;){if(e in n&&n[e]===t)return e;e++}return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(t){"use strict";if(null==this)throw new TypeError;var r,e,n=Object(this),o=n.length>>>0;if(0===o)return-1;for(r=o-1,arguments.length>1&&((r=Number(arguments[1]))!=r?r=0:0!=r&&r!=1/0&&r!=-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),e=r>=0?Math.min(r,o-1):o-Math.abs(r);e>=0;e--)if(e in n&&n[e]===t)return e;return-1}),Array.prototype.flat=Array.prototype.flat||function(){return(arr=[]).concat.apply([],this)},
/*!
* JSON
*/
"object"!=typeof JSON&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(t){return t<10?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var r=meta[t];return"string"==typeof r?r:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,r){var e,n,o,i,f,u=gap,a=r[t];switch(a&&"object"==typeof a&&"function"==typeof a.toJSON&&(a=a.toJSON(t)),"function"==typeof rep&&(a=rep.call(r,t,a)),typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(a)){for(i=a.length,e=0;e<i;e+=1)f[e]=str(e,a)||"null";return o=0===f.length?"[]":gap?"[\n"+gap+f.join(",\n"+gap)+"\n"+u+"]":"["+f.join(",")+"]",gap=u,o}if(rep&&"object"==typeof rep)for(i=rep.length,e=0;e<i;e+=1)"string"==typeof rep[e]&&(o=str(n=rep[e],a))&&f.push(quote(n)+(gap?": ":":")+o);else for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(o=str(n,a))&&f.push(quote(n)+(gap?": ":":")+o);return o=0===f.length?"{}":gap?"{\n"+gap+f.join(",\n"+gap)+"\n"+u+"}":"{"+f.join(",")+"}",gap=u,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value),"function"!=typeof JSON.stringify&&(meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(t,r,e){var n;if(gap="",indent="","number"==typeof e)for(n=0;n<e;n+=1)indent+=" ";else"string"==typeof e&&(indent=e);if(rep=r,r&&"function"!=typeof r&&("object"!=typeof r||"number"!=typeof r.length))throw new Error("JSON.stringify");return str("",{"":t})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){var j;function walk(t,r){var e,n,o=t[r];if(o&&"object"==typeof o)for(e in o)Object.prototype.hasOwnProperty.call(o,e)&&(void 0!==(n=walk(o,e))?o[e]=n:delete o[e]);return reviver.call(t,r,o)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),
/*!
* Date
*/
Date.now||(Date.now=function(){return(new Date).getTime()}),Date.prototype.toISOString||function(){function t(t){return t<10?"0"+t:t}Date.prototype.toISOString=function(){return this.getUTCFullYear()+"-"+t(this.getUTCMonth()+1)+"-"+t(this.getUTCDate())+"T"+t(this.getUTCHours())+":"+t(this.getUTCMinutes())+":"+t(this.getUTCSeconds())+"."+(this.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}}();