From: anthony Date: Mon, 11 Jun 2018 04:22:31 +0000 (-0700) Subject: working on fixing the on click event handler X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=6ace3abed7213a07c441a8c93914de3f136fd668;p=WP-Themes%2FglmOrigin.git working on fixing the on click event handler --- diff --git a/dev/app.scss b/dev/app.scss index 812e806..521eac1 100644 --- a/dev/app.scss +++ b/dev/app.scss @@ -1,6 +1,6 @@ /* Core and Required Modules */ -@import "core/defaults/settings"; +//mport "core/defaults/settings"; @import "core/defaults/defaults"; @import "foundation"; @import "core/header/header"; diff --git a/setup/renderer.js b/setup/renderer.js index f24823a..6b88bba 100644 --- a/setup/renderer.js +++ b/setup/renderer.js @@ -7,6 +7,7 @@ const modPaths = ['dev/core/', 'dev/custom/']; var lineReader = require('readline').createInterface({ input: require('fs').createReadStream('dev/app.scss') }); + String.prototype.stripSlashes = function(){ return this.replace(/\\(.)/mg, "$1"); } @@ -26,7 +27,6 @@ let modName = ''; function readLines(mode, state){ if(mode === 'parse'){ - console.log("start parse") lineReader.on('line', function (line) { parseModules(this, line); }); @@ -36,12 +36,13 @@ function readLines(mode, state){ if (err) { return console.log(err); } - // console.log(data); + 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); // var result = data.replace(/string to be replaced/g, 'replacement'); @@ -51,7 +52,7 @@ function readLines(mode, state){ }); } } - +let modList = $("#module-list"); function parseModules(reader,line){ let active = true; if(!line.match(/[^ ]/) || line.startsWith('/*')){ @@ -67,13 +68,18 @@ function parseModules(reader,line){ modName = modName.replace(/[^\w\s\-]/gi, '') }else if(line.indexOf(" ") > -1){ modName = line.match( /"(.*?)"/ )[1]; - //modName = line.substr(line.lastIndexOf('/') + 1); } active = true; } + moduleObjs.push({path: reader.input.path, line: line, modName: modName, active: active}) modStorage.mods = moduleObjs; localStorage.setItem("modules", JSON.stringify(modStorage)) + $('
  • ', { + class: `module-item module-active-${active}`, + id: `${modName}`, + text: `${modName}` + }).appendTo(modList) } } // true is used for init parsing of theme modules, edit is to activate or de-activate modules @@ -89,25 +95,23 @@ function scanModules(parse, edit, state){ } } +scanModules(true, false, false); -console.log("HIT THE PAGE") -scanModules(true, false, false, false); -let modList = $("#module-list"); 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) -}); +// 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 -$('.module-item').on("click", function(){ - +$(document).on("click", ".module-item", function(){ + let _ = $(this); let modName = _.attr("id"); let thisMod = allModules.mods.filter( function(mod){