Created
April 1, 2011 14:02
-
-
Save johanbrook/898192 to your computer and use it in GitHub Desktop.
Andra 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
var d = window.document, | |
s = d.createElement('script'), | |
u = 'https://gist.github.com/raw/898192/828a9f94ac02c4f95ed0e9538a9a7d26ad661395/systmt.js'; | |
function load(){ | |
if(d.readyState && d.readyState != 'complete'){ | |
setTimeout(load, 200); | |
}else{ | |
if(typeof systmt == 'undefined'){ | |
s.async = 1; | |
s.type = 'text/javascript'; | |
s.src = u; | |
d.body.appendChild(s); | |
} | |
function f(){ | |
if(typeof systmt == 'undefined'){ | |
setTimeout(f, 200); | |
}else{ | |
systmt.run(); | |
} | |
} | |
f(); | |
} | |
} | |
load(); |
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%20d%3Dwindow.document%2Cs%3Dd.createElement('script')%2Cu%3D'https%3A%2F%2Fgist.github.com%2Fraw%2F898192%2F828a9f94ac02c4f95ed0e9538a9a7d26ad661395%2Fsystmt.js'%3Bfunction%20load()%7Bif(d.readyState%26%26d.readyState!%3D'complete')%7BsetTimeout(load%2C200)%7Delse%7Bif(typeof%20systmt%3D%3D'undefined')%7Bs.async%3D1%3Bs.type%3D'text%2Fjavascript'%3Bs.src%3Du%3Bd.body.appendChild(s)%7Dfunction%20f()%7Bif(typeof%20systmt%3D%3D'undefined')%7BsetTimeout(f%2C200)%7Delse%7Bsystmt.run()%7D%7Df()%7D%7Dload()%3B})(); |
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
var systmt = function(){ | |
// Private | |
var getQueryVariable = function(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]; | |
} | |
} | |
} | |
return { | |
run: 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 false; | |
}else{ | |
var shorturl = 'http://systmt.se/' + getQueryVariable('varuNr', query); | |
alert('Din korta URL: ' + shorturl); | |
return shorturl; | |
} | |
} | |
} | |
}(); | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>systmt test</title> | |
</head> | |
<body> | |
<p> | |
<a href="javascript:(function(){ | |
var d = window.document, | |
s = d.createElement('script'), | |
u = 'https://gist.github.com/raw/898192/828a9f94ac02c4f95ed0e9538a9a7d26ad661395/systmt.js'; | |
function load(){ | |
if(d.readyState && d.readyState != 'complete'){ | |
setTimeout(load, 200); | |
}else{ | |
if(typeof systmt == 'undefined'){ | |
s.async = 1; | |
s.type = 'text/javascript'; | |
s.src = u; | |
d.body.appendChild(s); | |
} | |
function f(){ | |
if(typeof systmt == 'undefined'){ | |
setTimeout(f, 200); | |
}else{ | |
systmt.run(); | |
} | |
} | |
f(); | |
} | |
} | |
load(); | |
})();">External</a> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment