Jump to content

User:Danhash/global.js: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Danhash (talk | contribs)
migrating more wikEd config
Danhash (talk | contribs)
move wikEd configuration outside function which installs wikEd
Line 6: Line 6:
script.async = true;
script.async = true;
document.getElementsByTagName ('head')[0].appendChild (script);
document.getElementsByTagName ('head')[0].appendChild (script);
var wikEdConfig = {}; //Linkback: [[en:User:Cacycle/wikEd customization]]
wikEdConfig.showSourceButton = true;
wikEdConfig.regExTypoFix = true;
wikEdConfig.showTableModeButton = true;
wikEdConfig.showUsingButton = true;
wikEdConfig.summaryUsing = '(using [[User:Cacycle/wikEd|wikEd]])';
wikEdConfig.comboPresetOptions = {};
wikEdConfig.comboPresetOptions.summary = [
'TEMPLATES',
'+{{[[Template:XXXX|XXXX]]}}',
' ',
'DASHES/QUOTES/REFS/MOS:',
'[[WP:REFPUNC|reference punctuation]]',
'[[MOS:LQ|logical quotation]]',
'single to double [[WP:MOS#Quotation marks|quotation marks]]',
'curly to straight [[WP:MOS#Quotation marks|quotation marks]] and apostrophes',
'fix [[WP:MOS#Quotation marks|quotation marks]]',
'move quotation marks outside of links',
'move quotation marks outside of bold',
'fix [[MOS:DASH|dashes]]',
'punctuation',
'commas',
'rewrite [[WP:MOS#Contractions|contractions]]',
'remove "™" and "®" per [[Wikipedia:Manual of Style/Trademarks]]',
'{{[[WP:Citation Needed|citation needed]]}}',
'rm [[WP:WEASEL|weasel words]]',
' ',
'TALK PAGES:',
'reply',
' ',
'REMOVE/REVERT:',
'revert unexplained removal',
'revert [[WP:V|unsourced]]',
'revert [[WP:ELNO|external links]]',
' ',
'LEAD',
'rm "illegally"',
'bold abbreviation in lead',
' ',
'GENERAL CLEANUP/EDITING:',
'rm [[WP:WHITE|whitespace]]',
'rm [[WP:V|unsourced]]',
'rm [[WP:V|unsourced]] material which appears to be [[WP:NOR|original research]]',
'rm spam',
'rm [[WP:REDNOT|red links]]',
'copyedit',
'update links',
'fix links',
'rm unsourced sentence',
'rm entire [[WP:V|unsourced]] paragraph',
' ',
'TECHNICAL:',
'fix [[Wikipedia:Double redirects|double redirect]] after page move',
'update [[WP:DEFAULTSORT|DEFAULTSORT]]',
'update [[WP:HATNOTE|hatnote]] to use {{[[Template:About|about]]}}',
'update [[WP:HATNOTE|hatnote]] to use {{[[Template:For|for]]}}',
'update [[WP:HATNOTE|hatnote]] to use {{[[Template:Redirect|redirect]]}}',
'Cleaned up using [[WP:AutoEd|AutoEd]]',
'[[Wikipedia:RegExTypoFix|RegExTypoFix]] using [[User:Cacycle/wikEd|wikEd]]',
'(using [[User:Cacycle/wikEd|wikEd]])',
'edit wikEd RegEx defaults',
'edit wikEd edit summaries',
' ',
'IMAGE TEMPLATES:',
'+{{ShouldBePNG}}',
'+{{BadJPEG}}'
];
/*
===Find/replace regex presets===
*/
wikEdConfig.comboPresetOptions.find = [
'(“|”|″)', //match curly double quotes
"(‘|’|′)", //match curly single quotes/apostrophes
"(‘|’|′|')", //match all single quotes/apostrophes
'(‘|’|′|\')((.){1,15})(‘|’|′|\')', //match apostrophes and curly single quotes
'(“|”|″)((.){1,15})(“|”|″)', //match curly double quotes
'(\\.|,)"', //match period or comma before end of quote
'\'',
'-',
' – ',
'(™|®)'
];
wikEdConfig.comboPresetOptions.replace = [
'\\"$2\\"', //use in conjunction with the quote matching above to replace "wrong" quotes with "correct" quotes
'"$1', //use in conjunction with the above RegEx to match period or comma before end of quote; this moves the period of comma to after the ending quotation mark
'\n',
'"',
'\'',
'–'
];
/* END wikEd */
}
}
) ();
) ();
var wikEdConfig = {}; //Linkback: [[en:User:Cacycle/wikEd customization]]
wikEdConfig.showSourceButton = true;
wikEdConfig.regExTypoFix = true;
wikEdConfig.showTableModeButton = true;
wikEdConfig.showUsingButton = true;
wikEdConfig.summaryUsing = '(using [[User:Cacycle/wikEd|wikEd]])';

