מדיה ויקי:Gadget-Warnings.js: הבדלים בין גרסאות בדף
מראה
מ הסרת "ס:" לבקשת סקרלט. הוספת אפשרות להשתמש בזה בכל אופן. |
מ תיקון |
||
| שורה 5: | שורה 5: | ||
function warningsList() { | function warningsList() { | ||
if( ! | if( wgAction != 'edit' && wgAction != 'submit' ) 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 | if( wgNamespaceNumber != 3 || !/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test( wgTitle ) ) return; // not an anonymous user talk | ||
גרסה מ־23:17, 5 ביולי 2009
//<source lang="javascript">
/* סקריפט להוספת רשימת אזהרות כשעורכים דף שיחה של אנונימי, נכתב על-ידי ערן */
var warnings = ["בחרו אזהרה כדי להוסיף", "אזהרה", "הבל", "הזמנה", "ניסויים", "תודה", "ויקיזציה", "לך", "תלונה", "טעות", "נייטרליות", "נחסמת", "מילון", "כבר קיים", "שגיאה", "העתקה", "פרסומת", "נמחק", "נמחק ניסויים", "הסבר", "בוטל", "סגנון"];
var substWarning = false;
function warningsList() {
if( wgAction != 'edit' && wgAction != 'submit' ) 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 += "{" + "{" + (substWarning ? "ס:" : "") + title + "}} ~~" + "~~";
}
}
addOnloadHook(warningsList);
//</source>