/**
  * Add JS and CSS to File Page (except mobile skin - see onWikiaMobileAssetsPackages)
  *
  * @param OutputPage $out
  * @param $skin
  * @return bool
  */
 public static function onBeforePageDisplay(OutputPage $out, $skin)
 {
     global $wgEnableVideoPageRedesign;
     $app = F::app();
     wfProfileIn(__METHOD__);
     if ($app->wg->Title->getNamespace() == NS_FILE) {
         $assetsManager = AssetsManager::getInstance();
         $wikiaFilePageJs = 'wikia_file_page_js';
         foreach ($assetsManager->getURL($wikiaFilePageJs) as $url) {
             $out->addScript("<script src=\"{$url}\"></script>");
         }
         // load assets when File Page redesign is enabled
         if ($app->checkSkin('oasis') && !empty($wgEnableVideoPageRedesign)) {
             $filePageTabbedCss = 'file_page_tabbed_css';
             $filePageTabbedJs = 'file_page_tabbed_js';
             foreach ($assetsManager->getURL($filePageTabbedCss) as $url) {
                 $out->addStyle($url);
             }
             foreach ($assetsManager->getURL($filePageTabbedJs) as $url) {
                 $out->addScript("<script src=\"{$url}\"></script>");
             }
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     global $wgScriptPath;
     $dir = $wgScriptPath . '/extensions/MediawikiHighlight/highlight';
     $out->addScript('<script src="' . $dir . '/highlight.pack.js"></script>');
     $out->addScript('<link rel="stylesheet" href="' . $dir . '/styles/github.css" />');
     $out->addScript("<script type='text/javascript'>\$(document).ready(function() {\n                             \$('pre').each(function(i, block) {\n                                 hljs.highlightBlock(block);\n                             });\n                         });</script>");
     return true;
 }
 public function onBeforePageDisplay(OutputPage $out, $skin)
 {
     global $wgExtensionsPath;
     wfProfileIn(__METHOD__);
     $out->addScript('<script src="' . $wgExtensionsPath . '/wikia/ScavengerHunt/js/scavenger-game.js"></script>');
     $out->addScript('<script src="' . $wgExtensionsPath . '/wikia/ScavengerHunt/js/sprite.js"></script>');
     $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/ScavengerHunt/css/scavenger-game.scss'));
     wfProfileOut(__METHOD__);
     return true;
 }
 /**
  * Set the script tags in an OutputPage object
  * @param OutputPage $outputPage
  */
 static function setHeaders(&$outputPage)
 {
     global $wgJsMimeType, $wgScriptPath, $wgContLang, $wgCategoryTreeExtPath, $wgCategoryTreeVersion;
     wfLoadExtensionMessages('CategoryTree');
     # Register css file for CategoryTree
     $outputPage->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => "{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTree.css?{$wgCategoryTreeVersion}"));
     # Register css RTL file for CategoryTree
     if ($wgContLang->isRTL()) {
         $outputPage->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => "{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTree.rtl.css?{$wgCategoryTreeVersion}"));
     }
     # Register main js file for CategoryTree
     $outputPage->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTree.js?{$wgCategoryTreeVersion}\">" . "</script>\n");
     # Add messages
     $outputPage->addScript("\t<script type=\"{$wgJsMimeType}\">\n\t\t\tvar categoryTreeCollapseMsg = \"" . Xml::escapeJsString(self::msg('collapse')) . "\";\n\t\t\tvar categoryTreeExpandMsg = \"" . Xml::escapeJsString(self::msg('expand')) . "\";\n\t\t\tvar categoryTreeLoadMsg = \"" . Xml::escapeJsString(self::msg('load')) . "\";\n\t\t\tvar categoryTreeLoadingMsg = \"" . Xml::escapeJsString(self::msg('loading')) . "\";\n\t\t\tvar categoryTreeNothingFoundMsg = \"" . Xml::escapeJsString(self::msg('nothing-found')) . "\";\n\t\t\tvar categoryTreeNoSubcategoriesMsg = \"" . Xml::escapeJsString(self::msg('no-subcategories')) . "\";\n\t\t\tvar categoryTreeNoPagesMsg = \"" . Xml::escapeJsString(self::msg('no-pages')) . "\";\n\t\t\tvar categoryTreeErrorMsg = \"" . Xml::escapeJsString(self::msg('error')) . "\";\n\t\t\tvar categoryTreeRetryMsg = \"" . Xml::escapeJsString(self::msg('retry')) . "\";\n\t\t\t</script>\n");
 }
