۱۰۷
ویرایش
(صفحهای تازه حاوی «//<nowiki> (function($){ /* **************************************** *** twinkleconfig.js: Preferences module **********************...» ایجاد کرد) |
جز (۱ نسخه واردشده) |
||
(۳ نسخهٔ میانیِ ایجادشده توسط همین کاربر نشان داده نشد) | |||
خط ۹: | خط ۹: | ||
*** twinkleconfig.js: Preferences module | *** twinkleconfig.js: Preferences module | ||
**************************************** | **************************************** | ||
* Mode of invocation: Adds configuration form to | * Mode of invocation: Adds configuration form to Iranpedia:Twinkle/Preferences and user | ||
subpages named "/Twinkle preferences", and adds ad box to the top of user | subpages named "/Twinkle preferences", and adds ad box to the top of user | ||
subpages belonging to the currently logged-in user which end in '.js' | subpages belonging to the currently logged-in user which end in '.js' | ||
خط ۱۶: | خط ۱۶: | ||
I, [[User:This, that and the other]], originally wrote this. If the code is misbehaving, or you have any | I, [[User:This, that and the other]], originally wrote this. If the code is misbehaving, or you have any | ||
questions, don't hesitate to ask me. (This doesn't at all imply [[ | questions, don't hesitate to ask me. (This doesn't at all imply [[ip:OWN]]ership - it's just meant to | ||
point you in the right direction.) -- TTO | point you in the right direction.) -- TTO | ||
*/ | */ | ||
خط ۱۰۱: | خط ۱۰۱: | ||
"2": "User", | "2": "User", | ||
"3": "User talk", | "3": "User talk", | ||
"4": " | "4": "Iranpedia", | ||
"5": " | "5": "Iranpedia talk", | ||
"6": "File", | "6": "File", | ||
"7": "File talk", | "7": "File talk", | ||
خط ۶۳۵: | خط ۶۳۵: | ||
// TwinkleConfig.blankTalkpageOnIndefBlock (boolean) | // TwinkleConfig.blankTalkpageOnIndefBlock (boolean) | ||
// if true, blank the talk page when issuing an indef block notice (per [[ | // if true, blank the talk page when issuing an indef block notice (per [[ip:UW#Indefinitely blocked users]]) | ||
{ | { | ||
name: "blankTalkpageOnIndefBlock", | name: "blankTalkpageOnIndefBlock", | ||
label: "Blank the talk page when indefinitely blocking users", | label: "Blank the talk page when indefinitely blocking users", | ||
helptip: "See <a href=\"" + mw.util.getUrl(" | helptip: "See <a href=\"" + mw.util.getUrl("ip:UW#Indefinitely blocked users") + "\">ip:UW</a> for more information.", | ||
adminOnly: true, | adminOnly: true, | ||
type: "boolean" | type: "boolean" | ||
خط ۸۵۱: | خط ۸۵۱: | ||
(mw.config.get("wgNamespaceNumber") === mw.config.get("wgNamespaceIds").user && mw.config.get("wgTitle").lastIndexOf("/Twinkle preferences") === (mw.config.get("wgTitle").length - 20))) && | (mw.config.get("wgNamespaceNumber") === mw.config.get("wgNamespaceIds").user && mw.config.get("wgTitle").lastIndexOf("/Twinkle preferences") === (mw.config.get("wgTitle").length - 20))) && | ||
mw.config.get("wgAction") === "view") { | mw.config.get("wgAction") === "view") { | ||
// create the config page at | // create the config page at Iranpedia:Twinkle/Preferences, and at user subpages (for testing purposes) | ||
if (!document.getElementById("twinkle-config")) { | if (!document.getElementById("twinkle-config")) { | ||
خط ۱٬۲۳۹: | خط ۱٬۲۳۹: | ||
if (text.indexOf("TwinkleConfig") !== -1 || text.indexOf("FriendlyConfig") !== -1) { | if (text.indexOf("TwinkleConfig") !== -1 || text.indexOf("FriendlyConfig") !== -1) { | ||
contentnotice.innerHTML = '<table class="plainlinks ombox ombox-content"><tr><td class="mbox-image">' + | contentnotice.innerHTML = '<table class="plainlinks ombox ombox-content"><tr><td class="mbox-image">' + | ||
'<img alt="" src="http://upload.wikimedia.org/ | '<img alt="" src="http://upload.wikimedia.org/iranpedia/en/3/38/Imbox_content.png" /></td>' + | ||
'<td class="mbox-text"><p><big><b>Before modifying your settings here,</b> you must remove your old Twinkle and Friendly settings from your personal skin JavaScript.</big></p>' + | '<td class="mbox-text"><p><big><b>Before modifying your settings here,</b> you must remove your old Twinkle and Friendly settings from your personal skin JavaScript.</big></p>' + | ||
'<p>To do this, you can <a href="' + mw.config.get("wgScript") + '?title=User:' + encodeURIComponent(mw.config.get("wgUserName")) + '/' + mw.config.get("skin") + '.js&action=edit" target="_blank"><b>edit your personal JavaScript</b></a>, removing all lines of code that refer to <code>TwinkleConfig</code> and <code>FriendlyConfig</code>.</p>' + | '<p>To do this, you can <a href="' + mw.config.get("wgScript") + '?title=User:' + encodeURIComponent(mw.config.get("wgUserName")) + '/' + mw.config.get("skin") + '.js&action=edit" target="_blank"><b>edit your personal JavaScript</b></a>, removing all lines of code that refer to <code>TwinkleConfig</code> and <code>FriendlyConfig</code>.</p>' + | ||
خط ۱٬۵۰۹: | خط ۱٬۵۰۹: | ||
var userjs = mw.config.get("wgFormattedNamespaces")[mw.config.get("wgNamespaceIds").user] + ":" + mw.config.get("wgUserName") + "/twinkleoptions.js"; | var userjs = mw.config.get("wgFormattedNamespaces")[mw.config.get("wgNamespaceIds").user] + ":" + mw.config.get("wgUserName") + "/twinkleoptions.js"; | ||
var | var iranpedia_page = new Morebits.wiki.page(userjs, "Saving preferences to " + userjs); | ||
iranpedia_page.setCallbackParameters(e.target); | |||
iranpedia_page.load(Twinkle.config.writePrefs); | |||
return false; | return false; | ||
خط ۱٬۷۴۹: | خط ۱٬۷۴۹: | ||
pageobj.setPageText(text); | pageobj.setPageText(text); | ||
pageobj.setEditSummary("Saving Twinkle preferences: automatic edit from [[" + Morebits.pageNameNorm + "]] ([[ | pageobj.setEditSummary("Saving Twinkle preferences: automatic edit from [[" + Morebits.pageNameNorm + "]] ([[ip:TW|TW]])"); | ||
pageobj.setCreateOption("recreate"); | pageobj.setCreateOption("recreate"); | ||
pageobj.save(Twinkle.config.saveSuccess); | pageobj.save(Twinkle.config.saveSuccess); | ||
خط ۱٬۷۶۱: | خط ۱٬۷۶۱: | ||
noticebox.style.fontSize = "100%"; | noticebox.style.fontSize = "100%"; | ||
noticebox.style.marginTop = "2em"; | noticebox.style.marginTop = "2em"; | ||
noticebox.innerHTML = "<p><b>Your Twinkle preferences have been saved.</b></p><p>To see the changes, you will need to <b>clear your browser cache entirely</b> (see <a href=\"" + mw.util.getUrl(" | noticebox.innerHTML = "<p><b>Your Twinkle preferences have been saved.</b></p><p>To see the changes, you will need to <b>clear your browser cache entirely</b> (see <a href=\"" + mw.util.getUrl("ip:BYPASS") + "\" title=\"ip:BYPASS\">ip:BYPASS</a> for instructions).</p>"; | ||
Morebits.status.root.appendChild(noticebox); | Morebits.status.root.appendChild(noticebox); | ||
var noticeclear = document.createElement("br"); | var noticeclear = document.createElement("br"); |