fixing the toggling of active and not active modules and classes
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 11 Jun 2018 12:38:19 +0000 (08:38 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 11 Jun 2018 12:38:19 +0000 (08:38 -0400)
.nvmrc [new file with mode: 0644]
dev/app.scss
setup/renderer.js

diff --git a/.nvmrc b/.nvmrc
new file mode 100644 (file)
index 0000000..b009dfb
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+lts/*
index 521eac1..812e806 100644 (file)
@@ -1,6 +1,6 @@
 
 /* Core and Required Modules */
-//mport "core/defaults/settings";
+@import "core/defaults/settings";
 @import "core/defaults/defaults";
 @import "foundation";
 @import "core/header/header";
index 6b88bba..91cca71 100644 (file)
@@ -36,14 +36,15 @@ function readLines(mode, state){
             if (err) {
               return console.log(err);
             }
-            console.log(state);
             if(state.active){
                 var newLine = state.line.substr(2);
             }else{
                 var newLine = "//" + state.line;
             }
-            console.log(newLine)
             result = data.replace(state.line, newLine);
+            state.line = newLine;
+            localStorage.setItem(state.name, JSON.stringify(state));
+            console.log(result)
             // var result = data.replace(/string to be replaced/g, 'replacement');
         
             fs.writeFile(state.path, result, 'utf8', function (err) {
@@ -74,7 +75,8 @@ function parseModules(reader,line){
       
         moduleObjs.push({path: reader.input.path, line: line, modName: modName, active: active})
         modStorage.mods = moduleObjs;
-        localStorage.setItem("modules", JSON.stringify(modStorage))
+        // localStorage.setItem("modules", JSON.stringify(modStorage))
+        localStorage.setItem(modName, JSON.stringify({path: reader.input.path, line: line, modName: modName, active: active}))
         $('<li />', {
             class: `module-item module-active-${active}`,
             id: `${modName}`,
@@ -100,24 +102,13 @@ scanModules(true, false, false);
 
 let allModules = JSON.parse(localStorage.getItem("modules"))
 
-// allModules.mods.forEach(function(module){
-//     $('<li />', {
-//         class: `module-item module-active-${module.active}`,
-//         id: `${module.modName}`,
-//         text: `${module.modName}`
-//     }).appendTo(modList)
-// });
-
-
 // On Click Set Mod State
 $(document).on("click", ".module-item", function(){
-  
     let _ = $(this);
     let modName = _.attr("id");
-    let thisMod = allModules.mods.filter( function(mod){
-        return mod.modName === modName;
-    });
-    let state = {path: thisMod[0]. path, line: thisMod[0].line}
+    let thisMod = JSON.parse(localStorage.getItem(modName))
+
+    let state = {path: thisMod.path, line: thisMod.line, name: modName}
     
     if( _.hasClass("module-active-true") ){
         state.active = false;