MediaWiki:Common.js: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
(adding some of the contents of starwars:MediaWiki:Common.js so as to facilitate new preload system.)
(experimenting with a really old 2004 patch to MW from Wikipedia to address concern expressed by user:Tangerineduel)
Line 50: Line 50:


/* Preload system ends */
/* Preload system ends */
/*Testing implementation of different "new page" messages, depending on namespace.  Addressing concern expressed by [[user:Tangerineduel]] that MediaWikia:newarticletext inappropriate for talk pages.  This comes from the bowels of Wikipedia, an archived discussion in 2004 at [[wikipedia:MediaWiki talk:newarticletext/Archive 1]] */
@@ -116,7 +116,11 @@
$isCssJsSubpage = (Namespace::getUser() == $wgTitle->getNamespace() and preg_match("/\\.(css|js)$/", $wgTitle->getText() ));
if(!$this->mTitle->getArticleID()) { # new article
- $wgOut->addWikiText(wfmsg("newarticletext"));
+ if( Namespace::isTalk( $this->mTitle->getNamespace() )) {
+ $wgOut->addWikiText(wfmsg("newtalktext"));
+ } else {
+ $wgOut->addWikiText(wfmsg("newarticletext"));
+ }
}
if( Namespace::isTalk( $this->mTitle->getNamespace() ) ) {
diff -ur mediawiki-1.3.8_orig/languages/Language.php mediawiki-1.3.8/languages/Language.php
--- mediawiki-1.3.8_orig/languages/Language.php 2004-11-06 18:27:45.000000000 -0600
+++ mediawiki-1.3.8/languages/Language.php 2004-11-26 21:37:37.000000000 -0600
@@ -542,6 +542,11 @@
To create the page, start typing in the box below
(see the [[{{ns:4}}:Help|help page]] for more info).
If you are here by mistake, just click your browser's '''back''' button.",
+'newtalktext' =>
+"You've followed a link to a talk page that doesn't exist yet.
+To comment on the article, start typing in the box below
+(see the [[{{ns:4}}:Help|help page]] for more info).
+If you are here by mistake, just click your browser's '''back''' button.",
'talkpagetext' => '<!-- MediaWiki:talkpagetext -->',
'anontalkpagetext' => "----''This is the discussion page for an anonymous user who has not created an account yet or who does not use it. We therefore have to use the numerical [[IP address]] to identify him/her. Such an IP address can be shared by several users. If you are an anonymous user and feel that irrelevant comments have been directed at you, please [[Special:Userlogin|create an account or log in]] to avoid future confusion with other anonymous users.'' ",
'noarticletext' => '(There is currently no text in this page)',
/* end new page text experiment */

Revision as of 17:08, 14 February 2011

/* Any JavaScript here will be loaded for all users on every page load. */
importScriptPage('ShowHide/code.js', 'dev');

/*This comes from [[starwars:User:Sikon/preload.js]] and implements the preloadable template system at bottom of input page*/

document.write('<script type="text/javascript" src="' 
    + '/index.php?title=MediaWiki:Functions.js&action=raw&ctype=text/javascript"></script>');

function fillPreloads()
{
    var div = document.getElementById("lf-preload");

    if(div == null)
        return;

    div.style.display = 'block';
    var span = document.getElementById('lf-preload-cbox');

    var comboString = "<select id='stdPreloads' onchange='onPreloadChange()'>";
    comboString += "</select>";
    span.innerHTML = comboString;
    
    span = document.getElementById('lf-preload-pagename');
    span.innerHTML = '<input type="text" class="textbox" />';
    span = document.getElementById('lf-preload-button');
    span.innerHTML = '<input type="button" class="button" value="Insert" onclick="doCustomPreload()" />';

    requestComboFill('stdPreloads', "Template:Stdpreloads");
}

function doCustomPreload()
{
    doPreload(document.getElementById('lf-preload-pagename').getElementsByTagName('input')[0].value);
}

function onPreloadChange()
{
    var combo = document.getElementById("stdPreloads");
    var value = combo.options[combo.selectedIndex].value;

    if(value == "")
        return;

    value = "Template:" + value + "/preload";
    value = value.replace(" ", "_");
    doPreload(value);
}

addOnloadHook(fillPreloads);

/* Preload system ends */

/*Testing implementation of different "new page" messages, depending on namespace.  Addressing concern expressed by [[user:Tangerineduel]] that MediaWikia:newarticletext inappropriate for talk pages.  This comes from the bowels of Wikipedia, an archived discussion in 2004 at [[wikipedia:MediaWiki talk:newarticletext/Archive 1]] */

@@ -116,7 +116,11 @@
 		$isCssJsSubpage = (Namespace::getUser() == $wgTitle->getNamespace() and preg_match("/\\.(css|js)$/", $wgTitle->getText() ));
 
 		if(!$this->mTitle->getArticleID()) { # new article
-			$wgOut->addWikiText(wfmsg("newarticletext"));
+			if( Namespace::isTalk( $this->mTitle->getNamespace() )) {
+				$wgOut->addWikiText(wfmsg("newtalktext"));
+			} else {
+				$wgOut->addWikiText(wfmsg("newarticletext"));
+			}
 		}
 
 		if( Namespace::isTalk( $this->mTitle->getNamespace() ) ) {
diff -ur mediawiki-1.3.8_orig/languages/Language.php mediawiki-1.3.8/languages/Language.php
--- mediawiki-1.3.8_orig/languages/Language.php	2004-11-06 18:27:45.000000000 -0600
+++ mediawiki-1.3.8/languages/Language.php	2004-11-26 21:37:37.000000000 -0600
@@ -542,6 +542,11 @@
 To create the page, start typing in the box below
 (see the [[{{ns:4}}:Help|help page]] for more info).
 If you are here by mistake, just click your browser's '''back''' button.",
+'newtalktext' => 
+"You've followed a link to a talk page that doesn't exist yet.
+To comment on the article, start typing in the box below
+(see the [[{{ns:4}}:Help|help page]] for more info).
+If you are here by mistake, just click your browser's '''back''' button.",
 'talkpagetext' => '<!-- MediaWiki:talkpagetext -->',
 'anontalkpagetext' => "----''This is the discussion page for an anonymous user who has not created an account yet or who does not use it. We therefore have to use the numerical [[IP address]] to identify him/her. Such an IP address can be shared by several users. If you are an anonymous user and feel that irrelevant comments have been directed at you, please [[Special:Userlogin|create an account or log in]] to avoid future confusion with other anonymous users.'' ",
 'noarticletext' => '(There is currently no text in this page)',

/* end new page text experiment */