User:Dibbydib/nofancyquotes.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/**
* TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
* @see https://meta.wikimedia.org/wiki/TemplateScript
* @update-token [[File:pathoschild/templatescript.js]]
*
* --- Script forked off Ohconfucius on enwiki ~ kudos! [[User:Ohconfucius/script/formatgeneral.js]] ---
*/
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js');
function Ohc_format_Sundry() {
var txt=document.editform.wpTextbox1;
regex(/“/g, '"'); // L double
regex(/”/g, '"'); // R double
regex(/‘/g, "'"); // L single
regex(/’/g, "'"); // R single
}
/** ------------------------------------------------------------------------ **/
function Ohc_formats(){
Ohc_format_Sundry();
}
function Ohc_formatgeneral() { // Keeping this bit in here in case I have to fork some more code from the original script
Ohc_formats();
}
function Ohc_run_formatgeneral() {
Ohc_formatgeneral();
Ohc_formatgen_edit_summary();
}
function Ohc_formatgen_edit_summary(){
//Add a tag to the summary box
setoptions(minor='true');
setreason('[[WQ:PUNCTUATION]] fixes by [[User:Dibbydib/nofancyquotes|script]]', 'append');
doaction('diff');
}
// This bit is broken below, must fix or ask someone about it (probably ohc)
$(function () {
if(document.forms.editform) {
mw.loader.using( ['mediawiki.util'], function() {
mw.util.addPortletLink('p-tb', 'javascript:Ohc_run_formatgeneral()', 'Rem fancy quotes', 't-addmetric', 'description :3', '', ''); // Why must I always get these stupidly cryptic warning messages? I think this line is where the bug's at, tho
});
}
});
// The problem (I think) is that something's wrong with the "javascript:Ohc_run_formatgeneral()" or that line in general, either I cut something out
// from the original script by mistake or it doesn't work on Wikiquote. It's displaying fine but won't run when I click it, so the text displaying
// isn't the issue here