Skip to content

Instantly share code, notes, and snippets.

@veqtrus
Last active February 2, 2018 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veqtrus/8c33fb43b8ded470c6e271be1eb92c6b to your computer and use it in GitHub Desktop.
Save veqtrus/8c33fb43b8ded470c6e271be1eb92c6b to your computer and use it in GitHub Desktop.

Inf1 OP : Lab Sheet pagination bookmarklets

Add the following to your bookmarks bar:

Inf1 OP : Prev Q javascript:(function (incr) { if (!window.location.pathname.startsWith("/teaching/courses/inf1/op/")) return; var paths = window.location.href.split("/"); var last = paths[paths.length-1].split("q"); var n = parseInt(last[1].split(".")[0]) + incr; paths[paths.length-1] = last[0] + "q" + n + ".html"; window.location.href = paths.join("/"); })(-1);

Inf1 OP : Next Q javascript:(function (incr) { if (!window.location.pathname.startsWith("/teaching/courses/inf1/op/")) return; var paths = window.location.href.split("/"); var last = paths[paths.length-1].split("q"); var n = parseInt(last[1].split(".")[0]) + incr; paths[paths.length-1] = last[0] + "q" + n + ".html"; window.location.href = paths.join("/"); })(1);

Code

(function (incr) {
  if (!window.location.pathname.startsWith("/teaching/courses/inf1/op/")) return;
  var paths = window.location.href.split("/");
  var last = paths[paths.length-1].split("q");
  var n = parseInt(last[1].split(".")[0]) + incr;
  paths[paths.length-1] = last[0] + "q" + n + ".html";
  window.location.href = paths.join("/");
})(1);

incr = -1 for previous button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment