ميدياويكي:Gadget-GlobalWatchlist.js
ملاحظة: بعد الحفظ، قد يلزمك إفراغ الكاش لرؤية التغييرات.
// {{Catégorisation JS|GlobalWatchlist}}
//<source lang=javascript>
// <pre><nowiki>
/////////////////////////////// PARTIE PERSONNALISABLE /////////////////////////////
//// Liste des wikis disponibles ////
if (typeof (GlobalWatchlist_WikiList) == 'undefined') {
// wikis globaux
window.GlobalWatchlist_WikiList = [
'//www.mediawiki.org',
'//meta.wikimedia.org',
'//commons.wikimedia.org',
'//species.wikimedia.org',
'//www.wikidata.org',
'//translatewiki.net',
];
// wikis multi-langues
var GlobalWatchlist_WikiListLang = [
'aa',
'ab',
'ace',
'af',
'ak',
'als',
'am',
'an',
'ang',
'ar',
'arc',
'arz',
'as',
'ast',
'av',
'ay',
'az',
'ba',
'bar',
'bat-smg',
'bcl',
'be',
'be-x-old',
'bg',
'bh',
'bi',
'bm',
'bn',
'bo',
'bpy',
'br',
'bs',
'bug',
'bxr',
'ca',
'cbk-zam',
'cdo',
'ce',
'ceb',
'ch',
'cho',
'chr',
'chy',
'ckb',
'co',
'cr',
'crh',
'cs',
'csb',
'cu',
'cv',
'cy',
'cz',
'da',
'de',
'diq',
'dk',
'dsb',
'dv',
'dz',
'ee',
'el',
'eml',
'en',
'eo',
'epo',
'es',
'et',
'eu',
'ext',
'fa',
'ff',
'fi',
'fiu-vro',
'fj',
'fo',
'fr',
'frp',
'fur',
'fy',
'ga',
'gan',
'gd',
'gl',
'glk',
'gn',
'got',
'gu',
'gv',
'ha',
'hak',
'haw',
'he',
'hi',
'hif',
'ho',
'hr',
'hsb',
'ht',
'hu',
'hy',
'hz',
'ia',
'id',
'ie',
'ig',
'ii',
'ik',
'ilo',
'io',
'is',
'it',
'iu',
'ja',
'jbo',
'jp',
'jv',
'ka',
'kaa',
'kab',
'kg',
'ki',
'kj',
'kk',
'kl',
'km',
'kn',
'ko',
'kr',
'ks',
'ksh',
'ku',
'kv',
'kw',
'ky',
'la',
'lad',
'lb',
'lbe',
'lg',
'li',
'lij',
'lmo',
'ln',
'lo',
'lt',
'lv',
'map-bms',
'mdf',
'mg',
'mh',
'mhr',
'mi',
'minnan',
'mk',
'ml',
'mn',
'mo',
'mr',
'ms',
'mt',
'mus',
'mwl',
'my',
'myv',
'mzn',
'na',
'nah',
'nan',
'nap',
'nb',
'nds',
'nds-nl',
'ne',
'new',
'ng',
'nl',
'nn',
'no',
'nomcom',
'nov',
'nrm',
'nv',
'ny',
'oc',
'om',
'or',
'os',
'pa',
'pag',
'pam',
'pap',
'pcd',
'pdc',
'pi',
'pih',
'pl',
'pms',
'pnb',
'pnt',
'ps',
'pt',
'qu',
'rm',
'rmy',
'rn',
'ro',
'roa-rup',
'roa-tara',
'ru',
'rw',
'sa',
'sah',
'sc',
'scn',
'sco',
'sd',
'se',
'sg',
'sh',
'si',
'simple',
'sk',
'sl',
'sm',
'sn',
'so',
'sq',
'sr',
'srn',
'ss',
'st',
'stq',
'su',
'sv',
'sw',
'szl',
'ta',
'te',
'tet',
'tg',
'th',
'ti',
'tk',
'tl',
'tn',
'to',
'tp',
'tpi',
'tr',
'ts',
'tt',
'tum',
'tw',
'ty',
'udm',
'ug',
'uk',
'ur',
'uz',
've',
'vec',
'vi',
'vls',
'vo',
'wa',
'war',
'wo',
'wuu',
'xal',
'xh',
'yi',
'yo',
'za',
'zea',
'zh',
'zh-cfr',
'zh-classical',
'zh-min-nan',
'zh-yue',
'zu',
];
for (var a = 0; a < GlobalWatchlist_WikiListLang.length; a++) {
GlobalWatchlist_WikiList.push('//' + GlobalWatchlist_WikiListLang[a] + '.wikipedia.org');
GlobalWatchlist_WikiList.push('//' + GlobalWatchlist_WikiListLang[a] + '.wikibooks.org');
GlobalWatchlist_WikiList.push('//' + GlobalWatchlist_WikiListLang[a] + '.wiktionary.org');
GlobalWatchlist_WikiList.push('//' + GlobalWatchlist_WikiListLang[a] + '.wikinews.org');
GlobalWatchlist_WikiList.push('//' + GlobalWatchlist_WikiListLang[a] + '.wikiquote.org');
GlobalWatchlist_WikiList.push('//' + GlobalWatchlist_WikiListLang[a] + '.wikisource.org');
GlobalWatchlist_WikiList.push('//' + GlobalWatchlist_WikiListLang[a] + '.wikiversity.org');
GlobalWatchlist_WikiList.push('//' + GlobalWatchlist_WikiListLang[a] + '.wikivoyage.org');
}
}
if (typeof (GlobalWatchlist_Classes) == 'undefined') {
window.GlobalWatchlist_Classes = {};
GlobalWatchlist_Classes['www.mediawiki.org'] = 'wwwmediawiki';
GlobalWatchlist_Classes['meta.wikimedia.org'] = 'metawiki';
GlobalWatchlist_Classes['commons.wikimedia.org'] = 'commons';
GlobalWatchlist_Classes['species.wikimedia.org'] = 'wikispecies';
GlobalWatchlist_Classes['www.wikidata.org'] = 'wikidata';
GlobalWatchlist_Classes['.wikipedia.org'] = 'wikipedia';
GlobalWatchlist_Classes['.wikibooks.org'] = 'wikibooks';
GlobalWatchlist_Classes['.wiktionary.org'] = 'wiktionary';
GlobalWatchlist_Classes['.wikinews.org'] = 'wikinews';
GlobalWatchlist_Classes['.wikiquote.org'] = 'wikiquote';
GlobalWatchlist_Classes['.wikisource.org'] = 'wikisource';
GlobalWatchlist_Classes['.wikiversity.org'] = 'wikiversity';
GlobalWatchlist_Classes['.wikivoyage.org'] = 'wikivoyage';
}
var GlobalWatchlist_Options = [];
var GlobalWatchlist_TimeCorrection = "00:00";
var GlobalWatchlist_Bugs = [];
//// نصوص الروابط ////
if (typeof (GlobalWatchlist_Text) == 'undefined') {
window.GlobalWatchlist_Text = {};
GlobalWatchlist_Text["Specialpage_Title"] = "المراقبة الشاملة";
GlobalWatchlist_Text["Specialpage_Desc"] = 'قائمة المراقبة الشاملة لمختلف مواقع الويكي';
GlobalWatchlist_Text["Specialpage_FormLegend"] = 'خيارات المراقبة الشاملة';
GlobalWatchlist_Text["Wikis_Tip"] = 'لاختيار موقع عدة أبق الضغط على زر التحكم Ctrl';
GlobalWatchlist_Text["Wikis_All"] = 'القائمة الشاملة';
GlobalWatchlist_Text["Wikis_Search"] = 'ابحث في موقع في القائمة';
GlobalWatchlist_Text["Wikis_Selected"] = 'المواقع المختارة';
GlobalWatchlist_Text["Wiki_Del"] = '<';
GlobalWatchlist_Text["Wiki_Del_title"] = 'إزالة موقع من القائمة';
GlobalWatchlist_Text["Wiki_Add"] = '>';
GlobalWatchlist_Text["Wiki_Add_title"] = 'إضافة موقع آخر للقائمة';
GlobalWatchlist_Text["OK"] = 'تحديث';
GlobalWatchlist_Text["OK_title"] = 'تحديث قائمة المراقبة الشاملة';
GlobalWatchlist_Text["Hide_bots"] = 'إخفاء البوتات';
GlobalWatchlist_Text["Hide_anon"] = 'إخفاء المستخدمين المجهولين';
GlobalWatchlist_Text["Hide_users"] = 'إخفاء المستخدمين المسجلين';
GlobalWatchlist_Text["Hide_minor"] = 'إخفاء التعديلات الطفيفة';
GlobalWatchlist_Text["Hide_self"] = 'إخفاء تعديلاتي';
GlobalWatchlist_Text["Hide_logs"] = 'إخفاء السجلات';
GlobalWatchlist_Text["Hide_all"] = 'إظهار أحدث التغييرات فقط';
GlobalWatchlist_Text["Show_notif"] = 'أبرز <b> بخط غليظ </b> الصفحات التي عدلت بعد آخر مرة فتحت قائمة المراقبة';
GlobalWatchlist_Text["Show_grouped"] = 'رتب التعديلات حسب الصفحات';
GlobalWatchlist_Text["ToggleLink_opened_Title"] = 'إخفاء هذه التعديلات';
GlobalWatchlist_Text["ToggleLink_closed_Title"] = 'التعديلات';
GlobalWatchlist_Text["ToggleLink_opened_Text"] = '▼';
GlobalWatchlist_Text["ToggleLink_closed_Text"] = '►';
GlobalWatchlist_Text["Timecorrection"] = "التوقيت المحلي";
GlobalWatchlist_Text["Link_pagetalk_title"] = "نقاش المقالة";
GlobalWatchlist_Text["Link_pagetalk_text"] = "نقاش";
GlobalWatchlist_Text["Link_diff_title"] = "فرق النسختين";
GlobalWatchlist_Text["Link_diff_text"] = "الفرق";
GlobalWatchlist_Text["Link_log_title"] = "السجل";
GlobalWatchlist_Text["Link_log_text"] = "السجل";
GlobalWatchlist_Text["Link_hist_title"] = "التاريخ";
GlobalWatchlist_Text["Link_hist_text"] = "تاريخ";
GlobalWatchlist_Text["Link_edit_title"] = "تحرير";
GlobalWatchlist_Text["Link_edit_text"] = "تحرير";
GlobalWatchlist_Text["Link_unwatch_title"] = "لا تراقب";
GlobalWatchlist_Text["Link_unwatch_text"] = "لا تراقب";
GlobalWatchlist_Text["Link_usertalk_title"] = "نقاش المستخدم";
GlobalWatchlist_Text["Link_usertalk_text"] = "نقاش";
GlobalWatchlist_Text["Link_usercontrib_title"] = "مساهمات المستخدم";
GlobalWatchlist_Text["Link_usercontrib_text"] = "مساهمات";
GlobalWatchlist_Text["BugReport_Class"] = '<b><u>بلاغ الأخطاء</u> </b><br> أبلغ $1 عن الخطأ: <pre> \n';
GlobalWatchlist_Text["Tags"] = {
"ثانوي": '<abbr class="minoredit" title="تعديل طفيف.">ط</abbr>',
"bot": '<abbr class="botedit" title="تعديل بوت.">ب</abbr>'/*,
"patrol": '<abbr class="unpatrolled" title="تعديل غير مراجع.">ر </abbr>'*/
};
GlobalWatchlist_Text["MonthNames"] = {
"1": "يناير",
"2": "فبراير",
"3": "مارس",
"4": "نيسان",
"5": "مايو",
"6": "يونيو",
"7": "يوليو",
"8": "أغسطس",
"9": "سبتمبر",
"10": "أكتوبر",
"11": "نوفمبر",
"12": "ديسمبر"
};
}
/////////////////////////////// FIN DE LA PARTIE PERSONNALISABLE /////////////////////////////
// Mise à jour du cookie
window.GlobalWatchlist_SetCookie = function (cookieName, cookieValue) {
mw.cookie.set(cookieName, cookieValue, 86400 * 365);
};
// Interrogation du cookie
window.GlobalWatchlist_GetCookie = function (cookieName) {
return mw.cookie.get(cookieName);
};
// Ajax
var GlobalWatchlist_ajax = {
http: function (bundle) { var xmlhttp; try { xmlhttp = new XMLHttpRequest(); } catch (e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlhttp = false; } } }; if (xmlhttp) { xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { GlobalWatchlist_ajax.httpComplete(xmlhttp, bundle); } }; xmlhttp.open(bundle.method ? bundle.method : "GET", bundle.url, bundle.async === false ? false : true); if (bundle.headers) { for (var field in bundle.headers) { try { xmlhttp.setRequestHeader(field, bundle.headers[field]); } catch (err) { } } }; xmlhttp.send(bundle.data ? bundle.data : null); }; return xmlhttp; },
httpComplete: function (xmlhttp, bundle) { if (xmlhttp.status == 200 || xmlhttp.status == 302) { if (bundle.onSuccess) bundle.onSuccess(xmlhttp, bundle); } else if (bundle.onFailure) { bundle.onFailure(xmlhttp, bundle); } else { } }
};
// Mise en forme de la page
window.GlobalWatchlist_Init = function () {
GlobalWatchlist_getShowOptions();
GlobalWatchlist_getTimeOptions();
$(document.body).addClass("GlobalWatchlist");
var Title = document.getElementsByTagName('title')[0];
Title.innerHTML = GlobalWatchlist_Text["Specialpage_Title"];
var FirstHeading = document.getElementById("firstHeading");
FirstHeading.innerHTML = GlobalWatchlist_Text["Specialpage_Title"];
var Content = document.getElementById("mw-content-text");
while (Content.firstChild) { Content.removeChild(Content.firstChild); }
var Options = GlobalWatchlist_GetCookie("GlobalWatchlistOptions");
if (Options !== null) {
GlobalWatchlist_Options = new Array();
OptionsSplit = decodeURIComponent(Options).split("SPLIT")
for (var a = 0; a < OptionsSplit.length; a++) {
if (OptionsSplit[a] != '' && OptionsSplit[a] != 'null') {
GlobalWatchlist_Options.push(OptionsSplit[a]);
}
}
}
var WikiTime = GlobalWatchlist_GetCookie("GlobalWatchlistTimeCorrection");
if (WikiTime != null) GlobalWatchlist_TimeCorrection = decodeURIComponent(WikiTime);
var tip = ' <sup><small><abbr title="' + GlobalWatchlist_Text["Wikis_Tip"] + '">(?)</abbr></small></sup>';
var GlobalWatchlist_Form = '<fieldset><legend>' + GlobalWatchlist_Text["Specialpage_FormLegend"] + '</legend>'
+ '<table align="center" style="background-color:transparent;"><tr><td>'
+ '<ul id="showOptions">'
+ '<li><select id="timecorrection" >';
for (var a = -23, l = 24; a < l; a++) {
var time = (a < 0 ? "-" : (a > 0 ? "+" : "")) + ((a * a) < 100 ? "0" + Math.abs(a) : Math.abs(a)) + ":00";
GlobalWatchlist_Form += ''
+ '<option value="' + time + '" ' + ((time == GlobalWatchlist_TimeCorrection) ? 'selected="selected" ' : '')
+ '>' + time + '</option>';
}
GlobalWatchlist_Form += ''
+ '</select> <label for="timecorrection">' + GlobalWatchlist_Text["Timecorrection"] + '</label></li>'
+ '<li><input type="checkbox" id="hideBots" '
+ 'value="!bot" ' + (GlobalWatchlist_Options.indexOf("!bot") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="hideBots">' + GlobalWatchlist_Text["Hide_bots"] + '</label></li>'
+ '<li><input type="checkbox" id="hideAnon" '
+ 'value="!anon" ' + (GlobalWatchlist_Options.indexOf("!anon") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="hideAnon">' + GlobalWatchlist_Text["Hide_anon"] + '</label></li>'
+ '<li><input type="checkbox" id="hideRegistred" '
+ 'value="anon" ' + (GlobalWatchlist_Options.indexOf("anon") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="hideRegistred">' + GlobalWatchlist_Text["Hide_users"] + '</label></li>'
+ '<li><input type="checkbox" id="hideMinor" '
+ 'value="!minor" ' + (GlobalWatchlist_Options.indexOf("!minor") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="hideMinor">' + GlobalWatchlist_Text["Hide_minor"] + '</label></li>'
+ '<li><input type="checkbox" id="hideMyself" '
+ 'value="!self" ' + (GlobalWatchlist_Options.indexOf("!self") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="hideMyself">' + GlobalWatchlist_Text["Hide_self"] + '</label></li>'
+ '<li><input type="checkbox" id="hideLogs" '
+ 'value="!log" ' + (GlobalWatchlist_Options.indexOf("!log") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="hideLogs">' + GlobalWatchlist_Text["Hide_logs"] + '</label></li>'
+ '<li><input type="checkbox" id="hideAll" '
+ 'value="!all" ' + (GlobalWatchlist_Options.indexOf("!all") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="hideAll">' + GlobalWatchlist_Text["Hide_all"] + '</label></li>'
+ '<li><input type="checkbox" id="showGrouped" '
+ 'value="grouped" ' + (GlobalWatchlist_Options.indexOf("grouped") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="showGrouped">' + GlobalWatchlist_Text["Show_grouped"] + '</label></li>'
+ '<li><input type="checkbox" id="showNotif" onclick="GlobalWatchlist_checkNotifShow()" '
+ 'value="notif" ' + (GlobalWatchlist_Options.indexOf("notif") != -1 ? 'checked="checked" ' : '') + '/>'
+ ' <label for="showNotif">' + GlobalWatchlist_Text["Show_notif"] + '</label></li>'
+ '</ul>'
+ '</td><td width="3%">'
+ '</td><td>'
+ '<center><span style="margin:0.3em;"><b>' + GlobalWatchlist_Text["Wikis_All"] + tip + '</b></span></center>'
+ '<center><input type="text" id="searchwiki" size="28" style="padding-top:0;padding-bottom:0;" '
+ 'onkeyup="GlobalWatchlist_Search();" title="' + GlobalWatchlist_Text["Wikis_Search"] + '"/></center>';
GlobalWatchlist_Form += ''
+ '<select id="ListWiki" name="ListWiki" align="top" size="12" multiple="multiple">';
GlobalWatchlist_WikiList.sort();
for (var i = 0; i < GlobalWatchlist_WikiList.length; i++) {
GlobalWatchlist_Form += '<option value="' + GlobalWatchlist_WikiList[i] + '">' + GlobalWatchlist_WikiList[i].split("//").join("") + '</option>'
}
GlobalWatchlist_Form += '</select>'
+ '</td><td>'
+ '<center><input type="button" name="Wiki_Del" '
+ 'value="' + GlobalWatchlist_Text["Wiki_Del"] + '" '
+ 'title="' + GlobalWatchlist_Text["Wiki_Del_title"] + '" '
+ 'onclick="GlobalWatchlist_SupprWiki();" onselect="GlobalWatchlist_SupprWiki();" />'
+ '<input type="button" name="Wiki_Add" '
+ 'value="' + GlobalWatchlist_Text["Wiki_Add"] + '" '
+ 'title="' + GlobalWatchlist_Text["Wiki_Add_title"] + '" '
+ 'onclick="GlobalWatchlist_AddWiki();" onselect="GlobalWatchlist_AddWiki();" /></center>'
+ '<center><input type="button" name="OK" '
+ 'value="' + GlobalWatchlist_Text["OK"] + '" '
+ 'title="' + GlobalWatchlist_Text["OK_title"] + '" '
+ 'style="padding:0;" '
+ 'onclick="GlobalWatchlist_Init();" onselect="GlobalWatchlist_Init();" /></center>'
+ '</td><td><center><span style="margin:0.3em;"><b>' + GlobalWatchlist_Text["Wikis_Selected"] + tip + '</b></span></center>'
+ '<select id="WatchWiki" name="WatchWiki" align="top" size="13" multiple="multiple">';
var WikiList = GlobalWatchlist_GetCookie("GlobalWatchlist");
if (WikiList != null) {
var GlobalWatchlist_WikiSuivis = new Array();
WikiListSplit = WikiList.split("SPLIT")
for (var a = 0; a < WikiListSplit.length; a++) {
if (WikiListSplit[a] != '' && WikiListSplit[a] != 'null') {
GlobalWatchlist_WikiSuivis.push(WikiListSplit[a]);
}
}
} else {
var GlobalWatchlist_WikiSuivis = new Array();
GlobalWatchlist_WikiSuivis.push(mw.config.get('wgServer'));
}
for (var a = 0; a < GlobalWatchlist_WikiSuivis.length; a++) {
GlobalWatchlist_Form += '<option value="' + GlobalWatchlist_WikiSuivis[a] + '" style="color:red;">' + GlobalWatchlist_WikiSuivis[a].split("//").join("") + '</option>';
}
GlobalWatchlist_Form += '</select>'
+ '</td></tr><tr></table>'
+ '<div id="GlobalWatchlist_bugreport" style="display:none;"></div></fieldset><div id="GlobalWatchlist_edits"></div>';
Content.innerHTML += GlobalWatchlist_Form;
GlobalWatchlist_checkNotifShow();
GlobalWatchlist_Launch();
};
window.GlobalWatchlist_deleteNotShowOptions = function (Text) {
var unwantedoptions = ["!self", "!all", "!log", "notif", "grouped"];
for (var a = 0, l = unwantedoptions.length; a < l; a++) { Text = Text.split(unwantedoptions[a]).join(""); }
Text = Text.split("||").join("");
return Text;
};
window.GlobalWatchlist_checkNotifShow = function () {
var notifInput = document.getElementById("showNotif");
if (notifInput.checked) $(document.body).addClass("mw-special-GlobalWatchlist");
else $(document.body).removeClass("mw-special-GlobalWatchlist");
};
// Affiche un lien vers la liste de suivi globale dans les outils personnels
window.GlobalWatchlist_Link = function () {
var LienWatchlist = document.getElementById('pt-watchlist');
if (LienWatchlist != null) {
mw.util.addPortletLink(
'p-personal',
'/w/index.php?title=Special:Blankpage/GlobalWatchlist',
GlobalWatchlist_Text["Specialpage_Title"],
'pt-Gwatchlist',
GlobalWatchlist_Text["Specialpage_Desc"],
null,
(mw.config.get('skin')=='vector-2022') && '#pt-mytalk' || '#pt-mycontris'
);
// var LienGlobalWatchlist = document.createElement('li');
// LienGlobalWatchlist.id = 'pt-Gwatchlist';
// if ((mw.config.get('wgCanonicalSpecialPageName') == "Blankpage") && (mw.config.get('wgTitle').split("/")[1] === "GlobalWatchlist"))
// LienGlobalWatchlist.className = "active";
// LienGlobalWatchlist.innerHTML = '<a href="' + mw.config.get('wgArticlePath').split("$1").join("Special:Blankpage/GlobalWatchlist") + '" title="' + GlobalWatchlist_Text["Specialpage_Desc"] + '" >' + GlobalWatchlist_Text["Specialpage_Title"] + '</a>';
// LienWatchlist.parentNode.insertBefore(LienGlobalWatchlist, LienWatchlist);
} else if (mw.config.get('skin') == "cologneblue") {
var LienWatchlist = document.getElementById('topbar').getElementsByTagName('a')[6];
var Separator = document.createTextNode(' | ');
var LienGlobalWatchlist = document.createElement('a');
if ((mw.config.get('wgCanonicalSpecialPageName') == "Blankpage") && (mw.config.get('wgTitle').split("/")[1] === "GlobalWatchlist"))
LienGlobalWatchlist.className = "active";
LienGlobalWatchlist.href = mw.config.get('wgArticlePath').split("$1").join("Special:Blankpage/GlobalWatchlist");
LienGlobalWatchlist.innerHTML = GlobalWatchlist_Text["Specialpage_Title"];
LienGlobalWatchlist.title = GlobalWatchlist_Text["Specialpage_Desc"];
LienWatchlist.parentNode.insertBefore(Separator, LienWatchlist);
LienWatchlist.parentNode.insertBefore(LienGlobalWatchlist, Separator);
}
};
// Ajoute un wiki à la liste de suivi
window.GlobalWatchlist_AddWiki = function () {
var ListeCompleteSelect = document.getElementById('ListWiki');
var ListeWikisSelect = document.getElementById('WatchWiki');
var ListeComplete = ListeCompleteSelect.getElementsByTagName('option');
var ListeWikis = ListeWikisSelect.getElementsByTagName('option');
var AncienneListe = new Array();
var NouvelleListe = new Array();
for (var a = 0; a < ListeWikis.length; a++) {
var WikiName = ListeWikis[a].value;
AncienneListe.push(WikiName);
NouvelleListe.push(WikiName);
}
for (var a = 0; a < ListeComplete.length; a++) {
if (!ListeComplete[a].selected) continue;
var WikiSelectedName = ListeComplete[a].value;
if (NouvelleListe.indexOf(WikiSelectedName) == -1) NouvelleListe.push(WikiSelectedName);
ListeComplete[a].selected = false;
}
var CookieValue = '';
for (var b = 0; b < NouvelleListe.length; b++) {
var NewWiki = NouvelleListe[b];
CookieValue += NewWiki + 'SPLIT';
if (AncienneListe.indexOf(NewWiki) == -1) {
var opt = document.createElement('option');
opt.value = NewWiki;
opt.innerHTML = NewWiki.split("//").join("");
opt.style.color = "red";
ListeWikisSelect.appendChild(opt);
}
}
GlobalWatchlist_SetCookie('GlobalWatchlist', CookieValue);
};
// Supprime un wiki de la liste de suivi
window.GlobalWatchlist_SupprWiki = function () {
var ListeWikisSelect = document.getElementById('WatchWiki');
var ListeWikis = ListeWikisSelect.getElementsByTagName('option');
var NouvelleListe = new Array();
var CookieValue = '';
for (var a = 0; a < ListeWikis.length; a++) {
var opt = ListeWikis[a];
if (!opt) continue;
if (opt.selected) {
opt.parentNode.removeChild(opt);
a--
} else {
var WikiName = opt.value;
NouvelleListe.push(WikiName);
CookieValue += WikiName + 'SPLIT';
}
}
GlobalWatchlist_SetCookie('GlobalWatchlist', CookieValue);
};
window.GlobalWatchlist_Search = function () {
var searchwiki = document.getElementById("searchwiki");
var Select = document.getElementById("ListWiki");
if (!searchwiki || !Select) return;
var text = "//" + searchwiki.value;
if (text === "//") return;
var Options = Select.getElementsByTagName('option');
for (var a = 0, l = Options.length; a < l; a++) {
var opt = Options[a];
if (opt.value.indexOf(text) == 0) {
GlobalWatchlist_ScrollToOption(Options[(l - 1)]);
GlobalWatchlist_ScrollToOption(opt);
return;
}
}
};
window.GlobalWatchlist_ScrollToOption = function (opt) {
if (!opt) return;
var isSelected = (opt.selected ? "selected" : false);
opt.selected = false;
opt.selected = "selected";
opt.selected = isSelected;
};
window.GlobalWatchlist_Launch = function () {
var Target = document.getElementById("GlobalWatchlist_edits");
var Select = document.getElementById("WatchWiki");
if (!Target || !Select) return;
while (Target.firstChild) { Target.removeChild(Target.firstChild); };
if (GlobalWatchlist_Options.indexOf("!bot") != -1) $(Target).addClass("nobots");
else $(Target).removeClass("nobots");
if (GlobalWatchlist_Options.indexOf("!minor") != -1) $(Target).addClass("nominors");
else $(Target).removeClass("nominors");
var Options = Select.getElementsByTagName('option');
if (Options.length === 0) return;
var Servers = new Array();
for (var a = 0, l = Options.length; a < l; a++) {
var Option = Options[a];
Option.style.color = "red";
Servers.push(Option.value);
}
GlobalWatchlist_Request(Servers, 0);
};
window.GlobalWatchlist_getShowOptions = function () {
var ShowOptions = document.getElementById("showOptions");
if (!ShowOptions) return;
GlobalWatchlist_Options = new Array();
var opts = ShowOptions.getElementsByTagName('input');
for (var a = 0, l = opts.length; a < l; a++) {
var opt = opts[a];
if (opt.type != "checkbox") continue;
var thisopt = opt.value;
if (opt.checked) {
GlobalWatchlist_Options.push(thisopt);
}
}
GlobalWatchlist_SetCookie('GlobalWatchlistOptions', GlobalWatchlist_Options.join("SPLIT"));
};
window.GlobalWatchlist_getTimeOptions = function () {
var Select = document.getElementById("timecorrection");
if (!Select) return;
var Time = Select.value;
GlobalWatchlist_TimeCorrection = Time;
GlobalWatchlist_SetCookie('GlobalWatchlistTimeCorrection', GlobalWatchlist_TimeCorrection);
};
var GlobalWatchlist_StandardURL = ''
+ '/w/api.php?format=xml&action=query&list=watchlist'
+ '&wllimit=499'
+ '&wlprop=ids|title|flags|user|userid|comment|parsedcomment|timestamp|sizes|notificationtimestamp|loginfo'
+ '&wltype=new|edit'; // |external
window.GlobalWatchlist_Request = function (Servers, position) {
var Server = Servers[position];
if (!Server) {
if (GlobalWatchlist_Options.indexOf("grouped") != -1) GlobalWatchlist_GroupEdits();
return;
}
if (Server == mw.config.get('wgServer')) {
var URL = Server + GlobalWatchlist_StandardURL;
if (GlobalWatchlist_Options.indexOf("!log") == -1) URL += '|log';
if (GlobalWatchlist_Options.indexOf("!all") == -1) URL += '&wlallrev';
if (GlobalWatchlist_Options.indexOf("!self") != -1) URL += '&wlexcludeuser=' + encodeURIComponent(mw.config.get('wgUserName'));
var otherShowOptions = GlobalWatchlist_deleteNotShowOptions(GlobalWatchlist_Options.join("|"));
if (otherShowOptions != "") URL += '&wlshow=' + otherShowOptions;
GlobalWatchlist_ajax.http({
url: URL,
servers: Servers,
serverpos: position,
onSuccess: GlobalWatchlist_FillEditsDiv,
onFailure: GlobalWatchlist_FillEditsDiv
});
} else {
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=centralauthtoken';
GlobalWatchlist_ajax.http({
url: URL,
servers: Servers,
serverpos: position,
onSuccess: GlobalWatchlist_ManageCentralAuthToken,
onFailure: GlobalWatchlist_ManageCentralAuthToken
});
}
};
window.GlobalWatchlist_ManageCentralAuthToken = function (Req, data) {
var centralauthtoken = false;
try {
var XML = Req.responseXML;
var Tokens = XML.getElementsByTagName('centralauthtoken')[0];
centralauthtoken = Tokens.getAttribute('centralauthtoken');
} catch (e) { }
if (!centralauthtoken) return GlobalWatchlist_Request(data.servers, (data.serverpos + 1));;
var Server = data.servers[data.serverpos];
var URL = Server + GlobalWatchlist_StandardURL
if (GlobalWatchlist_Options.indexOf("!log") == -1) URL += '|log';
if (GlobalWatchlist_Options.indexOf("!all") == -1) URL += '&wlallrev';
if (GlobalWatchlist_Options.indexOf("!self") != -1) URL += '&wlexcludeuser=' + encodeURIComponent(mw.config.get('wgUserName'));
var otherShowOptions = GlobalWatchlist_deleteNotShowOptions(GlobalWatchlist_Options.join("|"));
if (otherShowOptions != "") URL += '&wlshow=' + otherShowOptions;
URL += '&origin=' + encodeURIComponent(window.location.protocol + mw.config.get('wgServer'))
+ '¢ralauthtoken=' + encodeURIComponent(centralauthtoken);
GlobalWatchlist_ajax.http({
url: URL,
servers: data.servers,
serverpos: data.serverpos,
onSuccess: GlobalWatchlist_FillEditsDiv,
onFailure: GlobalWatchlist_FillEditsDiv
});
};
window.GlobalWatchlist_FillEditsDiv = function (Req, data) {
var Target = document.getElementById("GlobalWatchlist_edits");
var Select = document.getElementById("WatchWiki");
if (!Target || !Select) return;
var XML = Req.responseXML;
if (!XML) {
GlobalWatchlist_Request(data.servers, (data.serverpos + 1));
return;
}
var api = XML.getElementsByTagName('api')[0];
if (!api || api.firstChild.nodeName == "error") {
GlobalWatchlist_Request(data.servers, (data.serverpos + 1));
return;
}
var query = api.getElementsByTagName('query')[0];
if (!query) {
GlobalWatchlist_Request(data.servers, (data.serverpos + 1));
return;
}
var Server = data.servers[data.serverpos];
var items = api.getElementsByTagName('item');
for (var a = 0, l = items.length; a < l; a++) {
var item = items[a];
var watchtimestamp = GlobalWatchlist_FillEditsDiv_ManageTimestamp(item.getAttribute('timestamp'));
var watchpage = item.getAttribute('title');
var bot = (item.getAttribute('bot') === "");
var minor = (item.getAttribute('minor') === "");
var patrolled = (item.getAttribute('patrolled') === "");
var watchtype = item.getAttribute('type');
var watchlogtype = item.getAttribute('logtype');
var watchaction = item.getAttribute('logaction');
var notificationtimestamp = item.getAttribute('notificationtimestamp');
var date = parseInt(watchtimestamp.split("T")[0].split("-").join(""));
var oldUL = document.getElementById(date);
if (!oldUL) {
var uladded = false;
oldUL = document.createElement('ul');
oldUL.id = date;
oldUL.className = "special";
var AllUl = Target.getElementsByTagName('ul');
if (AllUl.length === 0) {
uladded = true;
Target.appendChild(oldUL);
} else {
for (var u = 0, ulen = AllUl.length; u < ulen; u++) {
if (uladded) continue;
var ul = AllUl[u];
var ulid = parseInt(ul.id);
if (ulid < date) {
ul.parentNode.insertBefore(oldUL, ul.previousSibling);
uladded = true;
}
}
}
if (!uladded) Target.appendChild(oldUL);
var DateLi = document.createElement("h4");
DateLi.className = "DateLi";
oldUL.parentNode.insertBefore(DateLi, oldUL);
var FormattedDate = watchtimestamp.split("T")[0].split("-");
FormattedDate = parseInt(FormattedDate[2]) + " " + GlobalWatchlist_Text["MonthNames"][parseInt(FormattedDate[1])] + " " + FormattedDate[0];
DateLi.innerHTML = FormattedDate;
}
var NotifyText = GlobalWatchlist_FillEditsDiv_CreateLiContent(item, Server);
var LiTs = parseInt(watchtimestamp.split("T").join("").split("Z").join("").split("-").join("").split(":").join(""));
var Li = document.createElement('li');
Li.id = LiTs;
Li.title = Server;
for (var servername in GlobalWatchlist_Classes) {
if (Server.indexOf(servername) != -1) Li.className = GlobalWatchlist_Classes[servername];
}
$(Li).addClass("GWLpage-" + GlobalWatchlist_FillEditsDiv_SanitizeClass(Server + "-_-" + watchpage));
if (watchtype === "log") {
$(Li).addClass("mw-changeslist-line-log");
$(Li).addClass("mw-changeslist-line-" + watchlogtype);
$(Li).addClass("mw-changeslist-line-" + watchlogtype + "-" + watchaction);
}
if (notificationtimestamp === "") $(Li).addClass("mw-changeslist-line-not-watched");
else $(Li).addClass("mw-changeslist-line-watched");
if (bot) $(Li).addClass("bot");
if (minor) $(Li).addClass("minor");
if (patrolled) $(Li).addClass("patrolled");
Li.innerHTML = NotifyText;
var addedli = false;
var alllis = oldUL.getElementsByTagName('li');
if (alllis.length === 0) {
oldUL.appendChild(Li);
addedli = true;
} else {
for (var u = 0, ulen = alllis.length; u < ulen; u++) {
if (addedli) continue;
var li = alllis[u];
var liid = parseInt(li.id);
if (liid < LiTs) {
li.parentNode.insertBefore(Li, li);
addedli = true;
}
}
}
if (!addedli) oldUL.appendChild(Li);
GlobalWatchlist_FillEditsDiv_ManageLiContent(Li, Server);
}
var Options = Select.getElementsByTagName('option');
for (var a = 0, l = Options.length; a < l; a++) {
var Option = Options[a];
if (Option.value != Server) continue;
Option.style.color = "green";
}
GlobalWatchlist_Request(data.servers, (data.serverpos + 1));
};
window.GlobalWatchlist_FillEditsDiv_SanitizeClass = function (ClassName) {
ClassName = ClassName.replace(/[\/ "'’`,;:~!%#&^\*\+\\\(\)\[\]\{\}\.\$\?]/g, "_");
// ClassName = ClassName.replace(/[\/ "'’,;:~!%#&^\*\+\\\(\)\[\]\{\}\.\$\?]/g, "_"); // For tests
return ClassName;
};
window.GlobalWatchlist_FillEditsDiv_CreateLiContent = function (item, Server) {
var watchtimestamp = GlobalWatchlist_FillEditsDiv_ManageTimestamp(item.getAttribute('timestamp'));
var watchtype = item.getAttribute('type');
var watchlogtype = item.getAttribute('logtype');
var watchaction = item.getAttribute('logaction');
var watchpageid = item.getAttribute('pageid');
var watcholdrevid = item.getAttribute('old_revid');
var watchrevid = item.getAttribute('revid');
var watchpage = item.getAttribute('title');
var watchuser = item.getAttribute('user');
var watchsum = item.getAttribute('parsedcomment');
var oldlen = parseInt(item.getAttribute('oldlen'));
var newlen = parseInt(item.getAttribute('newlen'));
var codedpage = encodeURIComponent(watchpage);
var codeduser = encodeURIComponent(watchuser);
var Time = watchtimestamp.split("T")[1].split("Z").join("");
var Type = (Server == mw.config.get('wgServer') ? 'target="_blank" ' : 'class="extiw" target="_blank" ');
var PageLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + codedpage + '" '
+ 'title="' + watchpage + '">' + watchpage + '</a>';
var DiffLink = "";
if (watchtype == "new") {
DiffLink = GlobalWatchlist_Text["Link_diff_text"];
} else if (watchtype == "edit") {
DiffLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + codedpage + '&diff=' + watchrevid + '&oldid=' + watcholdrevid + '" '
+ 'title="' + GlobalWatchlist_Text["Link_diff_title"] + '">' + GlobalWatchlist_Text["Link_diff_text"] + '</a>';
} else if (watchtype == "log") {
DiffLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=Special:Log&type=' + watchlogtype + '&page=' + codedpage + '&user=' + codeduser + '" '
+ 'title="' + GlobalWatchlist_Text["Link_log_title"] + ' ' + watchtype + '">' + GlobalWatchlist_Text["Link_log_text"] + ' ' + watchlogtype + '/' + watchaction + '</a>';
}
var HistLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + codedpage + '&action=history" '
+ 'title="' + GlobalWatchlist_Text["Link_hist_title"] + '">' + GlobalWatchlist_Text["Link_hist_text"] + '</a>';
var EditLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + codedpage + '&action=edit" '
+ 'title="' + GlobalWatchlist_Text["Link_edit_title"] + '">' + GlobalWatchlist_Text["Link_edit_text"] + '</a>';
var StopLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + codedpage + '&action=unwatch" '
+ 'title="' + GlobalWatchlist_Text["Link_unwatch_title"] + '">' + GlobalWatchlist_Text["Link_unwatch_text"] + '</a>';
var UserLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgArticlePath').split('$1').join('User:' + codeduser) + '" '
+ 'title="User:' + watchuser + '">' + watchuser + '</a>';
var UserTalkLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgArticlePath').split('$1').join('User talk:' + codeduser) + '" '
+ 'title="' + GlobalWatchlist_Text["Link_usertalk_title"] + '">' + GlobalWatchlist_Text["Link_usertalk_text"] + '</a>';
var UserContribLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgArticlePath').split('$1').join('Special:Contributions/' + codeduser) + '" '
+ 'title="' + GlobalWatchlist_Text["Link_usercontrib_title"] + '">' + GlobalWatchlist_Text["Link_usercontrib_text"] + '</a>';
var sizespan = "";
var loginfos = "";
if (watchtype != "log") {
var diffsize = (newlen - oldlen);
var sizeclass = "mw-plusminus-null";
if (diffsize < 0) sizeclass = "mw-plusminus-neg";
if (diffsize > 0) sizeclass = "mw-plusminus-pos";
sizespan = '<span class="mw-sizespan ' + sizeclass + '">' + ((diffsize * diffsize > 250000) ? '<b>(' + diffsize + ')</b>' : '(' + diffsize + ')') + '</span>';
} else {
loginfos = GlobalWatchlist_FillEditsDiv_getItemLogIfos(item, Server);
}
var tags = "";
for (var tag in GlobalWatchlist_Text["Tags"]) {
tags += GlobalWatchlist_Text["Tags"][tag];
}
var NotifyText = '$00 <span class="mw-changeslist-date" title="$01">$02</span> (<span class="mw-difflink">$04</span>|$05|$06|$07) <span class="mw-changeslist-separator">. .</span> <span class="mw-title">$03</span> <span class="mw-changeslist-separator">. .</span> $12 <span class="mw-changeslist-separator">. .</span> <span class="mw-user">$08</span> <span class="mw-usertoollinks">($09|$10)</span> <span class="comment">($11)</span>';
if (watchtype == "log") {
NotifyText = '$00 <span class="mw-changeslist-date" title="$01">$02</span> (<span class="mw-difflink">$04</span>) <span class="mw-changeslist-separator">. .</span> <span class="mw-title">$03</span> <span class="mw-changeslist-separator">. .</span> <span class="mw-user">$08</span> <span class="mw-usertoollinks">($09|$10)</span> $13 <span class="comment">($11)</span>';
}
NotifyText = NotifyText.split('$00').join(tags);
NotifyText = NotifyText.split('$01').join(Server);
NotifyText = NotifyText.split('$02').join(Time);
NotifyText = NotifyText.split('$03').join(PageLink);
NotifyText = NotifyText.split('$04').join(DiffLink);
NotifyText = NotifyText.split('$05').join(HistLink);
NotifyText = NotifyText.split('$06').join(EditLink);
NotifyText = NotifyText.split('$07').join(StopLink);
NotifyText = NotifyText.split('$08').join(UserLink);
NotifyText = NotifyText.split('$09').join(UserTalkLink);
NotifyText = NotifyText.split('$10').join(UserContribLink);
NotifyText = NotifyText.split('$11').join(watchsum);
NotifyText = NotifyText.split('$12').join(sizespan);
NotifyText = NotifyText.split('$13').join(loginfos);
return NotifyText;
};
window.GlobalWatchlist_FillEditsDiv_getItemLogIfos = function (item, Server) {
var loginfos = "";
var watchlogtype = item.getAttribute('logtype');
var watchaction = item.getAttribute('logaction');
var Type = (Server == mw.config.get('wgServer') ? 'target="_blank" ' : 'class="extiw" target="_blank" ');
switch (watchlogtype) {
case 'protect':
try { loginfos = item.firstChild.firstChild.nodeValue; } catch (e) { }
break;
case 'move':
try {
var newtitle = item.firstChild.getAttribute("new_title");
if (!newtitle) newtitle = item.firstChild.getAttribute("target_title");
loginfos = "→" + '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + encodeURIComponent(newtitle) + '" '
+ 'title="' + newtitle + '">' + newtitle + '</a>';
} catch (e) { }
break;
case 'block':
try {
var itemFSAttr = item.firstChild.attributes;
for (var a = 0, l = itemFSAttr.length; a < l; a++) {
var attrname = itemFSAttr[a].name;
var attrvalue = itemFSAttr[a].value;
loginfos = (loginfos == "" ? "" : "|") + attrname + "=" + (attrname == "expiry" ? GlobalWatchlist_FillEditsDiv_ManageTimestamp(attrvalue) : attrvalue);
}
} catch (e) { }
break;
}
return "[" + loginfos + "]";
};
window.GlobalWatchlist_FillEditsDiv_ManageTimestamp = function (ts) {
var Correction = parseInt(GlobalWatchlist_TimeCorrection.split(":")[0]);
var TS = ts.replace(/\D/g, "|").split("|");
var year = parseInt(TS[0]);
var month = (parseInt(TS[1]) - 1);
var day = parseInt(TS[2]);
var hours = parseInt(TS[3]);
var minutes = parseInt(TS[4]);
var seconds = parseInt(TS[5]);
var TSDate = (new Date(year, month, day, hours, minutes, seconds)).getTime();
var CorrectedTSDate = TSDate + (Correction * 1000 * 60 * 60);
var RD = new Date();
RD.setTime(CorrectedTSDate);
function AddZ(txt) { return ((parseInt(txt) < 10) ? "0" + txt : txt); }
var RDS = {
"y": RD.getFullYear(),
"M": AddZ(RD.getMonth() + 1),
"d": AddZ(RD.getDate()),
"h": AddZ(RD.getHours()),
"m": AddZ(RD.getMinutes()),
"s": AddZ(RD.getSeconds())
}
var correctedts = RDS["y"] + "-" + RDS["M"] + "-" + RDS["d"] + "T" + RDS["h"] + ":" + RDS["m"] + ":" + RDS["s"] + "Z";
return correctedts;
};
window.GlobalWatchlist_FillEditsDiv_ManageLiContent = function (Li, Server) {
if (Server == mw.config.get('wgServer')) return;
var Links = $.makeArray($(Li).find('span.comment a'));
for (var a = 0, l = Links.length; a < l; a++) {
var Link = Links[a];
if (!$(Link).hasClass("extiw")) {
Link.href = Server + Link.href.split(window.location.protocol + mw.config.get('wgServer')).join("").split(mw.config.get('wgServer')).join("");
$(Link).addClass("extiw");
}
Link.target = "_blank";
}
};
window.GlobalWatchlist_GroupEdits = function () {
GlobalWatchlist_Bugs = new Array();
var Div = document.getElementById("GlobalWatchlist_edits");
if (!Div) return;
var Uls = $.makeArray($(Div).find('ul.special'));
for (var a = 0, l = Uls.length; a < l; a++) {
GlobalWatchlist_GroupULEdits(Uls[a]);
}
GlobalWatchlist_GroupEdits_ReportBugs();
};
window.GlobalWatchlist_GroupULEdits = function (UL) {
var Li = UL.firstChild;
while (Li) {
var infos = "";
var Classes = Li.className.split(" ");
for (var a = 0, l = Classes.length; a < l; a++) {
var ThisClass = Classes[a];
if (ThisClass.indexOf("GWLpage-") === 0) infos = ThisClass;
}
if (infos !== "") {
try {
var AllLis = $.makeArray($(UL).find('li.' + infos));
if (AllLis.length > 1) {
var NewLi = document.createElement("li");
Li.parentNode.insertBefore(NewLi, Li);
var NewUL = document.createElement("ul");
NewLi.appendChild(NewUL);
for (var a = 0, l = AllLis.length; a < l; a++) {
var thisli = AllLis[a];
thisli.parentNode.removeChild(thisli);
NewUL.appendChild(thisli);
}
GlobalWatchlist_GroupULEdits_EditLiContent(NewLi);
Li = NewLi;
}
} catch (e) {
if (GlobalWatchlist_Bugs.indexOf(infos) == -1) GlobalWatchlist_Bugs.push(infos);
}
}
Li = Li.nextSibling;
if (!Li) break;
}
var ToggleLinks = $.makeArray($(UL).find('a.GlobalWatchlist-toggleLink'));
for (var a = 0, l = ToggleLinks.length; a < l; a++) { GlobalWatchlist_ToggleEdits(ToggleLinks[a]); }
};
window.GlobalWatchlist_GroupEdits_ReportBugs = function () {
var BugDiv = document.getElementById("GlobalWatchlist_bugreport");
var BugLength = GlobalWatchlist_Bugs.length;
if (BugLength === 0) {
BugDiv.innerHTML = "";
BugDiv.style.display = "none";
return;
}
var DevLink = '<a href="//fr.wikipedia.org/wiki/Discussion_utilisateur:Dr_Brains">Dr Brains</a>';
var Text = GlobalWatchlist_Text["BugReport_Class"].split("$1").join(DevLink);
for (var a = 0, l = BugLength; a < l; a++) {
Text += '* ' + GlobalWatchlist_Bugs[a] + '\n';
}
Text += '</pre>';
BugDiv.innerHTML = Text;
BugDiv.style.display = "";
};
window.GlobalWatchlist_GroupULEdits_EditLiContent = function (NewLi) {
var Lis = $.makeArray($(NewLi).find('li'));
var FirstOldLi = Lis[0];
var Title = $.makeArray($(FirstOldLi).find('span.mw-title a'))[0].innerHTML;
var Server = FirstOldLi.title;
var Type = (Server == mw.config.get('wgServer') ? 'target="_blank" ' : 'class="extiw" target="_blank" ');
var Time = $.makeArray($(FirstOldLi).find('span.mw-changeslist-date'))[0].innerHTML;
var PageLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + encodeURIComponent(Title) + '" '
+ 'title="' + Title + '">' + Title + '</a>';
var HistLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + encodeURIComponent(Title) + '&action=history" '
+ 'title="' + GlobalWatchlist_Text["Link_hist_title"] + '">' + GlobalWatchlist_Text["Link_hist_text"] + '</a>';
var EditLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + encodeURIComponent(Title) + '&action=edit" '
+ 'title="' + GlobalWatchlist_Text["Link_edit_title"] + '">' + GlobalWatchlist_Text["Link_edit_text"] + '</a>';
var StopLink = '<a ' + Type + 'href="' + Server + mw.config.get('wgScript') + '?title=' + encodeURIComponent(Title) + '&action=unwatch" '
+ 'title="' + GlobalWatchlist_Text["Link_unwatch_title"] + '">' + GlobalWatchlist_Text["Link_unwatch_text"] + '</a>';
var Users = new Array();
var watchmissing = false;
var diffsize = 0;
for (var a = 0, l = Lis.length; a < l; a++) {
if ($(Lis[a]).hasClass("mw-changeslist-line-watched")) watchmissing = true;
var User = $.makeArray($(Lis[a]).find('span.mw-user a'))[0].innerHTML;
var UserLink = '<a ' + Type + 'href="' + Server + '/wiki/User:' + encodeURIComponent(User) + '" '
+ 'title="User:' + User + '">' + User + '</a>';
Users.push(UserLink);
var SizeSpan = $.makeArray($(Lis[a]).find('span.mw-sizespan'))[0];
if (SizeSpan) {
var ThisSize = parseInt(SizeSpan.innerHTML.replace(/[^0-9\-]/g, ""));
diffsize = diffsize + ThisSize;
}
var PageTitle = $.makeArray($(Lis[a]).find('span.mw-title a'))[0];
PageTitle.parentNode.removeChild(PageTitle);
var FirstSeperator = $.makeArray($(Lis[a]).find('span.mw-changeslist-separator'))[0];
FirstSeperator.parentNode.removeChild(FirstSeperator);
}
var UserLinks = new Array();
var UserLinksCount = new Array();
for (var a = 0, l = Users.length; a < l; a++) {
var ThisUserLink = Users[a];
var index = UserLinks.indexOf(ThisUserLink);
if (index == -1) {
UserLinks.push(ThisUserLink);
UserLinksCount.push(1);
} else {
UserLinksCount[index] = (UserLinksCount[index] + 1);
}
}
for (var a = 0, l = UserLinks.length; a < l; a++) {
if (UserLinksCount[a] > 1) UserLinks[a] = UserLinks[a] + "(" + UserLinksCount[a] + "×)";
}
var tags = "";
for (var tag in GlobalWatchlist_Text["Tags"]) {
tags += GlobalWatchlist_Text["Tags"][tag];
}
var sizeclass = "mw-plusminus-null";
if (diffsize < 0) sizeclass = "mw-plusminus-neg";
if (diffsize > 0) sizeclass = "mw-plusminus-pos";
var sizespan = '<span class="mw-sizespan ' + sizeclass + '">' + ((diffsize * diffsize > 250000) ? '<b>(' + diffsize + ')</b>' : '(' + diffsize + ')') + '</span>';
var NotifyText = '<span class="notag">$00 </span><span class="mw-changeslist-date" title="$01">$02</span> ($05|$06|$07) <span class="mw-changeslist-separator">. .</span> <span class="mw-title">$03</span> <span class="mw-changeslist-separator">. .</span> $12 <span class="mw-changeslist-separator">. .</span> <span class="changedby">[$14]</span>';
NotifyText = NotifyText.split('$00').join(tags);
NotifyText = NotifyText.split('$01').join(Server);
NotifyText = NotifyText.split('$02').join(Time);
NotifyText = NotifyText.split('$03').join(PageLink);
NotifyText = NotifyText.split('$05').join(HistLink);
NotifyText = NotifyText.split('$06').join(EditLink);
NotifyText = NotifyText.split('$07').join(StopLink);
NotifyText = NotifyText.split('$12').join(sizespan);
NotifyText = NotifyText.split('$14').join(UserLinks.join("; "));
for (var servername in GlobalWatchlist_Classes) {
if (Server.indexOf(servername) != -1) $(NewLi).addClass(GlobalWatchlist_Classes[servername]);
}
if (watchmissing) $(NewLi).addClass("mw-changeslist-line-watched");
else $(NewLi).addClass("mw-changeslist-line-not-watched");
var Span = document.createElement('span');
Span.innerHTML = NotifyText;
NewLi.insertBefore(Span, NewLi.firstChild);
NewLi.insertBefore(GlobalWatchlist_GroupULEdits_CreateToggleLink(NewLi), NewLi.firstChild);
};
window.GlobalWatchlist_GroupULEdits_CreateToggleLink = function (NewLi) {
var Link = document.createElement('a');
Link.className = "GlobalWatchlist-toggleLink";
Link.title = GlobalWatchlist_Text["ToggleLink_opened_Title"];
Link.innerHTML = GlobalWatchlist_Text["ToggleLink_opened_Text"];
Link.href = "javascript:;";
Link.onclick = function () { GlobalWatchlist_ToggleEdits(this); return false; }
return Link;
};
window.GlobalWatchlist_ToggleEdits = function (ToggleLink) {
if (!ToggleLink) return;
var Li = ToggleLink.parentNode;
var Ul = Li.getElementsByTagName('ul')[0];
if (!Ul) return;
if (ToggleLink.title == GlobalWatchlist_Text["ToggleLink_closed_Title"]) {
Ul.style.display = "";
ToggleLink.title = GlobalWatchlist_Text["ToggleLink_opened_Title"];
ToggleLink.innerHTML = GlobalWatchlist_Text["ToggleLink_opened_Text"];
} else {
Ul.style.display = "none";
ToggleLink.title = GlobalWatchlist_Text["ToggleLink_closed_Title"];
ToggleLink.innerHTML = GlobalWatchlist_Text["ToggleLink_closed_Text"];
}
ToggleLink.blur();
};
// Fonction de lancement
if ((mw.config.get('wgCanonicalSpecialPageName') == "Blankpage") && (mw.config.get('wgTitle').split("/")[1] === "GlobalWatchlist")) {
mw.loader.load('//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-GlobalWatchlist.css&action=raw&ctype=text/css', 'text/css');
mw.loader.using(['user', 'mediawiki.cookie'], function () {
$(GlobalWatchlist_Init);
});
}
$(GlobalWatchlist_Link);
// </nowiki></pre></source>