• Hi, since Loco Translate v2 I really cannot use this plugin properly anymore…

    When I activate v2 I get javascript errors when I try to save the work done or sync. The error says
    prototype.js?ver=1.7.1:845 Uncaught TypeError: this._each is not a function

    Then if I switch back to v1.x version I get different errors, for instance I cannot search/filter the translation/translated phrases. Luckily I can save mo and po files in this version. I waited to see improvements over new versions but I seem to be stuck on this. I had to move my translation work on external Poedit software and perform ftp uploads manually. Not a bad thing since I discovered the latest Poedit software notifies on translation problems (for instance the count of missing %s and other variables present in original strings). This would be nice to have on Loco plugin as well.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Tim W

    (@timwhitlock)

    My plugin does not use prototype.js so I don’t know how this error could be coming from my JavaScript. If you know differently, please elaborate.

    Regarding additional editor features such as formatting tokens. These are planned for future development. Thanks for confirming the need for them.

    Thread Starter Richard Vencu

    (@rvencu)

    Hm. This is the chain

    prototype.js?ver=1.7.1:845 Uncaught TypeError: this._each is not a function
    each @ prototype.js?ver=1.7.1:845
    m.register.d.clear @ admin.js?ver=2.0.6:88
    k @ admin.js?ver=2.0.6:90
    m.register.d.post @ admin.js?ver=2.0.6:92
    doSyncAction @ editor.js?ver=2.0.6:77
    (anonymous function) @ editor.js?ver=2.0.6:204
    dispatch @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils&ver=9ff1ced…:3
    r.handle @ load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils&ver=9ff1ced…:3

    So prototype.js is called from admin.js that is part of your plugin. I do not know why it does this call.

    • This reply was modified 9 years, 8 months ago by Richard Vencu. Reason: cleaner code
    Plugin Author Tim W

    (@timwhitlock)

    It can’t be called directly. My Js only calls jQuery directly.

    I notice that the current version of WordPress doesn’t include a file called prototype.js, so my guess is that this file is included by some other plugin and is messing things up. something with a version number of 1.7.1 by the looks of it. Can you see what plugin this is? or perhaps your theme?

    Thread Starter Richard Vencu

    (@rvencu)

    Plugin Author Tim W

    (@timwhitlock)

    Ok, I can see that WordPress will add this script from the remote source, but for whatever reason my admin pages don’t include it. What version of WordPress are you running?

    The apparently offending line 88 of admin.js includes a standard for loop. I am clueless as to how this ends up calling the each function in prototype.js

    Although the admin.js code is compressed I could debug it, but I’ll need to reproduce the error and currently I cannot. We need to establish why your admin pages are loading Prototype and mine are not.

    Plugin Author Tim W

    (@timwhitlock)

    Ah. I can reproduce it by forcing WordPress to include prototype.js.

    Looking into a fix for this conflict…

    Thread Starter Richard Vencu

    (@rvencu)

    I downloaded the entire plugins folder and themes folder in order to fileseek “prototype.js” against all plugin files. No result. Perhaps your finding is correct.

    In my multisite installation (I run some common and some different plugins on each site) the issue appears only on one site. So it could be something related to the theme.

    Thread Starter Richard Vencu

    (@rvencu)

    I use WordPress 4.6.1 – it is specified on the left sidebar of this thread since it is a required info to start a support topic

    Plugin Author Tim W

    (@timwhitlock)

    • This reply was modified 9 years, 8 months ago by Tim W. Reason: accidentally posted twice
    Plugin Author Tim W

    (@timwhitlock)

    Fixed it.

    The issue was that prototype.js (included as a dependency of something else you’re running) alters the Array prototype by adding methods to it. These show up during for..in iteration, hence breaking my code.

    I’ve change the iteration to use the numerical form, which fixed the conflict.
    This is in the current development version 2.0.7-dev https://localise.biz/wordpress/plugin/developers

    Thread Starter Richard Vencu

    (@rvencu)

    Great

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Lots of Javascript errors’ is closed to new replies.