מדיה ויקי:Gadget-Warnings.js
מתוך ויקיציטוט, מאגר הציטוטים החופשי.
הערה: לאחר השמירה, עליכם לנקות את זכרון המטמון (Cache) של הדפדפן על־מנת להבחין בשינויים.
- במוזילה, בפיירפוקס או בספארי, לחצו על מקש ה־Shift בעת לחיצתכם על העלה מחדש (Reload), או הקישו Ctrl+Shift+R (או Cmd+Shift+R במקינטוש של אפל).
- באינטרנט אקספלורר, לחצו על מקש ה־Ctrl בעת לחיצתכם על רענן (Refresh), או הקישו על Ctrl+F5.
- ב־Konqueror, לחצו על העלה מחדש (Reload), או הקישו על F5.
- באופרה, ייתכן שתצטרכו להשתמש בכלים (Tools) > העדפות (Preferences) כדי לנקות לחלוטין את זכרון המטמון.
//<source lang="javascript"> /* סקריפט להוספת רשימת אזהרות כשעורכים דף שיחה של אנונימי, נכתב על-ידי ערן */ /* מועתק מ[[w:מדיה ויקי:Gadget-Warnings.js]] */ var warnings = ["בחרו אזהרה כדי להוסיף", "אזהרה", "בוטל", "הבל", "הזמנה", "הסבר", "העתקה", "ויקיזציה", "כבר קיים", "לך", "נחסמת", "ניסויים", "נמחק", "נמחק ניסויים", "פרסומת", "תודה", "תלונה"]; var substWarning = false; function warningsList() { if (!document.getElementById("wpSummaryLabel")) return; // not an edit page if( wgNamespaceNumber != 3 || !/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test( wgTitle ) ) return; // not an anonymous user talk var select = document.createElement("select"); select.id = "warningsList"; select.onchange = function() { insertWarning( this.selectedIndex, this[this.selectedIndex].title ); this.selectedIndex = 0; return false; } for( var i = 0; i < warnings.length; i++ ) { select = createOptionElement( select, warnings[i] ); } var div = document.createElement("div"); div.appendChild (document.createTextNode("אזהרות: ")); div.appendChild (select); var wpSummaryLabel = document.getElementById("wpSummaryLabel"); wpSummaryLabel.parentNode.insertBefore (div, wpSummaryLabel); } function insertWarning( index, title ) { if( index > 0 ) { document.getElementById("wpSummary").value += title; document.getElementById("wpTextbox1").value += "{" + "{" + (substWarning ? "ס:" : "") + title + "}} ~~" + "~~"; } } addOnloadHook(warningsList); //</source>