[pmwiki-users] Javascript and 2.2.36 (Eemeli)

Petko Yotov 5ko at 5ko.fr
Fri Apr 6 07:49:10 CDT 2012


On Friday 06 April 2012 14:21:30 KRAIT Philippe wrote:
> Petko, thanks for doing the test about Autosave and the newest version of
> pmwiki. I still think something has changed, and you are right, it's in the
> javascript, somewhere.

No, PmWiki itself doesn't rely on JavaScript. I think that you have recently 
installed some recipe that uses JavaScript. It could be a picture gallery, a 
twitter feed, a facebook like button, a google map or another javascript 
program. If you disable the other programs, you'll see that Autosave works 
fine.

Some of these may have JavaScript functions with the same name, "$", which are 
overwritten by the recipe "last included in the HTML source" and don't behave 
the expected way for the first one.

It is also possible that you have changed your skin or installed a new one 
which may lack some required markers in the template, notably

  <!--HTMLHeader--> and <!--HTMLFooter-->

> In addition with autosave, which uses it quite a
> bit, I have also noticed some trouble with other jave script add-ons,
> although less serious. 

The $() function is widely used by various programs, but not in the same way. 
So if different programs define it, only the last included one will work as 
expected. To fix this, this function could be renamed in the files autosave.js 
and util.js to something unlikely to be used by your other recipes, for 
example to "AS_id". So, in autosave.js and util.js, if you replace every "$(" 
with "AS_id(", this should fix the Autocsave recipe, possibly the others too.

Unless there are other functions with conflicting names - like sendRequest().

> And from seeing your answer to Clemens, it seems
> that there are also javascript issues there.

The other thread has completely unrelated issues.

> Any idea what might have caused the change ? I will try what you suggested
> to Clemens, setting $PageRecodeFunction = "IsEnabled"; in config.php to see
> if that helps, but any suggestion would be appreciated.

This is not related at all. The other problem is that it is not even possible 
to get to the edit form -- likely because a PHP function is reporting that it 
is enabled but doesn't return a correct output. Unrelated to your JavaScript 
name conflict.

Petko




More information about the pmwiki-users mailing list