From 235c2a1c8a9e3526c5e8de24c5a0ac5674390003 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Wed, 22 Feb 2012 09:36:11 -0400 Subject: [PATCH] Added autoloader for EMIC --- lib/islandora/startup.js | 9 +++++++++ plugins/AutoLoadEmic/tileplugin.js | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 lib/islandora/startup.js create mode 100644 plugins/AutoLoadEmic/tileplugin.js diff --git a/lib/islandora/startup.js b/lib/islandora/startup.js new file mode 100644 index 0000000..4f65d08 --- /dev/null +++ b/lib/islandora/startup.js @@ -0,0 +1,9 @@ +$.urlParam = function(name){ + var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); + if (!results) + { + return 0; + } + return results[1] || 0; +} + diff --git a/plugins/AutoLoadEmic/tileplugin.js b/plugins/AutoLoadEmic/tileplugin.js new file mode 100644 index 0000000..405d190 --- /dev/null +++ b/plugins/AutoLoadEmic/tileplugin.js @@ -0,0 +1,26 @@ +/* +* AutoLoadEmic +* +* @author Alan Stanley +* +* Wrapper for TILE engine to automatically load +* JSON data from Fedora Repository, based on the PID from the url +* +*/ +var AutoLoadEmic={ + id:"Auto1000101", + name:'AutoLoad', + /* + * start() + * @constructor + * @params mode {Object} - Mode object passed to method + */ + start:function(mode){ + var PID = $.urlParam('PID'); + + TILE.preLoad='http://localhost/Development/emic/getTILE/' + PID; + } +}; + +// register the plugin with TILE +TILE.engine.registerPlugin(AutoLoadEmic); \ No newline at end of file