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(
|