(function($){
/**
URL Parsing Function v1.5
by DJDavid98 - created for EQReverb.com ("site").
2013 (c) EQReverb.com
You may not copy or redistribute this script in parts or in whole,
it can only be used on the site and its subdomains.
@requires jQuery
**/
$.parseURL = function(str) {
if (typeof str === 'undefined' && typeof window.location.href !== 'undefined') str = window.location.href;
var check = {
whole: /^((http|https):\/\/)?((.*\.)?.*\..*|localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/.*/,
protocol: /^(http|https):\/\//,
absolute: /^\/\/((.*\.)?.*\..*|localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\//,
relative: /^[\/](?!\/).*(\..*|\/)?.*$/,
params: /\?.*=.*(\&.*\=.*)+[^#.*]/,
},
r = {
protocol: undefined,
hostname: undefined,
hash: undefined,
href: {
original: undefined,
noparams: undefined,
},
parentDomain: undefined,
parameters: undefined,
pathname: {
nohash: undefined,
withhash: undefined,
},
type: undefined,
};
if (typeof str !== 'string') throw new TypeError('Argument must be a string!');
else if (!check.whole.test(str) && !check.absolute.test(str) && !check.relative.test(str)) throw new Error('Invalid string');
r.href.original = str;
if (str.indexOf('#') !== -1){
r.hash = str.substring(str.indexOf('#'));
str = str.substring(0,str.indexOf('#'));
}
if (check.params.test(str)){
r.parameters = {};
var urlparams = str.match(check.params)[0].substring(1).split("&");
for (var i=0,l=urlparams.length; i<l; i++){
var item = urlparams[i].split('=');
r.parameters[item[0]] = item[1];
}
str = str.replace(check.params,'');
r.href.noparams = str+(typeof r.hash !== 'undefined' ? r.hash : '');
}
if (check.protocol.test(str)){
r.protocol = str.match(check.protocol)[0];
r.hostname = str.replace(check.protocol,'');
r.hostname =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.