Files
dokuwiki-plugin-sync/script.js
Andreas Gohr 9c29364738 Set all files to the same action by clicking the table header
Ignore-this: 9b5e581860bef36138ba70e7d3f23239

darcs-hash:20091117174129-7ad00-b230101d9b126b2b2888ed4d1b68b1a175b2b8c2.gz
2009-11-17 18:41:29 +01:00

46 lines
1.2 KiB
JavaScript

addInitEvent(function(){
/**
* Attach diff popup
*/
var diffs = getElementsByClass('sync_popup',document,'a');
for(var i=0; i<diffs.length; i++){
addEvent(diffs[i],'click',function(e){
window.open(this.href,'diff',"width=700,height=500,left=100,top=100,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,toolbar=no");
e.preventDefault();
e.stopPropagation();
return false;
});
}
/**
* Attach the select all actions
*/
var push = $('sync__push');
if(push){
push.style.cursor = 'pointer';
addEvent(push,'click',function(){ sync_select('push'); });
}
var skip = $('sync__skip');
if(skip){
skip.style.cursor = 'pointer';
addEvent(skip,'click',function(){ sync_select('skip'); });
}
var pull = $('sync__pull');
if(pull){
pull.style.cursor = 'pointer';
addEvent(pull,'click',function(){ sync_select('pull'); });
}
});
/**
* Check all radio buttons of the given type
*/
function sync_select(type){
var items = getElementsByClass('sync'+type);
for(var i=0; i<items.length; i++){
items[i].checked = 'checked';
}
}