diff --git a/Refreshed.skin.php b/Refreshed.skin.php index 7b831ce..a278570 100644 --- a/Refreshed.skin.php +++ b/Refreshed.skin.php @@ -1,522 +1,507 @@ addMeta( 'viewport', 'width=device-width' ); $min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '.src' : '.min'; - // Add CSS @media support for older browsers (such as Internet Explorer - // 8) that do not support it natively - // @see https:// github.com/Brickimedia/brickimedia/issues/224 - // @todo FIXME: add Respond into the resources directory - // (skins/Refreshed/refreshed) and load it from there instead of from GitHub - // Remember to use the global variable $wgLocalStylePath, just like how - // Vector does! - $out->addHeadItem( 'css3mediaquerypolyfill', - '' - ); // add jQuery Mobile touch events $out->addHeadItem( 'jquerymobiletouchevents', Html::element( 'script', array( 'src' => htmlspecialchars( $wgLocalStylePath ) . "/Refreshed/refreshed/jquery.mobile.custom{$min}.js", 'type' => 'text/javascript' ) ) ); // prevent iOS from zooming out when the sidebar is opened $out->addHeadItem( 'viewportforios', Html::element( 'meta', array( 'name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0' ) ) ); // Add JavaScript via ResourceLoader $out->addModules( 'skins.refreshed.js' ); } function setupSkinUserCss( OutputPage $out ) { global $wgStylePath; parent::setupSkinUserCss( $out ); // Add CSS via ResourceLoader $out->addModuleStyles( array( 'mediawiki.skinning.interface', 'mediawiki.skinning.content.externallinks', 'skins.refreshed' ) ); // Internet Explorer fixes - $out->addStyle( $wgStylePath . '/Refreshed/refreshed/ie8.css', 'screen', 'IE 8' ); $out->addStyle( $wgStylePath . '/Refreshed/refreshed/iefontfix.css', 'screen', 'IE' ); $out->addStyle( $wgStylePath . '/Refreshed/refreshed/wikifont/WikiFontLoader.css', 'screen' ); /* IE 10+ */ } } class RefreshedTemplate extends BaseTemplate { public function execute() { global $wgStylePath, $wgRefreshedHeader, $wgMemc; $skin = $this->getSkin(); $user = $skin->getUser(); // Title processing $titleBase = $skin->getTitle(); $title = $titleBase->getSubjectPage(); $titleNamespace = $titleBase->getNamespace(); $refreshedImagePath = "$wgStylePath/Refreshed/refreshed/images"; $key = wfMemcKey( 'refreshed', 'header' ); $headerNav = $wgMemc->get( $key ); if ( !$headerNav ) { $headerNav = array(); $skin->addToSidebar( $headerNav, 'refreshed-navigation' ); $wgMemc->set( $key, $headerNav , 60 * 60 * 24 ); // 24 hours } // Output the tag and whatnot $this->html( 'headelement' ); ?>
    $img ) { ?>
getId(), 'l' ); $avatarImage = $avatar->getAvatarURL( array( 'width' => 30, 'class' => 'avatar' ) ); ?> getName() ?> data['loggedin'] ) { // if no SocialProfile but user is logged in ?> getName() ?> getMsg( 'login' )->text() ?>
$sub ) { ?>
    $item ) { $item['class'] = 'header-dropdown-item'; echo $this->makeListItem( $key, $item ); } ?>
