User:Falzar FZ/FormatChecker.js

// Here's something I written to check that you have signed your post.

if (wgCanonicalNamespace.match(/talk/i) || wgCanonicalNamespace.match("Forum") || wgTitle == "Falzar FZ/SignChecker.js") { addOnloadHook(   function {      document.getElementById('wpSave').onmousedown = SignChecker;      document.getElementById('wpPreview').onmousedown = SignChecker;    }  ); }

function SignChecker { var forumMessage = "Be sure to sign your edits with four tildes: " + ""; // Bypassing the line in the forum template. var noWiki = " " + " ";

var textA = document.getElementById('wpTextbox1').value.replace(forumMessage,"").replace(noWiki,""); if (!textA.match("" + "") && textA != "" && !textA.match("{{Delete")) { alert("Please sign your post by adding 4 tildes (" + ") to the end of your post."); } }

// Here's something I written to add Template:Navigation if it's not there.

if (wgCanonicalNamespace.match("Card Gallery") || wgCanonicalNamespace.match("Card Rulings") || wgCanonicalNamespace.match("Card Errata") || wgCanonicalNamespace.match("Card Tips") || wgCanonicalNamespace.match("Card Appearances") || wgCanonicalNamespace.match("Card Trivia") || wgCanonicalNamespace.match("Card Lores") || wgCanonicalNamespace.match("Card Artworks") || wgCanonicalNamespace.match("Card Names") || wgCanonicalNamespace.match("Card Sets")) { addOnloadHook(addNav); }

function addNav { var textA = document.getElementById('wpTextbox1').value.replace("{{Navigation","{{Navigation"); if (!textA.match("{{Navigation") && !textA.match("{{Delete")) { document.getElementById('wpTextbox1').value = "{{Navigation}}\n\n" + textA; } else { document.getElementById('wpTextbox1').value = textA; } }

// Here's something I written to add Template:Talkheader if it was not added during page creation from redlink.

if (document.URL.match("redlink=1") && wgCanonicalNamespace.match(/talk/i) && !wgCanonicalNamespace.match("User")) { addOnloadHook(addTalkheader); }

function addTalkheader { var textA = document.getElementById('wpTextbox1').value.replace("{{talkheader","{{Talkheader"); if (!textA.match("{{Talkheader") && !textA.match("{{Delete")) { document.getElementById('wpTextbox1').value = "\n\n" + textA; } else { document.getElementById('wpTextbox1').value = textA; } }