User:Jellby/quick proofread.js

// From: https://en.wikisource.org/wiki/Wikisource:Scriptorium/Archives/2017-07#Marking_multiple_pages_as_proofread // Quick proofread tool for preloaded proofread text

"use strict";

var quick_proofread = { init: function { var self = this; // only care for editing in the Page: namespace if ( !(mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' )           || mw.config.get( 'wgNamespaceNumber' ) !== 104 ) { return; }

console.log("Installing Quick PR tool");

$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function {

// Add tool to sidebar pathoschild.TemplateScript.add(               [                    {   name: 'Quick proofread',                         position: 'cursor',                        accessKey: 'o', // was 'q', but conflicts with "Special pages"                        script: function(editor) {                            self.mark_proofread;                            self.save_page;                        },                    },                ],                { category:'page', forNamespaces:'page' }            ); }); // end ajax   },    mark_proofread: function {        $('span.quality3 input').click;    },    save_page: function {        var summary_text = "Quick proofread from offline proofreading";        $('#wpSummary').val(summary_text);        $('#wpSave').click;    }, };

quick_proofread.init;