Exemple #5
0
 public static function Inject_JS(OutputPage $out)
 {
     global $wgMathJaxJS, $wgMathJaxProcConf, $wgMathJaxLocConf;
     if (self::$jsInserted === true) {
         return true;
     }
     $userConfig = $wgMathJaxLocConf ?: self::$defaultCustomConfig;
     $configContents = file_get_contents(__DIR__ . '/../../public' . $userConfig);
     $out->addScript(\Html::rawElement('script', ['type' => 'text/x-mathjax-config'], "\n" . $configContents . "\n"));
     $file = $wgMathJaxJS ?: self::$defaultMathJaxPath;
     $config = $wgMathJaxProcConf ?: self::$defaultMathJaxConfig;
     $url = $file . '?' . http_build_query(['config' => $config], NULL, '&');
     $out->addScript(Html::linkedScript($url));
     self::$jsInserted = true;
     return true;
 }
Exemple #6
0
/**
 * If interstitials are enabled, add the JS for them.
 */
function interstitialAddJs(OutputPage $out, Skin $sk)
{
    global $wgAdsInterstitialsEnabled;
    if (!empty($wgAdsInterstitialsEnabled)) {
        global $wgJsMimeType, $wgExtensionsPath;
        $out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/Interstitial/Interstitial.js\" ></script>\n");
    }
    return true;
}
function elmEasyRefOutput(OutputPage $outputPage, $skin)
{
    global $wgScriptPath;
    // Options
    global $wgElmEasyRefAddCSS, $wgElmEasyRefDebugMode, $wgElmEasyRefBodyContentId, $wgElmEasyRefAnimation, $wgElmEasyRefMetrics, $wgElmEasyRefNum_rp, $wgElmEasyRefNum_mt;
    // Register css for popup field
    $outputPage->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $wgScriptPath . '/extensions/ElmEasyRef/css/referencefield.css'));
    // Additonal css if setted
    if ($wgElmEasyRefAddCSS) {
        $outputPage->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $wgElmEasyRefAddCSS));
    }
    // Register js-script file
    $src = '/extensions/ElmEasyRef/js/elmEasyRef';
    if (!$wgElmEasyRefDebugMode) {
        $src .= '-min';
    }
    $outputPage->addScript(Html::linkedScript($wgScriptPath . $src . '.js'));
    // Settings
    $settings = '';
    if ($wgElmEasyRefDebugMode) {
        $settings .= 'elmEasyRef.debug = true;';
    }
    if ($wgElmEasyRefBodyContentId) {
        $settings .= 'elmEasyRef.bodyContentId = ' . Xml::encodeJsVar($wgElmEasyRefBodyContentId) . ';';
    }
    if ($wgElmEasyRefNum_rp) {
        $settings .= 'elmEasyRef.regRefNum_rp = /' . $wgElmEasyRefNum_rp . '/;';
    }
    if ($wgElmEasyRefNum_mt) {
        $settings .= 'elmEasyRef.regRefNum_mt = /' . $wgElmEasyRefNum_mt . '/;';
    }
    if ($wgElmEasyRefAnimation) {
        foreach ($wgElmEasyRefAnimation as $prop => $val) {
            $settings .= 'elmEasyRef.animation.' . $prop . ' = ' . Xml::encodeJsVar($val) . ';';
        }
    }
    if ($wgElmEasyRefMetrics) {
        foreach ($wgElmEasyRefMetrics as $prop => $val) {
            $settings .= 'elmEasyRef.fieldm.' . $prop . ' = ' . Xml::encodeJsVar($val) . ';';
        }
    }
    $msg = wfMsgExt('elm-easyref-ref', 'parseinline');
    $settings .= 'elmEasyRef.messages.elm_easyref_ref = ' . Xml::encodeJsVar($msg) . ';';
    $msg = wfMsgExt('elm-easyref-close', 'parseinline');
    $settings .= 'elmEasyRef.messages.elm_easyref_close = ' . Xml::encodeJsVar($msg) . ';';
    $outputPage->addInlineScript('addOnloadHook( function() {' . $settings . 'elmEasyRef.prepare();' . '} );');
    return true;
}
 public function onBeforePageDisplay(OutputPage $out, $skin)
 {
     wfProfileIn(__METHOD__);
     // don't load it on edit pages (perf improvement)
     if (F::app()->checkSkin('oasis', $skin) && !BodyController::isEditPage()) {
         $assetsManager = F::build('AssetsManager', array(), 'getInstance');
         $scssPackage = 'relatedvideos_scss';
         $jsPackage = 'relatedvideos_js';
         foreach ($assetsManager->getURL($scssPackage) as $url) {
             $out->addStyle($url);
         }
         foreach ($assetsManager->getURL($jsPackage) as $url) {
             $out->addScript("<script src=\"{$url}\"></script>");
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 public static function onBeforePageDisplay(OutputPage $out, Skin $sk)
 {
     wfProfileIn(__METHOD__);
     $title = $out->getTitle();
     if ($title instanceof Title && $title->isContentPage()) {
         $storage = PlaceStorage::newFromTitle($out->getTitle());
         $model = $storage->getModel();
         /* @var $model PlaceModel */
         if ($model instanceof PlaceModel && !$model->isEmpty()) {
             $out->addMeta('geo.position', implode(',', $model->getLatLon()));
         }
     }
     if ($title instanceof Title && $title->getNamespace() == NS_CATEGORY) {
         $out->addScript('<script src="' . F::app()->wg->extensionsPath . '/wikia/Places/js/GeoEnableButton.js"></script>');
         $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Places/css/GeoEnableButton.scss'));
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 /**
  * Adds CSS to Page
  * @param OutputPage $out
  * @param Skin $skin
  * @return boolean
  */
 public function onBeforePageDisplay(&$out, &$skin)
 {
     $out->addModuleStyles('ext.bluespice.review.styles');
     if ($out->getTitle()->isContentPage() == false) {
         return true;
     }
     if ($out->getTitle()->exists() == false) {
         return true;
     }
     //if( $out->getTitle()->userCan('workflowread') == false ) return true;
     $out->addModules('ext.bluespice.review');
     //PW TODO: find better way
     //this always was loaded too late, no matter what dependency or position
     $out->addScript('<script>' . "\$(document).on( 'BsStateBarRegisterToggleClickElements', function(event, aRegisteredToggleClickElements) {" . "aRegisteredToggleClickElements.push(\$('#sb-Review'));" . "});" . '</script>');
     $bUserCanEdit = $out->getTitle()->userCan('workflowedit');
     $out->addJsConfigVars('bsReviewUserCanEdit', $bUserCanEdit);
     $oRev = BsReviewProcess::newFromPid($out->getTitle()->getArticleID());
     $out->addJsConfigVars('bsReview', $this->makeJSDataObject($oRev));
     return true;
 }
Exemple #11
0
 /**
  * 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 = AssetsManager::getInstance()->getGroupCommonURL('chat_ban_js', array());
             foreach ($srcs as $val) {
                 $out->addScript('<script src="' . $val . '"></script>');
             }
             JSMessages::enqueuePackage('ChatBanModal', JSMessages::EXTERNAL);
             $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Chat2/css/ChatModal.scss'));
             break;
         }
     }
     JSMessages::enqueuePackage('ChatEntryPoint', JSMessages::INLINE);
     wfProfileOut(__METHOD__);
     return true;
 }
function devBoxPanelAdditionalScripts(OutputPage &$out, &$sk)
{
    global $wgExtensionsPath;
    $out->addStyle("{$wgExtensionsPath}/wikia/Development/SpecialDevBoxPanel/DevBoxPanel.css");
    $out->addScript("<script type='text/javascript' src='{$wgExtensionsPath}/wikia/Development/SpecialDevBoxPanel/DevBoxPanel.js'></script>");
    return true;
}
Exemple #13
0
 /**
  * Set the script tags in an OutputPage object
  * @param OutputPage $outputPage
  */
 static function setHeaders(&$outputPage)
 {
     global $wgJsMimeType, $wgPlayerExtensionPath, $wgContLang;
     # Register css file for Player
     /*$outputPage->addLink(
     			array(
     				'rel' => 'stylesheet',
     				'type' => 'text/css',
     				'href' => $wgPlayerExtensionPath . '/Player.css'
     			)
     		);*/
     # Register css RTL file for Player
     /*if( $wgContLang->isRTL() ) {
     			$outputPage->addLink(
     				array(
     					'rel' => 'stylesheet',
     					'type' => 'text/css',
     					'href' => $wgPlayerExtensionPath . '/Player.rtl.css'
     				)
     			);
     		}*/
     # Register main js file for Player
     $outputPage->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgPlayerExtensionPath}/Player.js\">" . "</script>\n");
     //var playerLoadingMsg = \"".Xml::escapeJsString(wfMsg('player-loading'))."\";
     //var playerErrorMsg = \"".Xml::escapeJsString(wfMsg('player-error'))."\";
     # Add messages
     $outputPage->addScript("\t<script type=\"{$wgJsMimeType}\">\n\t\t\tvar wgPlayerExtensionPath = \"" . $wgPlayerExtensionPath . "\";\n\t\t\t</script>\n");
 }
function gracenoteLyricsTagCss(OutputPage $out)
{
    $css = <<<DOC
.lyricbox
{
\tpadding: 1em;
\tborder: 1px solid silver;
\tcolor: black;
\tbackground-color: #ffffcc;
}
DOC;
    $out->addScript("<style type='text/css'>/*<![CDATA[*/\n" . $css . "\n/*]]>*/</style>");
    return true;
}
Exemple #15
0
 /**
  * Acutally commit the collected requirements to a given OutputPage object that
  * will later generate the HTML output. This makes sure that HTML output contains
  * all required output items. Note that there is no parser caching at this level of
  * processing. In particular, data should not be committed to $wgOut in methods
  * that run during page parsing, since these would not run next time when the page
  * is produced from parser cache.
  *
  * @param OutputPage $output
  */
 public static function commitToOutputPage(OutputPage $output)
 {
     foreach (self::$scripts as $script) {
         $output->addScript($script);
     }
     foreach (self::$headItems as $key => $item) {
         $output->addHeadItem($key, "\t\t" . $item . "\n");
     }
     $output->addModules(array_values(self::$resourceModules));
     self::$resourceModules = array();
     self::$headItems = array();
 }
 /**
  * Set the script tags in an OutputPage object
  * @param OutputPage $outputPage
  */
 static function setHeaders(&$outputPage)
 {
     global $wgJsMimeType, $wgScriptPath, $wgContLang;
     global $wgCategoryTreeHijackPageCategories, $wgCategoryTreeExtPath, $wgCategoryTreeVersion;
     self::init();
     # Register css file for CategoryTree
     $outputPage->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => "{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTree.css?{$wgCategoryTreeVersion}"));
     if ($wgCategoryTreeHijackPageCategories) {
         # Register MSIE quirks
         $outputPage->addScript("<!--[if IE]><link rel=\"stylesheet\" type=\"text/css\" src=\"{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTreeIE.css?{$wgCategoryTreeVersion}\"/><![endif]-->\r\n\t\n");
     }
     # Register css RTL file for CategoryTree
     if ($wgContLang->isRTL()) {
         $outputPage->addLink(array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => "{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTree.rtl.css?{$wgCategoryTreeVersion}"));
     }
     # Register main js file for CategoryTree
     $outputPage->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTree.js?{$wgCategoryTreeVersion}\">" . "</script>\n");
     # Add messages
     $outputPage->addScript("\t<script type=\"{$wgJsMimeType}\">\r\n\t\t\tvar categoryTreeCollapseMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-collapse')) . "\";\r\n\t\t\tvar categoryTreeExpandMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-expand')) . "\";\r\n\t\t\tvar categoryTreeCollapseBulletMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-collapse-bullet')) . "\";\r\n\t\t\tvar categoryTreeExpandBulletMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-expand-bullet')) . "\";\r\n\t\t\tvar categoryTreeLoadMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-load')) . "\";\r\n\t\t\tvar categoryTreeLoadingMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-loading')) . "\";\r\n\t\t\tvar categoryTreeNothingFoundMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-nothing-found')) . "\";\r\n\t\t\tvar categoryTreeNoSubcategoriesMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-no-subcategories')) . "\";\r\n\t\t\tvar categoryTreeNoParentCategoriesMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-no-parent-categories')) . "\";\r\n\t\t\tvar categoryTreeNoPagesMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-no-pages')) . "\";\r\n\t\t\tvar categoryTreeErrorMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-error')) . "\";\r\n\t\t\tvar categoryTreeRetryMsg = \"" . Xml::escapeJsString(wfMsgNoTrans('categorytree-retry')) . "\";\r\n\t\t\t</script>\n");
 }
