[pmwiki-users] Javascript and 2.2.36 (Eemeli)

Eemeli Aro eemeli at gmail.com
Tue Apr 10 03:07:21 CDT 2012


Original author here. Just noticed this thread, but I've little to add
to what Petko said; renaming $() and/or other included functions is
the only AutoSave-specific thing I can think of suggesting. In
hindsight, I should've picked a different name for it, but back in
2009 jQuery wasn't as dominant as it is now, and from what I saw few
PmWiki sites used JavaScript libraries so namespace conflicts didn't
seem that important, hence the semantic context for "$()" was
different than it would be today.

Unfortunately, I've not used AutoSave myself for a while, and I've had
little time recently to work on PmWiki code. As a complete aside, if I
did have the time I'd probably work on re-implementing the PmWiki
PageStore and page history-related actions to use git.

Also, AttachTable does in fact still use the same util.js and may
cause the same issues as mentioned here; it's included from line 469
of attachtable.php.

eemeli

On 6 April 2012 15:49, Petko Yotov <5ko at 5ko.fr> wrote:
> 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
>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users



More information about the pmwiki-users mailing list