I had some trouble getting my site to recognize the jquery.timeago.js library. This line ultimately helped me figure it out:

If the Libraries module (2.x) is installed, Timeago will use it to manage the library.

However, I was still just guessing that it should live at sites/all/libraries/timeago/jquery.timeago.js.

I would recommend adding more explicit instructions about using the Libraries module, even just listing the directory structure pasted above. Sounds newb-ish, but will definitely avoid confusion down the line.

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

IceCreamYou’s picture

Status: Active » Postponed (maintainer needs more info)

I don't understand the problem you were having. Where were you putting the file where it didn't work, and where did you ultimately put it where it did work?

Timeago can use the Libraries module to manage the jquery.timeago.js library if it is installed. In that case, it does not specify where the JS file has to go, it just asks the Libraries module to figure out where it is and load it. Whether you have the Libraries module installed or not, you can always put the JS file in the module directory.

aboutblank’s picture

So basically I had the library in sites/all/modules/timeago/jquery.timeago.js and it wasn't loading on the page.

I moved it to sites/default/files/timeago/jquery.timeago.js (which I guessed based on other Libraries I've installed) and it did load on the page.

It could have been a cache issue or just my ignorance of Libraries, so I'll see if I can replicate it.

IceCreamYou’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.12 KB

Oh, that could be the case actually. It probably shouldn't be the case (obviously that's not the way I thought it worked) but looking at the code it looks like that's what happens. The attached patch should fix it...

Zatox’s picture

Nice patch but even if it had been applied to the version i'm using (2.2) I still would have had a little problem. I put a translation file in the module's directory as explained in the README (line 102) but since I'm using the Drupal Commons distribution, the timeago library was in the libraries folder so the module was looking for the localization file in the libraries/timeago folder as reflected by line 369 of timeago.module:

$path = $library_path . '/jquery.timeago.' . $GLOBALS['language']->language . '.js';

To avoid misguiding site builders I think the better thing to do would be to change the README line to "This translation file should be placed in the same folder as the time ago library (ie. jquery.timeago.js)"
The () part is so users don't mistake the library with the module's helper JS (timeago.js). Just in case

IceCreamYou’s picture

Issue summary: View changes
Status: Needs review » Fixed

Committed fix to dev. Thanks.

  • IceCreamYou committed 29fb422 on 7.x-2.x
    Issue #1897816 by IceCreamYou: Fix loading the library from certain...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jcnventura’s picture

This fix seems to have broken libraries support, instead of fixing it. See #2804993: looking for jquery.timeago.js in module folder.