מדיה ויקי:Gadget-Warnings.js: הבדלים בין גרסאות בדף
מראה
מ מתוך ויקיפדיה:סקריפטים/5 |
|
(אין הבדלים)
| |
גרסה מ־23:39, 14 בדצמבר 2007
//<source lang="javascript">
/* סקריפט להוספת רשימת אזהרות כשעורכים דף שיחה של אנונימי, נכתב על-ידי ערן */
var warnings = ["בחרו אזהרה כדי להוסיף", "אזהרה", "הבל", "הזמנה", "ניסויים", "תודה", "ויקיזציה", "לך", "תלונה", "טעות", "נייטרליות", "נחסמת", "מילון", "כבר קיים", "שגיאה", "העתקה", "פרסומת", "נמחק", "הסבר", "בוטל", "סגנון"];
function warningsList() {
if( !document.getElementById("edit-templates") ) return; // not 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] );
}
addEditSelect( "אזהרות", select );
}
function insertWarning( index, title ) {
if( index > 0 ) {
document.getElementById("wpSummary").value += title;
document.getElementById("wpTextbox1").value += "{" + "{ס:" + title + "}} ~~" + "~~";
}
}
addOnloadHook(warningsList);
//</source>