User:A930913/vada/plugin/imgtag.js

if(typeof window!="undefined"){ //inside Vada DOM (function{		var a930913_imgtag={			about:{				"name":"A930913's Image Tagger",				"description":"Tags files",				"namespace":"a930913_imgtag",				"userscript":"User:A930913/vada/plugin/imgtag.js",			}		}		window.vada.loadPlugin(a930913_imgtag);	}); } else { //inside Vada process vada.plugins.a930913_imgtag={}; vada.plugins.a930913_imgtag.page=function(params){ var p=new vada.Page(params.page); vada.dom.summarybox.setText(""); vada.dom.minorbox.uncheck; try{vada.dom.load(p,".");}catch(e){ if(e=="PageDoesNotExist"){ vada.dom.queue.splice(vada.dom.queue.indexOf(p),1); vada.dom.queue.redraw; vada.dom.queue.next; } else throw(e); }		var img=vada.api({action:"query",titles:p.title,prop:"imageinfo",iiprop:"url",iiurlheight:"300"}); for(var pageid in img.query.pages)break; vada.dom.extraInfo(''); }	vada.plugins.a930913_imgtag.queueclick=function(params){ vada.plugins.a930913_imgtag.page({page:params.title}); vada.dom.queue.splice(vada.dom.queue.indexOf(new vada.Page(params.title)),1); vada.dom.queue.redraw; }	vada.plugins.a930913_imgtag.start=function{ vada.events.trigger("plugins.stop",{}); vada.events.addListener("plugins.stop",vada.plugins.a930913_imgtag.stop); vada.dom.menu.new([vada.dom.menu.buttons.nextq,vada.dom.menu.buttons.tagdelete,vada.plugins.a930913_imgtag.tagbutton]); vada.dom.queue.builders.show; vada.events.addListener("pagename",vada.plugins.a930913_imgtag.page); vada.events.addListener("queue.page.selected",vada.plugins.a930913_imgtag.queueclick); vada.plugins.a930913_imgtag.running=true; }	vada.plugins.a930913_imgtag.stop=function{ vada.plugins.a930913_imgtag.running=false; vada.dom.queue.builders.hide; vada.events.removeListener("pagename",vada.plugins.a930913_imgtag.page); vada.events.removeListener("queue.page.selected",vada.plugins.a930913_imgtag.queueclick); }	vada.plugins.a930913_imgtag.running=false; vada.plugins.a930913_imgtag.button=(function(pl){		var button=new vada.dom.menu.Button("a930913_imgtag_start");		button.text="A930913's Image Tagger";		button.click=pl.start;		vada.dom.menu.buttons.vada.children.push(button);		vada.dom.menu.redraw;		return button;	})(vada.plugins.a930913_imgtag); vada.plugins.a930913_imgtag.tagbutton=(function(pl){		var button=new vada.dom.menu.Button("a930913_imgtag_tag");		button.text="Tag image";		button.image="//upload.wikimedia.org/wikipedia/commons/thumb/9/97/Commons_in_image_icon.svg/40px-Commons_in_image_icon.svg.png";		return button;	})(vada.plugins.a930913_imgtag); vada.plugins.a930913_imgtag.tagbutton.common=(function(pl){		var button=new vada.dom.menu.Button("a930913_imgtag_common");		button.text="Copy to Commons";		button.click=function{			var r=vada.dom._diff.leftRevision, p=r.page;           vada.dom.queue.next;            p.text="\n"+p.text;            p.save("Tagging with ");		};		pl.tagbutton.children.push(button);		return button;	})(vada.plugins.a930913_imgtag); vada.plugins.a930913_imgtag.tagbutton.wronglicense=(function(pl){		var button=new vada.dom.menu.Button("a930913_imgtag_license");		button.text="Wrong license";		button.click=function{			var r=vada.dom._diff.leftRevision, p=r.page;           vada.dom.queue.next;            p.text="\n"+p.text;            p.save("Tagging with ");		};		pl.tagbutton.children.push(button);		return button;	})(vada.plugins.a930913_imgtag); }