Jelajahi Sumber

Fix for 'skript.js'

It was found in the process of david pulling the code out for configuration via the UI, he removed some code that was still and is still required, specifically 'convert_card' which passes the map of the card to JS being run within the DOM.

This has been confirmed to work correctly.
David Thielemann 7 bulan lalu
induk
melakukan
520f5e4f37
1 mengubah file dengan 14 tambahan dan 2 penghapusan
  1. 14 2
      skript.js

+ 14 - 2
skript.js

@@ -1,5 +1,5 @@
 // ==UserScript==
-// @name     Key Card
+// @name     Key card
 // @description Innovative and easy password generation
 // @version  1.0
 // @grant    none
@@ -9,7 +9,6 @@
 let card = {".": "", "a": "b", "b": "a", "c": "d", "d": "c", "e": "f", "f": "e", "g": "h", "h": "g", "i": "j", "j": "i", "l": "m", "m": "l", "n": "o", "o": "n", "p": "q", "q": "p", "r": "s", "s": "r", "t": "u", "u": "t", "v": "y", "y": "v", "x": "z", "z": "x", "0": "1", "1": "0", "2": "3", "3": "2", "4": "5", "5": "4", "6": "7", "7": "6", "8": "9", "9": "8"};
 let spacebar = "test";
 
-// Rest of the User script
 addCSS = (css) => {
   var head, obj;
   head = document.getElementsByTagName('head')[0];
@@ -36,6 +35,19 @@ addJS = (js) => {
 let domain = document.domain;
 //console.log("Hello " + domain + ", I'm Key card.");
 
+const convert_card = () => {
+  let out = "[";
+  for (let k in card) {
+    let v = card[k];
+    if (out != "[") {
+      out += ",";
+    }
+    out += "[\"" + k + "\",\"" + v + "\"]";
+  }
+  out += "]";
+  return out;
+}
+
 addCSS(`
 .keycardmenu{
   position:absolute;