/*! jQueryHref - v0.1.0 - 2016-06-26 * https://github.com/cheeserolls/jQueryHref * Copyright (c) 2016 Dan Howard; Licensed MIT */ !function(a){var b=function(a){var b={protocol:a.protocol.replace(/:?\/?\/?$/,""),host:a.host,path:a.pathname.replace(/^\//,""),query:d(a.search.replace(/^\?/,"")),hash:a.hash.replace(/^#/,"")};return b.href=c(b),b},c=function(b){var c=b.query?a.param(b.query):!1;return b.protocol+"://"+b.host+(b.path?"/"+b.path:"")+(c?"?"+c:"")+(b.hash?"#"+b.hash:"")},d=function(b,c){var d={},e={"true":!0,"false":!1,"null":null};return a.each(b.replace(/\+/g," ").split("&"),function(b,f){var g,h=f.split("="),i=decodeURIComponent(h[0]),j=d,k=0,l=i.split("]["),m=l.length-1;if(/\[/.test(l[0])&&/\]$/.test(l[m])?(l[m]=l[m].replace(/\]$/,""),l=l.shift().split("[").concat(l),m=l.length-1):m=0,2===h.length)if(g=decodeURIComponent(h[1]),c&&(g=g&&!isNaN(g)?+g:"undefined"===g?void 0:void 0!==e[g]?e[g]:g),m)for(;m>=k;k++)i=""===l[k]?j.length:l[k],j=j[i]=m>k?j[i]||(l[k+1]&&isNaN(l[k+1])?{}:[]):g;else a.isArray(d[i])?d[i].push(g):void 0!==d[i]?d[i]=[d[i],g]:d[i]=g;else i&&(d[i]=c?void 0:"")}),d},e={protocol:function(a,b){null==a&&(a=window.document.location.protocol),b.protocol=a.toString().replace(/:?\/?\/?$/,"")},host:function(a,b){null==a&&(a=window.document.location.hostname),b.host=a.toString()},path:function(a,b){null==a&&(a=""),b.path=a.toString().replace(/^\//,"")},query:function(b,c){a.extend(c.query,b)},"query.replace":function(a,b){b.query=a},hash:function(a,b){b.hash=a?a.toString().replace(/^#/,""):null},href:function(c,d){null==c&&(c=window.document.location.href),this.attr("href",c.toString()),a.extend(d,b(this[0]))}};a.fn.href=function(){if("A"!==this[0].nodeName)return this;if(this[0].href||(this[0].href=window.document.location.href),0===arguments.length)return this[0].href;var a=b(this[0]);if(1===arguments.length&&"string"==typeof arguments[0])return a.hasOwnProperty(arguments[0])?a[arguments[0]]:(this.attr("href",arguments[0]),this);if(2===arguments.length&&e[arguments[0]]&&e[arguments[0]].call(this,arguments[1],a),1===arguments.length&&"object"==typeof arguments[0])for(var d in arguments[0])e[d]&&e[d].call(this,arguments[0][d],a);return this.attr("href",c(a))},a.href=function(){return a("").attr("href",arguments.length>0?arguments[0]:window.document.location.href)},a.href.linkEquals=function(c,d){return"string"==typeof c&&(c=a("").attr("href",c)),c instanceof a&&(c=c[0]),c&&"A"===c.nodeName?(c=b(c),"string"==typeof d&&(d=a("").attr("href",d)),d instanceof a&&(d=d[0]),d&&"A"===d.nodeName?(d=b(d),c.protocol===d.protocol&&c.host===d.host&&c.path===d.path&&c.hash===d.hash&&a.param(c.query).split("&").sort().join("&")===a.param(d.query).split("&").sort().join("&")):!1):!1},a.href.home=function(){return a.href().href({path:null,"query.replace":null,hash:null})},a.href.decomposeLink=b,a.href.composeLink=c,a.href.deparam=d,a.expr[":"]["href-internal"]=function(a,b,c,d){return a.hostname&&a.hostname===document.location.hostname},a.expr[":"]["href-external"]=function(a,b,c,d){return a.hostname&&a.hostname!==document.location.hostname}}(jQuery);