Forum Support

Shape 5
March 28, 2024, 03:32:24 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Shape 5 Forum
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] overriding a Mootools function (periodical())  (Read 711 times)
brandokx70
Jr. Member
**
Offline Offline

Posts: 22



« on: July 25, 2016, 03:36:28 PM »

Image and Content Fader v3
Hello, I have been told by another forum that this module overriding a Mootools function (periodical()).  

This is stopping a form module of mine with Mootools to not process properly.  Can the code be modified to not override that function prototype, or call the original when they've finished doing whatever it is it needs to do?

Thanks in advance.
J3.6

P.S. I just realized my extension wasn't up to date so I updated to v4.  Still having the same problem. Is there a setting or a way to change this?
https://www.ridersurance.com/
Image and content fader module is at the top, and the other module that isn't processing is at the bottom "Pick A Plan"
« Last Edit: July 27, 2016, 12:55:28 PM by brandokx70 » Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #1 on: July 26, 2016, 06:29:38 AM »

Hello,

This module does not use mootools, it is jquery only. Other Joomla modules really shouldn't be using Mootools anymore either, the switch to Jquery has been in effect for over three years at this point.

periodical is not a function that we declare, that is a default function of the javascript library itself, so it's not something we can change. I also checked your site and didn't see any javascript errors on the page.
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
brandokx70
Jr. Member
**
Offline Offline

Posts: 22



« Reply #2 on: July 26, 2016, 07:31:19 AM »

Thanks, I am assuming v3 was mootools and v4 switched to jquery.

Thanks for the response.
Logged
brandokx70
Jr. Member
**
Offline Offline

Posts: 22



« Reply #3 on: July 26, 2016, 11:30:07 AM »

Hi Mike, thanks again for your help I have a little more info.

What about this line of code?

Function.prototype.periodical=function (c,b,a){return setInterval(this.passx((a==null?[]:a),b),c);};

... in jd.gallery.jquery.js, overrides the Mootools periodical() function.

When any other Mootools code calls periodical(), it is calling your function, instead of Mootools'.

Is it possible to use some other function name, perhaps jdPeriodical.

Thanks again in advance.

« Last Edit: July 26, 2016, 12:53:42 PM by brandokx70 » Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #4 on: July 26, 2016, 01:34:19 PM »

Hello,

We can try doing a find a replace for periodical to something else in the js file, but we are not going to re-write our script because another script is using the same name. You would have to replace all calls of periodical with a new function, it's not tested though, so no guarantees that it will work.
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
brandokx70
Jr. Member
**
Offline Offline

Posts: 22



« Reply #5 on: July 26, 2016, 02:30:23 PM »

I am a little confused. It's not "another script", it part of the Mootools framework:

http://mootools.net/core/docs/1.5.2/Types/Function#Function:periodical

Mootools may have fallen out of favor and is being deprecated in J! in favor of jQuery, but it is still a major JS framework library, and is still shipped with J!.

Overriding global function prototypes is NOT something which should be done lightly, and DEFINITELY should not tread on things like jQuery or Mootools.

I have a coder that states:
"There's absolutely no reason they need to do that, they could do it in native jquery, or put those functions in a "closure" so they don't pollute the global Javascript name space."

Can you pass this along to Shape5's coder?  If not I will just have to find another image and content type of module....

Thanks in advance.
Logged
mikek
Administrator
*****
Offline Offline

Posts: 28743



WWW
« Reply #6 on: July 27, 2016, 05:31:05 AM »

Hello,

It appears those calls are remnants of when the module was converted from mootools too jquery. I have commented out each line that calls periodicial and tested the script and it is working fine without them. We now are not calling this anywhere in our script. You can download the latest version of the module or use the attached js file.


"Mootools may have fallen out of favor and is being deprecated in J! in favor of jQuery, but it is still a major JS framework library, and is still shipped with J!."

-----I am only stating that as a precaution. Joomla has made it very clear that it will be deprecated from their CMS soon. If the developer hasn't updated by now you may very well be stuck with a script that no longer works soon.
Logged

Mike Knott
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
brandokx70
Jr. Member
**
Offline Offline

Posts: 22



« Reply #7 on: July 27, 2016, 12:54:43 PM »

Thank you for the fix. Works now.

Cheers!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Looking for the largest variety in template designs? Look no more. Never buy 1 theme again. Signups start at just $89 for access to all of our themes.
Send Us An Email
Please send us your questions and we will email you back as soon as we can. Product support questions should be posted in our support forums under the Help menu. Our staff will assist you from there.