Where in the file structure do I add a non-omeka timeline script?

Hi - I am new to Omeka - wanting to add a timeline script to a block on a page - https://codepen.io/tutsplus/pen/ZKpNwm?editors=0010

This task might be beyond my ken - I added the js code from codepen into the minimalist theme’s “/minimalist.js” file , and the css and html to the page.
I’m getting ’ test-timeline:12 Uncaught ReferenceError: jQuery is not defined
at test-timeline:12
minimalist.js?v=2.7.1:129 Uncaught ReferenceError: Hammer is not defined
at setSwipeFn (minimalist.js?v=2.7.1:129)
at init (minimalist.js?v=2.7.1:51)

I just want a simple timeline holding some info that’s not related to the omeka items…

Am wondering (browsing thru old forums) if I have to add that file to a queue so it gets read. Is there documentation that explains how and where to add javascripts to Omeka?

Update - I removed all the code I added, and notice I’m getting a console error even without it: lettershome:12 Uncaught ReferenceError: jQuery is not defined
Is it possible that JQuery is not being loaded at all?

Thanks for any help -
Jackie

It would be easiest to see what’s going on if you could provide a link to the page showing the problem.

If the error says jQuery is not defined, it would certainly seem like it’s not being loaded. Maybe you could look for other errors or messages that would indicate why.

Thank you. In frustration I removed the code and tried to do a workaround, so I have no link at this time.
Will include one on next try.

Could you explain or point to me in meantime where it’s explained how/where Jquery gets loaded into Omeka… and if there is a script that uses it, does that script belong in the theme’s js?

Themes usually handle loading javascript for the whole theme through their “common/header.php” file. jQuery is actually loaded automatically, though, so it’s quite odd that it wouldn’t be present. It’s possible, depending on the changes you tried to make, that the issue was just that you tried to load your script at the wrong time, rather than jQuery really not loading at all.

The PHP function head_js is what’s used in the header file to output the scripts. If you look at the “See Also” section on that page, you’ll see links to the other functions used in the header file and in plugins and other views for loading additional scripts through that system.

Many thanks.
I’ll digest this all and try again!

This topic was automatically closed after 250 days. New replies are no longer allowed.