mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-23 16:06:45 +00:00
2.4.1 - Switch hash tab switching. Target mobile. Remove deprecated files.
This commit is contained in:
parent
a499360d0d
commit
7b302a284b
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This is a backwards-compatibility shim, generated by:
|
||||
* https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
|
||||
*
|
||||
* Beginning with MediaWiki 1.23, translation strings are stored in json files,
|
||||
* and the EXTENSION.i18n.php file only exists to provide compatibility with
|
||||
* older releases of MediaWiki. For more information about this migration, see:
|
||||
* https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
|
||||
*
|
||||
* This shim maintains compatibility back to MediaWiki 1.17.
|
||||
*/
|
||||
$messages = array();
|
||||
if ( !function_exists( 'wfJsonI18nShim4f0a5bb1a7dd77ea' ) ) {
|
||||
function wfJsonI18nShim4f0a5bb1a7dd77ea( $cache, $code, &$cachedData ) {
|
||||
$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
|
||||
foreach ( $codeSequence as $csCode ) {
|
||||
$fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
|
||||
if ( is_readable( $fileName ) ) {
|
||||
$data = FormatJson::decode( file_get_contents( $fileName ), true );
|
||||
foreach ( array_keys( $data ) as $key ) {
|
||||
if ( $key === '' || $key[0] === '@' ) {
|
||||
unset( $data[$key] );
|
||||
}
|
||||
}
|
||||
$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
|
||||
}
|
||||
|
||||
$cachedData['deps'][] = new FileDependency( $fileName );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShim4f0a5bb1a7dd77ea';
|
||||
}
|
44
Tabber.php
44
Tabber.php
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Tabber
|
||||
* Tabber Main File
|
||||
*
|
||||
* @author Eric Fortin, Alexia E. Smith
|
||||
* @license GPL
|
||||
* @package Tabber
|
||||
* @link https://www.mediawiki.org/wiki/Extension:Tabber
|
||||
*
|
||||
**/
|
||||
|
||||
/******************************************/
|
||||
/* Credits */
|
||||
/******************************************/
|
||||
$credits = [
|
||||
'path' => __FILE__,
|
||||
'name' => 'Tabber',
|
||||
'author' => ['Eric Fortin', 'Alexia E. Smith'],
|
||||
'url' => 'https://www.mediawiki.org/wiki/Extension:Tabber',
|
||||
'descriptionmsg' => 'tabber-desc',
|
||||
'version' => '2.4'
|
||||
];
|
||||
$wgExtensionCredits['parserhook'][] = $credits;
|
||||
|
||||
|
||||
/******************************************/
|
||||
/* Language Strings, Page Aliases, Hooks */
|
||||
/******************************************/
|
||||
$extDir = __DIR__.'/';
|
||||
|
||||
$wgMessagesDirs['Tabber'] = "{$extDir}/i18n";
|
||||
$wgExtensionMessagesFiles['Tabber'] = "{$extDir}/Tabber.i18n.php";
|
||||
|
||||
$wgAutoloadClasses['TabberHooks'] = "{$extDir}/Tabber.hooks.php";
|
||||
|
||||
$wgHooks['ParserFirstCallInit'][] = 'TabberHooks::onParserFirstCallInit';
|
||||
|
||||
$wgResourceModules['ext.Tabber'] = [
|
||||
'localBasePath' => __DIR__,
|
||||
'remoteExtPath' => 'Tabber',
|
||||
'styles' => ['css/tabber.css'],
|
||||
'scripts' => ['js/tabber.js']
|
||||
];
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Tabber",
|
||||
"version": "2.4",
|
||||
"version": "2.4.1",
|
||||
"author": [
|
||||
"Eric Fortin",
|
||||
"Alexia E. Smith"
|
||||
|
@ -14,7 +14,7 @@
|
|||
]
|
||||
},
|
||||
"AutoloadClasses": {
|
||||
"TabberHooks": "/Tabber.hooks.php"
|
||||
"TabberHooks": "Tabber.hooks.php"
|
||||
},
|
||||
"ResourceModules": {
|
||||
"ext.Tabber": {
|
||||
|
@ -23,6 +23,10 @@
|
|||
],
|
||||
"scripts": [
|
||||
"js/tabber.js"
|
||||
],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
16
js/tabber.js
16
js/tabber.js
|
@ -44,12 +44,26 @@
|
|||
e.preventDefault();
|
||||
if ( history.pushState ) {
|
||||
history.pushState( null, null, '#' + title );
|
||||
switchTab(title);
|
||||
} else {
|
||||
location.hash = '#' + title;
|
||||
}
|
||||
showContent( title );
|
||||
} );
|
||||
|
||||
$(window).on('hashchange', function(event) {
|
||||
switchTab(event);
|
||||
});
|
||||
|
||||
function switchTab(event) {
|
||||
var tab = location.hash.replace('#', '');
|
||||
if (!tab.length) {
|
||||
showContent(tabContent.first().attr('title'));
|
||||
}
|
||||
if (nav.find('a[title="'+tab+'"]').length) {
|
||||
showContent(tab);
|
||||
}
|
||||
}
|
||||
|
||||
$this.addClass( 'tabberlive' );
|
||||
} );
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue