Sfoglia il codice sorgente

Merge pull request #236 from paladox/patch-14

Add support for extension.json whilst supporting mw 1.24 or lower. Thanks @paladox, excellent PR
Tom Hutchison 9 anni fa
parent
commit
3912fd0aa0
3 ha cambiato i file con 83 aggiunte e 8 eliminazioni
  1. 2 2
      Foreground.skin.php
  2. 19 6
      foreground.php
  3. 62 0
      skin.json

+ 2 - 2
Foreground.skin.php

@@ -39,7 +39,7 @@ class Skinforeground extends SkinTemplate {
 					header('X-UA-Compatible: IE=edge');
 				break;
 		}
-		$out->addModuleStyles('skins.foreground');
+		$out->addModuleStyles('skins.foreground.styles');
 	}
 
 	public function initPage( OutputPage $out ) {
@@ -48,7 +48,7 @@ class Skinforeground extends SkinTemplate {
 
 		$viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0';
 	  $out->addMeta('viewport', $viewport_meta);
-		$out->addModuleScripts('skins.foreground');
+		$out->addModuleScripts('skins.foreground.js');
 	}
 
 }

+ 19 - 6
foreground.php

@@ -9,8 +9,15 @@
  * @license 2-clause BSD
  */
 
-if( !defined( 'MEDIAWIKI' ) ) {
-   die( 'This is a skin to the MediaWiki package and cannot be run standalone.' );
+if ( function_exists( 'wfLoadSkin' ) ) {
+	wfLoadSkin( 'foreground' );
+	// Keep i18n globals so mergeMessageFileList.php doesn't break
+	$wgMessagesDirs['SkinForeground'] = __DIR__ . '/i18n';
+	/* wfWarn(
+		'Deprecated PHP entry point used for foreground skin. Please use wfLoadSkin instead, ' .
+		'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
+	); */
+	return;
 }
 
 $wgExtensionCredits['skin'][] = array(
@@ -23,7 +30,7 @@ $wgExtensionCredits['skin'][] = array(
 		'Jamie Thingelstad',
 		'Tom Hutchison',
 		'...'
-		),
+	),
 	'descriptionmsg' => 'foreground-desc'
 );
 
@@ -34,7 +41,8 @@ $wgAutoloadClasses['SkinForeground'] = __DIR__ . '/Foreground.skin.php';
 $wgMessagesDirs['SkinForeground'] = __DIR__ . '/i18n';
 $wgExtensionMessagesFiles['SkinForeground'] = __DIR__ . '/Foreground.i18n.php';
 
-$wgResourceModules['skins.foreground'] = array(
+$wgResourceModules['skins.foreground.styles'] = array(
+	'position'       => 'top',
 	'styles'         => array(
 		'foreground/assets/stylesheets/normalize.css',
 		'foreground/assets/stylesheets/font-awesome.css',
@@ -44,6 +52,12 @@ $wgResourceModules['skins.foreground'] = array(
 		'foreground/assets/stylesheets/jquery.autocomplete.css',
 		'foreground/assets/stylesheets/responsive-tables.css'
 	),
+	'remoteBasePath' => &$GLOBALS['wgStylePath'],
+	'localBasePath'  => &$GLOBALS['wgStyleDirectory']
+);
+
+$wgResourceModules['skins.foreground.js'] = array(
+	'position'       => 'top',
 	'scripts'        => array(
 		'foreground/assets/scripts/vendor/custom.modernizr.js',
 		'foreground/assets/scripts/vendor/fastclick.js',
@@ -60,6 +74,5 @@ $wgResourceModules['skins.foreground'] = array(
 		'foreground/assets/scripts/foreground.js'
 	),
 	'remoteBasePath' => &$GLOBALS['wgStylePath'],
-	'localBasePath'  => &$GLOBALS['wgStyleDirectory'],
-	'position'       => 'bottom'
+	'localBasePath'  => &$GLOBALS['wgStyleDirectory']
 );

+ 62 - 0
skin.json

@@ -0,0 +1,62 @@
+{
+	"name": "Foreground",
+	"version": "1.2-alpha",
+	"author": [
+		"Garrick Van Buren",
+		"Jamie Thingelstad",
+		"Tom Hutchison",
+		"..."
+	],
+	"url": "http://foreground.thingelstad.com",
+	"descriptionmsg": "foreground-desc",
+	"type": "skin",
+	"ValidSkinNames": {
+		"foreground": "Foreground"
+	},
+	"MessagesDirs": {
+		"SkinForeground": [
+			"i18n"
+		]
+	},
+	"AutoloadClasses": {
+		"SkinForeground": "Foreground.skin.php"
+	},
+	"ResourceModules": {
+		"skins.foreground.styles": {
+			"position": "top",
+			"styles": [
+				"assets/stylesheets/normalize.css",
+				"assets/stylesheets/font-awesome.css",
+				"assets/stylesheets/foundation.css",
+				"assets/stylesheets/foreground.css",
+				"assets/stylesheets/foreground-print.css",
+				"assets/stylesheets/jquery.autocomplete.css",
+				"assets/stylesheets/responsive-tables.css"
+			]
+		},
+		"skins.foreground.js": {
+			"position": "top",
+			"scripts": [
+				"assets/scripts/vendor/custom.modernizr.js",
+				"assets/scripts/vendor/fastclick.js",
+				"assets/scripts/vendor/responsive-tables.js",
+				"assets/scripts/foundation/foundation.js",
+				"assets/scripts/foundation/foundation.topbar.js",
+				"assets/scripts/foundation/foundation.dropdown.js",
+				"assets/scripts/foundation/foundation.section.js",
+				"assets/scripts/foundation/foundation.clearing.js",
+				"assets/scripts/foundation/foundation.cookie.js",
+				"assets/scripts/foundation/foundation.placeholder.js",
+				"assets/scripts/foundation/foundation.forms.js",
+				"assets/scripts/foundation/foundation.alerts.js",
+				"assets/scripts/foreground.js"
+			]
+		}
+	},
+	"ResourceFileModulePaths": {
+		"localBasePath": "",
+		"remoteSkinPath": "foreground"
+	},
+	"config": {},
+	"manifest_version": 1
+}