Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

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
You can’t perform that action at this time.