1
0
mirror of https://github.com/Hutchy68/pivot.git synced 2024-11-21 18:09:03 +01:00

update to skin and loading with wfLoadSkin

This commit is contained in:
Tom Hutchison 2017-03-12 12:52:30 -04:00
parent da9cc8a96d
commit 3c46af8dba
13 changed files with 3104 additions and 2093 deletions

View File

@ -8,7 +8,7 @@
*/ */
class Skinpivot extends SkinTemplate { class SkinPivot extends SkinTemplate {
public $skinname = 'pivot', $stylename = 'pivot', $template = 'pivotTemplate', $useHeadElement = true; public $skinname = 'pivot', $stylename = 'pivot', $template = 'pivotTemplate', $useHeadElement = true;
public function setupSkinUserCss(OutputPage $out) { public function setupSkinUserCss(OutputPage $out) {
@ -17,6 +17,7 @@ class Skinpivot extends SkinTemplate {
$wgPivotFeaturesDefaults = array( $wgPivotFeaturesDefaults = array(
'showActionsForAnon' => true, 'showActionsForAnon' => true,
'fixedNavBar' => false, 'fixedNavBar' => false,
'usePivotTabs' => false,
'showHelpUnderTools' => true, 'showHelpUnderTools' => true,
'showRecentChangesUnderTools' => true, 'showRecentChangesUnderTools' => true,
'wikiName' => &$GLOBALS['wgSitename'], 'wikiName' => &$GLOBALS['wgSitename'],
@ -42,7 +43,7 @@ class Skinpivot extends SkinTemplate {
header('X-UA-Compatible: IE=edge'); header('X-UA-Compatible: IE=edge');
break; break;
} }
$out->addModuleStyles('skins.pivot'); $out->addModuleStyles('skins.pivot.styles');
} }
public function initPage(OutputPage $out) { public function initPage(OutputPage $out) {
@ -51,7 +52,7 @@ class Skinpivot extends SkinTemplate {
$viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0'; $viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0';
$out->addMeta('viewport', $viewport_meta); $out->addMeta('viewport', $viewport_meta);
$out->addModuleScripts('skins.pivot'); $out->addModuleScripts('skins.pivot.js');
} }
} }
@ -61,7 +62,7 @@ class pivotTemplate extends BaseTemplate {
public function execute() { public function execute() {
global $wgUser; global $wgUser;
global $wgPivotFeatures; global $wgPivotFeatures;
wfSuppressWarnings(); //wfSuppressWarnings();
$this->html('headelement'); $this->html('headelement');
switch ($wgPivotFeatures['usePivotTabs']) { switch ($wgPivotFeatures['usePivotTabs']) {
case true: case true:
@ -126,7 +127,7 @@ class pivotTemplate extends BaseTemplate {
</form> </form>
</li> </li>
<?php include(__DIR__.'/view/sidebar.php'); ?> <?php $this->renderSidebar() ?>
</ul> </ul>
</aside> </aside>
@ -171,7 +172,7 @@ class pivotTemplate extends BaseTemplate {
</form> </form>
</li> </li>
<?php include(__DIR__.'/view/sidebar.php'); ?> <?php $this->renderSidebar() ?>
</ul> </ul>
</div> </div>
@ -219,7 +220,6 @@ class pivotTemplate extends BaseTemplate {
switch ($wgPivotFeatures['usePivotTabs']) { switch ($wgPivotFeatures['usePivotTabs']) {
case true: case true:
echo $body; echo $body;
ob_flush();
break; break;
default: default:
$this->html('bodytext'); $this->html('bodytext');
@ -280,7 +280,7 @@ class pivotTemplate extends BaseTemplate {
<?php $this->printTrail(); ?> <?php $this->printTrail(); ?>
<?php if ($wgPivotFeatures['addThisFollowPUBID'] != '') { ?> <?php if ($wgPivotFeatures['addThisPUBID'] != '') { ?>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async">></script> <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async">></script>
<?php } ?> <?php } ?>
</body> </body>
@ -288,6 +288,21 @@ class pivotTemplate extends BaseTemplate {
<?php <?php
wfRestoreWarnings(); wfRestoreWarnings();
}
function renderSidebar() {
$sidebar = $this->getSidebar();
$toolbox = $this->getToolbox();
foreach ($sidebar as $boxName => $box) { if ( ($box['header'] != wfMessage( 'toolbox' )->text()) ) {
echo '<li id='.Sanitizer::escapeId( $box['id'] ); Linker::tooltip( $box['id'] ).'>';
echo '<li><label>'.htmlspecialchars( $box['header'] ).'</label></li>';
if ( is_array( $box['content'] ) ) {
foreach ($box['content'] as $key => $item) { echo $this->makeListItem($key, $item); }
} }
}
echo '<li><label>Toolbox</label></li>';
foreach ($toolbox as $key => $item) { echo $this->makeListItem($key, $item); }
} }
} }
?> ?>

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 348 KiB

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

View File

@ -60,7 +60,7 @@ if ( jQuery( '#ca-addsection' ).length ) {
jQuery('li#n-recentchanges a').prepend('<div id="drop-icon"><i class="fa fa-tasks fa-fw"></i></div>') jQuery('li#n-recentchanges a').prepend('<div id="drop-icon"><i class="fa fa-tasks fa-fw"></i></div>')
jQuery('li#n-help a').prepend('<div id="drop-icon"><i class="fa fa-question fa-fw"></i></div>') jQuery('li#n-help a').prepend('<div id="drop-icon"><i class="fa fa-question fa-fw"></i></div>')
jQuery('li#n-randompage a').prepend('<div id="drop-icon"><i class="fa fa-random fa-fw"></i></div>')
// Turn categories into labels // Turn categories into labels

View File

@ -1,13 +1,13 @@
/*! /*!
* Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/ */
/* FONT PATH /* FONT PATH
* -------------------------- */ * -------------------------- */
@font-face { @font-face {
font-family: 'FontAwesome'; font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.4.0'); src: url('../fonts/fontawesome-webfont.eot?v=4.7.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.4.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.4.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.4.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.4.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.4.0#fontawesomeregular') format('svg'); src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@ -118,31 +118,31 @@
} }
} }
.fa-rotate-90 { .fa-rotate-90 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
-webkit-transform: rotate(90deg); -webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg); -ms-transform: rotate(90deg);
transform: rotate(90deg); transform: rotate(90deg);
} }
.fa-rotate-180 { .fa-rotate-180 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg); -ms-transform: rotate(180deg);
transform: rotate(180deg); transform: rotate(180deg);
} }
.fa-rotate-270 { .fa-rotate-270 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
-webkit-transform: rotate(270deg); -webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg); -ms-transform: rotate(270deg);
transform: rotate(270deg); transform: rotate(270deg);
} }
.fa-flip-horizontal { .fa-flip-horizontal {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1); -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
-webkit-transform: scale(-1, 1); -webkit-transform: scale(-1, 1);
-ms-transform: scale(-1, 1); -ms-transform: scale(-1, 1);
transform: scale(-1, 1); transform: scale(-1, 1);
} }
.fa-flip-vertical { .fa-flip-vertical {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1); -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
-webkit-transform: scale(1, -1); -webkit-transform: scale(1, -1);
-ms-transform: scale(1, -1); -ms-transform: scale(1, -1);
transform: scale(1, -1); transform: scale(1, -1);
@ -1383,7 +1383,7 @@
.fa-digg:before { .fa-digg:before {
content: "\f1a6"; content: "\f1a6";
} }
.fa-pied-piper:before { .fa-pied-piper-pp:before {
content: "\f1a7"; content: "\f1a7";
} }
.fa-pied-piper-alt:before { .fa-pied-piper-alt:before {
@ -1509,6 +1509,7 @@
content: "\f1ce"; content: "\f1ce";
} }
.fa-ra:before, .fa-ra:before,
.fa-resistance:before,
.fa-rebel:before { .fa-rebel:before {
content: "\f1d0"; content: "\f1d0";
} }
@ -1831,6 +1832,7 @@
content: "\f23e"; content: "\f23e";
} }
.fa-battery-4:before, .fa-battery-4:before,
.fa-battery:before,
.fa-battery-full:before { .fa-battery-full:before {
content: "\f240"; content: "\f240";
} }
@ -2024,3 +2026,312 @@
.fa-fonticons:before { .fa-fonticons:before {
content: "\f280"; content: "\f280";
} }
.fa-reddit-alien:before {
content: "\f281";
}
.fa-edge:before {
content: "\f282";
}
.fa-credit-card-alt:before {
content: "\f283";
}
.fa-codiepie:before {
content: "\f284";
}
.fa-modx:before {
content: "\f285";
}
.fa-fort-awesome:before {
content: "\f286";
}
.fa-usb:before {
content: "\f287";
}
.fa-product-hunt:before {
content: "\f288";
}
.fa-mixcloud:before {
content: "\f289";
}
.fa-scribd:before {
content: "\f28a";
}
.fa-pause-circle:before {
content: "\f28b";
}
.fa-pause-circle-o:before {
content: "\f28c";
}
.fa-stop-circle:before {
content: "\f28d";
}
.fa-stop-circle-o:before {
content: "\f28e";
}
.fa-shopping-bag:before {
content: "\f290";
}
.fa-shopping-basket:before {
content: "\f291";
}
.fa-hashtag:before {
content: "\f292";
}
.fa-bluetooth:before {
content: "\f293";
}
.fa-bluetooth-b:before {
content: "\f294";
}
.fa-percent:before {
content: "\f295";
}
.fa-gitlab:before {
content: "\f296";
}
.fa-wpbeginner:before {
content: "\f297";
}
.fa-wpforms:before {
content: "\f298";
}
.fa-envira:before {
content: "\f299";
}
.fa-universal-access:before {
content: "\f29a";
}
.fa-wheelchair-alt:before {
content: "\f29b";
}
.fa-question-circle-o:before {
content: "\f29c";
}
.fa-blind:before {
content: "\f29d";
}
.fa-audio-description:before {
content: "\f29e";
}
.fa-volume-control-phone:before {
content: "\f2a0";
}
.fa-braille:before {
content: "\f2a1";
}
.fa-assistive-listening-systems:before {
content: "\f2a2";
}
.fa-asl-interpreting:before,
.fa-american-sign-language-interpreting:before {
content: "\f2a3";
}
.fa-deafness:before,
.fa-hard-of-hearing:before,
.fa-deaf:before {
content: "\f2a4";
}
.fa-glide:before {
content: "\f2a5";
}
.fa-glide-g:before {
content: "\f2a6";
}
.fa-signing:before,
.fa-sign-language:before {
content: "\f2a7";
}
.fa-low-vision:before {
content: "\f2a8";
}
.fa-viadeo:before {
content: "\f2a9";
}
.fa-viadeo-square:before {
content: "\f2aa";
}
.fa-snapchat:before {
content: "\f2ab";
}
.fa-snapchat-ghost:before {
content: "\f2ac";
}
.fa-snapchat-square:before {
content: "\f2ad";
}
.fa-pied-piper:before {
content: "\f2ae";
}
.fa-first-order:before {
content: "\f2b0";
}
.fa-yoast:before {
content: "\f2b1";
}
.fa-themeisle:before {
content: "\f2b2";
}
.fa-google-plus-circle:before,
.fa-google-plus-official:before {
content: "\f2b3";
}
.fa-fa:before,
.fa-font-awesome:before {
content: "\f2b4";
}
.fa-handshake-o:before {
content: "\f2b5";
}
.fa-envelope-open:before {
content: "\f2b6";
}
.fa-envelope-open-o:before {
content: "\f2b7";
}
.fa-linode:before {
content: "\f2b8";
}
.fa-address-book:before {
content: "\f2b9";
}
.fa-address-book-o:before {
content: "\f2ba";
}
.fa-vcard:before,
.fa-address-card:before {
content: "\f2bb";
}
.fa-vcard-o:before,
.fa-address-card-o:before {
content: "\f2bc";
}
.fa-user-circle:before {
content: "\f2bd";
}
.fa-user-circle-o:before {
content: "\f2be";
}
.fa-user-o:before {
content: "\f2c0";
}
.fa-id-badge:before {
content: "\f2c1";
}
.fa-drivers-license:before,
.fa-id-card:before {
content: "\f2c2";
}
.fa-drivers-license-o:before,
.fa-id-card-o:before {
content: "\f2c3";
}
.fa-quora:before {
content: "\f2c4";
}
.fa-free-code-camp:before {
content: "\f2c5";
}
.fa-telegram:before {
content: "\f2c6";
}
.fa-thermometer-4:before,
.fa-thermometer:before,
.fa-thermometer-full:before {
content: "\f2c7";
}
.fa-thermometer-3:before,
.fa-thermometer-three-quarters:before {
content: "\f2c8";
}
.fa-thermometer-2:before,
.fa-thermometer-half:before {
content: "\f2c9";
}
.fa-thermometer-1:before,
.fa-thermometer-quarter:before {
content: "\f2ca";
}
.fa-thermometer-0:before,
.fa-thermometer-empty:before {
content: "\f2cb";
}
.fa-shower:before {
content: "\f2cc";
}
.fa-bathtub:before,
.fa-s15:before,
.fa-bath:before {
content: "\f2cd";
}
.fa-podcast:before {
content: "\f2ce";
}
.fa-window-maximize:before {
content: "\f2d0";
}
.fa-window-minimize:before {
content: "\f2d1";
}
.fa-window-restore:before {
content: "\f2d2";
}
.fa-times-rectangle:before,
.fa-window-close:before {
content: "\f2d3";
}
.fa-times-rectangle-o:before,
.fa-window-close-o:before {
content: "\f2d4";
}
.fa-bandcamp:before {
content: "\f2d5";
}
.fa-grav:before {
content: "\f2d6";
}
.fa-etsy:before {
content: "\f2d7";
}
.fa-imdb:before {
content: "\f2d8";
}
.fa-ravelry:before {
content: "\f2d9";
}
.fa-eercast:before {
content: "\f2da";
}
.fa-microchip:before {
content: "\f2db";
}
.fa-snowflake-o:before {
content: "\f2dc";
}
.fa-superpowers:before {
content: "\f2dd";
}
.fa-wpexplorer:before {
content: "\f2de";
}
.fa-meetup:before {
content: "\f2e0";
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +1,14 @@
<?php <?php
/** if ( function_exists( 'wfLoadSkin' ) ) {
* Pivot Skin wfLoadSkin( 'pivot' );
* // Keep i18n globals so mergeMessageFileList.php doesn't break
* @file Since Version 1.0 $wgMessagesDirs['pivot'] = __DIR__ . '/i18n';
* @ingroup Skins /* wfWarn(
* @author Garrick Van Buren, Jamie Thingelstad 'Deprecated PHP entry point used for Pivot skin. Please use wfLoadSkin instead, ' .
* @author Tom Hutchison 'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
* @license 2-clause BSD ); */
*/ return true;
} else {
if ( ! defined('MEDIAWIKI')) die( 'This version of the Pivot skin requires MediaWiki 1.25+' );
{
die("Not Directly Called So What Are You Doing");
} }
$wgExtensionCredits['skin'][] = array(
'path' => __FILE__,
'name' => 'skinname-pivot',
'url' => 'http://github.com/hutchy68/pivot/',
'author' => array(
'Tom Hutchison',
'...'
),
'version' => '1.0.0 rc',
'descriptionmsg' => 'pivot-desc'
);
$wgValidSkinNames['pivot'] = 'Pivot';
$wgAutoloadClasses['SkinPivot'] = __DIR__.'/Pivot.skin.php';
$wgMessagesDirs['SkinPivot'] = __DIR__.'/i18n';
$wgResourceModules['skins.pivot'] = array(
'styles' => array(
'pivot/assets/stylesheets/normalize.css',
'pivot/assets/stylesheets/font-awesome.css',
'pivot/assets/stylesheets/foundation.css',
'pivot/assets/stylesheets/pivot.css',
'pivot/assets/stylesheets/pivot-print.css',
'pivot/assets/stylesheets/jquery.autocomplete.css'
),
'scripts' => array(
'pivot/assets/scripts/vendor/jquery.cookie.js',
'pivot/assets/scripts/vendor/modernizr.js',
'pivot/assets/scripts/vendor/fastclick.js',
'pivot/assets/scripts/vendor/placeholder.js',
'pivot/assets/scripts/foundation/foundation.js',
'pivot/assets/scripts/foundation/foundation.topbar.js',
'pivot/assets/scripts/foundation/foundation.tooltip.js',
'pivot/assets/scripts/foundation/foundation.tab.js',
'pivot/assets/scripts/foundation/foundation.slider.js',
'pivot/assets/scripts/foundation/foundation.reveal.js',
'pivot/assets/scripts/foundation/foundation.orbit.js',
'pivot/assets/scripts/foundation/foundation.offcanvas.js',
'pivot/assets/scripts/foundation/foundation.magellan.js',
'pivot/assets/scripts/foundation/foundation.joyride.js',
'pivot/assets/scripts/foundation/foundation.interchange.js',
'pivot/assets/scripts/foundation/foundation.equalizer.js',
'pivot/assets/scripts/foundation/foundation.dropdown.js',
'pivot/assets/scripts/foundation/foundation.clearing.js',
'pivot/assets/scripts/foundation/foundation.alert.js',
'pivot/assets/scripts/foundation/foundation.accordion.js',
'pivot/assets/scripts/foundation/foundation.abide.js',
'pivot/assets/scripts/pivot.js',
),
'remoteBasePath' => &$GLOBALS['wgStylePath'],
'localBasePath' => &$GLOBALS['wgStyleDirectory']
);

76
skin.json Normal file
View File

@ -0,0 +1,76 @@
{
"name": "Pivot",
"version": "1.0.0",
"author": [
"Tom Hutchison",
"..."
],
"url": "http://github.com/hutchy68/pivot",
"descriptionmsg": "pivot-desc",
"type": "skin",
"ValidSkinNames": {
"pivot": "Pivot"
},
"MessagesDirs": {
"Skinpivot": [
"i18n"
]
},
"AutoloadClasses": {
"SkinPivot": "Pivot.skin.php"
},
"ResourceModules": {
"skins.pivot.styles": {
"position": "top",
"styles": [
"assets/stylesheets/normalize.css",
"assets/stylesheets/font-awesome.css",
"assets/stylesheets/foundation.css",
"assets/stylesheets/pivot.css",
"assets/stylesheets/pivot-print.css"
]
},
"skins.pivot.modernizr": {
"position": "top",
"scripts": [
"assets/scripts/vendor/modernizr.js"
]
},
"skins.pivot.js": {
"position": "bottom",
"scripts": [
"assets/scripts/vendor/jquery.cookie.js",
"assets/scripts/vendor/fastclick.js",
"assets/scripts/vendor/placeholder.js",
"assets/scripts/foundation/foundation.js",
"assets/scripts/foundation/foundation.topbar.js",
"assets/scripts/foundation/foundation.tooltip.js",
"assets/scripts/foundation/foundation.tab.js",
"assets/scripts/foundation/foundation.slider.js",
"assets/scripts/foundation/foundation.reveal.js",
"assets/scripts/foundation/foundation.orbit.js",
"assets/scripts/foundation/foundation.offcanvas.js",
"assets/scripts/foundation/foundation.magellan.js",
"assets/scripts/foundation/foundation.joyride.js",
"assets/scripts/foundation/foundation.interchange.js",
"assets/scripts/foundation/foundation.equalizer.js",
"assets/scripts/foundation/foundation.dropdown.js",
"assets/scripts/foundation/foundation.clearing.js",
"assets/scripts/foundation/foundation.alert.js",
"assets/scripts/foundation/foundation.accordion.js",
"assets/scripts/foundation/foundation.abide.js",
"assets/scripts/pivot.js"
],
"dependencies": [
"jquery.cookie",
"skins.pivot.modernizr"
]
}
},
"ResourceFileModulePaths": {
"localBasePath": "",
"remoteSkinPath": "pivot"
},
"config": {},
"manifest_version": 1
}

View File

@ -1,26 +0,0 @@
<?php
/**
* Pivot Skin
*
* @file Builds the Sidebar reducing code duplication
* @since Version 1.0
* @ingroup Skins
* @author Tom Hutchison
* @license 2-clause BSD
*/
if ( ! defined('MEDIAWIKI'))
{
die("Not Directly Called So What Are You Doing?");
}
foreach ($this->getSidebar() as $boxName => $box) { if ( ($box['header'] != wfMessage( 'toolbox' )->text()) ) { ?>
<li id='<?php echo Sanitizer::escapeId( $box['id'] ) ?>'<?php echo Linker::tooltip( $box['id'] ) ?>>
<li><label><?php echo htmlspecialchars( $box['header'] ); ?></label></li>
<?php if ( is_array( $box['content'] ) ) { ?>
<?php foreach ($box['content'] as $key => $item) { echo $this->makeListItem($key, $item); } ?>
<?php } } ?>
<?php } ?>
<li><label>Toolbox</label></li>
<?php foreach ($this->getToolbox() as $key => $item) { echo $this->makeListItem($key, $item); } ?>