מדיה ויקי:Gadget-browsertab.js
הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.
- פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload), או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
- גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
- אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh), או ללחוץ על צירוף המקשים Ctrl-F5.
- אופרה: ללחוץ על Ctrl-F5.
/* This gadget shortens the tab browser title. For example, "(1) שיחה:אורי צבי גרינברג – הבדלי גרסאות" will be "(1) =ש:אורי צבי גרינברג – השוואה" To understand RTL, the translated result is "(1) =ShortNamespacePageName – diff". The structure of the new title includes: 1) Browser number data, as "(1) ", if existed in the original title. 2) Action symbol, "=" for diff, "!" for editing, ";" for history, nothing for reading. 3) Page name with shortened namespace. 4) Text " – " 5) Action full name, like "ויקיפדיה" for reading, "השוואה", "עריכה", "היסטוריה". There is no change for two different pages comparing or on flow conversations. */ $(function () { //exit on non Hebrew if (mw.config.get('wgUserLanguage') != 'he') return; // convertion data var converttable = { 'מיוחד': 'מי', 'שיחה': 'ש', 'משתמש': 'מש', 'שיחת משתמש': 'שמש', 'ויקיפדיה': 'וק', 'שיחת ויקיפדיה': 'שוק', 'קובץ': 'קו', 'שיחת קובץ': 'שקו', 'מדיה ויקי': 'מו', 'שיחת מדיה ויקי': 'שמו', 'תבנית': 'תב', 'שיחת תבנית': 'שתב', 'עזרה': 'עז', 'שיחת עזרה': 'שז', 'קטגוריה': 'קט', 'שיחת קטגוריה': 'שקט', 'פורטל': 'פ', 'שיחת פורטל': 'שפ', 'טיוטה': 'טי', 'שיחת טיוטה': 'שטי', 'יחידה': 'י', 'שיחת יחידה': 'שי', 'נושא': 'נ' }; // data about action symbols and names var letters = { view: ['', 'ויקיפדיה'], purge: ['', 'ויקיפדיה'], submit: ['!', 'עריכה'], edit: ['!', 'עריכה'], history: [';', 'היסטוריה'], diff: ['=', 'השוואה'] }; // find namespace var namespace = mw.config.get('wgNamespaceNumber'); // ignore flow sections if (namespace === 2600) return; // find page name var pagename = mw.config.get('wgPageName').replace(/_/g, ' '); // find current action var action, letter, actionname; if ($('.difference-title').length) action = 'diff'; else if ($('#contentSub').length && $('#contentSub').text().indexOf('הבדלים בין דפים') !== -1) // different pages comparing, do not touch return; else action = mw.config.get('wgAction'); // unknown action if (letters[action] == null) return; else [letter, actionname] = letters[action]; // get browser number data at title start var oldtext = $(document).prop('title'); var par = oldtext.match(/^\([^\)]*\)/); var partext = par ? par[0] + ' ' : '' ; // set the short name var namespaces = mw.config.get('wgFormattedNamespaces'); var namespace = namespaces[namespace]; $(document) .prop('title', partext + letter + String.fromCharCode(8207) + pagename.replace(namespace, converttable[namespace] || namespace) + ' – ' + actionname); });