Mercurial > hg > digilib-old
annotate client/digitallibrary/jquery/jquery-digilib-plugins.txt @ 867:987cfe401970 stream
add default error message type config.
author | robcast |
---|---|
date | Thu, 10 Mar 2011 21:21:10 +0100 |
parents | ae8e98c479d5 |
children |
rev | line source |
---|---|
793
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
1 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
2 The plugin API of jquery.digilib |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
3 -------------------------------- |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
4 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
5 * The plugin Javascript file has to be loaded after jquery.digilib.js. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
6 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
7 * The plugin should be written as a closure on jQuery (like a jquery plugin) exporting a plugin object as its interface: |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
8 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
9 var plugin = { |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
10 name : 'mydigilibplugin', |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
11 install : install, |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
12 init : init, |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
13 buttons : {}, |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
14 actions : {}, |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
15 fn : {}, |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
16 plugins : {}, |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
17 defaults : {} |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
18 }; |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
19 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
20 The "name" string, "install" function and "init" function are provided by the plugin and called by digilib. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
21 "buttons", "actions", "fn" and "plugins" are shared objects provided by digilib. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
22 "buttons" is the array of button objects. The plugin can add its own buttons to this array. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
23 "actions" is the array of action objects. The plugin can add its own actions to this array. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
24 "fn" is an object with functions from digilib. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
25 "plugins" is an object with all digilib plugin objects. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
26 "defaults" is an object with all digilib defaults. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
27 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
28 * the plugin object is passed to digilib in the "plugin" action on loading the plugin javascript file: |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
29 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
30 $.fn.digilib('plugin', plugin); |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
31 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
32 digilib then calls the "install" function on the populated plugin object (i.e. this = plugin) with the plugin object as parameter. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
33 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
34 * digilib calls the "init" function from the plugin object with the data object instance as a parameter in digilibs init phase. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
35 |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
36 * further actions should be implemented as custom events on the data object. |
63c1b33e38b1
documentation for new plugin api in jquery-digilib-plugin.txt.
robcast
parents:
diff
changeset
|
37 |
796
6aa9908303f1
added redisplay handler to birdseye. updated plugin docu.
robcast
parents:
793
diff
changeset
|
38 * events triggered by digilib on the data object: |
6aa9908303f1
added redisplay handler to birdseye. updated plugin docu.
robcast
parents:
793
diff
changeset
|
39 "setup": in the init phase, after scalerDiv and buttons have been set up. |
6aa9908303f1
added redisplay handler to birdseye. updated plugin docu.
robcast
parents:
793
diff
changeset
|
40 "update", updateDisplay(): after small updates in the display, e.g. when the scaler-img finished loading. |
6aa9908303f1
added redisplay handler to birdseye. updated plugin docu.
robcast
parents:
793
diff
changeset
|
41 "redisplay", redisplay(): after changes in the display, e.g. after changing zoom factor. |
6aa9908303f1
added redisplay handler to birdseye. updated plugin docu.
robcast
parents:
793
diff
changeset
|
42 "dragZoom(newZoomArea)": while dragging the zoom area (with parameter newZoomArea). |
808
ae8e98c479d5
stub for new plugins; overlay div for regions plugin
hertzhaft
parents:
796
diff
changeset
|
43 |
ae8e98c479d5
stub for new plugins; overlay div for regions plugin
hertzhaft
parents:
796
diff
changeset
|
44 * initial options for the plugin can be passed to digilib, together with digilib options, by passing an object to the 'digilib' function: $div.digilib(options); |
ae8e98c479d5
stub for new plugins; overlay div for regions plugin
hertzhaft
parents:
796
diff
changeset
|
45 The passed options extend/override the default digilib options. The options are stored in the "data.settings" array. |
ae8e98c479d5
stub for new plugins; overlay div for regions plugin
hertzhaft
parents:
796
diff
changeset
|
46 |
ae8e98c479d5
stub for new plugins; overlay div for regions plugin
hertzhaft
parents:
796
diff
changeset
|
47 * A functional stub for new digilib plugins is available in the file "jquery.digilib.pluginstub.js" |