Commits

Ed Brannin  committed 6a9719b

Renamed ebzkeys.js to ebz-keys.js

  • Participants
  • Parent commits b8e86c8

Comments (0)

Files changed (3)

+function getActionFunction(jQuery, idx) {
+  return function() {
+    console.log("Invoking storylet at index: ", idx);
+    var button = jQuery('.storylet').eq(0+idx).find('input[value="GO"]');
+
+    if (button.length > 0) {
+      button.click();
+      return false;
+    } else {
+      console.log("Can't find a button for action #%d", idx);
+      return true;
+    }
+
+  }
+}
+
+function bindButtonByName(jQuery, key, name) {
+  bindClickBySelector(jQuery, key, 'input[value="' + name + '"]')
+}
+
+function bindClickBySelector(jQuery, key, selector) {
+  console.log("Binding: '%s' ->", key, name);
+  jQuery(document).bind("keyup", key, function() {
+    var button = jQuery(selector)
+    if (button.length > 0) {
+      button.click();
+      return false;
+    } else {
+      console.log("Can't find a button called '%s'", name);
+      return true;
+    }
+  });
+}
+
+function setup_ebz_keys(jQuery) {
+  for (var idx = 0; idx < 10; idx += 1) {
+    var key = String( (idx+1) % 10 )
+    console.log("Binding: '%s' -> action #%d", key, idx);
+    jQuery(document).bind("keyup", key, getActionFunction(jQuery, idx));
+  }
+
+  bindButtonByName(jQuery, "a", "TRY THIS AGAIN");
+  bindButtonByName(jQuery, "s", "ONWARDS!");
+  bindButtonByName(jQuery, "q", "Perhaps not");
+  bindClickBySelector(jQuery, "d", "li#card_deck a");
+  bindClickBySelector(jQuery, "c", "li#card_deck a");
+
+  console.log("Pretending to Disable key-bindings when using an input or textarea");
+}
+
+jQuery(setup_ebz_keys);
+

File ebzkeys.js

-function getActionFunction(jQuery, idx) {
-  return function() {
-    console.log("Invoking storylet at index: ", idx);
-    var button = jQuery('.storylet').eq(0+idx).find('input[value="GO"]');
-
-    if (button.length > 0) {
-      button.click();
-      return false;
-    } else {
-      console.log("Can't find a button for action #%d", idx);
-      return true;
-    }
-
-  }
-}
-
-function bindButtonByName(jQuery, key, name) {
-  bindClickBySelector(jQuery, key, 'input[value="' + name + '"]')
-}
-
-function bindClickBySelector(jQuery, key, selector) {
-  console.log("Binding: '%s' ->", key, name);
-  jQuery(document).bind("keyup", key, function() {
-    var button = jQuery(selector)
-    if (button.length > 0) {
-      button.click();
-      return false;
-    } else {
-      console.log("Can't find a button called '%s'", name);
-      return true;
-    }
-  });
-}
-
-function setup_ebz_keys(jQuery) {
-  for (var idx = 0; idx < 10; idx += 1) {
-    var key = String( (idx+1) % 10 )
-    console.log("Binding: '%s' -> action #%d", key, idx);
-    jQuery(document).bind("keyup", key, getActionFunction(jQuery, idx));
-  }
-
-  bindButtonByName(jQuery, "a", "TRY THIS AGAIN");
-  bindButtonByName(jQuery, "s", "ONWARDS!");
-  bindButtonByName(jQuery, "q", "Perhaps not");
-  bindClickBySelector(jQuery, "d", "li#card_deck a");
-  bindClickBySelector(jQuery, "c", "li#card_deck a");
-
-  console.log("Pretending to Disable key-bindings when using an input or textarea");
-}
-
-jQuery(setup_ebz_keys);
-

File manifest.json

     {
       "matches": ["*://echobazaar.failbettergames.com/*"],
       "run_at": "document_end",
-      "js": ["jquery-1.4.2.js", "jquery.hotkeys.js", "ebzkeys.js"]
+      "js": ["jquery-1.4.2.js", "jquery.hotkeys.js", "ebz-keys.js"]
     }
   ],