Canvas 6 functions.js Modification - How Do I Set Custom Path?

7 replies · opened Jun 10, 2020

CcarabsJun 10, 2020

Hello,

I really like the new functions.js functionality. I also like that you added a way to disable the AJAX loading.

But what I am looking for is a way to set a custom path. Using a js file located in the root directory of my site is not an option.

maybe I missed something? I really do not want to modify the .JS file at all to allow easier upgrades in the future.

For now, I modify your functions file with:

			let initjsPath = 'js/';
			if( typeof CUSTOMTHEMEJSPATH !== 'undefined' ) {
				initjsPath = CUSTOMTHEMEJSPATH;
			}
			let pluginFnExec = Function( 'return ' + settings.pluginfn )(),
				jsPath = initjsPath, file,
				disableAJAX = 'false';

I doubt this is optimal, but it allows me to add the proper path to the footer of my HTML and still use your ajax solution.

Since you already have us define scwDisableJsAJAX for an override, it would be nice to set multiple things without modifying the file. JS Path and Google API Key are the only 2 I have needed so far, but building out overrides for many settings would be a great addition.

I would also ask that you provide some documentation on how to leverage this file.

Keep up the great work!

SSemicolon WebSTAFFJun 10, 2020

Hello,

Thank You so much for the Kind Words! :)

There is no need to edit the Default JS Files as an Option for setting a Custom JS path is already available within the js/functions.js File. Simply consider using the following code:


window.scwJsPath = 'custom-path/js';

This will definitely work fine. We will be adding more comprehensive documentation and the related possibilities for this by tonight. Hope this Helps!

Regarding the Google Maps API Code, we will definitely try adding this in the Next Update.

Let us know if we can help you with anything else or if you find any further issues.

CcarabsJun 10, 2020

Man... scwJsPath is perfect. And I certainly missed it. As a new user to this, I am trying to find the fast answer and not really getting to know the entire script. Now that you pointed it out I feel dumb that I missed it.

Thanks!

SSemicolon WebSTAFFJun 11, 2020

Hello,

Very Happy to Help! We will be adding more Documentation related to this after today's update, so you can know more about the included features.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

CcarabsJun 11, 2020

I love the new Ajax loading of plugins once you mentioned how to specify a custom path: window.scwJsPath

But I can not find a way to include the plugins.bootstrap.js file after removing "link[href="css/bootstrap.css"]" from my HTML. For now, I had to include it into my minified JS file built by gulp. But for other folks that have changed their paths, including to the CSS, they may still need an automatic solution for the BS file.

Thanks again.

SSemicolon WebSTAFFJun 11, 2020

Hello,

There is a Minor Bug with the Codes in the js/functions.js File with loading the Bootstrap JS. Please find the following code:


default: 'link[href="css/bootstrap.css"]',

and replace it with:


default: 'body',

This will definitely fix the issue. We will be including this fix in an Update shortly. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

CcarabsJun 12, 2020

Thank you again for your reply.

Personally, I want to include things within my minified JS that will always be loaded and allow your function script to pick up the lesser-used files. So right now I include your function script, my custom JS, and what you have in Default (easing/bootstrap). Everything else being dynamic is amazing. If you could build in more than what you have now (everything on or everything off) many users would appreciate it.

SSemicolon WebSTAFFJun 13, 2020

Hello,

Thank You so much for the Kind Words! :)

We had developed the New JS Functions for Users to accommodate their own codes without worrying about bloating the Page. Glad you like it.

If you could build in more than what you have now (everything on or everything off) many users would appreciate it.

Would be so kind to elaborate further on this so that we can understand what you are exactly looking for. Then we can try introducing this in the Future Updates. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard