User:Quarl/copyvio.js

// User:Quarl/copyvio.js - add copyvio tag and add entry to 'copyright // problems' page

// depends: wikipage.js, addlilink.js

//

var copyvio = new Object;

copyvio.logEntry = function(wp, url, callback) { copyvio._getLogWP.getEditorAsync(copyvio._logEntryEdit, wp, url, callback); }

copyvio._logEntryEdit = function(editor, wp, url, callback) { if (editor.wpTextbox1.indexOf(+wp.page+) == -1) { editor.wpTextbox1 += '* '+wp.page+' from ['+url+']. ~';       editor.wpSummary += 'Listing '+wp.page+' as copyvio of '+url; editor.submitAsync(callback, wp, url); } else { alert(""+wp.page+" already on log page; not relisting!"); callback(wp, url); } }

copyvio.tagEntry = function(wp, url) { wp.getEditorAsync(copyvio._tagEntryEdit, url); }

copyvio._tagEntryEdit = function(editor, url) { // **replace** content! editor.wpTextbox1 = '{' + '{' + 'copyvio|url='+url+'}}\n~'; editor.wpSummary = 'copyvio of '+url+' (log)'; editor.submit; }

copyvio._getLogWP = function { var logPageName = 'Wikipedia:Copyright problems/' + datestampYYYYMonthD; return new WikiPage(null, logPageName); }

copyvio.logAndTagWp = function(wp, url) { copyvio.logEntry(wp, url, copyvio.tagEntry) }

copyvio.queryLogAndTag = function { var url = window.prompt("Copyvio of which URL?"); if (!url) return;

copyvio.logAndTagWp(wikiPage, url); }

copyvio._load = function { //if (wikiPage.nsSpecialP) return; if (!wikiPage.nsMainP) return; // copyvios generally only in article space addTab('javascript:copyvio.queryLogAndTag', 'CopyVio', 'ca-copyvio', 'Tag for copyright violation'); }

$(copyvio._load);

//