data['sitenotice'] ) { ?>
html( 'sitenotice' ) ?>
html( 'newtalk' ) ?>

html( 'title' ) ?>

msg( 'tagline' ) ?>
data['subtitle'] || $this->data['undelete'] ) { ?>
html( 'userlangattributes' ) ?>>html( 'subtitle' ) ?>html( 'undelete' ) ?>
getIndicators(); } ?>
getToolbox(); // if there are actions like "edit," etc. // (not counting generic toolbox tools like "upload file") // in addition to non-page-specific ones like "page" (so a "more..." link is needed) if ( sizeof( $this->data['content_actions'] ) > 1 ) { foreach ( $this->data['content_actions'] as $key => $action ) { if ( !$lastLinkOutsideOfStandardToolboxDropdownHasBeenGenerated ) { // this runs until all the actions outside the dropdown have been generated (generates actions outside dropdown) echo $this->makeLink( $key, $action ); $amountOfToolsGenerated++; if ( sizeof( $this->data['content_actions'] ) == $amountOfToolsGenerated || $key == 'history' || $key == 'addsection' || $key == 'protect' || $key == 'unprotect' ) { // if this is the last action or it is the // history, new section, or protect/unprotect action // (whichever comes first) $lastLinkOutsideOfStandardToolboxDropdownHasBeenGenerated = true; ?>
getMsg( 'moredotdotdot' )->text() ?>
    makeListItem( $key, $action, array( 'text-wrapper' => array( 'tag' => 'span' ) ) ); } } foreach ( $toolbox as $tool => $toolData ) { // generates toolbox tools inside dropdown (e.g. "upload file") echo $this->makeListItem( $tool, $toolData, array( 'text-wrapper' => array( 'tag' => 'span' ) ) ); } } else { // if there aren't actions like edit, etc. (so a "tools" link is needed instead of a "more..." link) foreach ( $this->data['content_actions'] as $key => $action ) { // generates first link (i.e. "page" button on the mainspace, "special page" on Special namespace, etc.); the foreach loop should once run once since there should only be one link echo $this->makeLink( $key, $action ); } ?>
    getMsg( 'toolbox' )->text() ?>
      $toolData ) { // generates toolbox tools inside dropdown (e.g. "upload file") echo $this->makeListItem( $tool, $toolData, array( 'text-wrapper' => array( 'tag' => 'span' ) ) ); } } Hooks::run( 'SkinTemplateToolboxEnd', array( &$this, true ) ); ?>
getMsg( 'backlinksubtitle', $title->getPrefixedText() )->escaped(), array( 'id' => 'back-to-subject' ) ); } ?>
data['content_actions'] ); $pageTab = key( $this->data['content_actions'] ); $isEditing = in_array( $skin->getRequest()->getText( 'action' ), array( 'edit', 'submit' ) ); // determining how many tools need to be generated $totalSmallToolsToGenerate = 0; $listOfToolsToGenerate = array( 'wikiglyph wikiglyph-speech-bubbles' => 'ca-talk', 'wikiglyph wikiglyph-pencil-lock-full' => 'ca-viewsource', 'wikiglyph wikiglyph-pencil' => 'ca-edit', 'wikiglyph wikiglyph-clock' => 'ca-history', 'wikiglyph wikiglyph-trash' => 'ca-delete', 'wikiglyph wikiglyph-move' => 'ca-move', 'wikiglyph wikiglyph-lock' => 'ca-protect', 'wikiglyph wikiglyph-unlock' => 'ca-unprotect', 'wikiglyph wikiglyph-star' => 'ca-watch', 'wikiglyph wikiglyph-unstar' => 'ca-unwatch' ); foreach ( $this->data['content_actions'] as $action ) { if ( in_array( $action['id'], $listOfToolsToGenerate ) ) { // if the icon in question is one of the listed ones $totalSmallToolsToGenerate++; } } if ( MWNamespace::isTalk( $titleNamespace ) ) { // if talk namespace $totalSmallToolsToGenerate--; // remove a tool (the talk page tool) if the user is on a talk page } if ( $totalSmallToolsToGenerate > 0 && !$isEditing ) { // if there's more than zero tools to be generated and the user isn't editing a page ?>
data['content_actions'] as $action ) { if ( $smallToolBeingTested > $amountOfSmallToolsToSkipInFront ) { // if we're not supposed to skip this tool (e.g. if we're supposed to skip the first 2 tools and we're at the 3rd tool, then the boolean is true) // @todo Maybe write a custom makeLink()-like function for generating this code? if ( in_array( $action['id'], $listOfToolsToGenerate ) ) { // if the icon being rendered is one of the listed ones (if we're supposed to generate this tool) ?>
3 ) { ?>
html( 'bodytext' ) ?>
html( 'catlinks' ); if ( $this->data['dataAfterContent'] ) { $this->html( 'dataAfterContent' ); } ?>
printTrail(); echo Html::closeElement( 'body' ); echo Html::closeElement( 'html' ); } }