From: Anthony Talarico Date: Mon, 11 Jun 2018 12:38:19 +0000 (-0400) Subject: fixing the toggling of active and not active modules and classes X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a0e59a5b6c3c6e96a3cdb3435cab8d7f6e33f322;p=WP-Themes%2FglmOrigin.git fixing the toggling of active and not active modules and classes --- diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..b009dfb --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +lts/* diff --git a/dev/app.scss b/dev/app.scss index 521eac1..812e806 100644 --- a/dev/app.scss +++ b/dev/app.scss @@ -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"; diff --git a/setup/renderer.js b/setup/renderer.js index 6b88bba..91cca71 100644 --- a/setup/renderer.js +++ b/setup/renderer.js @@ -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})) $('
  • ', { 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){ -// $('
  • ', { -// 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;