Index: trunk/extensions/UsabilityInitiative/CollapsibleTabs/CollapsibleTabs.php |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Usability Initiative CollapsibleTabs extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * |
| 9 | + * This file contains the include file for the CollapsibleTabs portion of the |
| 10 | + * UsabilityInitiative extension of MediaWiki. |
| 11 | + * |
| 12 | + * Usage: Include the following line in your LocalSettings.php |
| 13 | + * require_once( "$IP/extensions/UsabilityInitiative/CollapsibleTabs/CollapsibleTabs.php" ); |
| 14 | + * |
| 15 | + * @author Adam Miller <amiller@wikimedia.org> |
| 16 | + * @license GPL v2 or later |
| 17 | + * @version 0.0.1 |
| 18 | + */ |
| 19 | + |
| 20 | +/* Configuration */ |
| 21 | +// Bump the version number every time you change any of the .css/.js files |
| 22 | +$wgCollapsibleTabsStyleVersion = 1; |
| 23 | + |
| 24 | +/* Setup */ |
| 25 | + |
| 26 | +// Credits |
| 27 | +$wgExtensionCredits['other'][] = array( |
| 28 | + 'path' => __FILE__, |
| 29 | + 'name' => 'CollapsibleTabs', |
| 30 | + 'author' => 'Adam Miller', |
| 31 | + 'version' => '0.0.1', |
| 32 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:CollapsibleTabs', |
| 33 | + 'descriptionmsg' => 'collapsibletabs-desc', |
| 34 | +); |
| 35 | +// Includes parent extension |
| 36 | +require_once( dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative.php" ); |
| 37 | + |
| 38 | + |
| 39 | +// Adds Autoload Classes |
| 40 | +$wgAutoloadClasses['CollapsibleTabsHooks'] = |
| 41 | + dirname( __FILE__ ) . '/CollapsibleTabs.hooks.php'; |
| 42 | + |
| 43 | +$wgHooks['BeforePageDisplay'][] = 'CollapsibleTabsHooks::addCollapsibleTabs'; |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/CollapsibleTabs/CollapsibleTabs.hooks.php |
— | — | @@ -0,0 +1,38 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Hooks for Usability Initiative Collapsing Tabs extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +class CollapsibleTabsHooks { |
| 11 | + |
| 12 | + /* Static Functions */ |
| 13 | + |
| 14 | + |
| 15 | + /** |
| 16 | + * addCollapsibleTabs hook |
| 17 | + */ |
| 18 | + public static function addCollapsibleTabs( $out ) { |
| 19 | + global $wgCollapsibleTabsStyleVersion, $wgScriptPath, $wgJsMimeType; |
| 20 | + |
| 21 | + $out->addScript( |
| 22 | + Xml::element( |
| 23 | + 'script', |
| 24 | + array( |
| 25 | + 'type' => $wgJsMimeType, |
| 26 | + 'src' => $wgScriptPath . |
| 27 | + "/extensions/UsabilityInitiative/" . |
| 28 | + 'CollapsibleTabs/CollapsibleTabs.js?'. |
| 29 | + $wgCollapsibleTabsStyleVersion, |
| 30 | + ), |
| 31 | + '', |
| 32 | + false |
| 33 | + ) |
| 34 | + ); |
| 35 | + |
| 36 | + return true; |
| 37 | + } |
| 38 | + |
| 39 | +} |
Index: trunk/extensions/UsabilityInitiative/CollapsibleTabs/CollapsibleTabs.js |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +js2AddOnloadHook( function() { |
| 3 | + |
| 4 | + // add first and last classes to left and right nav |
| 5 | + var $leftNavPosition = $j('#left-navigation').position().left; |
| 6 | + var $leftNavWidth = $j('#left-navigation').width(); |
| 7 | + // add browser resive event |
| 8 | + $j(window).bind('resize', function () { |
| 9 | + if(( $leftNavPosition + $leftNavWidth) > $j('#right-navigation').position().left){ |
| 10 | + // Collision! Pop the last item off the right nav and put it in the drop down |
| 11 | + console.log('collision!'); |
| 12 | + } |
| 13 | + }); |
| 14 | +}); |
\ No newline at end of file |