Download presentation
Presentation is loading. Please wait.
Published byIlene Tate Modified over 8 years ago
2
A Javascript library designed to simplify client-side scripting of HTML
3
Javascript is a programming language commonly used to run scripts on web browsers. Examples of stuff that Javascript does: Animation of webpage elements, such as drop-down menus that expand or fade in and out, objects that move when you click on them, etc. Interactive content, for example games, and playing audio and video Not to be confused with Java, which is another programming language that works differently (which isn’t confusing at all!)
4
A Javascript library designed to simplify client-side scripting of HTML A javascript library is a collection of pre-written Javascript functions, or ‘tools’ that take the grunt work out of writing Javascript and extends its compatibility and features. My half-baked analogy: Using jQuery (javascript library) is kind of like using a cake mix to make a cake, instead of making it from scratch
5
A Javascript library designed to simplify client-side scripting of HTML This means the script is doing stuff in your user’s web browser (front-end), as opposed to server-side, which is where the script is doing stuff with data in your web server (back-end). (we will be working with both today!)
6
A Javascript library designed to simplify client-side scripting of HTML Using ‘scripts’ of code (like sets of instructions) written in a programming language that get interpreted and executed by another program (such as your web browser) to make something happen
7
A Javascript library designed to simplify client-side scripting of HTML (I hope you’ve heard of this before) It is the language used to create web pages Stands for HyperText Markup Language Written as a series of elements that are enclosed in tags example: This is my header Ultimately, everything that appears on your web page is made from just HTML. Other languages like Javascript, CSS and PHP just create or transform the HTML.
8
A Javascript library designed to simplify client-side scripting of HTML In other words…. A collection of functions written in the Javascript language that make it easy to write scripts that tell the user’s web browser how to transform your website’s HTML Or in other words…. You can use this library to easily create awesome interactive stuff for your website!
9
jQuery is free and open source It’s currently the most popular Javascript library in use on the web Because of this, lots of people have already created lots of cool stuff And lots of it’s available to use off the shelf, complete with instructions on how to ‘plug it in’ on your website, some of it for free!
10
Image galleries and sliders
11
Image zoom/magnifier tools
12
Pop-up notes
13
Interactive timelines
14
Graph and chart generators
15
jqueryrain.com is a great resource for finding free or low-cost jQuery plugins jqueryrain.com
16
Wouldn’t it be awesome to use this stuff on your Digital Humanities Omeka site? Is such a thing even possible?
17
Omeka is a little different from a simple website, and in order to make these jQuery plugins work with your content in Omeka, we will have to some things a bit differently…
18
The back-end of a very simple webpage can consist of just a few lines of HTML code and a few data files (such as images) located on a web server. All the data files can be linked to directly in the HTML files. This means the HTML code to display this content never has to change. The code and content are both ‘static’ For example, if you only have one logo image, and only need to display in one spot, this is the HTML code you would use: But your Omeka site has lots of content to show in lots of different places, and this content is getting changed and added to pretty often. It would be impossible for HTML code written like this to keep up! Your HTML code needs to be created or altered automatically as things change. This means it’s ‘dynamic’
19
Omeka is more than just a website to share your digital collection (client-side). Because it has to manage all this changing content, it also creates and runs a database of all your data and associated metadata (server-side) This makes Omeka a Content Management System. A CMS is a computer application that allows you to organize, edit, maintain and publish content from a central interface. The programming language used to run Omeka on the server-side is called PHP. Instead of using HTML files, Omeka uses PHP scripts to pull in the content from the database and build HTML code on request
21
You will need to be able to access and edit your omeka theme files on your website’s server (without this, you can’t do anything!) You also need to be able to ‘look under the hood’ to see what HTML is being generated and what your browser is doing using the ‘Inspect Element’ feature. To do this, go to your site in a web browser, right click on the page and choose ‘inspect element’ from the drop-down menu. And of course, we need to find a jQuery plugin we like and download the files (usually these will consist of some javascript files, a CSS file for styling, and possibly some icons)
22
Before you start making any changes to your theme, it’s a very good idea to save a copy of the entire thing and back it up somewhere, even offline. If you have the means: You might also want to track the changes you make to your files using a Git repository. If you have access to a development server, it’s a good idea to mirror your Omeka site there and test the theme changes on that site before going ‘live’
23
The instructions for the plugin should tell you what version of jQuery it needs. Usually any later version will work fine. Omeka version 2.0 automatically links to at least jQuery version 1.9.1, Version 2.1 links to jQuery 1.10.1 So you don’t need to add the link to jQuery You can check which version of jQuery your Omeka site is running by opening up ‘Inspect Element’ on your browser, and looking in the of the html for the page.
24
Omeka files are organized in folders in the following way on your server: Omeka › www data admin application files install plugins themes
25
You need to add the plugin files into the appropriate places in your Omeka theme Omeka theme files are organized in the following way: › Your Theme common css images items Javascripts Move your jQuery plugin files into the appropriate folders in your theme. CSS file(s) needs to go in the CSS folder, Javascript file(s) needs to go in the javascripts folder, any image icons need to go in the images folder
26
Now you need to ‘tell’ your theme that these new files are there, and that it needs to get them loaded up for web browsers to use. You do this by editing header.php in the ‘common’ folder. Open header.php and find the stylesheets and javascripts sections, which should look something like this:
27
Add your CSS file(s) queue_css_file('pluginstyle'); Immediately above echo head_css(); Add your js file(s) queue_js_file('plugin'); Immediately above echo head_js();
28
Next, we need to add the jQuery function for your plugin to the footer.php file. This script actually tells the plugin to run, and has to be read by your browser after all of the other necessary files. The best way to do this is in Omeka is to save this in its own javascript file and link to it in footer.php Open a new file in notepad or any basic text editor program. Copy/paste the function provided by the jQuery plugin’s instructions. Follow the plugin’s instructions to edit this script with the various plugin options provided. Save the file something like ‘pluginscript.js’ and then copy this file into your theme’s javascripts folder.
29
Both Omeka code and jQuery use the symbol $ to do different things, and this can cause your plugin to not work. To get around this, simply change all the $ in your plugin script to ‘jQuery’ Example: $('.zoom-file').click(function(){ $('.zoomContainer').remove(); }); Becomes: jQuery('.zoom-file').click(function(){ jQuery('.zoomContainer').remove(); });
30
Now open footer.php Between the and add: <script type="text/javascript“ src="https://youromeka.com/themes/ yourtheme/javascripts/pluginscript.js">
31
Now that you’ve added the plugin files to your theme and set them up to load, you’ve got to install the HTML markup for the plugin where you want it to appear in your site. This could be on your home page (index.php) a custom page you’ve added with the SimplePages Omeka plugin, or on your items show page (items/show.php) Open the appropriate file, and find the section of the file that corresponds to the area of the page where you want your plugin to be. Use the ‘inspect element’ tool on your browser and compare with the php file for that page to find the spot.
32
Follow the jQuery plugin instructions for how the HTML markup needs to be arranged
33
Example: " alt=" " data-description=" " />
34
This depends on what Omeka content you want to pull in, and how it needs to be linked in your plugin. You can pull in files and information from any of Omeka’s metadata fields using these Omeka PHP functions. omeka.readthedocs.org is the place to find out how to write these functions omeka.readthedocs.org
35
If you need to add image URLs: If you need to add the text from a particular metadata field:
36
If you need your plugin to repeat this process for multiple records (like multiple files in an image slider), you need to surround this markup with a ‘foreach’ statement and ‘loop’ through all the records you want to get
37
Let’s take a look at the same plugin markup with the PHP added in:
38
After you’ve completed these steps, you need to make sure all your changed files are saved, refresh your webpage and test it out. Chances are it will not be displaying right, or working at all. You’ve got a lot of troubleshooting ahead!
39
Did you type everything correctly? › Check your files and make sure all the brackets and statements are ‘closed.’ If something is really wrong, the webpage will show an error and tell you the line number of your file
40
jQuery Conflicts › There might be more conflicts with $ in your js files. Try changing the $ for ‘jQuery’ in your other plugin files › Check the ‘Script’ section of your inspect element tool to see if your scripts are loading properly
41
Fix your CSS › You might have to add some style such as dimensions and positioning of the plugin’s HTML containers. Use ‘Inspect Element’ to find out where things are going wrong › Example : .rg-image{ position: relative; text-align:center; }}
42
codeacademy.com codeacademy.com omeka.org/forums omeka.org/forums stackoverflow.com stackoverflow.com Desperate Googling Contact me! (aserra@vt.edu)
43
Contact me: › Adrienne Serra › Technical Archivist › Special Collections, Virginia Tech › aserra@vt.edu aserra@vt.edu › Our Omeka site: › Virginia Tech Special Collections Online Virginia Tech Special Collections Online
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.