From b8ca76981484cc691dde30c3905d1f7ae0e8678b Mon Sep 17 00:00:00 2001 From: anthony Date: Mon, 11 Jun 2018 22:05:45 -0400 Subject: [PATCH] setting up functions file reader for lib modules --- dev/app.scss | 8 +-- .../defaults/functions/defaults.php} | 0 .../defaults/{ => functions}/menu-walker.php | 0 .../defaults/{ => functions}/navigation.php | 0 dev/core/footer/functions/footer.php | 0 dev/core/front-page/functions/front-page.php | 0 .../interior-page/functions/interior-page.php | 0 .../functions/off-canvas-overlay.php | 0 dev/core/off-canvas/functions/off_canvas.php | 0 dev/core/topbar/functions/topbar.php | 0 .../{action-items.js => action-items.js.off} | 0 .../action-items/functions/action-items.php | 0 .../glm-blocks/functions/glm-blocks.php | 0 dev/custom/glma/functions/glma.php | 0 dev/custom/nextgen/functions/nextgen.php | 0 dev/custom/sidebar/functions/sidebar.php | 0 dev/custom/slideshow/functions/slideshow.php | 0 dev/custom/slideshow/slideshow.js.off | 0 dev/modules.php | 17 ++++- functions.php | 4 +- setup/renderer.js | 71 +++++++++---------- 21 files changed, 57 insertions(+), 43 deletions(-) rename dev/{custom/slideshow/slideshow.js => core/defaults/functions/defaults.php} (100%) rename dev/core/defaults/{ => functions}/menu-walker.php (100%) rename dev/core/defaults/{ => functions}/navigation.php (100%) create mode 100644 dev/core/footer/functions/footer.php create mode 100644 dev/core/front-page/functions/front-page.php create mode 100644 dev/core/interior-page/functions/interior-page.php create mode 100644 dev/core/off-canvas-overlay/functions/off-canvas-overlay.php create mode 100644 dev/core/off-canvas/functions/off_canvas.php create mode 100644 dev/core/topbar/functions/topbar.php rename dev/custom/action-items/{action-items.js => action-items.js.off} (100%) create mode 100644 dev/custom/action-items/functions/action-items.php create mode 100644 dev/custom/glm-blocks/functions/glm-blocks.php create mode 100644 dev/custom/glma/functions/glma.php create mode 100644 dev/custom/nextgen/functions/nextgen.php create mode 100644 dev/custom/sidebar/functions/sidebar.php create mode 100644 dev/custom/slideshow/functions/slideshow.php create mode 100644 dev/custom/slideshow/slideshow.js.off diff --git a/dev/app.scss b/dev/app.scss index 812e806..7202ec1 100644 --- a/dev/app.scss +++ b/dev/app.scss @@ -14,13 +14,13 @@ /*Custom Modules */ @import "custom/sidebar/sidebar"; -@import "custom/slideshow/slideshow"; +//@import "custom/slideshow/slideshow"; @import "custom/gravity-forms/gravity-forms"; @import "custom/weather/weather"; @import "custom/nextgen/nextgen"; @import "custom/glma/glm-member-db"; -@import "custom/glma/glm-member-db-events"; -@import "custom/blocks/blocks"; +//@import "custom/glma/glm-member-db-events"; +//@import "custom/blocks/blocks"; @import "custom/action-items/action-items"; @import "custom/svg-map/svg-map"; -@import "custom/woocommerce/woocommerce"; \ No newline at end of file +@import "custom/woocommerce/woocommerce";";";";"; \ No newline at end of file diff --git a/dev/custom/slideshow/slideshow.js b/dev/core/defaults/functions/defaults.php similarity index 100% rename from dev/custom/slideshow/slideshow.js rename to dev/core/defaults/functions/defaults.php diff --git a/dev/core/defaults/menu-walker.php b/dev/core/defaults/functions/menu-walker.php similarity index 100% rename from dev/core/defaults/menu-walker.php rename to dev/core/defaults/functions/menu-walker.php diff --git a/dev/core/defaults/navigation.php b/dev/core/defaults/functions/navigation.php similarity index 100% rename from dev/core/defaults/navigation.php rename to dev/core/defaults/functions/navigation.php diff --git a/dev/core/footer/functions/footer.php b/dev/core/footer/functions/footer.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/core/front-page/functions/front-page.php b/dev/core/front-page/functions/front-page.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/core/interior-page/functions/interior-page.php b/dev/core/interior-page/functions/interior-page.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/core/off-canvas-overlay/functions/off-canvas-overlay.php b/dev/core/off-canvas-overlay/functions/off-canvas-overlay.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/core/off-canvas/functions/off_canvas.php b/dev/core/off-canvas/functions/off_canvas.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/core/topbar/functions/topbar.php b/dev/core/topbar/functions/topbar.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/custom/action-items/action-items.js b/dev/custom/action-items/action-items.js.off similarity index 100% rename from dev/custom/action-items/action-items.js rename to dev/custom/action-items/action-items.js.off diff --git a/dev/custom/action-items/functions/action-items.php b/dev/custom/action-items/functions/action-items.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/custom/glm-blocks/functions/glm-blocks.php b/dev/custom/glm-blocks/functions/glm-blocks.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/custom/glma/functions/glma.php b/dev/custom/glma/functions/glma.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/custom/nextgen/functions/nextgen.php b/dev/custom/nextgen/functions/nextgen.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/custom/sidebar/functions/sidebar.php b/dev/custom/sidebar/functions/sidebar.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/custom/slideshow/functions/slideshow.php b/dev/custom/slideshow/functions/slideshow.php new file mode 100644 index 0000000..e69de29 diff --git a/dev/custom/slideshow/slideshow.js.off b/dev/custom/slideshow/slideshow.js.off new file mode 100644 index 0000000..e69de29 diff --git a/dev/modules.php b/dev/modules.php index cb5888c..30796e0 100644 --- a/dev/modules.php +++ b/dev/modules.php @@ -1,7 +1,22 @@ ', { - class: `module-item module-active-${active}`, - id: `${modName}`, - text: `${modName}` - }).appendTo(modList) - } + localStorage.setItem(modName, JSON.stringify({path: reader.input.path, line: line, modName: modName, active: active})) + $('
  • ', { + 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 @@ -115,7 +90,6 @@ function parseModules(reader,line){ // last param is the path to the file to be editted since we can't use the readLine Stream again (idk how yet) function scanModules(parse, edit, state){ if(parse) { - console.log("init parse") readLines("parse"); }else if(edit){ readLines("edit", state) @@ -126,6 +100,12 @@ scanModules(true, false, false); let allModules = JSON.parse(localStorage.getItem("modules")) +// activate or deactivate the JS files for each module +const modPaths = ['dev/core/', 'dev/custom/']; + +functionsFileReader.on('line', function (line) { + parsePhpLibs(this, line) +}); // On Click Set Mod State $(document).on("click", ".module-item", function(){ @@ -133,6 +113,7 @@ $(document).on("click", ".module-item", function(){ let modName = _.attr("id"); let thisMod = JSON.parse(localStorage.getItem(modName)) + let moduleLocation = `dev/${thisMod.line.split("import ").pop().replace(/[;'"]+/g, '')}`; let state = {path: thisMod.path, line: thisMod.line, name: modName} if( _.hasClass("module-active-true") ){ @@ -146,4 +127,22 @@ $(document).on("click", ".module-item", function(){ } scanModules(false, true , state) + + // Activate or De-Activate JS Files + let jsFile = path.join(__dirname, `../${moduleLocation}.js`); + let newJsFile = jsFile+'.off'; + fs.exists(jsFile, function(exists) { + if(exists){ + fs.rename(jsFile, newJsFile, function(err){ + if (err) throw err; + }); + } + }); + fs.exists(newJsFile, function(exists) { + if(exists){ + fs.rename(newJsFile, jsFile, function(err){ + if (err) throw err; + }); + } + }); }) \ No newline at end of file -- 2.17.1