Index: tags/extensions/HeaderTabs/REL_0_6_6/LICENSE |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +Copyright (c) 2008 Sergey Chernyshev |
| 3 | +All rights reserved. |
| 4 | + |
| 5 | +Redistribution and use in source and binary forms, with or without |
| 6 | +modification, are permitted provided that the following conditions |
| 7 | +are met: |
| 8 | +1. Redistributions of source code must retain the above copyright |
| 9 | + notice, this list of conditions and the following disclaimer. |
| 10 | +2. Redistributions in binary form must reproduce the above copyright |
| 11 | + notice, this list of conditions and the following disclaimer in the |
| 12 | + documentation and/or other materials provided with the distribution. |
| 13 | +3. The name of the author may not be used to endorse or promote products |
| 14 | + derived from this software without specific prior written permission. |
| 15 | + |
| 16 | +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 17 | +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 18 | +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 19 | +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 21 | +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 | +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 23 | +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 25 | +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | + |
Index: tags/extensions/HeaderTabs/REL_0_6_6/skins/headertabs_hide_factbox.css |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +.smwfact { |
| 3 | + display: none; |
| 4 | +} |
Property changes on: tags/extensions/HeaderTabs/REL_0_6_6/skins/headertabs_hide_factbox.css |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 5 | + native |
Index: tags/extensions/HeaderTabs/REL_0_6_6/skins/headertabs.css |
— | — | @@ -0,0 +1,180 @@ |
| 2 | +.yui-skin-sam .yui-navset .yui-content { |
| 3 | + background: transparent; /* content background color */ |
| 4 | +} |
| 5 | + |
| 6 | +/* |
| 7 | + All the definitions below are intended to replicate the look of the "Sam" |
| 8 | + skin, for sites that don't have a yui-skin-sam class declaration anywhere. |
| 9 | +*/ |
| 10 | + |
| 11 | +.yui-navset .yui-content { |
| 12 | + background: transparent; /* content background color */ |
| 13 | +} |
| 14 | + |
| 15 | +.yui-navset .yui-nav, .yui-navset .yui-navset-top .yui-nav { |
| 16 | + border-color:#2647A0; |
| 17 | + border-style:solid; |
| 18 | + border-width:0pt 0pt 5px; |
| 19 | +} |
| 20 | + |
| 21 | +.yui-navset .yui-nav li, .yui-skin-sam .yui-navset .yui-navset-top .yui-nav li { |
| 22 | + margin:0pt 0.16em 0pt 0pt; |
| 23 | + padding:1px 0pt 0pt; |
| 24 | +} |
| 25 | +.yui-navset .yui-nav .selected, .yui-skin-sam .yui-navset .yui-navset-top .yui-nav .selected { |
| 26 | + margin:0pt 0.16em -1px 0pt; |
| 27 | +} |
| 28 | + |
| 29 | +.yui-navset .yui-nav a, .yui-navset .yui-navset-top .yui-nav a { |
| 30 | + background:#D8D8D8; |
| 31 | + border-color:#A3A3A3; |
| 32 | + border-style:solid; |
| 33 | + border-width:0pt 1px; |
| 34 | + color:#000000; |
| 35 | + position:relative; |
| 36 | + text-decoration:none; |
| 37 | +} |
| 38 | + |
| 39 | +.yui-navset .yui-nav a em, .yui-navset .yui-navset-top .yui-nav a em { |
| 40 | + border-color:#A3A3A3; |
| 41 | + border-style:solid; |
| 42 | + border-width:1px 0pt 0pt; |
| 43 | + bottom:0pt; |
| 44 | + left:0pt; |
| 45 | + padding:0.25em 0.75em; |
| 46 | + position:relative; |
| 47 | + right:0pt; |
| 48 | + top:-1px; |
| 49 | +} |
| 50 | + |
| 51 | +.yui-navset .yui-nav .selected a, .yui-navset .yui-nav .selected a:focus, .yui-navset .yui-nav .selected a:hover { |
| 52 | + background:#2647A0; |
| 53 | + color:#FFFFFF; |
| 54 | +} |
| 55 | + |
| 56 | +.yui-navset .yui-nav a:hover, .yui-navset .yui-nav a:focus { |
| 57 | + background:#BFDAFF; |
| 58 | + outline-color:invert; |
| 59 | + outline-style:none; |
| 60 | + outline-width:0pt; |
| 61 | +} |
| 62 | + |
| 63 | +.yui-navset .yui-nav .selected a em { |
| 64 | + padding:0.35em 0.75em; |
| 65 | +} |
| 66 | + |
| 67 | +.yui-navset .yui-nav .selected a, .yui-navset .yui-nav .selected a em { |
| 68 | + border-color:#243356; |
| 69 | +} |
| 70 | + |
| 71 | +.yui-navset .yui-nav .selected a em { |
| 72 | + padding:0.35em 0.75em; |
| 73 | +} |
| 74 | + |
| 75 | +.yui-navset .yui-content, .yui-navset .yui-navset-top .yui-content { |
| 76 | + border-color:#243356 rgb(128, 128, 128) rgb(128, 128, 128); |
| 77 | + border-style:solid; |
| 78 | + border-width:1px; |
| 79 | + padding:0.25em 0.5em; |
| 80 | +} |
| 81 | +.yui-navset-left .yui-nav, .yui-navset .yui-navset-left .yui-nav, .yui-navset .yui-navset-right .yui-nav, .yui-navset-right .yui-nav { |
| 82 | + border-width:0pt 5px 0pt 0pt; |
| 83 | + bottom:0pt; |
| 84 | + top:0pt; |
| 85 | +} |
| 86 | +.yui-navset .yui-navset-right .yui-nav, .yui-navset-right .yui-nav { |
| 87 | + border-width:0pt 0pt 0pt 5px; |
| 88 | +} |
| 89 | +.yui-navset-left .yui-nav li, .yui-navset .yui-navset-left .yui-nav li, .yui-navset-right .yui-nav li { |
| 90 | + margin:0pt 0pt 0.16em; |
| 91 | + padding:0pt 0pt 0pt 1px; |
| 92 | +} |
| 93 | +.yui-navset-right .yui-nav li { |
| 94 | + padding:0pt 1px 0pt 0pt; |
| 95 | +} |
| 96 | +.yui-navset-left .yui-nav .selected, .yui-navset .yui-navset-left .yui-nav .selected { |
| 97 | + margin:0pt -1px 0.16em 0pt; |
| 98 | +} |
| 99 | +.yui-navset-right .yui-nav .selected { |
| 100 | + margin:0pt 0pt 0.16em -1px; |
| 101 | +} |
| 102 | +.yui-navset-left .yui-nav a, .yui-navset-right .yui-nav a { |
| 103 | + border-width:1px 0pt; |
| 104 | +} |
| 105 | +.yui-navset-left .yui-nav a em, .yui-navset .yui-navset-left .yui-nav a em, .yui-navset-right .yui-nav a em { |
| 106 | + border-width:0pt 0pt 0pt 1px; |
| 107 | + left:-1px; |
| 108 | + padding:0.2em 0.75em; |
| 109 | + top:auto; |
| 110 | +} |
| 111 | +.yui-navset-right .yui-nav a em { |
| 112 | + border-width:0pt 1px 0pt 0pt; |
| 113 | + left:auto; |
| 114 | + right:-1px; |
| 115 | +} |
| 116 | +.yui-navset-left .yui-nav a, .yui-navset-left .yui-nav .selected a, .yui-navset-left .yui-nav a:hover, .yui-navset-right .yui-nav a, .yui-navset-right .yui-nav .selected a, .yui-navset-right .yui-nav a:hover, .yui-navset-bottom .yui-nav a, .yui-navset-bottom .yui-nav .selected a, .yui-navset-bottom .yui-nav a:hover { |
| 117 | + background-image:none; |
| 118 | +} |
| 119 | +.yui-navset-left .yui-content { |
| 120 | + border-color:#808080 rgb(128, 128, 128) rgb(128, 128, 128) rgb(36, 51, 86); |
| 121 | + border-style:solid; |
| 122 | + border-width:1px; |
| 123 | +} |
| 124 | +.yui-navset-bottom .yui-nav, .yui-navset .yui-navset-bottom .yui-nav { |
| 125 | + border-width:5px 0pt 0pt; |
| 126 | +} |
| 127 | +.yui-navset .yui-navset-bottom .yui-nav .selected, .yui-navset-bottom .yui-nav .selected { |
| 128 | + margin:-1px 0.16em 0pt 0pt; |
| 129 | +} |
| 130 | +.yui-navset .yui-navset-bottom .yui-nav li, .yui-navset-bottom .yui-nav li { |
| 131 | + padding:0pt 0pt 1px; |
| 132 | + vertical-align:top; |
| 133 | +} |
| 134 | +.yui-navset .yui-navset-bottom .yui-nav li a, .yui-navset-bottom .yui-nav li a { |
| 135 | +} |
| 136 | +.yui-navset .yui-navset-bottom .yui-nav a em, .yui-navset-bottom .yui-nav a em { |
| 137 | + border-width:0pt 0pt 1px; |
| 138 | + bottom:-1px; |
| 139 | + top:auto; |
| 140 | +} |
| 141 | +.yui-navset-bottom .yui-content, .yui-navset .yui-navset-bottom .yui-content { |
| 142 | + border-color:#808080 rgb(128, 128, 128) rgb(36, 51, 86); |
| 143 | + border-style:solid; |
| 144 | + border-width:1px; |
| 145 | +} |
| 146 | + |
| 147 | +.yui-navset .yui-nav a em, .yui-navset .yui-navset-top .yui-nav a em { |
| 148 | + border-color:#A3A3A3; |
| 149 | + border-style:solid; |
| 150 | + border-width:1px 0pt 0pt; |
| 151 | + bottom:0pt; |
| 152 | + left:0pt; |
| 153 | + padding:0.25em 0.75em; |
| 154 | + position:relative; |
| 155 | + right:0pt; |
| 156 | + top:-1px; |
| 157 | +} |
| 158 | +.yui-navset .yui-nav li a em, .yui-navset-top .yui-nav li a em, .yui-navset-bottom .yui-nav li a em { |
| 159 | + display:block; |
| 160 | +} |
| 161 | + |
| 162 | +.yui-navset .yui-nav a em, .yui-navset .yui-navset-top .yui-nav a em { |
| 163 | + border-color:#A3A3A3; |
| 164 | + border-style:solid; |
| 165 | + border-width:1px 0pt 0pt; |
| 166 | + bottom:0pt; |
| 167 | + left:0pt; |
| 168 | + padding:0.25em 0.75em; |
| 169 | + position:relative; |
| 170 | + right:0pt; |
| 171 | + top:-1px; |
| 172 | +} |
| 173 | + |
| 174 | +.yui-navset .yui-nav li a em, .yui-navset-top .yui-nav li a em, .yui-navset-bottom .yui-nav li a em { |
| 175 | + display:block; |
| 176 | +} |
| 177 | + |
| 178 | +.yui-navset .yui-nav a, .yui-navset .yui-navset-top .yui-nav a { |
| 179 | + color:#000000; |
| 180 | + text-decoration:none; |
| 181 | +} |
Property changes on: tags/extensions/HeaderTabs/REL_0_6_6/skins/headertabs.css |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 182 | + native |
Index: tags/extensions/HeaderTabs/REL_0_6_6/skins/blank.html |
Property changes on: tags/extensions/HeaderTabs/REL_0_6_6/skins/blank.html |
___________________________________________________________________ |
Name: svn:keywords |
2 | 183 | + Id Rev |
Index: tags/extensions/HeaderTabs/REL_0_6_6/skins/headertabs.js |
— | — | @@ -0,0 +1,119 @@ |
| 2 | +// Tabs code |
| 3 | +if (typeof HeaderTabs == "undefined") { |
| 4 | + var HeaderTabs = { }; |
| 5 | +} |
| 6 | + |
| 7 | +HeaderTabs.tabView = null; |
| 8 | +HeaderTabs.tabids = []; |
| 9 | +HeaderTabs.init = function(useHistory) { |
| 10 | + |
| 11 | + if (useHistory) |
| 12 | + { |
| 13 | + var bookmarkedtab = YAHOO.util.History.getBookmarkedState('tab') || '--no-tab--'; |
| 14 | + |
| 15 | + YAHOO.util.History.register('tab', bookmarkedtab, function(tabid) |
| 16 | + { |
| 17 | + for (var i = 0; i<HeaderTabs.tabids.length; i++) |
| 18 | + { |
| 19 | + if (HeaderTabs.tabids[i] == tabid) |
| 20 | + { |
| 21 | + HeaderTabs.tabView.set('activeIndex', i); |
| 22 | + return; |
| 23 | + } |
| 24 | + } |
| 25 | + }); |
| 26 | + |
| 27 | + try { |
| 28 | + YAHOO.util.History.initialize("yui-history-field", "yui-history-iframe"); |
| 29 | + } |
| 30 | + catch (e) |
| 31 | + { |
| 32 | + useHistory = false; |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + if (useHistory) |
| 37 | + { |
| 38 | + YAHOO.util.History.onReady(function() |
| 39 | + { |
| 40 | + var tabid = YAHOO.util.History.getCurrentState("tab"); |
| 41 | + for (var i = 0; i<HeaderTabs.tabids.length; i++) |
| 42 | + { |
| 43 | + if (HeaderTabs.tabids[i] == tabid) |
| 44 | + { |
| 45 | + HeaderTabs.tabView.set('activeIndex', i); |
| 46 | + return; |
| 47 | + } |
| 48 | + } |
| 49 | + }); |
| 50 | + } |
| 51 | + |
| 52 | + YAHOO.util.Event.onContentReady('headertabs', function() |
| 53 | + { |
| 54 | + HeaderTabs.tabView = new YAHOO.widget.TabView('headertabs'); |
| 55 | + |
| 56 | + var tabs = new YAHOO.util.Element('headertabs').getElementsByClassName('yui-content')[0].childNodes; |
| 57 | + |
| 58 | + YAHOO.util.Dom.batch(tabs, function(tab) { |
| 59 | + HeaderTabs.tabids.push(tab.id); |
| 60 | + }); |
| 61 | + |
| 62 | + HeaderTabs.tabView.set('activeIndex', 0); |
| 63 | + |
| 64 | + if (useHistory) |
| 65 | + { |
| 66 | + HeaderTabs.tabView.addListener('activeTabChange', function(e) |
| 67 | + { |
| 68 | + if (e.prevValue != e.newValue) |
| 69 | + { |
| 70 | + YAHOO.util.History.navigate('tab', HeaderTabs.tabids[HeaderTabs.tabView.get('activeIndex')]); |
| 71 | + } |
| 72 | + }); |
| 73 | + } |
| 74 | + }); |
| 75 | + |
| 76 | + YAHOO.util.Event.onContentReady('bodyContent', function() |
| 77 | + { |
| 78 | + // don't try adding tabs if there is no tabview |
| 79 | + if (typeof HeaderTabs.tabView == "undefined") |
| 80 | + { |
| 81 | + return; |
| 82 | + } |
| 83 | + |
| 84 | + // Adding Factbox tab |
| 85 | + var factboxdiv = new YAHOO.util.Element('bodyContent').getElementsByClassName('smwfact')[0]; |
| 86 | + if (factboxdiv) |
| 87 | + { |
| 88 | + HeaderTabs.tabView.addTab(new YAHOO.widget.Tab({ |
| 89 | + label: 'Factbox', |
| 90 | + id: 'headertabs_Factbox_tab', |
| 91 | + contentEl: factboxdiv |
| 92 | + })); |
| 93 | + |
| 94 | + HeaderTabs.tabids.push('Factbox'); |
| 95 | + |
| 96 | + document.getElementById('headertabs_Factbox_tab').getElementsByTagName('a')[0].id = 'headertab_Factbox'; |
| 97 | + } |
| 98 | + }); |
| 99 | +}; |
| 100 | + |
| 101 | +HeaderTabs.switchTab = function(tabid) { |
| 102 | + if (typeof HeaderTabs.tabView == "undefined") |
| 103 | + { |
| 104 | + return false; |
| 105 | + } |
| 106 | + |
| 107 | + for (var i = 0; i<HeaderTabs.tabids.length; i++) |
| 108 | + { |
| 109 | + if (HeaderTabs.tabids[i] == tabid) |
| 110 | + { |
| 111 | + HeaderTabs.tabView.set('activeIndex', i); |
| 112 | + |
| 113 | + document.getElementById('headertab_'+tabid).focus(); |
| 114 | + |
| 115 | + return false; |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + return false; |
| 120 | +} |
Property changes on: tags/extensions/HeaderTabs/REL_0_6_6/skins/headertabs.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 121 | + native |
Index: tags/extensions/HeaderTabs/REL_0_6_6/HeaderTabs.php |
— | — | @@ -0,0 +1,223 @@ |
| 2 | +<?php |
| 3 | +$htScriptPath = $wgScriptPath . '/extensions/HeaderTabs'; |
| 4 | + |
| 5 | +$wgExtensionFunctions[] = 'htSetupExtension'; |
| 6 | +$wgExtensionCredits['parserhook'][] = array( |
| 7 | + 'name' => 'Header Tabs', |
| 8 | + 'description' => 'Adds tabs to the page separating top-level sections. Originally developed for [http://www.ardorado.com Ardorado.com]', |
| 9 | + 'version' => '0.6.6', |
| 10 | + 'author' => '[http://www.sergeychernyshev.com Sergey Chernyshev] (for [http://www.semanticcommunities.com Semantic Communities LLC.])', |
| 11 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Header_Tabs' |
| 12 | +); |
| 13 | + |
| 14 | +$htYUIBase = 'http://yui.yahooapis.com/2.5.1/build/'; |
| 15 | +$htUseHistory = true; |
| 16 | + |
| 17 | +function htSetupExtension() |
| 18 | +{ |
| 19 | + global $wgHooks; |
| 20 | + global $wgParser; |
| 21 | + |
| 22 | + $wgHooks['BeforePageDisplay'][] = 'htAddHTMLHeader'; |
| 23 | + $wgHooks['ParserAfterTidy'][] = 'htReplaceFirstLevelHeaders'; |
| 24 | + $wgParser->setHook('headertabs', 'htTag' ); |
| 25 | + |
| 26 | + return true; |
| 27 | +} |
| 28 | + |
| 29 | +function htTag( $input, $args, $parser ) { |
| 30 | + global $wgOut, $htScriptPath; |
| 31 | + |
| 32 | + $wgOut->addLink(array( |
| 33 | + 'rel' => 'stylesheet', |
| 34 | + 'type' => 'text/css', |
| 35 | + 'media' => 'screen, projection', |
| 36 | + 'href' => $htScriptPath.'/skins/headertabs_hide_factbox.css' |
| 37 | + )); |
| 38 | + |
| 39 | + // this tag besides just enabling tabs, also designates end of tabs |
| 40 | + // TOC doesn't make sense where tabs are used |
| 41 | + return '<div id="nomoretabs"></div>'; |
| 42 | +} |
| 43 | + |
| 44 | +function htReplaceFirstLevelHeaders(&$parser, &$text) |
| 45 | +{ |
| 46 | + global $htUseHistory, $htScriptPath, $wgVersion; |
| 47 | + |
| 48 | + $aboveandbelow = explode('<div id="nomoretabs"></div>', $text, 2); |
| 49 | + |
| 50 | + if (count($aboveandbelow) <= 1) |
| 51 | + { |
| 52 | + return true; // <headertabs/> tag is not found |
| 53 | + } |
| 54 | + $below = $aboveandbelow[1]; |
| 55 | + |
| 56 | + $aboveandtext = preg_split('/(<a name=".*?"><\/a>)?<h1.*?class="mw-headline".*?<\/h1>/', $aboveandbelow[0], 2); |
| 57 | + if (count($aboveandtext) > 1) |
| 58 | + { |
| 59 | + $above = $aboveandtext[0]; |
| 60 | + |
| 61 | + $tabs = array(); |
| 62 | + |
| 63 | + $v = explode('.', $wgVersion); |
| 64 | + if ($v[0] > 1 || ($v[0] == 1 && $v[1] >= 16)) |
| 65 | + { |
| 66 | + $parts = preg_split('/(<h1.*?class="mw-headline".*?<\/h1>)/', $aboveandbelow[0], -1, PREG_SPLIT_DELIM_CAPTURE); |
| 67 | + array_shift($parts); // don't need above part anyway |
| 68 | + |
| 69 | + for ( $i = 0; $i<(count($parts)/2); $i++) |
| 70 | + { |
| 71 | + preg_match('/id="(.*?)"/', $parts[$i*2], $matches); |
| 72 | + $tabid = $matches[1]; |
| 73 | + |
| 74 | + preg_match('/<span.*?class="mw-headline".*?>\s*(.*?)\s*<\/h1>/', $parts[$i*2], $matches); |
| 75 | + $tabtitle = $matches[1]; |
| 76 | + |
| 77 | + array_push($tabs, array( |
| 78 | + 'tabid' => $tabid, |
| 79 | + 'title' => $tabtitle, |
| 80 | + 'tabcontent' => $parts[$i*2+1] |
| 81 | + )); |
| 82 | + } |
| 83 | + } |
| 84 | + else |
| 85 | + { |
| 86 | + $parts = preg_split('/<a name="(.*?)"><\/a><h1>.*?<span class="mw-headline">\s*(.*?)\s*<\/span><\/h1>/', $aboveandbelow[0], -1, PREG_SPLIT_DELIM_CAPTURE); |
| 87 | + array_shift($parts); // don't need above part anyway |
| 88 | + |
| 89 | + for ( $i = 0; $i<(count($parts)/3); $i++) |
| 90 | + { |
| 91 | + array_push($tabs, array( |
| 92 | + 'tabid' => $parts[$i*3], |
| 93 | + 'title' => $parts[$i*3+1], |
| 94 | + 'tabcontent' => $parts[$i*3+2] |
| 95 | + )); |
| 96 | + } |
| 97 | + } |
| 98 | + |
| 99 | + $tabhtml = '<div id="headertabs" class="yui-navset">'; |
| 100 | + |
| 101 | + $tabhtml .= '<ul class="yui-nav">'; |
| 102 | + $firsttab = true; |
| 103 | + foreach ($tabs as $tab) |
| 104 | + { |
| 105 | + $tabhtml .= '<li'; |
| 106 | + if ($firsttab) |
| 107 | + { |
| 108 | + $tabhtml .= ' class="selected"'; |
| 109 | + $firsttab = false; |
| 110 | + } |
| 111 | + $tabhtml .= '><a id="headertab_'.$tab['tabid'].'" tabid="#'.$tab['tabid'].'"><em>'.$tab['title']."</em></a></li>\n"; |
| 112 | + } |
| 113 | + $tabhtml .= '</ul>'; |
| 114 | + |
| 115 | + $tabhtml .= '<div class="yui-content">'; |
| 116 | + $firsttab = true; |
| 117 | + foreach ($tabs as $tab) |
| 118 | + { |
| 119 | + if ($firsttab) |
| 120 | + { |
| 121 | + $style = ''; |
| 122 | + $firsttab = false; |
| 123 | + } |
| 124 | + else |
| 125 | + { |
| 126 | + $style = ' style="display:none"'; |
| 127 | + } |
| 128 | + $tabhtml .= '<div id="'.$tab['tabid'].'"'.$style.'><p>'.$tab['tabcontent'].'</p></div>'; |
| 129 | + } |
| 130 | + $tabhtml .= '</div></div>'; |
| 131 | + |
| 132 | + if ($htUseHistory) |
| 133 | + { |
| 134 | + $text = '<iframe id="yui-history-iframe" src="'.$htScriptPath.'/skins/blank.html" style="position:absolute; top:0; left:0; width:1px; height:1px; visibility:hidden;"></iframe><input id="yui-history-field" type="hidden">'; |
| 135 | + } |
| 136 | + else |
| 137 | + { |
| 138 | + $text = ''; |
| 139 | + } |
| 140 | + $text .= '<script>HeaderTabs.init('.($htUseHistory ? 'true' : 'false').');</script>'; |
| 141 | + $text .= $above.$tabhtml.$below; |
| 142 | + } |
| 143 | + |
| 144 | + return true; |
| 145 | +} |
| 146 | + |
| 147 | +function htAddHTMLHeader(&$wgOut) |
| 148 | +{ |
| 149 | + global $htScriptPath, $htYUIBase, $htUseHistory; |
| 150 | + |
| 151 | + $wgOut->addScript('<script type="text/javascript" src="'.$htYUIBase.'utilities/utilities.js"></script>'); |
| 152 | + $wgOut->addScript('<script type="text/javascript" src="'.$htYUIBase.'tabview/tabview-min.js"></script>'); |
| 153 | + $wgOut->addScript('<script type="text/javascript" src="'.$htYUIBase.'event/event-min.js"></script>'); |
| 154 | + |
| 155 | + if ($htUseHistory) |
| 156 | + { |
| 157 | + // TODO Rewrite it using latest History package so we can update $htYUIBase to latest version |
| 158 | + $wgOut->addScript('<script type="text/javascript" src="'.$htYUIBase.'history/history-min.js"></script>'); |
| 159 | + } |
| 160 | + |
| 161 | + $wgOut->addLink(array( |
| 162 | + 'rel' => 'stylesheet', |
| 163 | + 'type' => 'text/css', |
| 164 | + 'media' => 'screen, projection', |
| 165 | + 'href' => $htYUIBase.'fonts/fonts-min.css' |
| 166 | + )); |
| 167 | + |
| 168 | + $wgOut->addScript('<script type="text/javascript" src="'.$htScriptPath.'/skins/headertabs.js"></script>'); |
| 169 | + |
| 170 | + $wgOut->addLink(array( |
| 171 | + 'rel' => 'stylesheet', |
| 172 | + 'type' => 'text/css', |
| 173 | + 'media' => 'screen, projection', |
| 174 | + 'href' => $htYUIBase.'tabview/assets/skins/sam/tabview.css' |
| 175 | + )); |
| 176 | + |
| 177 | + $wgOut->addLink(array( |
| 178 | + 'rel' => 'stylesheet', |
| 179 | + 'type' => 'text/css', |
| 180 | + 'media' => 'screen, projection', |
| 181 | + 'href' => $htScriptPath.'/skins/headertabs.css' |
| 182 | + )); |
| 183 | + |
| 184 | + return true; |
| 185 | +} |
| 186 | + |
| 187 | +# Parser function to insert a link changing a tab: |
| 188 | +$wgExtensionFunctions[] = 'headerTabsParserFunctions'; |
| 189 | +$wgHooks['LanguageGetMagic'][] = 'headerTabsLanguageGetMagic'; |
| 190 | + |
| 191 | +function headerTabsParserFunctions() |
| 192 | +{ |
| 193 | + global $wgParser; |
| 194 | + $wgParser->setFunctionHook('switchtablink', 'renderSwitchTabLink'); |
| 195 | +} |
| 196 | + |
| 197 | +function headerTabsLanguageGetMagic( &$magicWords, $langCode = "en" ) |
| 198 | +{ |
| 199 | + switch ( $langCode ) { |
| 200 | + default: |
| 201 | + $magicWords['switchtablink'] = array ( 0, 'switchtablink' ); |
| 202 | + } |
| 203 | + return true; |
| 204 | +} |
| 205 | + |
| 206 | +function renderSwitchTabLink(&$parser, $tabName, $linkText, $anotherTarget = '') |
| 207 | +{ |
| 208 | + $tabTitle = Title::newFromText($tabName); |
| 209 | + $tabKey = $tabTitle->getDBkey(); |
| 210 | + |
| 211 | + if ($anotherTarget != '') |
| 212 | + { |
| 213 | + $targetTitle = Title::newFromText($anotherTarget); |
| 214 | + $targetURL = $targetTitle->getFullURL(); |
| 215 | + |
| 216 | + $output = '<a href="'.$targetURL.'#tab='.$tabKey.'">'.$linkText.'</a>'; |
| 217 | + } |
| 218 | + else |
| 219 | + { |
| 220 | + $output = '<a href="#tab='.$tabKey.'" onclick="return HeaderTabs.switchTab(\''.$tabKey.'\')">'.$linkText.'</a>'; |
| 221 | + } |
| 222 | + |
| 223 | + return $parser->insertStripItem( $output, $parser->mStripState ); |
| 224 | +} |
Property changes on: tags/extensions/HeaderTabs/REL_0_6_6/HeaderTabs.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 225 | + native |