EPrints Technical Mailing List Archive

Message: #07549


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] JavaScript & JQuery on EPrints


EPrints uses a library called prototype.js which clashes the function name "$".

https://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/


On 01/11/2018 14:38, James Kerwin via Eprints-tech wrote:
Hi all,

This isn't exclusively an EPrints problem, but it's possible some of you may have experienced similar.

I'm putting some new institutional headers on the test repository and I have a problem with the JQuery line of code (src="" href="https://emea01.safelinks.protection.outlook.com/?url="" originalsrc="http://www.liverpool.ac.uk/files/js/common-scripts/jquery/jquery-3.1.0.min.js" shash="JQyMrxnHzZUbHn8APq9tTgxpCcjZ4sJsqMG7DZ4hehNkEQ1qcWclB7L6vBWvIEDCTMv/jjsOhDlppac84iEW5Flm5sXqWyd0fuRDgA+M20G0+INjM12HBNyN8aAILz3/Fa30CRlKYE9qJYbZsAIVxi6g4k/h3nSA6i2oU5wS/7k=" originalsrc="http://www.liverpool.ac.uk/files/js/common-scripts/jquery/jquery-3.1.0.min.js" shash="kCMUHGXSo3jgDzTj4WK6RqIWA5e6f1OhUCtqP/lxzSSxiZQW/0b6pSbJiX4beolphoPrnAv8sCCJ+DtRjK3gKtcsl9BKfxkXlwcflQDrCMIuDeKdwG/xPSk5q+1Ryvg8TfLR92g8lvC1XnVr9URFJ02pqEH13nXuQZZWeJN//Qc=" moz-do-not-send="true">www.liverpool.ac.uk/files/js/common-scripts/jquery/jquery-3.1.0.min.js") and the eprints "epc:pin ref="head"" element. Both of these were in the previous layout of the ../[ARCHIVE_ID/cfg/templatesdefault.xml file.

If I put the eprints pin before the JQuery call, the eprints JS is ignored. The small drop down "+" does nothing when clicked and so some parts of EPrints can't become visible to the user. If the pin is placed after the JQuery call, the headers aren't dynamic and can't be expanded etc.

Frustratingly, if I remove all references to _javascript_ in the file except for the eprints pin and the jquery call, it still behaves in the same way. People have suggested that it may be a clash between function/variable names, but I can't see where this clash could be. If I revert to the previous file, everything works as expected (headers and dropdowns despite the exact same files being called in the same order).

Has anybody experienced anything like this?

Thanks,
James




*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: https://emea01.safelinks.protection.outlook.com/?url="">
*** EPrints community wiki: https://emea01.safelinks.protection.outlook.com/?url="">
*** EPrints developers Forum: https://emea01.safelinks.protection.outlook.com/?url="">

-- 
Christopher Gutteridge <totl@soton.ac.uk> 
You should read our team blog at http://blog.soton.ac.uk/webteam/