Browse files

smbc-mode: new page mode for smbc-comics.com

Provides "next" and "previous" relationship support.

Loaded by default.
  • Loading branch information...
1 parent 0de1ee8 commit 466e06474736043e9b8a03e352e7d5edc437cfdf @retroj committed Feb 15, 2012
Showing with 23 additions and 0 deletions.
  1. +1 −0 defaults/preferences/default-modules.js
  2. +22 −0 modules/page-modes/smbc.js
View
1 defaults/preferences/default-modules.js
@@ -48,6 +48,7 @@ pref("conkeror.load.page-modes/google-calendar", 1);
pref("conkeror.load.page-modes/google-maps", 1);
pref("conkeror.load.page-modes/google-reader", 1);
pref("conkeror.load.page-modes/google-video", 1);
+pref("conkeror.load.page-modes/smbc", 1);
pref("conkeror.load.page-modes/stackexchange", 1);
pref("conkeror.load.page-modes/xkcd", 1);
pref("conkeror.load.page-modes/youtube", 1);
View
22 modules/page-modes/smbc.js
@@ -0,0 +1,22 @@
+/**
+ * (C) Copyright 2012 John J. Foerch
+ *
+ * Use, modification, and distribution are subject to the terms specified in the
+ * COPYING file.
+**/
+
+define_page_mode("smbc-mode",
+ build_url_regexp($domain = "www.smbc-comics"),
+ function enable (buffer) {
+ buffer.page.local.browser_relationship_patterns = {};
+ buffer.page.local.browser_relationship_patterns[RELATIONSHIP_NEXT] =
+ [function (doc) xpath_find_node(doc, "//map[@name='buttons']/area[4]")];
+ buffer.page.local.browser_relationship_patterns[RELATIONSHIP_PREVIOUS] =
+ [function (doc) xpath_find_node(doc, "//map[@name='buttons']/area[2]")];
+ },
+ function disable (buffer) {},
+ $display_name = "SMBC");
+
+page_mode_activate(smbc_mode);
+
+provide("smbc");

0 comments on commit 466e064

Please sign in to comment.