mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
5.8 KiB
JavaScript
1 line
5.8 KiB
JavaScript
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).URLParse=e()}(function(){return function r(n,s,a){function i(t,e){if(!s[t]){if(!n[t]){var o="function"==typeof require&&require;if(!e&&o)return o(t,!0);if(u)return u(t,!0);throw(o=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",o}o=s[t]={exports:{}},n[t][0].call(o.exports,function(e){return i(n[t][1][e]||e)},o,o.exports,r,n,s,a)}return s[t].exports}for(var u="function"==typeof require&&require,e=0;e<a.length;e++)i(a[e]);return i}({1:[function(e,o,t){!function(a){!function(){"use strict";var f=e("requires-port"),h=e("querystringify"),n=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,i=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,d=/^[a-zA-Z]:/,t=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function y(e){return(e||"").toString().replace(t,"")}var g=[["#","hash"],["?","query"],function(e,t){return w(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],s={hash:1,query:1};function m(e){var t,o="undefined"!=typeof window?window:void 0!==a?a:"undefined"!=typeof self?self:{},o=o.location||{},r={},o=typeof(e=e||o);if("blob:"===e.protocol)r=new v(unescape(e.pathname),{});else if("string"==o)for(t in r=new v(e,{}),s)delete r[t];else if("object"==o){for(t in e)t in s||(r[t]=e[t]);void 0===r.slashes&&(r.slashes=n.test(e.href))}return r}function w(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function x(e,t){e=y(e),t=t||{};var o,r=i.exec(e),n=r[1]?r[1].toLowerCase():"",s=!!r[2],a=!!r[3],e=0;return s?e=a?(o=r[2]+r[3]+r[4],r[2].length+r[3].length):(o=r[2]+r[4],r[2].length):a?(o=r[3]+r[4],e=r[3].length):o=r[4],"file:"===n?2<=e&&(o=o.slice(2)):w(n)?o=r[4]:n?s&&(o=o.slice(2)):2<=e&&w(t.protocol)&&(o=r[4]),{protocol:n,slashes:s||w(n),slashesCount:e,rest:o}}function v(e,t,o){if(e=y(e),!(this instanceof v))return new v(e,t,o);var r,n,s,a,i,u=g.slice(),l=typeof t,c=this,p=0;for("object"!=l&&"string"!=l&&(o=t,t=null),o&&"function"!=typeof o&&(o=h.parse),r=!(l=x(e||"",t=m(t))).protocol&&!l.slashes,c.slashes=l.slashes||r&&t.slashes,c.protocol=l.protocol||t.protocol||"",e=l.rest,("file:"===l.protocol&&(2!==l.slashesCount||d.test(e))||!l.slashes&&(l.protocol||l.slashesCount<2||!w(c.protocol)))&&(u[3]=[/(.*)/,"pathname"]);p<u.length;p++)"function"!=typeof(s=u[p])?(n=s[0],i=s[1],n!=n?c[i]=e:"string"==typeof n?~(a=e.indexOf(n))&&(e="number"==typeof s[2]?(c[i]=e.slice(0,a),e.slice(a+s[2])):(c[i]=e.slice(a),e.slice(0,a))):(a=n.exec(e))&&(c[i]=a[1],e=e.slice(0,a.index)),c[i]=c[i]||r&&s[3]&&t[i]||"",s[4]&&(c[i]=c[i].toLowerCase())):e=s(e,c);o&&(c.query=o(c.query)),r&&t.slashes&&"/"!==c.pathname.charAt(0)&&(""!==c.pathname||""!==t.pathname)&&(c.pathname=function(e,t){if(""===e)return t;for(var o=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=o.length,e=o[r-1],n=!1,s=0;r--;)"."===o[r]?o.splice(r,1):".."===o[r]?(o.splice(r,1),s++):s&&(0===r&&(n=!0),o.splice(r,1),s--);return n&&o.unshift(""),"."!==e&&".."!==e||o.push(""),o.join("/")}(c.pathname,t.pathname)),"/"!==c.pathname.charAt(0)&&w(c.protocol)&&(c.pathname="/"+c.pathname),f(c.port,c.protocol)||(c.host=c.hostname,c.port=""),c.username=c.password="",c.auth&&(s=c.auth.split(":"),c.username=s[0]||"",c.password=s[1]||""),c.origin="file:"!==c.protocol&&w(c.protocol)&&c.host?c.protocol+"//"+c.host:"null",c.href=c.toString()}v.prototype={set:function(e,t,o){var r,n=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(o||h.parse)(t)),n[e]=t;break;case"port":n[e]=t,f(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,/:\d+$/.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!o;break;case"pathname":case"hash":t?(r="pathname"===e?"/":"#",n[e]=t.charAt(0)!==r?r+t:t):n[e]=t;break;default:n[e]=t}for(var s=0;s<g.length;s++){var a=g[s];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.origin="file:"!==n.protocol&&w(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(e){e&&"function"==typeof e||(e=h.stringify);var t=this,o=t.protocol;return o&&":"!==o.charAt(o.length-1)&&(o+=":"),o+=t.slashes||w(t.protocol)?"//":"",t.username&&(o+=t.username,t.password&&(o+=":"+t.password),o+="@"),o+=t.host+t.pathname,(e="object"==typeof t.query?e(t.query):t.query)&&(o+="?"!==e.charAt(0)?"?"+e:e),t.hash&&(o+=t.hash),o}},v.extractProtocol=x,v.location=m,v.trimLeft=y,v.qs=h,o.exports=v}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:2,"requires-port":3}],2:[function(e,t,o){"use strict";var s=Object.prototype.hasOwnProperty;function a(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function i(e){try{return encodeURIComponent(e)}catch(e){return null}}o.stringify=function(e,t){var o,r,n=[];for(r in"string"!=typeof(t=t||"")&&(t="?"),e)s.call(e,r)&&((o=e[r])||null!=o&&!isNaN(o)||(o=""),r=i(r),o=i(o),null!==r&&null!==o&&n.push(r+"="+o));return n.length?t+n.join("&"):""},o.parse=function(e){for(var t=/([^=?#&]+)=?([^&]*)/g,o={};n=t.exec(e);){var r=a(n[1]),n=a(n[2]);null===r||null===n||r in o||(o[r]=n)}return o}},{}],3:[function(e,t,o){"use strict";t.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},{}]},{},[1])(1)}); |