wikEdConfig.comboPresetOptions = {};
wikEdConfig.comboPresetOptions.summary = [
'TEMPLATES',
'+{{[[Template:XXXX|XXXX]]}}',
' ',
'DASHES/QUOTES/REFS/MOS:',
'[[WP:REFPUNC|reference punctuation]]',
'[[MOS:LQ|logical quotation]]',
'single to double [[WP:MOS#Quotation marks|quotation marks]]',
'curly to straight [[WP:MOS#Quotation marks|quotation marks]] and apostrophes',
'fix [[WP:MOS#Quotation marks|quotation marks]]',
'move quotation marks outside of links',
'move quotation marks outside of bold',
'fix [[MOS:DASH|dashes]]',
'punctuation',
'commas',
'rewrite [[WP:MOS#Contractions|contractions]]',
'remove "™" and "®" per [[Wikipedia:Manual of Style/Trademarks]]',
'{{[[WP:Citation Needed|citation needed]]}}',
'rm [[WP:WEASEL|weasel words]]',
' ',
'TALK PAGES:',
'reply',
' ',
'REMOVE/REVERT:',
'revert unexplained removal',
'revert [[WP:V|unsourced]]',
'revert [[WP:ELNO|external links]]',
' ',
'LEAD',
'rm "illegally"',
'bold abbreviation in lead',
' ',
'GENERAL CLEANUP/EDITING:',
'rm [[WP:WHITE|whitespace]]',
'rm [[WP:V|unsourced]]',
'rm [[WP:V|unsourced]] material which appears to be [[WP:NOR|original research]]',
'rm spam',
'rm [[WP:REDNOT|red links]]',
'copyedit',
'update links',
'fix links',
'rm unsourced sentence',
'rm entire [[WP:V|unsourced]] paragraph',
' ',
'TECHNICAL:',
'fix [[Wikipedia:Double redirects|double redirect]] after page move',
'update [[WP:DEFAULTSORT|DEFAULTSORT]]',
'update [[WP:HATNOTE|hatnote]] to use {{[[Template:About|about]]}}',
'update [[WP:HATNOTE|hatnote]] to use {{[[Template:For|for]]}}',
'update [[WP:HATNOTE|hatnote]] to use {{[[Template:Redirect|redirect]]}}',
'Cleaned up using [[WP:AutoEd|AutoEd]]',
'[[Wikipedia:RegExTypoFix|RegExTypoFix]] using [[User:Cacycle/wikEd|wikEd]]',
'(using [[User:Cacycle/wikEd|wikEd]])',
'edit wikEd RegEx defaults',
'edit wikEd edit summaries',
' ',
'IMAGE TEMPLATES:',
'+{{ShouldBePNG}}',
'+{{BadJPEG}}'
];
/*
===Find/replace regex presets===
*/
wikEdConfig.comboPresetOptions.find = [
'(“|”|″)', //match curly double quotes
"(‘|’|′)", //match curly single quotes/apostrophes
"(‘|’|′|')", //match all single quotes/apostrophes
'(‘|’|′|\')((.){1,15})(‘|’|′|\')', //match apostrophes and curly single quotes
'(“|”|″)((.){1,15})(“|”|″)', //match curly double quotes
'(\\.|,)"', //match period or comma before end of quote
'\'',
'-',
' – ',
'(™|®)'
];
wikEdConfig.comboPresetOptions.replace = [
'\\"$2\\"', //use in conjunction with the quote matching above to replace "wrong" quotes with "correct" quotes
'"$1', //use in conjunction with the above RegEx to match period or comma before end of quote; this moves the period of comma to after the ending quotation mark
'\n',
'"',
'\'',
'–'
];
/* END wikEd */

Revision as of 20:52, 16 May 2017

// install [[en:User:Cacycle/wikEd]] in-browser text editor
(function ()
{
	var script = document.createElement ('script');
	script.src = '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript';
	script.async = true;
	document.getElementsByTagName ('head')[0].appendChild (script);
	 }
) ();
	
