Mercurial > hg > digilib-old
comparison client/digitallibrary/jquery/jquery-digilib-plugins.txt @ 800:65e70c03870b stream
merge from juqery branch
12f790cb30de0ac42ff62fb9921d7a3215243b7b
author | robcast |
---|---|
date | Sat, 19 Feb 2011 09:56:18 +0100 |
parents | 6aa9908303f1 |
children | ae8e98c479d5 |
comparison
equal
deleted
inserted
replaced
774:4568e539abd2 | 800:65e70c03870b |
---|---|
1 | |
2 The plugin API of jquery.digilib | |
3 -------------------------------- | |
4 | |
5 * The plugin Javascript file has to be loaded after jquery.digilib.js. | |
6 | |
7 * The plugin should be written as a closure on jQuery (like a jquery plugin) exporting a plugin object as its interface: | |
8 | |
9 var plugin = { | |
10 name : 'mydigilibplugin', | |
11 install : install, | |
12 init : init, | |
13 buttons : {}, | |
14 actions : {}, | |
15 fn : {}, | |
16 plugins : {}, | |
17 defaults : {} | |
18 }; | |
19 | |
20 The "name" string, "install" function and "init" function are provided by the plugin and called by digilib. | |
21 "buttons", "actions", "fn" and "plugins" are shared objects provided by digilib. | |
22 "buttons" is the array of button objects. The plugin can add its own buttons to this array. | |
23 "actions" is the array of action objects. The plugin can add its own actions to this array. | |
24 "fn" is an object with functions from digilib. | |
25 "plugins" is an object with all digilib plugin objects. | |
26 "defaults" is an object with all digilib defaults. | |
27 | |
28 * the plugin object is passed to digilib in the "plugin" action on loading the plugin javascript file: | |
29 | |
30 $.fn.digilib('plugin', plugin); | |
31 | |
32 digilib then calls the "install" function on the populated plugin object (i.e. this = plugin) with the plugin object as parameter. | |
33 | |
34 * digilib calls the "init" function from the plugin object with the data object instance as a parameter in digilibs init phase. | |
35 | |
36 * further actions should be implemented as custom events on the data object. | |
37 | |
38 * events triggered by digilib on the data object: | |
39 "setup": in the init phase, after scalerDiv and buttons have been set up. | |
40 "update", updateDisplay(): after small updates in the display, e.g. when the scaler-img finished loading. | |
41 "redisplay", redisplay(): after changes in the display, e.g. after changing zoom factor. | |
42 "dragZoom(newZoomArea)": while dragging the zoom area (with parameter newZoomArea). |