From 588cc40aeec0165400421ef9612e81b6d2c7b936 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 13 Jun 2012 23:40:19 +0200 Subject: Update to MediaWiki 1.19.1 --- extensions/Vector/Vector.i18n.php | 104 +++++- extensions/Vector/Vector.php | 5 +- .../Vector/modules/ext.vector.collapsibleNav.css | 89 +++-- .../Vector/modules/ext.vector.collapsibleNav.js | 399 +++++++++++---------- .../Vector/modules/ext.vector.collapsibleTabs.js | 102 +++--- .../Vector/modules/ext.vector.editWarning.js | 69 ++-- .../Vector/modules/ext.vector.expandableSearch.css | 4 +- .../Vector/modules/ext.vector.expandableSearch.js | 70 ++-- .../Vector/modules/ext.vector.footerCleanup.css | 42 ++- .../Vector/modules/ext.vector.footerCleanup.js | 14 +- .../Vector/modules/ext.vector.sectionEditLinks.css | 10 +- .../Vector/modules/ext.vector.sectionEditLinks.js | 10 +- .../Vector/modules/ext.vector.simpleSearch.js | 88 ++--- 13 files changed, 579 insertions(+), 427 deletions(-) (limited to 'extensions/Vector') diff --git a/extensions/Vector/Vector.i18n.php b/extensions/Vector/Vector.i18n.php index 904d1d5d..8283c9c4 100644 --- a/extensions/Vector/Vector.i18n.php +++ b/extensions/Vector/Vector.i18n.php @@ -29,13 +29,16 @@ If you are logged in, you can disable this warning in the "Editing" section of y * @author Fryed-peach * @author Lloffiwr * @author Nemo bis + * @author Srtxg * @author Umherirrender */ $messages['qqq'] = array( 'vector' => 'UI means User Interface. Vector is the name of an interface skin.', 'vector-desc' => '{{desc}}', 'vector-collapsiblenav-preference' => 'The message refers to the sidebar, whose sections are collapsible in Vector skin (some of them collapsed by default and some no); the preference disables collapsing entirely and is among "Advanced options" in the "Appearence" section.', - 'vector-editwarning-warning' => "{{doc-important|Do ''not'' use {{int:prefs-editing}} for \"Editing\". It is forbidden in this message, see [[mwr:68405]].}}", + 'vector-editwarning-warning' => "{{doc-important|Do ''not'' use {{int:prefs-editing}} for \"Editing\". It is forbidden in this message, see [[mwr:68405]].}} + +but you can see the text of that button here: {{msg-mw|Prefs-editing}}", 'vector-simplesearch-search' => 'Greyed out default text in the simple search box in the Vector skin. (It disappears and lets the user enter the requested search terms when the search box receives focus.) {{Identical|Search}}', @@ -108,6 +111,7 @@ $messages['an'] = array( /** Arabic (العربية) * @author Aiman titi * @author Alexknight12 + * @author DRIHEM * @author Meno25 * @author OsamaK */ @@ -122,6 +126,7 @@ $messages['ar'] = array( 'vector-simplesearch-search' => 'ابحث', 'vector-simplesearch-containing' => 'يحتوي...', 'vector-noexperiments-preference' => 'استبعدني من تجارب الخاصية', + 'vector-footercleanup-transclusion' => 'هذه الصفحة تحتوي على {{PLURAL:$1تضمين|تضمينات}} لـ {{PLURAL:$1|صفحة واحدة أخرى|$1 صفحات أخرى}}.', ); /** Aramaic (ܐܪܡܝܐ) @@ -129,7 +134,7 @@ $messages['ar'] = array( */ $messages['arc'] = array( 'vector-simplesearch-search' => 'ܒܨܝ', - 'vector-simplesearch-containing' => 'ܚܒܫ ܥܠ...', + 'vector-simplesearch-containing' => 'ܬܚܒܘܫ...', ); /** Egyptian Spoken Arabic (مصرى) @@ -148,6 +153,18 @@ $messages['arz'] = array( 'vector-simplesearch-containing' => 'جوّاه...', ); +/** Assamese (অসমীয়া) + * @author Bishnu Saikia + * @author Gitartha.bordoloi + */ +$messages['as'] = array( + 'vector-collapsiblenav-more' => 'অধিক ভাষা', + 'vector-editwarning-preference' => 'সালসলনি সংৰক্ষণ নকৰাকৈ সম্পাদনা পৃষ্ঠা ত্যাগৰ সময়ত মোক সাৱধান কৰক', + 'vector-simplesearch-search' => 'সন্ধান কৰক', + 'vector-simplesearch-containing' => 'যি আছে...', + 'vector-noexperiments-preference' => 'ভৱিষ্যতৰ পৰীক্ষাবোৰৰ পৰা মোক ৰেহাই দিয়ক', +); + /** Asturian (Asturianu) * @author Xuacu */ @@ -271,6 +288,7 @@ $messages['bjn'] = array( /** Bengali (বাংলা) * @author Bellayet + * @author Nasir8891 * @author Wikitanvir */ $messages['bn'] = array( @@ -283,6 +301,7 @@ $messages['bn'] = array( 'vector-editwarning-preference' => 'অসংরক্ষিত পরিবর্তন সহ কোনো পাতা ত্যাগের সময় সাবধান করো', 'vector-simplesearch-search' => 'অনুসন্ধান', 'vector-simplesearch-containing' => 'যা আছে...', + 'vector-noexperiments-preference' => 'বৈশিষ্ট পরীক্ষার তালিকা থেকে আমাকে বাদ দেয়া হোক', ); /** Bishnupria Manipuri (ইমার ঠার/বিষ্ণুপ্রিয়া মণিপুরী) @@ -451,16 +470,17 @@ Gallwch ddiddymu\'r rhybudd hwn yn yr adran "Golygu" yn eich dewisiadau.', * @author Sir48 */ $messages['da'] = array( - 'vector' => 'Forbedringer af brugerinterfacet til Vector', - 'vector-desc' => 'Forbedrer dele af brugerinterfacet til Vector-skinnet', - 'vector-collapsiblenav-preference' => 'Aktiver sammenklapning i navigationsmenuen i Vector-skinnet', + 'vector' => 'Forbedringer af brugerfladen til Vector', + 'vector-desc' => 'Forbedrer dele af brugerfladen til Vector-udseendet.', + 'vector-collapsiblenav-preference' => 'Aktiver sammenklapning af sidemenuen i Vector-udseendet', 'vector-collapsiblenav-more' => 'Flere sprog', 'vector-editwarning-warning' => 'Hvis du forlader siden nu, risikerer du at miste alle ændringer som du har lavet. Denne advarsel kan slås fra under Redigering i dine indstillinger.', - 'vector-editwarning-preference' => 'Advar mig hvis jeg forlader en redigeringsside med ikke gemte ændringer.', + 'vector-editwarning-preference' => 'Advar mig, hvis jeg forlader en redigeringsside med ændringer, der ikke er gemt.', 'vector-simplesearch-search' => 'Søg', 'vector-simplesearch-containing' => 'indeholder...', 'vector-noexperiments-preference' => 'Udeluk mig fra funktionseksperimenter', + 'vector-footercleanup-transclusion' => 'Denne side indeholder {{PLURAL:$1|en transklusion|transklusioner}} af {{PLURAL:$1|én anden side|$1 andre sider}}.', ); /** German (Deutsch) @@ -505,7 +525,8 @@ $messages['diq'] = array( eke şıma kewtê hesabê xo, no hişyari tercihanê xo ra şıma eşkeni "Ho vurnayeno" bıvındarnî .', 'vector-editwarning-preference' => 'wexta ke ez pelo nêqeydbiyaye ra veciyaya mı hişyar bıker', 'vector-simplesearch-search' => 'Cı geyre', - 'vector-simplesearch-containing' => 'tedeestey...', + 'vector-simplesearch-containing' => 'Estên...', + 'vector-noexperiments-preference' => 'Mı tewrê cerbnayışan dê bahdoyêna meke', ); /** Lower Sorbian (Dolnoserbski) @@ -619,6 +640,7 @@ Saioa hasi baduzu, mezu hau kendu dezakezu zure hobespenen orrialdeko "Aldatzen" * @author Huji * @author Ladsgroup * @author Sahim + * @author ZxxZxxZ */ $messages['fa'] = array( 'vector' => 'بهبودهای رابط کاربر برای پوستهٔ برداری', @@ -631,6 +653,7 @@ $messages['fa'] = array( 'vector-simplesearch-search' => 'جستجو', 'vector-simplesearch-containing' => 'صفحه‌های دربردارنده...', 'vector-noexperiments-preference' => 'من را از ویژگی‌های آزمایشی مستثنی کن', + 'vector-footercleanup-transclusion' => 'این صفحه شامل {{PLURAL:$1|تراگنجانش|تراگنجانش‌های}} {{PLURAL:$1|صفحه‌ای دیگر است|$1 صفحهٔ دیگر است}}.', ); /** Finnish (Suomi) @@ -953,6 +976,7 @@ No nakastrekka, mabalin mo nga ikkaten daytoy a ballaag idiay "Panagurnos" a pas 'vector-simplesearch-search' => 'Biruken', 'vector-simplesearch-containing' => 'naglaon ti...', 'vector-noexperiments-preference' => 'Saannak nga iraman kadagiti eksperimento a langa', + 'vector-footercleanup-transclusion' => 'Daytoy a panid ket naglaon {{PLURAL:$1|ti transklusion|dagiti transklusion}} iti {{PLURAL:$1|maysa a panid|$1 dadduma a pampanid}}.', ); /** Ido (Ido) @@ -998,6 +1022,7 @@ Se sei loggato, puoi disattivare questo avviso nella sezione "Casella di modific 'vector-simplesearch-search' => 'Ricerca', 'vector-simplesearch-containing' => 'contenente...', 'vector-noexperiments-preference' => 'Escludimi dalle funzionalità sperimentali', + 'vector-footercleanup-transclusion' => "Questa pagina contiene {{PLURAL:$1|un'inclusione|delle inclusioni}} di {{PLURAL:$1|un'altra pagina|$1 altre pagine}}.", ); /** Japanese (日本語) @@ -1007,8 +1032,8 @@ Se sei loggato, puoi disattivare questo avviso nella sezione "Casella di modific * @author 青子守歌 */ $messages['ja'] = array( - 'vector' => 'ベクター用ユーザーインターフェイス改良', - 'vector-desc' => 'ベクター外装のユーザーインターフェイス要素を改良します。', + 'vector' => 'ベクター外装用ユーザーインターフェイス改良', + 'vector-desc' => 'ベクター外装のユーザーインターフェイス要素を改良する', 'vector-collapsiblenav-preference' => 'ベクター外装のナビゲーションで、項目の折り畳みを有効にする', 'vector-collapsiblenav-more' => '他の言語', 'vector-editwarning-warning' => 'このページを離れると、あなたが行った変更はすべて失われてしまうかもしれません。ログインしている場合、個人設定の「編集」タブでこの警告を表示しないようにすることができます。', @@ -1085,6 +1110,7 @@ $messages['km'] = array( * @author Albamhandae * @author IRTC1015 * @author Kwj2772 + * @author 아라 */ $messages['ko'] = array( 'vector' => '벡터 스킨의 인터페이스 향상', @@ -1097,6 +1123,7 @@ $messages['ko'] = array( 'vector-simplesearch-search' => '검색', 'vector-simplesearch-containing' => '다음의 어구가 들어간 문서 찾기', 'vector-noexperiments-preference' => '새 기능 실험에서 나를 제외합니다.', + 'vector-footercleanup-transclusion' => '이 페이지는 다른 $1 페이지의 트랜스클루전이 포함되어 있습니다.', ); /** Karachay-Balkar (Къарачай-Малкъар) @@ -1128,6 +1155,7 @@ Do kanns heh di Warnung affschallde, wann de aanjemelldt un enjelogg bes, dann k 'vector-simplesearch-search' => 'Söhke', 'vector-simplesearch-containing' => 'dren änthallde…', 'vector-noexperiments-preference' => 'Donn mesch nit met neue Saache zom Ußprobeere behällijje', + 'vector-footercleanup-transclusion' => 'Heh di Sigg trick {{PLURAL:$1|ein ander Sigg|$1 ander Sigge|kein ander Sigg}} en sesch eren.', ); /** Kurdish (Latin script) (‪Kurdî (latînî)‬) @@ -1141,14 +1169,15 @@ $messages['ku-latn'] = array( /** Cornish (Kernowek) * @author Kw-Moon + * @author Nrowe */ $messages['kw'] = array( - 'vector-collapsiblenav-more' => 'Moy a yethow', - 'vector-editwarning-warning' => 'Mar qwrewgh whi gara an folen-ma, whi a alja kelly chanjyow eus gwres genowgh. -Mars owgh whi omgelmys, whi a ell dialosegy an gwarnyans-ma en trogh "Chanjya" agas dowisyanjow.', - 'vector-editwarning-preference' => 'Gwra ow gwarnya pan von gara folen chanjya gen chanjyow nag eus gwithys', - 'vector-simplesearch-search' => 'Whilas', - 'vector-simplesearch-containing' => 'ow senjy...', + 'vector-collapsiblenav-more' => 'Moy yethow', + 'vector-editwarning-warning' => 'Mar tewgh hwi ha gasa an folen-ma, hwi a alsa kelli chanjyow eus gwres genowgh. +Mars owgh hwi omgelmys, hwi a ell dialosegi an gwarnyans-ma en trogh "Chanjya" agas dowisyansow.', + 'vector-editwarning-preference' => 'Gwra ow gwarnya pan wrellen vy gasa folen chanjya gans chanjyow nag eus gwithys', + 'vector-simplesearch-search' => 'Hwilas', + 'vector-simplesearch-containing' => 'ow senji...', ); /** Latin (Latina) */ @@ -1195,6 +1224,7 @@ Es se bös aangemeld, kins se dees waorsjoewing oetzètten in 't bewerkingstabbl 'vector-simplesearch-search' => 'Zeuke', 'vector-simplesearch-containing' => 'bevat...', 'vector-noexperiments-preference' => "Laot mich in 't vervolg neet mier mitdoon aan experimente", + 'vector-footercleanup-transclusion' => "Dees pagina bevat {{PLURAL:$1|'n transclusie|transclusies}} van {{PLURAL:$1|ein anger pagina|$1 anger pagina's}}.", ); /** Lithuanian (Lietuvių) @@ -1447,6 +1477,14 @@ $messages['pdc'] = array( 'vector-simplesearch-search' => 'Uffgucke', ); +/** Pälzisch (Pälzisch) + * @author Manuae + */ +$messages['pfl'] = array( + 'vector-collapsiblenav-more' => 'Mea Schbooche', + 'vector-simplesearch-search' => 'Suche', +); + /** Polish (Polski) * @author BeginaFelicysym * @author Sp5uhe @@ -1480,6 +1518,7 @@ S'it ses logà, it peule disabilité st'avis-sì ant la session \"Quàder ëd mo 'vector-simplesearch-search' => 'Arserca', 'vector-simplesearch-containing' => 'contenent ...', 'vector-noexperiments-preference' => "Gav-me da j'esperiment ëd le funsion", + 'vector-footercleanup-transclusion' => "Costa pàgina a conten {{PLURAL:$1|transclusion|transclusion}} ëd {{PLURAL:$1|n'àutra pàgina|$1 àutre pàgine}}.", ); /** Western Punjabi (پنجابی) @@ -1563,7 +1602,7 @@ Yaykusqa kaspaykiqa, kay yuyampayta hark'ayta atinki allinkachinaykikunapi \"Lla 'vector-noexperiments-preference' => 'Ñuqawan ama lliplli llanchikukunata ruraychu', ); -/** Romanian (Română) +/** Romanian (română) * @author AdiJapan * @author Minisarm */ @@ -1578,6 +1617,7 @@ Dacă sunteți autentificat, puteți dezactiva această avertizare în secțiune 'vector-simplesearch-search' => 'Căutare', 'vector-simplesearch-containing' => 'conținând...', 'vector-noexperiments-preference' => 'Nu mai vreau să iau parte la experimente viitoare', + 'vector-footercleanup-transclusion' => 'Această pagină conține {{PLURAL:$1|o transcludere a |transcluderi ale}} {{PLURAL:$1|unei alte pagini|altor $1 pagini|altor $1 de pagini}}.', ); /** Tarandíne (Tarandíne) @@ -1596,7 +1636,7 @@ Ce tu è trasute, tu puè disabbilità st\'avvertimende jndr\'à sezione "Cangia 'vector-noexperiments-preference' => 'Escludeme da le funziune sperimendale', ); -/** Russian (Русский) +/** Russian (русский) * @author G0rn * @author KPu3uC B Poccuu * @author Kaganer @@ -1614,6 +1654,7 @@ $messages['ru'] = array( 'vector-simplesearch-search' => 'Поиск', 'vector-simplesearch-containing' => 'содержащие…', 'vector-noexperiments-preference' => 'Не предлагать экспериментальные возможности', + 'vector-footercleanup-transclusion' => 'Эта страница содержит {{PLURAL:$1|включение|включения}} {{PLURAL:$1|другой страницы|$1 других страниц}}.', ); /** Rusyn (Русиньскый) @@ -1778,6 +1819,14 @@ Ako ste prijavljeni, možete onemogućiti ovo upozorenje u svojim podešavanjima 'vector-simplesearch-containing' => 'sadrži...', ); +/** Seeltersk (Seeltersk) + * @author Pyt + */ +$messages['stq'] = array( + 'vector-simplesearch-search' => 'Säik', + 'vector-simplesearch-containing' => 'Fultextsäike ätter ...', +); + /** Sundanese (Basa Sunda) * @author Kandar */ @@ -1887,6 +1936,7 @@ Kung nakalagda ka, maaari mong huwag paganahin ang babalang ito sa loob ng seksy ); /** Turkish (Türkçe) + * @author Hcagri * @author Karduelis * @author Srhat * @author Vito Genovese @@ -1901,6 +1951,7 @@ Eğer giriş yaptıysanız, bu uyarıyı, tercihlerinizin "Sayfa yazma alanı" b 'vector-editwarning-preference' => 'Kaydedilmemiş değişikliğe sahip bir değişiklik sayfasından çıkarken beni uyar', 'vector-simplesearch-search' => 'Ara', 'vector-simplesearch-containing' => 'içeren...', + 'vector-noexperiments-preference' => 'Beni gelecekteki deneylere dahil etme', ); /** Tatar (Cyrillic script) (Татарча) @@ -1952,7 +2003,7 @@ Se te sì loggà, te poli disabilitar sto aviso in te la sezion "Dimension de la 'vector-simplesearch-containing' => 'che contien...', ); -/** Veps (Vepsan kel') */ +/** Veps (Vepsän kel’) */ $messages['vep'] = array( 'vector-simplesearch-search' => 'Ectä', 'vector-simplesearch-containing' => 'mülütajad...', @@ -1985,6 +2036,23 @@ $messages['vo'] = array( 'vector-simplesearch-containing' => 'ninädöl...', ); +/** Walloon (walon) + * @author Srtxg + */ +$messages['wa'] = array( + 'vector' => "Amidraedjes di l' eterface pol pea «Vector»", + 'vector-desc' => "Amidraedjes pol pea d' eterface d' uzeu «Vector»", + 'vector-collapsiblenav-preference' => "Permete d' erôler les cayets del båre di costé avou l' pea «Vector»", + 'vector-collapsiblenav-more' => 'Pus di lingaedjes', + 'vector-editwarning-warning' => "Cwiter cisse pådje ci vos frè piede tos les candjmints ki vos avoz fwait. +Si vos estoz elodjî, vos ploz dismete cist adviertixhmint ci dins l' linwete «Boesse di tecse» di vos preferinces.", + 'vector-editwarning-preference' => "M' advierti cwand dji cwite ene pådje k' a des candjmints nén schapés", + 'vector-simplesearch-search' => 'Cweri', + 'vector-simplesearch-containing' => 'ki contént...', + 'vector-noexperiments-preference' => 'Mi rsaetchî des esperyinces di fonccionalité', + 'vector-footercleanup-transclusion' => "Cisse pådje ci a {{PLURAL:$1|on ravalé elemint|des ravalés elemints}} vnant d' {{PLURAL:$1|ene ôte pådje|$1 ôtès pådjes}}.", +); + /** Mingrelian (მარგალური) */ $messages['xmf'] = array( 'vector-simplesearch-search' => 'გორუა', diff --git a/extensions/Vector/Vector.php b/extensions/Vector/Vector.php index abe488fb..cc8f8eda 100644 --- a/extensions/Vector/Vector.php +++ b/extensions/Vector/Vector.php @@ -75,6 +75,7 @@ $wgResourceModules += array( 'vector-collapsiblenav-more', ), 'dependencies' => array( + 'mediawiki.util', 'jquery.client', 'jquery.cookie', 'jquery.tabIndex', @@ -128,10 +129,10 @@ $wgResourceModules += array( 'vector-simplesearch-containing', ), 'dependencies' => array( - 'jquery.client', - 'jquery.suggestions', 'jquery.autoEllipsis', + 'jquery.client', 'jquery.placeholder', + 'jquery.suggestions', 'mediawiki.legacy.mwsuggest', // to ensure we disable it in proper order ), ), diff --git a/extensions/Vector/modules/ext.vector.collapsibleNav.css b/extensions/Vector/modules/ext.vector.collapsibleNav.css index f11046c9..fc9246b0 100644 --- a/extensions/Vector/modules/ext.vector.collapsibleNav.css +++ b/extensions/Vector/modules/ext.vector.collapsibleNav.css @@ -1,56 +1,83 @@ -/* Prototype code to show collapsing left nav options */ -#mw-panel.collapsible-nav div.portal { +/** + * Stylesheet for collapsible nav + */ + +#mw-panel.collapsible-nav .portal { /* @embed */ - background-image:url(images/portal-break.png); - background-position:left top; - background-repeat:no-repeat; + background: url(images/portal-break.png) left top no-repeat; padding: 0.25em 0 !important; margin: -11px 9px 10px 11px; } -#mw-panel.collapsible-nav div.portal h5 { + +#mw-panel.collapsible-nav .portal h5 { color: #4D4D4D; font-weight: normal; /* @embed */ background: url(images/open.png) left center no-repeat; - padding: 4px 0 3px 1.5em; - margin-bottom: 0px; + padding: 4px 0 3px 1.5em; + margin-bottom: 0; } -#mw-panel.collapsible-nav div.collapsed h5 { - color: #0645AD; - /* @embed */ - background: url(images/closed-ltr.png) left center no-repeat; - margin-bottom: 0px; -} -#mw-panel.collapsible-nav div h5:hover { + +#mw-panel.collapsible-nav .portal h5:hover { cursor: pointer; text-decoration: none; } -#mw-panel.collapsible-nav div.collapsed h5:hover { - text-decoration: underline; + +#mw-panel.collapsible-nav .portal h5 a { + color: #4D4D4D; + text-decoration: none; } -#mw-panel.collapsible-nav div.portal div.body { + +#mw-panel.collapsible-nav .portal .body { background: none !important; - padding-top: 0px; + padding-top: 0; display: none; } -#mw-panel.collapsible-nav div.persistent div.body { - display: block; + +#mw-panel.collapsible-nav .portal .body ul li { + padding: 0.25em 0; } -#mw-panel.collapsible-nav div.first h5 { + +/* First */ + +#mw-panel.collapsible-nav .portal.first h5 { display: none; } -#mw-panel.collapsible-nav div.persistent h5 { + +#mw-panel.collapsible-nav .portal.first { + background-image: none; + margin-top: 0; +} + +/* Persistent */ + +#mw-panel.collapsible-nav .portal.persistent .body { + display: block; +} + +#mw-panel.collapsible-nav .portal.persistent h5 { background: none !important; padding-left: 0.7em; cursor: default; } -#mw-panel.collapsible-nav div.portal div.body ul li { - padding: 0.25em 0; + +#mw-panel.collapsible-nav .portal.persistent .body { + margin-left: 0.5em; } -#mw-panel.collapsible-nav div.first { - background-image: none; - margin-top: 0px; + +/* Collapsed */ + +#mw-panel.collapsible-nav .portal.collapsed h5 { + color: #0645AD; + /* @embed */ + background: url(images/closed-ltr.png) left center no-repeat; + margin-bottom: 0; +} + +#mw-panel.collapsible-nav .portal.collapsed h5 a { + color: #0645AD; +} + +#mw-panel.collapsible-nav .portal.collapsed h5:hover { + text-decoration: underline; } -#mw-panel.collapsible-nav div.persistent div.body { - margin-left: 0.5em; -} \ No newline at end of file diff --git a/extensions/Vector/modules/ext.vector.collapsibleNav.js b/extensions/Vector/modules/ext.vector.collapsibleNav.js index 5da57aca..85143014 100644 --- a/extensions/Vector/modules/ext.vector.collapsibleNav.js +++ b/extensions/Vector/modules/ext.vector.collapsibleNav.js @@ -1,29 +1,46 @@ -/* +/** * Collapisble navigation for Vector */ -jQuery( function( $ ) { +( function ( mw, $ ) { + "use strict"; + var map, version; + + // Use the same function for all navigation headings - don't repeat + function toggle( $element ) { + $.cookie( + 'vector-nav-' + $element.parent().attr( 'id' ), + $element.parent().is( '.collapsed' ), + { 'expires': 30, 'path': '/' } + ); + $element + .parent() + .toggleClass( 'expanded' ) + .toggleClass( 'collapsed' ) + .find( '.body' ) + .slideToggle( 'fast' ); + } /* Browser Support */ - var map = { + map = { // Left-to-right languages - 'ltr': { + ltr: { // Collapsible Nav is broken in Opera < 9.6 and Konqueror < 4 - 'opera': [['>=', 9.6]], - 'konqueror': [['>=', 4.0]], - 'blackberry': false, - 'ipod': false, - 'iphone': false, - 'ps3': false + opera: [['>=', 9.6]], + konqueror: [['>=', 4.0]], + blackberry: false, + ipod: false, + iphone: false, + ps3: false }, // Right-to-left languages - 'rtl': { - 'opera': [['>=', 9.6]], - 'konqueror': [['>=', 4.0]], - 'blackberry': false, - 'ipod': false, - 'iphone': false, - 'ps3': false + rtl: { + opera: [['>=', 9.6]], + konqueror: [['>=', 4.0]], + blackberry: false, + ipod: false, + iphone: false, + ps3: false } }; if ( !$.client.test( map ) ) { @@ -33,198 +50,204 @@ jQuery( function( $ ) { /* Bucket Testing */ // Fallback to old version - var version = 1; + version = 1; // Allow new version override - if ( mediaWiki.config.get( 'wgCollapsibleNavForceNewVersion' ) ) { + if ( mw.config.get( 'wgCollapsibleNavForceNewVersion' ) ) { version = 2; } else { // Make bucket testing optional - if ( mediaWiki.config.get( 'wgCollapsibleNavBucketTest' ) ) { + if ( mw.config.get( 'wgCollapsibleNavBucketTest' ) ) { // This is be determined randomly, and then stored in a cookie version = $.cookie( 'vector-nav-pref-version' ); // If the cookie didn't exist, or the value is out of range, generate a new one and save it - if ( version == null ) { + if ( version === null ) { // 50% of the people will get the new version version = Math.round( Math.random() + 1 ); - $.cookie( 'vector-nav-pref-version', version, { 'expires': 30, 'path': '/' } ); + $.cookie( 'vector-nav-pref-version', version, { + expires: 30, + path: '/' + }); } } } - /* Special Language Portal Handling */ - - // Language portal splitting feature (if it's turned on) - if ( version == 2 ) { - // How many links to show in the primary languages portal - var limit = 5; - // How many links there must be in the secondary portal to justify having a secondary portal - var threshold = 3; - // Make the interwiki language links list a secondary list, and create a new list before it as primary list - $( '#p-lang ul' ).addClass( 'secondary' ).before( '' ); - // This is a list of languages in order of Wikipedia project size. This is the lowest fallback for choosing - // which links to show in the primary list. Ideally the browser's accept-language headers should steer this - // list, and we should fallback on a site configured (MediaWiki:Common.js) list of prefered languages. - var languages = [ - 'en', 'fr', 'de', 'es', 'pt', 'it', 'ru', 'ja', 'nl', 'pl', 'zh', 'sv', 'ar', 'tr', 'uk', 'fi', 'no', 'ca', - 'ro', 'hu', 'ksh', 'id', 'he', 'cs', 'vi', 'ko', 'sr', 'fa', 'da', 'eo', 'sk', 'th', 'lt', 'vo', 'bg', - 'sl', 'hr', 'hi', 'et', 'mk', 'simple', 'new', 'ms', 'nn', 'gl', 'el', 'eu', 'ka', 'tl', 'bn', 'lv', 'ml', - 'bs', 'te', 'la', 'az', 'sh', 'war', 'br', 'is', 'mr', 'be-x-old', 'sq', 'cy', 'lb', 'ta', 'zh-classical', - 'an', 'jv', 'ht', 'oc', 'bpy', 'ceb', 'ur', 'zh-yue', 'pms', 'scn', 'be', 'roa-rup', 'qu', 'af', 'sw', - 'nds', 'fy', 'lmo', 'wa', 'ku', 'hy', 'su', 'yi', 'io', 'os', 'ga', 'ast', 'nap', 'vec', 'gu', 'cv', - 'bat-smg', 'kn', 'uz', 'zh-min-nan', 'si', 'als', 'yo', 'li', 'gan', 'arz', 'sah', 'tt', 'bar', 'gd', 'tg', - 'kk', 'pam', 'hsb', 'roa-tara', 'nah', 'mn', 'vls', 'gv', 'mi', 'am', 'ia', 'co', 'ne', 'fo', 'nds-nl', - 'glk', 'mt', 'ang', 'wuu', 'dv', 'km', 'sco', 'bcl', 'mg', 'my', 'diq', 'tk', 'szl', 'ug', 'fiu-vro', 'sc', - 'rm', 'nrm', 'ps', 'nv', 'hif', 'bo', 'se', 'sa', 'pnb', 'map-bms', 'lad', 'lij', 'crh', 'fur', 'kw', 'to', - 'pa', 'jbo', 'ba', 'ilo', 'csb', 'wo', 'xal', 'krc', 'ckb', 'pag', 'ln', 'frp', 'mzn', 'ce', 'nov', 'kv', - 'eml', 'gn', 'ky', 'pdc', 'lo', 'haw', 'mhr', 'dsb', 'stq', 'tpi', 'arc', 'hak', 'ie', 'so', 'bh', 'ext', - 'mwl', 'sd', 'ig', 'myv', 'ay', 'iu', 'na', 'cu', 'pi', 'kl', 'ty', 'lbe', 'ab', 'got', 'sm', 'as', 'mo', - 'ee', 'zea', 'av', 'ace', 'kg', 'bm', 'cdo', 'cbk-zam', 'kab', 'om', 'chr', 'pap', 'udm', 'ks', 'zu', 'rmy', - 'cr', 'ch', 'st', 'ik', 'mdf', 'kaa', 'aa', 'fj', 'srn', 'tet', 'or', 'pnt', 'bug', 'ss', 'ts', 'pcd', - 'pih', 'za', 'sg', 'lg', 'bxr', 'xh', 'ak', 'ha', 'bi', 've', 'tn', 'ff', 'dz', 'ti', 'ki', 'ny', 'rw', - 'chy', 'tw', 'sn', 'tum', 'ng', 'rn', 'mh', 'ii', 'cho', 'hz', 'kr', 'ho', 'mus', 'kj' - ]; - // If the user has an Accept-Language cookie, use it. Otherwise, set it asynchronously but keep the default - // behavior for this page view. - var acceptLangCookie = $.cookie( 'accept-language' ); - if ( acceptLangCookie != null ) { - // Put the user's accepted languages before the list ordered by wiki size - if ( acceptLangCookie != '' ) { - languages = acceptLangCookie.split( ',' ).concat( languages ); - } - } else { - $.getJSON( - wgScriptPath + '/api.php?action=query&meta=userinfo&uiprop=acceptlang&format=json', - function( data ) { - var langs = []; - if ( - typeof data.query != 'undefined' && - typeof data.query.userinfo != 'undefined' && - typeof data.query.userinfo.acceptlang != 'undefined' - ) { - for ( var j = 0; j < data.query.userinfo.acceptlang.length; j++ ) { - if ( data.query.userinfo.acceptlang[j].q != 0 ) { - langs.push( data.query.userinfo.acceptlang[j]['*'] ); + $( function ( $ ) { + var limit, threshold, languages, acceptLangCookie, + $primary, $secondary, + i, $link, count, + $headings, tabIndex; + + /* Special Language Portal Handling */ + + // Language portal splitting feature (if it's turned on) + if ( version === 2 ) { + // How many links to show in the primary languages portal + limit = 5; + // How many links there must be in the secondary portal to justify having a secondary portal + threshold = 3; + // Make the interwiki language links list a secondary list, and create a new list before it as primary list + $( '#p-lang ul' ).addClass( 'secondary' ).before( '' ); + // This is a list of languages in order of Wikipedia project size. This is the lowest fallback for choosing + // which links to show in the primary list. Ideally the browser's accept-language headers should steer this + // list, and we should fallback on a site configured (MediaWiki:Common.js) list of prefered languages. + languages = [ + 'en', 'fr', 'de', 'es', 'pt', 'it', 'ru', 'ja', 'nl', 'pl', 'zh', 'sv', 'ar', 'tr', 'uk', 'fi', 'no', 'ca', + 'ro', 'hu', 'ksh', 'id', 'he', 'cs', 'vi', 'ko', 'sr', 'fa', 'da', 'eo', 'sk', 'th', 'lt', 'vo', 'bg', + 'sl', 'hr', 'hi', 'et', 'mk', 'simple', 'new', 'ms', 'nn', 'gl', 'el', 'eu', 'ka', 'tl', 'bn', 'lv', 'ml', + 'bs', 'te', 'la', 'az', 'sh', 'war', 'br', 'is', 'mr', 'be-x-old', 'sq', 'cy', 'lb', 'ta', 'zh-classical', + 'an', 'jv', 'ht', 'oc', 'bpy', 'ceb', 'ur', 'zh-yue', 'pms', 'scn', 'be', 'roa-rup', 'qu', 'af', 'sw', + 'nds', 'fy', 'lmo', 'wa', 'ku', 'hy', 'su', 'yi', 'io', 'os', 'ga', 'ast', 'nap', 'vec', 'gu', 'cv', + 'bat-smg', 'kn', 'uz', 'zh-min-nan', 'si', 'als', 'yo', 'li', 'gan', 'arz', 'sah', 'tt', 'bar', 'gd', 'tg', + 'kk', 'pam', 'hsb', 'roa-tara', 'nah', 'mn', 'vls', 'gv', 'mi', 'am', 'ia', 'co', 'ne', 'fo', 'nds-nl', + 'glk', 'mt', 'ang', 'wuu', 'dv', 'km', 'sco', 'bcl', 'mg', 'my', 'diq', 'tk', 'szl', 'ug', 'fiu-vro', 'sc', + 'rm', 'nrm', 'ps', 'nv', 'hif', 'bo', 'se', 'sa', 'pnb', 'map-bms', 'lad', 'lij', 'crh', 'fur', 'kw', 'to', + 'pa', 'jbo', 'ba', 'ilo', 'csb', 'wo', 'xal', 'krc', 'ckb', 'pag', 'ln', 'frp', 'mzn', 'ce', 'nov', 'kv', + 'eml', 'gn', 'ky', 'pdc', 'lo', 'haw', 'mhr', 'dsb', 'stq', 'tpi', 'arc', 'hak', 'ie', 'so', 'bh', 'ext', + 'mwl', 'sd', 'ig', 'myv', 'ay', 'iu', 'na', 'cu', 'pi', 'kl', 'ty', 'lbe', 'ab', 'got', 'sm', 'as', 'mo', + 'ee', 'zea', 'av', 'ace', 'kg', 'bm', 'cdo', 'cbk-zam', 'kab', 'om', 'chr', 'pap', 'udm', 'ks', 'zu', 'rmy', + 'cr', 'ch', 'st', 'ik', 'mdf', 'kaa', 'aa', 'fj', 'srn', 'tet', 'or', 'pnt', 'bug', 'ss', 'ts', 'pcd', + 'pih', 'za', 'sg', 'lg', 'bxr', 'xh', 'ak', 'ha', 'bi', 've', 'tn', 'ff', 'dz', 'ti', 'ki', 'ny', 'rw', + 'chy', 'tw', 'sn', 'tum', 'ng', 'rn', 'mh', 'ii', 'cho', 'hz', 'kr', 'ho', 'mus', 'kj' + ]; + // If the user has an Accept-Language cookie, use it. Otherwise, set it asynchronously but keep the default + // behavior for this page view. + acceptLangCookie = $.cookie( 'accept-language' ); + if ( acceptLangCookie !== null ) { + // Put the user's accepted languages before the list ordered by wiki size + if ( acceptLangCookie !== '' ) { + languages = acceptLangCookie.split( ',' ).concat( languages ); + } + } else { + $.getJSON( + mw.util.wikiScript( 'api' ), + 'format=json&action=query&meta=userinfo&uiprop=acceptlang', + function ( data ) { + var langs = [], j, len, lang; + if ( data.query && + data.query.userinfo && + data.query.userinfo.acceptlang !== undefined + ) { + for ( j = 0, lang = data.query.userinfo.acceptlang, len = lang.length; j < len; j++ ) { + if ( lang[j].q !== 0 ) { + langs.push( lang[j]['*'] ); + } } } + $.cookie( 'accept-language', langs.join( ',' ), { + path: '/', + expires: 30 + }); + } + ); + } + // Shortcuts to the two lists + $primary = $( '#p-lang ul.primary' ); + $secondary = $( '#p-lang ul.secondary' ); + // Adjust the limit based on the threshold + if ( $secondary.children().length < limit + threshold ) { + limit += threshold; + } + // Move up to 5 of the links into the primary list, based on the priorities set forth in the languages list + count = 0; + for ( i = 0; i < languages.length; i++ ) { + $link = $secondary.find( '.interwiki-' + languages[i] ); + if ( $link.length ) { + if ( count++ < limit ) { + $link.appendTo( $primary ); + } else { + break; } - $.cookie( 'accept-language', langs.join( ',' ), { 'path': '/', 'expires': 30 } ); - } - ); - } - // Shortcuts to the two lists - var $primary = $( '#p-lang ul.primary' ); - var $secondary = $( '#p-lang ul.secondary' ); - // Adjust the limit based on the threshold - if ( $secondary.children().length < limit + threshold ) { - limit += threshold; - } - // Move up to 5 of the links into the primary list, based on the priorities set forth in the languages list - var count = 0; - for ( var i = 0; i < languages.length; i++ ) { - var $link = $secondary.find( '.interwiki-' + languages[i] ); - if ( $link.length ) { - if ( count++ < limit ) { - $link.appendTo( $primary ); - } else { - break; } } + // If there's still links in the secondary list and we havn't filled the primary list to it's limit yet, move + // links into the primary list in order of appearance + if ( count < limit ) { + $secondary.children().each( function () { + if ( count++ < limit ) { + $(this).appendTo( $primary ); + } else { + return false; + } + } ); + } + // Hide the more portal if it's now empty, otherwise make the list into it's very own portal + if ( $secondary.children().length === 0 ) { + $secondary.remove(); + } else { + $( '#p-lang' ).after( '
' ); + $( '#p-lang-more h5' ).text( mw.msg( 'vector-collapsiblenav-more' ) ); + $secondary.appendTo( $( '#p-lang-more .body' ) ); + } + // Always show the primary interwiki language portal + $( '#p-lang' ).addClass( 'persistent' ); } - // If there's still links in the secondary list and we havn't filled the primary list to it's limit yet, move - // links into the primary list in order of appearance - if ( count < limit ) { - $secondary.children().each( function() { - if ( count++ < limit ) { - $(this).appendTo( $primary ); + + /* General Portal Modification */ + + // Always show the first portal + $( '#mw-panel > .portal:first' ).addClass( 'first persistent' ); + // Apply a class to the entire panel to activate styles + $( '#mw-panel' ).addClass( 'collapsible-nav' ); + // Use cookie data to restore preferences of what to show and hide + $( '#mw-panel > .portal:not(.persistent)' ) + .each( function ( i ) { + var id = $(this).attr( 'id' ), + state = $.cookie( 'vector-nav-' + id ); + // Add anchor tag to heading for better accessibility + $( this ).find( 'h5' ).wrapInner( $( '' ).click( false ) ); + // In the case that we are not showing the new version, let's show the languages by default + if ( + state === 'true' || + ( state === null && i < 1 ) || + ( state === null && version === 1 && id === 'p-lang' ) + ) { + $(this) + .addClass( 'expanded' ) + .removeClass( 'collapsed' ) + .find( '.body' ) + .hide() // bug 34450 + .show(); } else { - return false; + $(this) + .addClass( 'collapsed' ) + .removeClass( 'expanded' ); + } + // Re-save cookie + if ( state !== null ) { + $.cookie( 'vector-nav-' + $(this).attr( 'id' ), state, { 'expires': 30, 'path': '/' } ); } } ); - } - // Hide the more portal if it's now empty, otherwise make the list into it's very own portal - if ( $secondary.children().length == 0 ) { - $secondary.remove(); - } else { - $( '#p-lang' ).after( '
' ); - $( '#p-lang-more h5' ).text( mw.usability.getMsg( 'vector-collapsiblenav-more' ) ); - $secondary.appendTo( $( '#p-lang-more div.body' ) ); - } - // Always show the primary interwiki language portal - $( '#p-lang' ).addClass( 'persistent' ); - } - /* General Portal Modification */ - - // Always show the first portal - $( '#mw-panel > div.portal:first' ).addClass( 'first persistent' ); - // Apply a class to the entire panel to activate styles - $( '#mw-panel' ).addClass( 'collapsible-nav' ); - // Use cookie data to restore preferences of what to show and hide - $( '#mw-panel > div.portal:not(.persistent)' ) - .each( function( i ) { - var id = $(this).attr( 'id' ); - var state = $.cookie( 'vector-nav-' + id ); - // In the case that we are not showing the new version, let's show the languages by default - if ( - state == 'true' || - ( state == null && i < 1 ) || - ( state == null && version == 1 && id == 'p-lang' ) - ) { - $(this) - .addClass( 'expanded' ) - .removeClass( 'collapsed' ) - .find( 'div.body' ) - .hide() // bug 34450 - .show(); - } else { - $(this) - .addClass( 'collapsed' ) - .removeClass( 'expanded' ); - } - // Re-save cookie - if ( state != null ) { - $.cookie( 'vector-nav-' + $(this).attr( 'id' ), state, { 'expires': 30, 'path': '/' } ); - } - } ); - // Use the same function for all navigation headings - don't repeat yourself - function toggle( $element ) { - $.cookie( - 'vector-nav-' + $element.parent().attr( 'id' ), - $element.parent().is( '.collapsed' ), - { 'expires': 30, 'path': '/' } - ); - $element - .parent() - .toggleClass( 'expanded' ) - .toggleClass( 'collapsed' ) - .find( 'div.body' ) - .slideToggle( 'fast' ); - } + /* Tab Indexing */ - /* Tab Indexing */ - - var $headings = $( '#mw-panel > div.portal:not(.persistent) > h5' ); - // Get the highest tab index - var tabIndex = $( document ).lastTabIndex() + 1; - // Fix the search not having a tabindex - $( '#searchInput' ).attr( 'tabindex', tabIndex++ ); - // Make it keyboard accessible - $headings.each( function() { - $(this).attr( 'tabindex', tabIndex++ ); - } ); - // Toggle the selected menu's class and expand or collapse the menu - $( '#mw-panel' ) - .delegate( 'div.portal:not(.persistent) > h5', 'keydown', function( event ) { - // Make the space and enter keys act as a click - if ( event.which == 13 /* Enter */ || event.which == 32 /* Space */ ) { - toggle( $(this) ); - } - } ) - .delegate( 'div.portal:not(.persistent) > h5', 'mousedown', function( event ) { - if ( event.which != 3 ) { // Right mouse click - toggle( $(this) ); - $(this).blur(); - } - return false; - } ); -} ); + $headings = $( '#mw-panel > .portal:not(.persistent) > h5' ); + + // Get the highest tab index + tabIndex = $( document ).lastTabIndex() + 1; + + // Fix the search not having a tabindex + $( '#searchInput' ).attr( 'tabindex', tabIndex++ ); + + // Make it keyboard accessible + $headings.attr( 'tabindex', function () { + return tabIndex++; + }); + + // Toggle the selected menu's class and expand or collapse the menu + $( '#mw-panel' ) + .delegate( '.portal:not(.persistent) > h5', 'keydown', function ( e ) { + // Make the space and enter keys act as a click + if ( e.which === 13 /* Enter */ || e.which === 32 /* Space */ ) { + toggle( $(this) ); + } + } ) + .delegate( '.portal:not(.persistent) > h5', 'mousedown', function ( e ) { + if ( e.which !== 3 ) { // Right mouse click + toggle( $(this) ); + $(this).blur(); + } + return false; + } ); + }); + +}( mediaWiki, jQuery ) ); diff --git a/extensions/Vector/modules/ext.vector.collapsibleTabs.js b/extensions/Vector/modules/ext.vector.collapsibleTabs.js index fb0681e7..31f91cbb 100644 --- a/extensions/Vector/modules/ext.vector.collapsibleTabs.js +++ b/extensions/Vector/modules/ext.vector.collapsibleTabs.js @@ -1,11 +1,11 @@ -/* +/** * Collapsible tabs for Vector */ -jQuery(function( $ ) { +jQuery( function ( $ ) { var rtl = $( 'body' ).is( '.rtl' ); // Overloading the moveToCollapsed function to animate the transition - $.collapsibleTabs.moveToCollapsed = function( ele ) { + $.collapsibleTabs.moveToCollapsed = function ( ele ) { var $moving = $( ele ); //$.collapsibleTabs.getSettings( $( $.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true; @@ -22,35 +22,36 @@ jQuery(function( $ ) { // Remove the element from where it's at and put it in the dropdown menu var target = data.collapsedContainer; - $moving.css( "position", "relative" ) + $moving.css( 'position', 'relative' ) .css( ( rtl ? 'left' : 'right' ), 0 ) - .animate( { width: '1px' }, "normal", function() { + .animate( { width: '1px' }, 'normal', function () { + var data; $( this ).hide(); // add the placeholder - $( '' ).insertAfter( this ); + $( '' ).insertAfter( this ); + // XXX: 'data' is undefined here, should the 'data' from the outer scope have + // a different name? $( this ).detach().prependTo( target ).data( 'collapsibleTabsSettings', data ); - $( this ).attr( 'style', 'display:list-item;' ); - //$.collapsibleTabs.getSettings( $( $.collapsibleTabs.getSettings( $( ele ) ).expandedContainer ) ) - // .shifting = false; - // Do the above, except with guards for JS errors - var data = $.collapsibleTabs.getSettings( $( ele ) ); - if ( !data ) { - return; - } - var expContainerSettings = $.collapsibleTabs.getSettings( $( data.expandedContainer ) ); - if ( !expContainerSettings ) { - return; + $( this ).attr( 'style', 'display: list-item;' ); + // $.collapsibleTabs.getSettings( $( $.collapsibleTabs.getSettings( $( ele ) ).expandedContainer ) ) + // .shifting = false; + // Do the above, except with guards for accessing properties of undefined. + data = $.collapsibleTabs.getSettings( $( ele ) ); + if ( data ) { + var expContainerSettings = $.collapsibleTabs.getSettings( $( data.expandedContainer ) ); + if ( expContainerSettings ) { + expContainerSettings.shifting = false; + $.collapsibleTabs.handleResize(); + } } - expContainerSettings.shifting = false; - $.collapsibleTabs.handleResize(); } ); }; // Overloading the moveToExpanded function to animate the transition - $.collapsibleTabs.moveToExpanded = function( ele ) { + $.collapsibleTabs.moveToExpanded = function ( ele ) { var $moving = $( ele ); //$.collapsibleTabs.getSettings( $( $.collapsibleTabs.getSettings( $moving ).expandedContainer ) ).shifting = true; - // Do the above, except with guards for JS errors + // Do the above, except with guards for accessing properties of undefined. var data = $.collapsibleTabs.getSettings( $moving ); if ( !data ) { return; @@ -64,60 +65,61 @@ jQuery(function( $ ) { // grab the next appearing placeholder so we can use it for replacing var $target = $( data.expandedContainer ).find( 'span.placeholder:first' ); var expandedWidth = data.expandedWidth; - $moving.css( "position", "relative" ).css( ( rtl ? 'right' : 'left' ), 0 ).css( 'width', '1px' ); - $target.replaceWith( $moving.detach().css( 'width', '1px' ).data( 'collapsibleTabsSettings', data ) - .animate( { width: expandedWidth+"px" }, "normal", function( ) { - $( this ).attr( 'style', 'display:block;' ); + $moving.css( 'position', 'relative' ).css( ( rtl ? 'right' : 'left' ), 0 ).css( 'width', '1px' ); + $target.replaceWith( + $moving + .detach() + .css( 'width', '1px' ) + .data( 'collapsibleTabsSettings', data ) + .animate( { width: expandedWidth + 'px' }, 'normal', function () { + $( this ).attr( 'style', 'display: block;' ); //$.collapsibleTabs.getSettings( $( $.collapsibleTabs.getSettings( $( ele ) ).expandedContainer ) ) // .shifting = false; - // Do the above, except with guards for JS errors + // Do the above, except with guards for accessing properties of undefined. var data = $.collapsibleTabs.getSettings( $( this ) ); - if ( !data ) { - return; - } - var expContainerSettings = $.collapsibleTabs.getSettings( $( data.expandedContainer ) ); - if ( !expContainerSettings ) { - return; + if ( data ) { + var expContainerSettings = $.collapsibleTabs.getSettings( $( data.expandedContainer ) ); + if ( expContainerSettings ) { + expContainerSettings.shifting = false; + $.collapsibleTabs.handleResize(); + } } - expContainerSettings.shifting = false; - $.collapsibleTabs.handleResize(); - } ) ); + } ) + ); }; // Bind callback functions to animate our drop down menu in and out // and then call the collapsibleTabs function on the menu - $( '#p-views ul' ).bind( 'beforeTabCollapse', function() { - if ( $( '#p-cactions' ).css( 'display' ) == 'none' ) { + $( '#p-views ul' ).bind( 'beforeTabCollapse', function () { + if ( $( '#p-cactions' ).css( 'display' ) === 'none' ) { $( '#p-cactions' ) .addClass( 'filledPortlet' ).removeClass( 'emptyPortlet' ) .find( 'h5' ) .css( 'width','1px' ).animate( { 'width':'26px' }, 390 ); } - } ).bind( 'beforeTabExpand', function() { - if ( $( '#p-cactions li' ).length == 1 ) { - $( '#p-cactions h5' ).animate( { 'width':'1px' }, 370, function() { + } ).bind( 'beforeTabExpand', function () { + if ( $( '#p-cactions li' ).length === 1 ) { + $( '#p-cactions h5' ).animate( { 'width':'1px' }, 370, function () { $( this ).attr( 'style', '' ) .parent().addClass( 'emptyPortlet' ).removeClass( 'filledPortlet' ); }); } } ).collapsibleTabs( { - expandCondition: function( eleWidth ) { - if( rtl ){ + expandCondition: function ( eleWidth ) { + if ( rtl ) { return ( $( '#right-navigation' ).position().left + $( '#right-navigation' ).width() + 1 ) < ( $( '#left-navigation' ).position().left - eleWidth ); - } else { - return ( $( '#left-navigation' ).position().left + $( '#left-navigation' ).width() + 1 ) - < ( $( '#right-navigation' ).position().left - eleWidth ); } + return ( $( '#left-navigation' ).position().left + $( '#left-navigation' ).width() + 1 ) + < ( $( '#right-navigation' ).position().left - eleWidth ); }, - collapseCondition: function() { - if( rtl ) { + collapseCondition: function () { + if ( rtl ) { return ( $( '#right-navigation' ).position().left + $( '#right-navigation' ).width() ) > $( '#left-navigation' ).position().left; - } else { - return ( $( '#left-navigation' ).position().left + $( '#left-navigation' ).width() ) - > $( '#right-navigation' ).position().left; } + return ( $( '#left-navigation' ).position().left + $( '#left-navigation' ).width() ) + > $( '#right-navigation' ).position().left; } } ); } ); diff --git a/extensions/Vector/modules/ext.vector.editWarning.js b/extensions/Vector/modules/ext.vector.editWarning.js index 5b97670d..e6ee5c60 100644 --- a/extensions/Vector/modules/ext.vector.editWarning.js +++ b/extensions/Vector/modules/ext.vector.editWarning.js @@ -1,27 +1,27 @@ /* * Edit warning for Vector */ -(function( $ ) { - $(document).ready( function() { +( function ( mw, $ ) { + $(document).ready( function () { // Check if EditWarning is enabled and if we need it - if ( $( '#wpTextbox1' ).size() == 0 ) { + if ( $( '#wpTextbox1' ).length === 0 ) { return true; } // Get the original values of some form elements - $( '#wpTextbox1, #wpSummary' ).each( function() { + $( '#wpTextbox1, #wpSummary' ).each( function () { $(this).data( 'origtext', $(this).val() ); }); // Attach our own handler for onbeforeunload which respects the current one - var fallbackWindowOnBeforeUnload = window.onbeforeunload; - var ourWindowOnBeforeUnload = function() { - var fallbackResult = undefined; - var retval = undefined; - var thisFunc = arguments.callee; - // Check if someone already set on onbeforeunload hook - if ( fallbackWindowOnBeforeUnload ) { + var otherOnBeforeUnload = window.onbeforeunload; + function ourOnBeforeUnload() { + var fallbackResult, retval; + + // Check if someone already set an onbeforeunload hook + if ( otherOnBeforeUnload ) { // Get the result of their onbeforeunload hook - fallbackResult = fallbackWindowOnBeforeUnload(); + fallbackResult = otherOnBeforeUnload(); } + // Check if their onbeforeunload hook returned something if ( fallbackResult !== undefined ) { // Exit here, returning their message @@ -31,41 +31,40 @@ // the original values if ( mw.config.get( 'wgAction' ) == 'submit' || - $( '#wpTextbox1' ).data( 'origtext' ) != $( '#wpTextbox1' ).val() || - $( '#wpSummary' ).data( 'origtext' ) != $( '#wpSummary' ).val() + $( '#wpTextbox1' ).data( 'origtext' ) != $( '#wpTextbox1' ).val() || + $( '#wpSummary' ).data( 'origtext' ) != $( '#wpSummary' ).val() ) { // Return our message - retval = mediaWiki.msg( 'vector-editwarning-warning' ); + retval = mw.msg( 'vector-editwarning-warning' ); } } - + // Unset the onbeforeunload handler so we don't break page caching in Firefox window.onbeforeunload = null; if ( retval !== undefined ) { // ...but if the user chooses not to leave the page, we need to rebind it - setTimeout( function() { - window.onbeforeunload = thisFunc; - } ); + setTimeout( function () { + window.onbeforeunload = ourOnBeforeUnload; + }, 1 ); return retval; } - }; - var pageShowHandler = function() { - // Re-add onbeforeunload handler - window.onbeforeunload = ourWindowOnBeforeUnload; - }; - pageShowHandler(); - if ( window.addEventListener ) { - window.addEventListener('pageshow', pageShowHandler, false); - } else if ( window.attachEvent ) { - window.attachEvent( 'pageshow', pageShowHandler ); } - + + // Do the first binding now + window.onbeforeunload = ourOnBeforeUnload; + + function pageShowHandler() { + // Re-add onbeforeunload handler on pageshow. + window.onbeforeunload = ourOnBeforeUnload; + } + + $( window ).on( 'pageshow', pageShowHandler ); + // Add form submission handler - $( 'form' ).submit( function() { + $( '#editform' ).submit( function () { // Restore whatever previous onbeforeload hook existed - window.onbeforeunload = fallbackWindowOnBeforeUnload; + window.onbeforeunload = otherOnBeforeUnload; }); }); - //Global storage of fallback for onbeforeunload hook - var fallbackWindowOnBeforeUnload = null; -})( jQuery ); + +}( mediaWiki, jQuery ) ); diff --git a/extensions/Vector/modules/ext.vector.expandableSearch.css b/extensions/Vector/modules/ext.vector.expandableSearch.css index be679b4c..8b33bbb1 100644 --- a/extensions/Vector/modules/ext.vector.expandableSearch.css +++ b/extensions/Vector/modules/ext.vector.expandableSearch.css @@ -1,9 +1,11 @@ .expandableField { display: block; } + #simpleSearch { overflow: auto; } + #searchButton { margin-top: 0.2em !important; -} \ No newline at end of file +} diff --git a/extensions/Vector/modules/ext.vector.expandableSearch.js b/extensions/Vector/modules/ext.vector.expandableSearch.js index 619ea9c2..b4910647 100644 --- a/extensions/Vector/modules/ext.vector.expandableSearch.js +++ b/extensions/Vector/modules/ext.vector.expandableSearch.js @@ -1,27 +1,27 @@ /* * Expandable search for Vector */ -jQuery( document ).ready( function( $ ) { +jQuery( document ).ready( function ( $ ) { /* Browser Support */ var map = { // Left-to-right languages - 'ltr': { + ltr: { // Collapsible Nav is broken in Opera < 9.6 and Konqueror < 4 - 'msie': [['>=', 8]], - 'blackberry': false, - 'ipod': false, - 'iphone': false, - 'ps3': false + msie: [['>=', 8]], + blackberry: false, + ipod: false, + iphone: false, + ps3: false }, // Right-to-left languages - 'rtl': { - 'msie': [['>=', 8]], - 'blackberry': false, - 'ipod': false, - 'iphone': false, - 'ps3': false + rtl: { + msie: [['>=', 8]], + blackberry: false, + ipod: false, + iphone: false, + ps3: false } }; if ( !$.client.test( map ) ) { @@ -30,41 +30,43 @@ jQuery( document ).ready( function( $ ) { $( '#searchInput' ) .expandableField( { - 'beforeExpand': function( context ) { - // animate the containers border + beforeExpand: function ( context ) { + // Animate the containers border $( this ) .parent() .animate( { - 'borderTopColor': '#a0d8ff', - 'borderLeftColor': '#a0d8ff', - 'borderRightColor': '#a0d8ff', - 'borderBottomColor': '#a0d8ff' }, 'fast' ); + borderTopColor: '#a0d8ff', + borderLeftColor: '#a0d8ff', + borderRightColor: '#a0d8ff', + borderBottomColor: '#a0d8ff' + }, 'fast' ); }, - 'beforeCondense': function( context ) { - // animate the containers border + beforeCondense: function ( context ) { + // Animate the containers border $( this ) .parent() .animate( { - 'borderTopColor': '#aaaaaa', - 'borderLeftColor': '#aaaaaa', - 'borderRightColor': '#aaaaaa', - 'borderBottomColor': '#aaaaaa' }, 'fast' ); + borderTopColor: '#aaaaaa', + borderLeftColor: '#aaaaaa', + borderRightColor: '#aaaaaa', + borderBottomColor: '#aaaaaa' + }, 'fast' ); }, - 'afterExpand': function( context ) { - //trigger the collapsible tabs resize handler - if ( typeof $.collapsibleTabs != 'undefined' ){ + afterExpand: function ( context ) { + // Trigger the collapsible tabs resize handler + if ( $.collapsibleTabs ) { $.collapsibleTabs.handleResize(); } }, - 'afterCondense': function( context ) { - //trigger the collapsible tabs resize handler - if ( typeof $.collapsibleTabs != 'undefined' ){ + afterCondense: function ( context ) { + // Trigger the collapsible tabs resize handler + if ( $.collapsibleTabs ) { $.collapsibleTabs.handleResize(); } }, - 'expandToLeft': ! $( 'body' ).is( '.rtl' ) + expandToLeft: !$( 'body' ).hasClass( 'rtl' ) } ) - .css( 'float', $( 'body' ).is( '.rtl' ) ? 'right' : 'left' ) + .css( 'float', $( 'body' ).hasClass( 'rtl' ) ? 'right' : 'left' ) .siblings( 'button' ) - .css( 'float', $( 'body' ).is( '.rtl' ) ? 'right' : 'left' ); + .css( 'float', $( 'body' ).hasClass( 'rtl' ) ? 'right' : 'left' ); } ); diff --git a/extensions/Vector/modules/ext.vector.footerCleanup.css b/extensions/Vector/modules/ext.vector.footerCleanup.css index ab951df6..cd621006 100644 --- a/extensions/Vector/modules/ext.vector.footerCleanup.css +++ b/extensions/Vector/modules/ext.vector.footerCleanup.css @@ -1,4 +1,7 @@ -/* Prototype code to show collapsing left nav options */ +/** + * Footer cleanup + */ + #editpage-bottom { background-color: #F3F3F3; border: 1px solid silver; @@ -11,62 +14,74 @@ color: #999999; font-style: italic; } + .collapsible-list { border-top: 1px solid silver; border-bottom: 1px solid silver; } + .collapsible-list { border-top: 1px solid silver; border-bottom: 1px solid silver; padding: 3px 2px; } + .collapsible-list ul { display: block; padding: 0 0 0 14px; } + .collapsible-list.collapsed label { /* @embed */ - background: url(../images/vector/collapsibleNav/arrow-down.png?1) 0 50% no-repeat; - padding: 4px 0 3px 1.5em; - margin-bottom: 0px; + background: url(../images/vector/collapsibleNav/arrow-down.png) 0 50% no-repeat; + padding: 4px 0 3px 1.5em; + margin-bottom: 0; } + .collapsible-list.expanded label { /* @embed */ - background: url(../images/vector/collapsibleNav/arrow-right.png?1) 0 50% no-repeat; - padding: 4px 0 3px 1.5em; - margin-bottom: 0px; + background: url(../images/vector/collapsibleNav/arrow-right.png) 0 50% no-repeat; + padding: 4px 0 3px 1.5em; + margin-bottom: 0; } #editpage-bottom .editOptions { width: 100%; } + #editpage-bottom #wpSummaryLabel, #editpage-bottom #editpage-summary-fields, #editpage-bottom .editButtons { float: left; } -#editpage-bottom #wpSummaryLabel{ + +#editpage-bottom #wpSummaryLabel { width: 150px; margin-left: -150px; position: relative; } + #editpage-bottom #editpage-summary-fields { width: 100%; margin-right: -100%; } + #editpage-bottom #editpage-summary-fields input.mw-summary { width: 95%; } + #editpage-bottom .editButtons { width: 150px; margin-right: -150px; float: right; position: relative; } + #editpage-bottom #editpage-copywarn { margin-left: -150px; margin-right: 10px; } + /* Why don't we use self clearing floats anywhere? */ #editpage-bottom .editOptions:after { @@ -76,12 +91,15 @@ clear: both; visibility: hidden; } + #editpage-bottom .editOptions { display: inline-block; } -* html #editpage-bottom .editOptions { + +* html #editpage-bottom .editOptions { height: 1%; } -#editpage-bottom .editOptions { - display:block; -} \ No newline at end of file + +#editpage-bottom .editOptions { + display: block; +} diff --git a/extensions/Vector/modules/ext.vector.footerCleanup.js b/extensions/Vector/modules/ext.vector.footerCleanup.js index 66838375..b3f5594d 100644 --- a/extensions/Vector/modules/ext.vector.footerCleanup.js +++ b/extensions/Vector/modules/ext.vector.footerCleanup.js @@ -1,7 +1,7 @@ /* * Footer cleanup for Vector */ -jQuery( document ).ready( function( $ ) { +jQuery( function ( $ ) { $( '#editpage-copywarn' ) .add( '.editOptions' ) .wrapAll( '
' ); @@ -13,8 +13,8 @@ jQuery( document ).ready( function( $ ) { // FIXME - Not a long-term solution. This change should be done in the message itself .replace( /\)|\(/g, '' ) ) - .change( function() { - if ( $( this ).val().length == 0 ) { + .change( function () { + if ( $( this ).val().length === 0 ) { $( this ) .addClass( 'inline-hint' ) .val( $( this ).data( 'hint' ) ); @@ -22,14 +22,14 @@ jQuery( document ).ready( function( $ ) { $( this ).removeClass( 'inline-hint' ); } } ) - .focus( function() { + .focus( function () { if ( $( this ).val() == $( this ).data( 'hint' ) ) { $( this ) .removeClass( 'inline-hint' ) .val( "" ); } }) - .blur( function() { $( this ).trigger( 'change' ); } ) + .blur( function () { $( this ).trigger( 'change' ); } ) .trigger( 'change' ); $( '#wpSummary' ) .add( '.editCheckboxes' ) @@ -49,7 +49,7 @@ jQuery( document ).ready( function( $ ) { $( '.mw-templatesUsedExplanation' ).remove(); $( '.collapsible-list label' ) - .click( function() { + .click( function () { $( this ) .parent() .toggleClass( 'expanded' ) @@ -59,8 +59,10 @@ jQuery( document ).ready( function( $ ) { return false; }) .trigger( 'click' ); + $( '#wpPreview, #wpDiff, .editHelp, #editpage-specialchars' ) .remove(); + $( '#mw-editform-cancel' ) .remove() .appendTo( '.editButtons' ); diff --git a/extensions/Vector/modules/ext.vector.sectionEditLinks.css b/extensions/Vector/modules/ext.vector.sectionEditLinks.css index 6c864001..07df70aa 100644 --- a/extensions/Vector/modules/ext.vector.sectionEditLinks.css +++ b/extensions/Vector/modules/ext.vector.sectionEditLinks.css @@ -1,14 +1,18 @@ +/** + * Section edit links + */ + span.vector-editLink { float: none; display: inline-block; } + span.vector-editLink a { padding-left: 18px; /* @embed */ - background-image: url(images/edit-faded.png); - background-position: left top; - background-repeat: no-repeat; + background: url(images/edit-faded.png) left top no-repeat; } + span.vector-editLink a:hover { /* @embed */ background-image: url(images/edit.png); diff --git a/extensions/Vector/modules/ext.vector.sectionEditLinks.js b/extensions/Vector/modules/ext.vector.sectionEditLinks.js index b8e2f601..2a3301bf 100644 --- a/extensions/Vector/modules/ext.vector.sectionEditLinks.js +++ b/extensions/Vector/modules/ext.vector.sectionEditLinks.js @@ -1,7 +1,7 @@ /* * Section Edit Links for Vector */ -( function( $, mw ) { +( function ( $, mw ) { var eventBase = 'ext.vector.sectionEditLinks-bucket:'; var cookieBase = 'ext.vector.sectionEditLinks-'; @@ -37,10 +37,10 @@ if ( bucket <= 0 ) { return; } -$(document).ready( function() { +$(document).ready( function () { // Transform the targets of section edit links to route through the click tracking API var session = $.cookie( 'clicktracking-session' ); - $( 'span.editsection a, #ca-edit a' ).each( function() { + $( 'span.editsection a, #ca-edit a' ).each( function () { var event = eventBase + bucket + '@' + experiment; if ( $(this).is( '#ca-edit a' ) ) { event += '-tab'; @@ -54,7 +54,7 @@ $(document).ready( function() { } ); if ( bucket == 2 ) { // Move the link over to be next to the heading text and style it with an icon - $( 'span.mw-headline' ).each( function() { + $( 'span.mw-headline' ).each( function () { $(this) .after( $( '' ) @@ -62,7 +62,7 @@ $(document).ready( function() { $(this) .prev( 'span.editsection' ) .find( 'a' ) - .each( function() { + .each( function () { var text = $(this).text(); $(this).text( text.substr( 0, 1 ).toUpperCase() + text.substr( 1 ) diff --git a/extensions/Vector/modules/ext.vector.simpleSearch.js b/extensions/Vector/modules/ext.vector.simpleSearch.js index 8af1f9a1..4dbdd705 100644 --- a/extensions/Vector/modules/ext.vector.simpleSearch.js +++ b/extensions/Vector/modules/ext.vector.simpleSearch.js @@ -1,9 +1,11 @@ -/* JavaScript for SimpleSearch extension */ +/** + * JavaScript for SimpleSearch + */ -jQuery( document ).ready( function( $ ) { +jQuery( document ).ready( function ( $ ) { // Ensure that the thing is actually present! - if ($('#simpleSearch').length == 0) { + if ( $( '#simpleSearch' ).length === 0 ) { // Don't try to set anything up if simpleSearch is disabled sitewide. // The loader code loads us if the option is present, even if we're // not actually enabled (anymore). @@ -12,23 +14,23 @@ jQuery( document ).ready( function( $ ) { // Compatibility map var map = { - 'browsers': { + browsers: { // Left-to-right languages - 'ltr': { + ltr: { // SimpleSearch is broken in Opera < 9.6 - 'opera': [['>=', 9.6]], - 'docomo': false, - 'blackberry': false, - 'ipod': false, - 'iphone': false + opera: [['>=', 9.6]], + docomo: false, + blackberry: false, + ipod: false, + iphone: false }, // Right-to-left languages - 'rtl': { - 'opera': [['>=', 9.6]], - 'docomo': false, - 'blackberry': false, - 'ipod': false, - 'iphone': false + rtl: { + opera: [['>=', 9.6]], + docomo: false, + blackberry: false, + ipod: false, + iphone: false } } }; @@ -49,38 +51,39 @@ jQuery( document ).ready( function( $ ) { // General suggestions functionality for all search boxes $( '#searchInput, #searchInput2, #powerSearchText, #searchText' ) .suggestions( { - fetch: function( query ) { - var $this = $(this); + fetch: function ( query ) { + var $el = $(this); if ( query.length !== 0 ) { - var request = $.ajax( { + var jqXhr = $.ajax( { url: mw.util.wikiScript( 'api' ), data: { + format: 'json', action: 'opensearch', search: query, namespace: 0, suggest: '' }, dataType: 'json', - success: function( data ) { - if ( $.isArray( data ) && 1 in data ) { - $this.suggestions( 'suggestions', data[1] ); + success: function ( data ) { + if ( $.isArray( data ) && data.length ) { + $el.suggestions( 'suggestions', data[1] ); } } }); - $this.data( 'request', request ); + $el.data( 'request', jqXhr ); } }, - cancel: function() { - var request = $(this).data( 'request' ); - // If the delay setting has caused the fetch to have not even happend yet, the request object will - // have never been set - if ( request && $.isFunction( request.abort ) ) { - request.abort(); + cancel: function () { + var jqXhr = $(this).data( 'request' ); + // If the delay setting has caused the fetch to have not even happend yet, + // the jqXHR object will have never been set. + if ( jqXhr && $.isFunction ( jqXhr.abort ) ) { + jqXhr.abort(); $(this).removeData( 'request' ); } }, result: { - select: function( $input ) { + select: function ( $input ) { $input.closest( 'form' ).submit(); } }, @@ -88,7 +91,7 @@ jQuery( document ).ready( function( $ ) { positionFromLeft: $( 'body' ).hasClass( 'rtl' ), highlightInput: true } ) - .bind( 'paste cut drop', function( e ) { + .bind( 'paste cut drop', function ( e ) { // make sure paste and cut events from the mouse and drag&drop events // trigger the keypress handler and cause the suggestions to update $( this ).trigger( 'keypress' ); @@ -96,33 +99,34 @@ jQuery( document ).ready( function( $ ) { // Special suggestions functionality for skin-provided search box $( '#searchInput' ).suggestions( { result: { - select: function( $input ) { + select: function ( $input ) { $input.closest( 'form' ).submit(); } }, special: { - render: function( query ) { - if ( $(this).children().length === 0 ) { - $(this).show(); - var $label = $( '
', { + render: function ( query ) { + var $el = $(this); + if ( $el.children().length === 0 ) { + $el.show(); + $( '
', { 'class': 'special-label', text: mw.msg( 'vector-simplesearch-containing' ) }) - .appendTo( $(this) ); - var $query = $( '
', { + .appendTo( $el ); + $( '
', { 'class': 'special-query', text: query }) - .appendTo( $(this) ); - $query.autoEllipsis(); + .appendTo( $el ) + .autoEllipsis(); } else { - $(this).find( '.special-query' ) + $el.find( '.special-query' ) .empty() .text( query ) .autoEllipsis(); } }, - select: function( $input ) { + select: function ( $input ) { $input.closest( 'form' ).append( $( '', { type: 'hidden', -- cgit v1.2.3-54-g00ecf