User:Alexis Jazz/AngerManagement.js

// AngerManagement by Alexis Jazz. Currently only works with plain text source editor (does not work with code source editor or VE) and edit summaries // Add: // mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Alexis_Jazz/AngerManagement.js&action=raw&ctype=text/javascript'); // To your common.js to load this script. // Changelog: // 1: Initial version // 2: Now supports edit summaries and won't be triggered by bad words that were already in the edit field before you starting typing your crap. (like comments from others)

if ( mw.config.get('wgAction') == 'edit' ) { window.anger = {}; var anger = window.anger; anger.wpTextboxInitial = document.editform.wpTextbox1.value; anger.wpTextboxInitialCensored = anger.wpTextboxInitial.replace( /(f.ck|cunt|prick|shit|piss|circus|sad child|dimwit)/gi, '' );

anger.management = function { console.log('anger: breathe in, breathe out'); anger.wpTextbox1 = document.editform.wpTextbox1.value.replace( anger.wpTextboxInitial, anger.wpTextboxInitialCensored ); anger.fuckit = anger.wpTextbox1.replace( /(f.ck|cunt|prick|shit|piss|circus|sad child|dimwit)/gi, '' ); anger.wpSummary = document.editform.wpSummary.value; anger.fucksummary = anger.wpSummary.replace( /(f.ck|cunt|prick|shit|piss|circus|sad child|dimwit)/gi, '' ); if ( anger.wpTextbox1 != anger.fuckit ) {

document.getElementById("wpTextbox1").style.background = "red"; //		document.getElementsByClassName("CodeMirror")[0].style.background = "red"; } else { document.getElementById("wpTextbox1").style.background = "white"; }		if ( anger.wpSummary != anger.fucksummary ) { document.getElementById("wpSummary").style.background = "red"; } else { document.getElementById("wpSummary").style.background = "white"; }		if (( anger.wpTextbox1 != anger.fuckit ) || ( anger.wpSummary != anger.fucksummary )) { document.getElementById("wpSave").value = "GReAt IdEA DumBAss!"; document.getElementById("wpSave").style.background = "red"; document.getElementById("wpPreview").value = "PREVIEW IS FOR WUSSIES RIGHT?"; document.getElementById("wpDiff").value = "MAYBE CHANGE SOMETHING? BETTER YET TAKE A WALK"; } else { document.getElementById("wpSave").value = "Publish changes"; document.getElementById("wpSave").style.background = "#36c"; document.getElementById("wpPreview").value = "Preview changes"; document.getElementById("wpDiff").value = "Show changes"; } };

$(document).on('keydown',function{anger.management;}); }