]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
bip44TabSelected and bip32TabSelected functions
authorIan Coleman <coleman.ian@gmail.com>
Sun, 11 Dec 2016 23:51:37 +0000 (10:51 +1100)
committerIan Coleman <coleman.ian@gmail.com>
Sun, 11 Dec 2016 23:51:37 +0000 (10:51 +1100)
This is more descriptive than a blob of jquery, and simplifies reuse in
the near future.

src/js/index.js

index 1e66dd852006ba3eef41110f37114d87399387e3..6367c0197fc985bc17d96a8ae15e9387effb89c8 100644 (file)
     }
 
     function getDerivationPath() {
-        if (DOM.bip44tab.hasClass("active")) {
+        if (bip44TabSelected()) {
             var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44);
             var coin = parseIntNoNaN(DOM.bip44coin.val(), 0);
             var account = parseIntNoNaN(DOM.bip44account.val(), 0);
             console.log("Using derivation path from BIP44 tab: " + derivationPath);
             return derivationPath;
         }
-        else if (DOM.bip32tab.hasClass("active")) {
+        else if (bip32TabSelected()) {
             var derivationPath = DOM.bip32path.val();
             console.log("Using derivation path from BIP32 tab: " + derivationPath);
             return derivationPath;
         DOM.qrHint.toggleClass("hidden");
     }
 
+    function bip44TabSelected() {
+        return DOM.bip44tab.hasClass("active");
+    }
+
+    function bip32TabSelected() {
+        return DOM.bip32tab.hasClass("active");
+    }
+
     var networks = [
         {
             name: "Bitcoin",