1 line
7.5 KiB
JavaScript
1 line
7.5 KiB
JavaScript
|
!function(f){"use strict";function i(e){return!!e&&("Symbol"in f&&"iterator"in f.Symbol&&"function"==typeof e[Symbol.iterator]||!!Array.isArray(e))}function o(e){return"from"in Array?Array.from(e):Array.prototype.slice.call(e)}!function(){var u,l=f.URL;try{if(l){if("searchParams"in(u=new f.URL("http://example.com"))){var e=new n("http://example.com");if(e.search="a=1&b=2","http://example.com/?a=1&b=2"===e.href&&(e.search="","http://example.com/"===e.href))return}"href"in u||(u=void 0),u=void 0}}catch(e){}function a(e){var r="",a=!0;return e.forEach(function(e){var t=encodeURIComponent(e.name),n=encodeURIComponent(e.value);a||(r+="&"),r+=t+"="+n,a=!1}),r.replace(/%20/g,"+")}function c(e,t){var n=e.split("&");t&&-1===n[0].indexOf("=")&&(n[0]="="+n[0]);var a=[];n.forEach(function(e){if(0!==e.length){var t=e.indexOf("=");if(-1!==t)var n=e.substring(0,t),r=e.substring(t+1);else n=e,r="";n=n.replace(/\+/g," "),r=r.replace(/\+/g," "),a.push({name:n,value:r})}});var r=[];return a.forEach(function(e){r.push({name:decodeURIComponent(e.name),value:decodeURIComponent(e.value)})}),r}function s(t){var n=this;this._list=[],null==t||(t instanceof s?this._list=c(String(t)):"object"==typeof t&&i(t)?o(t).forEach(function(e){if(!i(e))throw TypeError();var t=o(e);if(2!==t.length)throw TypeError();n._list.push({name:String(t[0]),value:String(t[1])})}):"object"==typeof t&&t?Object.keys(t).forEach(function(e){n._list.push({name:String(e),value:String(t[e])})}):("?"===(t=String(t)).substring(0,1)&&(t=t.substring(1)),this._list=c(t))),this._url_object=null;var r=!(this._setList=function(e){r||(n._list=e)});this._update_steps=function(){r||(r=!0,n._url_object&&("about:"===n._url_object.protocol&&-1!==n._url_object.pathname.indexOf("?")&&(n._url_object.pathname=n._url_object.pathname.split("?")[0]),n._url_object.search=a(n._list),r=!1))}}function t(t,n){var r=0;this.next=function(){if(r>=t.length)return{done:!0,value:void 0};var e=t[r++];return{done:!1,value:"key"===n?e.name:"value"===n?e.value:[e.name,e.value]}}}function n(a,i){if(!(this instanceof f.URL))throw new TypeError("Failed to construct 'URL': Please use the 'new' operator.");i&&(a=function(){if(u)return new l(a,i).href;var e;try{var t;if("[object OperaMini]"===Object.prototype.toString.call(window.operamini)?((e=document.createElement("iframe")).style.display="none",document.documentElement.appendChild(e),t=e.contentWindow.document):document.implementation&&document.implementation.createHTMLDocument?t=document.implementation.createHTMLDocument(""):document.implementation&&document.implementation.createDocument?((t=document.implementation.createDocument("http://www.w3.org/1999/xhtml","html",null)).documentElement.appendChild(t.createElement("head")),t.documentElement.appendChild(t.createElement("body"))):window.ActiveXObject&&((t=new window.ActiveXObject("htmlfile")).write("<head></head><body></body>"),t.close()),!t)throw Error("base not supported");var n=t.createElement("base");n.href=i,t.getElementsByTagName("head")[0].appendChild(n);var r=t.createElement("a");return r.href=a,r.href}finally{e&&e.parentNode.removeChild(e)}}());var t=function(e){if(u)return new l(e);var t=document.createElement("a");return t.href=e,t}(a||""),e=function(){if(!("defineProperties"in Object))return!1;try{var e={};return Object.defineProperties(e,{prop:{get:function(){return!0}}}),e.prop}catch(e){return!1}}()?this:document.createElement("a"),n=new s(t.search?t.search.substring(1):null);function r(){var e=t.href.replace(/#$|\?$|\?(?=#)/g,"");t.href!==e&&(t.href=e)}function o(){n._setList(t.search?c(t.search.substring(1)):[]),n._update_steps()}return n._url_object=e,Object.defineProperties(e,{href:{get:function(){return t.href},set:function(e){t.href=e,r(),o()},enumerable:!0,configurable:!0},origin:{get:function(){return"origin"in t?t.origin:this.protocol+"//"+this.host},enumerable:!0,configurable:!0},protocol:{get:function(){return t.protocol},set:function(e){t.protocol=e},enumerable:!0,configurable:!0},username:{get:function(){return t.username},set:function(e){t.username=e},enumerable:!0,configurable:!0},pas
|