1mw.tools.tabGroup = function (obj, element, model) { 2 /* 3 * 4 * { 5 * linkable: 'link' | 'auto', 6 * nav: string 7 * tabs: string 8 * onclick: function 9 * } 10 * 11 * */ 12 element = element || document.body; 13 model = typeof model === 'undefined' ? true : model; 14 if (model) { 15 model = { 16 set: function (i) { 17 if (typeof i === 'number') { 18 if (!$(obj.nav).eq(i).hasClass(active)) { 19 mw.$(obj.nav).removeClass(active); 20 mw.$(obj.nav).eq(i).addClass(active); 21 mw.$(obj.tabs).hide().eq(i).show(); 22 } 23 } 24 }, 25 setLastClicked: function () { 26 if ((typeof(obj.lastClickedTabIndex) != 'undefined') && obj.lastClickedTabIndex !== null) { 27 this.set(obj.lastClickedTabIndex); 28 } 29 }, 30 unset: function (i) { 31 if (typeof i === 'number') { 32 if ($(obj.nav).eq(i).hasClass(active)) { 33 mw.$(obj.nav).eq(i).removeClass(active); 34 mw.$(obj.tabs).hide().eq(i).hide(); 35 } 36 } 37 }, 38 toggle: function (i) { 39 if (typeof i === 'number') { 40 if ($(obj.nav).eq(i).hasClass(active)) { 41 this.unset(i); 42 } 43 else { 44 this.set(i); 45 } 46 } 47 } 48 }; 49 } 50 var active = obj.activeNav || obj.activeClass || "active active-info", 51 firstActive = 0; 52 53 obj.lastClickedTabIndex = null; 54 55 if (obj.linkable) { 56 57 58 if (obj.linkable === 'link') { 59 60 } else if (typeof obj.linkable === 'string') { 61 $(window).on('load hashchange', function () { 62 var param = mw.url.windowHashParam(obj.linkable); 63 if(param) { 64 var el = $('[data-' + obj.linkable + '="' + param + '"]'); 65 } 66 }); 67 $(obj.nav).each(function (i) { 68 this.dataset.linkable = obj.linkable + '-' + i; 69 (function (linkable, i) { 70 this.onclick = function () { 71 mw.url.windowHashParam(linkable, i); 72 }; 73 })(obj.linkable, i); 74 }); 75 } 76 } 77 78 79 mw.$(obj.nav).on('click', function (e) { 80 if (obj.linkable) { 81 if (obj.linkable === 'link') { 82 83 } 84 } else { 85 if (!$(this).hasClass(active)) { 86 var i = mw.tools.index(this, mw.$(obj.nav).get(), mw.$(obj.nav)[0].nodeName); 87 mw.$(obj.nav).removeClass(active); 88 mw.$(this).addClass(active); 89 mw.$(obj.tabs).hide().eq(i).show(); 90 obj.lastClickedTabIndex = i; 91 if (typeof obj.onclick === 'function') { 92 obj.onclick.call(this, mw.$(obj.tabs).eq(i)[0], e, i); 93 } 94 } 95 else { 96 if (obj.toggle === true) { 97 mw.$(this).removeClass(active); 98 mw.$(obj.tabs).hide(); 99 if (typeof obj.onclick === 'function') { 100 var i = mw.tools.index(this, element, obj.nav); 101 obj.onclick.call(this, mw.$(obj.tabs).eq(i)[0], e, i); 102 } 103 } 104 } 105 } 106 107 108 return false; 109 }).each(function (i) { 110 if (mw.tools.hasClass(this, active)) { 111 firstActive = i; 112 } 113 }); 114 model.set(firstActive); 115 return model; 116};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.