1 /* staff client integration functions */
2 function debug(msg){dump(msg+'\n')}
4 function attachEvt(scope, name, action) {
5 if(!eventCache[scope]) eventCache[scope] = {};
6 if(!eventCache[scope][name]) eventCache[scope][name] = [];
7 eventCache[scope][name].push(action);
9 function runEvt(scope, name) {
10 debug('running event '+scope+':'+name);
11 var args = Array.prototype.slice.call(arguments).slice(2);
12 if(eventCache[scope]) {
13 var evt = eventCache[scope][name];
14 for(var i in evt) {evt[i].apply(evt[i], args);}
17 window.onload = function() {
18 // record details page events
19 var rec = location.href.match(/\/opac\/record\/(\d+)/);
20 if(rec && rec[1]) { runEvt('rdetail', 'recordRetrieved', rec[1]); }
21 // fire other events the staff client is expecting...