Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ModernSkylight for latest MediaWiki #23

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions SkinModernSkylight.php → ModernSkylightHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,35 @@
die( -1 );
}

class SkinModernSkylight extends SkinTemplate {

var $skinname = 'modernskylight', $stylename = 'ModernSkylight',
$template = 'ModernSkylightTemplate', $useHeadElement = true;

class ModernSkylightHooks {
/**
* Initializes output page and sets up skin-specific parameters
* @param $out OutputPage object to initialize
*/
public function initPage( OutputPage $out ) {
public static function onBeforePageDisplay( OutputPage $out, &$skin ) {
global $wgLocalStylePath;

parent::initPage( $out );
if ( $skin->getSkinName() !== 'modernskylight' ) {
return;
}

// Append CSS which includes IE only behavior fixes for hover support -
// this is better than including this in a CSS file since it doesn't
// wait for the CSS file to load before fetching the HTC file.
$min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min';
$min = $out->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min';
$out->addHeadItem( 'csshover',
'<!--[if lt IE 7]><style type="text/css">body{behavior:url("' .
htmlspecialchars( $wgLocalStylePath ) .
"/{$this->stylename}/csshover{$min}.htc\")}</style><![endif]-->");
"/ModernSkylight/csshover{$min}.htc\")}</style><![endif]-->");

// tab-size가 듣지 않는 IE를 위해 글꼴 강제 수정
$out->addHeadItem( 'fontoverride',
'<!--[if IE]><style type="text/css">pre{font-family:굴림,Gulrim !important;}</style><![endif]-->'
);

$out->addModuleScripts( 'skins.modern-skylight.js' );
if ($out->getTitle()->isMainPage()) {
$out->addModuleScripts( 'skins.modern-skylight.mainpage.js' );
$out->addModules( 'skins.modern-skylight.mainpage.js' );
}
}

function setupSkinUserCss( OutputPage $out ){
global $wgStylePath;

parent::setupSkinUserCss( $out );

$out->addModuleStyles( 'skins.modern-skylight.css' );
if ($out->getTitle()->isMainPage()) {
$out->addModuleStyles( 'skins.modern-skylight.mainpage.css' );
}
Expand Down
11 changes: 5 additions & 6 deletions ModernSkylightTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
define('NS_PORTAL', -10000);
}

use MediaWiki\MediaWikiServices;

class ModernSkylightTemplate extends BaseTemplate {

// Functions
Expand Down Expand Up @@ -96,22 +98,22 @@ public function execute() {
//$this->data['catlinks'] = str_replace("</li></ul>", "</li> / </ul>", $this->data['catlinks']);

# 메뉴를 위한 툴 리스트 받기
$toolList = $this->getToolbox();
$toolList = $this->data['sidebar']['TOOLBOX'];

# 대문 네임스페이스에서 제목에서 '대문:' 자 빼기
if ($c_namespace == NS_PORTAL && strpos($this->data['title'], ':') !== false)
$this->data['title'] = substr($this->data['title'], strpos($this->data['title'], ':') + 1 );

# 현재 유저가 어드민 그룹에 속해있는지 검사
if ( in_array('sysop', $skin->getUser()->getEffectiveGroups() ) )
$userGroupManager = MediaWikiServices::getInstance()->getUserGroupManager();
if ( in_array('sysop', $userGroupManager->getUserEffectiveGroups( $skin->getUser() ) ) )
$this->data['isadmin'] = true;
else
$this->data['isadmin'] = false;

# 메뉴바 데이터 가져오기
$this->data['menubar'] = ModernSkylightMenubar::getMenubar();
?>
<?php $this->html( 'headelement' ); ?>

<div id="header" role="header">
<div class="holder clear">
Expand Down Expand Up @@ -251,9 +253,6 @@ public function execute() {
<?=wfMessage( 'ModernSkylightFooter' )->parse()?>
</div>
</div>
<?php $this->printTrail(); ?>
</body>
</html>
<?php
}

Expand Down
3 changes: 3 additions & 0 deletions resources/modern-skylight.css
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,9 @@ ul.top-menu > li:hover > a {
padding: 0 6px 0 5px;
content: "»";
}
.catlinks-allhidden {
display: none;
}

/* Page title */
h1#firstheading {
Expand Down
25 changes: 23 additions & 2 deletions skin.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,39 @@
"license-name": "BSD-2",
"type": "skin",
"ValidSkinNames": {
"modernskylight": "ModernSkylight"
"modernskylight": {
"class": "SkinTemplate",
"args": [
{
"name": "modernskylight",
"template": "ModernSkylightTemplate",
"styles": [
"skins.modern-skylight.css"
],
"scripts": [
"skins.modern-skylight.js"
]
}
]
}
},
"MessagesDirs": {
"ModernSkylight": [
"i18n"
]
},
"requires": {
"MediaWiki": ">= 1.41.0"
},
"manifest_version": 2,
"AutoloadClasses": {
"SkinModernSkylight": "SkinModernSkylight.php",
"ModernSkylightHooks": "ModernSkylightHooks.php",
"ModernSkylightTemplate": "ModernSkylightTemplate.php",
"ModernSkylightMenubar": "ModernSkylightMenubar.php"
},
"Hooks": {
"BeforePageDisplay": "ModernSkylightHooks::onBeforePageDisplay"
},
"ResourceModules": {
"skins.modern-skylight.js": {
"scripts": [
Expand Down