/** * Check if article is in insights flow and init script to show banner with message and next steps */ public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin) { global $wgRequest; $subpage = $wgRequest->getVal('insights', null); // Load scripts for pages in insights loop if (InsightsHelper::isInsightPage($subpage)) { $out->addScriptFile('/extensions/wikia/Insights/scripts/LoopNotification.js'); $out->addScriptFile('/extensions/wikia/Insights/scripts/InsightsLoopNotificationTracking.js'); } return true; }
/** * Adds required JavaScript & CSS files to the HTML output of a page if AjaxLogin is enabled * * @param $out OutputPage object * @return true */ function AjaxLoginJS(OutputPage $out) { global $wgEnableAjaxLogin, $wgScriptPath; # Don't load anything if AjaxLogin isn't enabled or if we're on login page if (!isset($wgEnableAjaxLogin) || $out->getTitle()->isSpecial('Userlogin')) { return true; } // Our custom CSS $out->addExtensionStyle($wgScriptPath . '/extensions/AjaxLogin/AjaxLogin.css'); // jQuery and JQModal scripts $out->includeJQuery(); $out->addScriptFile($wgScriptPath . '/extensions/AjaxLogin/jqModal.js'); $out->addScriptFile($wgScriptPath . '/extensions/AjaxLogin/AjaxLogin.js'); return true; }
/** * Adds one legacy script to output. * * @param string $page Unprefixed page title * @param OutputPage $out */ private static function applyScript($page, $out) { global $wgJsMimeType; # bug 22929: disable gadgets on sensitive pages. Scripts loaded through the # ResourceLoader handle this in OutputPage::getModules() # TODO: make this extension load everything via RL, then we don't need to worry # about any of this. if ($out->getAllowedModules(ResourceLoaderModule::TYPE_SCRIPTS) < ResourceLoaderModule::ORIGIN_USER_SITEWIDE) { return; } $t = Title::makeTitleSafe(NS_MEDIAWIKI, $page); if (!$t) { return; } $u = $t->getLocalURL('action=raw&ctype=' . $wgJsMimeType); $out->addScriptFile($u, $t->getLatestRevID()); }
public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin) { $out->addScriptFile(F::app()->wg->ExtensionsPath . '/wikia/ContentWarning/js/ContentWarning.js'); $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/ContentWarning/css/ContentWarning.scss')); return true; }
/** * Print extra field for 'title' * * @param OutputPage $wgOut */ public function renderFormHeader($wgOut) { global $wgRequest; $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/"); $oTmpl->set_vars(array("formErrors" => $this->mFormErrors, "formData" => $this->mFormData, "isReload" => $wgRequest->getVal('wpIsReload', 0) == 1, "editIntro" => $wgOut->parse($this->mEditIntro))); $wgOut->setPageTitle(wfMsg("createpage")); $wgOut->addScriptFile('edit.js'); if ($this->mPreviewTitle == null) { $wgOut->addHTML('<div id="custom_createpagetext">'); $wgOut->addWikiText(wfMsgForContent('newarticletext')); $wgOut->addHTML('</div>'); } $wgOut->addHTML($oTmpl->render("createFormHeader")); }
/** * add resources needed by chat * as chat entry points or links can appear on any page, * we really need them everywhere */ public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin) { global $wgExtensionsPath, $wgTitle, $wgResourceBasePath; wfProfileIn(__METHOD__); $sp = array('Contributions', 'Log', 'Recentchanges'); foreach ($sp as $value) { if ($wgTitle->isSpecial($value)) { // For Chat2 (doesn't exist in Chat(1)) $srcs = F::build('AssetsManager', array(), 'getInstance')->getGroupCommonURL('chat_ban_js', array()); foreach ($srcs as $val) { $out->addScript('<script src="' . $val . '"></script>'); } F::build('JSMessages')->enqueuePackage('ChatBanModal', JSMessages::EXTERNAL); $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Chat2/css/ChatModal.scss')); break; } } // don't load ChatEntryPoint on edit pages (perf optimization) if (F::app()->checkSkin('oasis') && !BodyController::isEditPage()) { // TODO: move these to asset manager when we release chat globally $out->addScriptFile($wgResourceBasePath . '/resources/wikia/libraries/bootstrap/popover.js'); $out->addScriptFile($wgExtensionsPath . '/wikia/Chat2/js/ChatEntryPoint.js'); $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('resources/wikia/libraries/bootstrap/popover.scss')); $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Chat2/css/ChatEntryPoint.scss')); } wfProfileOut(__METHOD__); return true; }