var wikEdConfig = {};  //Linkback: [[en:User:Cacycle/wikEd customization]]
wikEdConfig.showSourceButton = true; 
wikEdConfig.regExTypoFix = true;
wikEdConfig.showTableModeButton = true;
wikEdConfig.showUsingButton = true;
wikEdConfig.summaryUsing = '(using [[User:Cacycle/wikEd|wikEd]])';

wikEdConfig.comboPresetOptions = {};
wikEdConfig.comboPresetOptions.summary = [
'TEMPLATES',
 '+{{[[Template:XXXX|XXXX]]}}',
 ' ',
'DASHES/QUOTES/REFS/MOS:',
 '[[WP:REFPUNC|reference punctuation]]',
 '[[MOS:LQ|logical quotation]]',
 'single to double [[WP:MOS#Quotation marks|quotation marks]]',
 'curly to straight [[WP:MOS#Quotation marks|quotation marks]] and apostrophes',
 'fix [[WP:MOS#Quotation marks|quotation marks]]',
 'move quotation marks outside of links',
 'move quotation marks outside of bold',
 'fix [[MOS:DASH|dashes]]',
 'punctuation',
 'commas',
 'rewrite [[WP:MOS#Contractions|contractions]]',
 'remove "™" and "®" per [[Wikipedia:Manual of Style/Trademarks]]',
 '{{[[WP:Citation Needed|citation needed]]}}',
 'rm [[WP:WEASEL|weasel words]]',
 ' ',
 'TALK PAGES:',
 'reply',
 ' ',
 'REMOVE/REVERT:',
 'revert unexplained removal',
 'revert [[WP:V|unsourced]]',
 'revert [[WP:ELNO|external links]]',
 ' ',
 'LEAD',
 'rm "illegally"',
 'bold abbreviation in lead',
 ' ',
 'GENERAL CLEANUP/EDITING:',
 'rm [[WP:WHITE|whitespace]]',
 'rm [[WP:V|unsourced]]',
 'rm [[WP:V|unsourced]] material which appears to be [[WP:NOR|original research]]',
 'rm spam',
 'rm [[WP:REDNOT|red links]]',
 'copyedit',
 'update links',
 'fix links',
 'rm unsourced sentence',
 'rm entire [[WP:V|unsourced]] paragraph',
 ' ',
 'TECHNICAL:',
 'fix [[Wikipedia:Double redirects|double redirect]] after page move',
 'update [[WP:DEFAULTSORT|DEFAULTSORT]]',
 'update [[WP:HATNOTE|hatnote]] to use {{[[Template:About|about]]}}',
 'update [[WP:HATNOTE|hatnote]] to use {{[[Template:For|for]]}}',
 'update [[WP:HATNOTE|hatnote]] to use {{[[Template:Redirect|redirect]]}}',
 'Cleaned up using [[WP:AutoEd|AutoEd]]',
 '[[Wikipedia:RegExTypoFix|RegExTypoFix]] using [[User:Cacycle/wikEd|wikEd]]',
 '(using [[User:Cacycle/wikEd|wikEd]])',
 'edit wikEd RegEx defaults',
 'edit wikEd edit summaries',
 ' ',
 'IMAGE TEMPLATES:',
 '+{{ShouldBePNG}}',
 '+{{BadJPEG}}'
];
 
/*
===Find/replace regex presets===
*/
wikEdConfig.comboPresetOptions.find = [
	'(“|”|″)', //match curly double quotes
	"(‘|’|′)", //match curly single quotes/apostrophes
	"(‘|’|′|')", //match all single quotes/apostrophes
	'(‘|’|′|\')((.){1,15})(‘|’|′|\')', //match apostrophes and curly single quotes
	'(“|”|″)((.){1,15})(“|”|″)',   //match curly double quotes
	'(\\.|,)"', //match period or comma before end of quote
	'\'',
	'-',
	' – ',
	'(™|®)'
	];
wikEdConfig.comboPresetOptions.replace = [
	'\\"$2\\"', //use in conjunction with the quote matching above to replace "wrong" quotes with "correct" quotes
	'"$1', //use in conjunction with the above RegEx to match period or comma before end of quote; this moves the period of comma to after the ending quotation mark
	'\n',
	'"',
	'\'',
	'–'
	];
 
/* END wikEd */