Exemple #17
0
 /**
  * Acutally commit the collected requirements to a given OutputPage object that
  * will later generate the HTML output. This makes sure that HTML output contains
  * all required output items. Note that there is no parser caching at this level of
  * processing. In particular, data should not be committed to $wgOut in methods
  * that run during page parsing, since these would not run next time when the page
  * is produced from parser cache.
  *
  * @param OutputPage $output
  */
 public static function commitToOutputPage(OutputPage $output)
 {
     foreach (self::$scripts as $script) {
         $output->addScript($script);
     }
     foreach (self::$headItems as $key => $item) {
         $output->addHeadItem($key, "\t\t" . $item . "\n");
     }
     // Check if the resource loader can be used or not.
     if (method_exists($output, 'addModules')) {
         $output->addModules(array_values(self::$resourceModules));
     } else {
         self::addModulesBC($output);
     }
     self::$resourceModules = array();
     self::$headItems = array();
 }
Exemple #18
0
 /**
  * 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;
 }
Exemple #19
0
function gracenote_installCopyProtection(OutputPage &$out, &$sk)
{
    wfProfileIn(__METHOD__);
    global $wgTitle, $wgUser;
    // Lyrics protections are unneeded JS on pages which aren't even in the right namespace for being GRACENOTE lyrics pages.
    // UPDATE: BugzId 6278 - 20110605 - After reading the contract, we realized that we only need these protections on Gracenote lyrics pages.
    if ($wgTitle->getNamespace() != NS_GRACENOTE) {
        wfProfileOut(__METHOD__);
        return true;
    }
    // Disable text-selection in the lyricsbox divs (this only needs to be done once between both the lyrics and gracenotelyrics extensions.
    $DISABLE_TEXT_SELECTION_FUNCTIONS = "\n\t\tfunction preventHighlighting(element){\n\t\t\tif (typeof element.onselectstart!=\"undefined\"){ // IE\n\t\t\t\telement.onselectstart=function(){return false};\n\t\t\t} else if (typeof element.style.MozUserSelect!=\"undefined\"){ // Moz-based (FireFox, etc.)\n\t\t\t\telement.style.MozUserSelect=\"none\";\n\t\t\t} else {\n\t\t\t\telement.onmousedown=function(){return false};\n\t\t\t}\n\t\t\telement.style.cursor = \"default\";\n\t\t}\n\t";
    $DISABLE_TEXT_SELECTION_CODE = "\n\t\t\$('.lyricbox').each(function (i){\n\t\t\tpreventHighlighting(this);\n\t\t});\n\t";
    // Disable CTRL+A's select-all capability.
    $DISABLE_SELECT_ALL = "\n\t\t\$(window).keypress(function(event) {\n\t\t\tif (!(event.which == 97 && event.ctrlKey)) return true;\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t});\n\t";
    // Repeatedly clear clipboard (to attempt to stop Print-Screen, this doesn't work in modern browsers).
    $DISABLE_CLIPBOARD_FUNCTIONS = "\n\t\tfunction no_cp(){\n\t\t\tif(\$.browser.msie && \$.browser.version==\"6.0\"){\n\t\t\t\twindow.clipboardData.setData('text', '');\n\t\t\t\tsetTimeout(\"no_cp()\",500);\n\t\t\t}\n\t\t}\n\t\tfunction do_err(){return true}\n\t";
    $DISABLE_CLIPBOARD_CODE = "\n\t\tif(\$.browser.msie && \$.browser.version==\"6.0\"){onerror=do_err;}\n\t\tno_cp();\n\t";
    $DISABLE_RIGHT_CLICK_CODE = "\$('body').bind('contextmenu', function(e) {return false;});";
    // Disables text-selection in the text-area on the 'edit' page (which will only show up in normal namespaces anyway).
    // We only want to do this for lyrics pages, so we first determine the page-type.
    $DISABLE_TEXT_SELECTION_IN_EDIT_BOX_CODE = "\n\t\t\$('#wpTextbox1').select(function(event){\n\t\t\tevent.preventDefault();\n\t\t\t//alert(\$('#gnCopySelectNotice').size());\n\t\t\tif(\$('#gnCopySelectNotice').size() == 0){\n\t\t\t\tvar noticeDiv = \"<div id='gnCopySelectNotice'>We're sorry, but as part of licensing restrictions text-selection of this box has been disabled on lyrics pages.</div>\";\n\t\t\t\t\$('#wpTextbox1').before(noticeDiv);\n\t\t\t}\n\t\t\t\$('#gnCopySelectNotice').show()//.fadeOut(5000);\n\n\t\t\t// Remove and re-add the text to unselect.\n\t\t\tvar backup = \$('#wpTextbox1').get(0).value;\n\t\t\t\$('#wpTextbox1').get(0).value = '';\n\t\t\t\$('#wpTextbox1').get(0).value = backup;\n\t\t});\n\t";
    // TODO: If acceptable, make the DISABLE_RIGHT_CLICK_CODE and DISABLE_SELECT_ALL only apply to Gracenote pages and lyrics pages (Gracenote namespace is: NS_GRACENOTE).
    // Add the various chunks of javascript that need to be run after the page is loaded.
    $out->addScript("<script type=\"text/javascript\">\n\t/* <![CDATA[ */\n\t\t\$(document).ready(function() {\n\t\t\t{$DISABLE_CLIPBOARD_FUNCTIONS}\n\t\t\t{$DISABLE_TEXT_SELECTION_FUNCTIONS}\n\n\t\t\t{$DISABLE_CLIPBOARD_CODE}\n\t\t\t{$DISABLE_TEXT_SELECTION_CODE}\n\n\t\t\t// Select all should be disabled on pages that have lyrics (even if they're 'edit' pages).\n\t\t\tif((wgNamespaceNumber == 220) || (wgNamespaceNumber == 0)){\n\t\t\t\t{$DISABLE_SELECT_ALL}\n\t\t\t}" . "\n\n\t\t\tif(\$('.lyricbox').size() > 0){\n\t\t\t\t{$DISABLE_RIGHT_CLICK_CODE}\n\t\t\t}\n\n\t\t\t//\$('.lyricbox').show();\n\t\t});\n\t/* ]]> */\n\t</script>");
    wfProfileOut(__METHOD__);
    return true;
}