Skip to content

Instantly share code, notes, and snippets.

@jboecker
Last active December 14, 2015 17:39
Show Gist options
  • Save jboecker/5123578 to your computer and use it in GitHub Desktop.
Save jboecker/5123578 to your computer and use it in GitHub Desktop.
Bookmarklet to create a custom printable view of zeit.de "Um die Ecke gedacht" riddles (use jscompress.com to get it to a manageable size for a bookmarklet)
var jQuery, document;
function f() {
'use strict';
var title = jQuery("span.title"),
image = jQuery("#main > div.article-body > div.block > img"),
across = jQuery("#main > div.article-body > p")[1],
down = jQuery("#main > div.article-body > p")[2],
b,
imgwidth;
jQuery("html").html("<body></body>");
b = jQuery(document.body);
b.css("background", "white");
b.css("margin", "0mm");
b.css("padding", "0mm");
b.append(image);
b.append(title);
b.append(across);
b.append(down);
image.css("width", "auto");
image.css("margin", "auto");
image.css("display", "block");
imgwidth = 100;
image.css("width", imgwidth + "%");
image.mousedown(function(event) {
if (event.which === 1) { // left click
imgwidth -= 1;
image.css("width", imgwidth + "%");
event.preventDefault();
} else { // middle or right click
imgwidth += 1;
image.css("width", imgwidth + "%");
event.preventDefault();
}
});
}
f();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment