Skip to content

Instantly share code, notes, and snippets.

@damienklinnert
Created May 17, 2012 11:07
Show Gist options
  • Save damienklinnert/2718189 to your computer and use it in GitHub Desktop.
Save damienklinnert/2718189 to your computer and use it in GitHub Desktop.
wikipedia game bookmarklet
<a href="javascript:(function(){
script = document.createElement( 'script' );
script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
script.onload=releasetheKraken;
document.body.appendChild(script);
function releasetheKraken () {
$('#mw-head').css('display', 'none');
$('#mw-panel').css('display', 'none');
$('#footer').css('display', 'none');
var counter = document.createElement('p');
counter.id='counter';
$(counter).css('float', 'right');
$(counter).css('padding-right', '20px');
$(counter).css('background', '#000');
var header = document.createElement('h1');
$(header).html('wikigame');
$(header).css('padding-left', '20px');
$(header).css('background', '#000');
$(header).css('color', '#fff');
var currentCount = 0;
$('body').html('<iframe></iframe>');
$('iframe').attr('src', '/wiki/Spezial:Zuf%C3%A4llige_Seite');
$('iframe').attr('width', '100%');
$('iframe').attr('height', '70%');
$('iframe').css('border', '0');
$('iframe').load(function () {
$(counter).html('clicks: '+currentCount);
currentCount+=1;
$('iframe').contents().find('#mw-head').css('display', 'none');
$('iframe').contents().find('#mw-panel').css('display', 'none');
$('iframe').contents().find('#footer').css('display', 'none');
});
$('body').prepend(header);
$(header).prepend(counter);
}
})();
">wikigame</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment