Created
April 1, 2011 11:11
-
-
Save johanbrook/898008 to your computer and use it in GitHub Desktop.
Första versionen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var c=window.location.search.substring(1);if(window.location.href.search('systembolaget.se')==-1||c.search('varuNr')==-1){alert('Hittade ingen URL från Systembolaget.se. Se till att du verkligen har en produktsida från Systembolaget.se öppen!');return false}else{var d='http://systmt.se/'+f('varuNr',c);alert('Din korta URL: '+d);return d}function f(g,h){var e=h.split('&'),a;for(var b=0;b<e.length;b++){a=e[b].split('=');if(a[0]==g){return a[1]}}}})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var query = window.location.search.substring(1); | |
if(window.location.href.search('systembolaget.se') == -1 || query.search('varuNr') == -1){ | |
alert('Hittade ingen URL från Systembolaget.se. Se till att du verkligen har en produktsida från Systembolaget.se öppen!'); | |
return; | |
}else{ | |
var shorturl = 'http://systmt.se/' + getQueryVariable('varuNr', query); | |
alert('Din korta URL: ' + shorturl); | |
return; | |
} | |
function getQueryVariable(variable, query){ | |
var vars = query.split('&'), | |
pair; | |
for (var i=0; i < vars.length; i++){ | |
pair = vars[i].split('='); | |
if(pair[0] == variable){ | |
return pair[1]; | |
} | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment