MediaWiki talk:Common.js

From Wikisource
Jump to: navigation, search
This interface message is documented at mw:Manual:Interface/Common.js.

Contents

[edit] Missing object

We have a problem here, an object can't be found by IE 6's script debugger. Can we get this sorted out?

function dotabs()
{
   //first tab
   var a = document.getElementById("ca-nstab-main");
--> var s = a.innerHTML;

Looks like a is not defined for some reason. - Ta bu shi da yu 05:59, 29 March 2006 (UTC)

I don't get that problem; I assume it's been fixed since then. If not, you'll probably get more responses if you add a note on the community discussion page linking to your question here. —{admin} Pathoschild 01:38, 23 January 2007 (UTC)

[edit] Directory

Where can I find COMMON.JS? what is the path directory? I can't find it... thanks Alain, 22, January 2007

Hello Alain. Common.js is dynamically generated from MediaWiki:Common.js, and isn't saved in the files. You can see it for yourself by visiting en.wikisource.org/w/index.php?title=-&action=raw&smaxage=0&gen=js. It's called in the XHTML code on this line:
<script type="text/javascript" src="/w/index.php?title=-&action=raw&smaxage=0&gen=js"><!-- site js --></script>
. —{admin} Pathoschild 01:38, 23 January 2007 (UTC)

[edit] dotabs() error

The innerHTML hack in dotabs() messes up pages with non-english interface really bad. Please use proper DOM manipulation instead. --Tgr 17:13, 12 April 2007 (UTC)

I'll recode it soon. —{admin} Pathoschild 05:33:54, 13 April 2007 (UTC)

[edit] wgArticlePath

I just tried to fix some bugs on the secure wiki (logging on to which is now encouraged) by replacing links beginning with /wiki with code similar to wgArticlePath.replace(/\$1/,"blah") (along with changing png images to their svg counterparts) and failed somehow (images don't show any more at all). Can somehow with better knowledge of the workings of our site JavaScript look into this? Thank you.--GrafZahl (talk) 11:13, 27 July 2007 (UTC)

[edit] Script error

I can't pinpoint the exact cause, but most pages on Wikisource produce this error in IE6:

Line: 322
Char: 3
Error: Object doesn't support this property or method.

Edokter 19:19, 17 October 2007 (UTC)

[edit] A better DisplayFooter() function

I think I found a way to get this function to work in IE too. Here's how:

function DisplayFooter() {
        if(document.getElementById && wgNamespaceNumber==0) {
                nofooter = document.getElementById('nofooter');
                hp = document.getElementById('headerprevious');
                hn = document.getElementById('headernext');
                cnt = document.getElementById('bodyContent');  // IE does not accept variable names
                ctl = document.getElementById('catlinks');     // if the name is already defined
                ftr = document.createElement('table');         // somewhere in HTML! --Lozman--
                //header_template = document.getElementById('headertemplate');                
 
                if( (!((cnt) && (ftr))) || (!(hp || hn)) ||
                (nofooter))
                return;
 
                ftr.className='headertemplate';                // IE does not have setAttribute! --Lozman--
                ftr.id='footertemplate'; 
                ftr.style.marginTop='1em'; 
                ftr.style.clear='all'; 
 
                /* Begin footer HTML code */
                tr = document.createElement('tr');
                td = document.createElement('td');
                td.align='left';                               // IE does not have setAttribute! --Lozman--
                td.style.width='33%';
                td.className='header_backlink';
 
 
                if (hp) {
                  fp = hp.cloneNode(true);
                  fp.id='footerprevious';                      // IE does not have setAttribute! --Lozman--
                  td.appendChild(fp);
                }
                tr.appendChild(td);
 
                td = document.createElement('td');
                td.align='center';                             // IE does not have setAttribute! --Lozman--
                td.style.width='34%';
                td.className='header_title';
                a = document.createElement('a');
                a.href='#top';                                 // IE does not have setAttribute! --Lozman--
                text = document.createTextNode('Return to the top of the page.');
                a.appendChild(text);
                td.appendChild(a);
                tr.appendChild(td);
 
                td = document.createElement('td');
                td.align='right';                              // IE does not have setAttribute! --Lozman--
                td.style.width='33%';
                td.className='header_forelink';
 
                if (hn) {
                  fn = hn.cloneNode(true);
                  fn.id='footernext';                          // IE does not have setAttribute! --Lozman--
                  td.appendChild(fn);
                }
 
                tr.appendChild(td);
 
                ftr.appendChild(tr);
 
                /* End footer HTML code */
 
                if(ctl) // place footer before category box
                cnt.insertBefore(ftr, ctl);
                else
                cnt.appendChild(ftr);
                // This forces IE to refresh page content, otherwise it won't --Lozman--
                try {
                  bodyContent.outerHTML = cnt.outerHTML;
                } catch(e) {
                }
        }
}

Works in IE, Firefox, Opera and Safari (tested in ru.wikisource). — Lozman (talk) 19:42, 8 September 2008 (UTC)

Thank you. I don't have IE and I didn't even know it doesn't work with it. Can some admin with IE try out the new code here on this Wikisource? Thanks!--GrafZahl (talk) 08:02, 10 September 2008 (UTC)

[edit] MediaWiki:Common.js

where do i find MediaWiki:Common.js on my mediawiki. for example local setting or do i have to start a page called MediaWiki:Common.js but where? Thanks --86.136.108.50 15:15, 18 February 2009 (UTC)

You need to create a page called "MediaWiki:Common.js"; go to that page name, and click edit. mw:Manual:Interface/JavaScript has a little bit more information, and that is the website where you should seek further technical support. John Vandenberg (chat) 22:54, 18 February 2009 (UTC)

[edit] Tabber

What is the tabber code actually being used for on WikiSource? There has been talk of some day implementing an easy way to create additional tabs in MediaWiki, but it would be good to know the various use cases before anything gets developed. Kaldari (talk) 05:02, 4 September 2010 (UTC)

Primarily Template:Welcome, hence widely used. Not sure of other use. — billinghurst sDrewth 07:50, 4 September 2010 (UTC)
So we're loading 20K of Javascript on every page load just so Template:Welcome doesn't have to use any CSS? Seems like overkill to me. Kaldari (talk) 06:08, 5 September 2010 (UTC)
  • Removed. cygnis insignis 13:25, 15 October 2010 (UTC)
    • Cool. Thanks for taking care of that. Kaldari (talk) 00:30, 16 October 2010 (UTC)

[edit] Implemented commons script for secure servers

There has been navigation issues for those logged in via the secure login facility with relation to some links, especially crosswiki and interwiki links. Pathoschild amended those issues that came with the extension DoubleWiki yesterday, and today I have added the fix from Commons that rewrites the links. If there problems then we should revert my change to import that script. — billinghurst sDrewth 00:23, 11 January 2011 (UTC)

I'm having problems with false-positive result for https WS, resulting in broken links of the format en.wikisource.org/wikisource/en/wiki/blah everywhere. Happens on both chrome and IE. Prosody (talk) 00:47, 11 January 2011 (UTC)
That was probably badly worded. I'm not using secure.wikimedia.org, but getting links as if I am. Prosody (talk) 00:49, 11 January 2011 (UTC)
Per commons:MediaWiki:Common.js, I think you just need to enclose the importScriptURI in 'if( wgServer == 'https://secure.wikimedia.org' )' Prosody (talk) 01:03, 11 January 2011 (UTC)
Don't know if its related or just me but attempting to patrol edits from the (prev) link(s) on the Recent Changes page brings up 404-server-type errors. The provided alternative link does eventually take you to where you wanted to go apparently. -- George Orwell III (talk) 01:36, 11 January 2011 (UTC)
This just stopped - back to as before -- George Orwell III (talk) 01:53, 11 January 2011 (UTC)
Been better gIFt wrapped this time, and using enWP as per John's preference. Apologies. — billinghurst sDrewth 02:20, 11 January 2011 (UTC)

[edit] Adding withJS support & temporal media fragments

I added withJS support to match commons and en.wikipeida this is helpful for people to try out gadgets. Per bug 26663 and Theornamentalist and I wanted to try supporting temporal media fragments for wikisource articles about video assets. You can see the work in progress here. If desirable we can more broadly enable the feature. Mdale (talk) 19:03, 14 January 2011 (UTC)


[edit] Wikisource layouts

A variety of layouts for transcluded works are available for logged-in readers. [Left hand margin, toggle through Layout 1/2/3] There is scope for the development of more layouts, and this is the space to propose test layouts, and to have the discussion about layouts that are proposed. At this point in time it requires the intervention of an administrator to put the test layout into play, through every user can turn on the test layer through the gadget Billinghurst (talk) 03:44, 11 March 2011 (UTC)

To have a test layout introduced, please identify below

  1. A name and the descriptive elements for your test code
  2. Where the administrator can get the code that you have tested

(this list of criteria/elements will certainly mature)

[edit] Test layouts

[edit] Commented out usejs

After a quick chat with the author of usejs, it was indicated that we believe that the script is archaic, unused and no longer supported, hence there is no longer a need for it to be included in the file. I have commented out the file, and see if this is an issue for users. — billinghurst sDrewth 06:47, 11 April 2011 (UTC)

[edit] protocol relative url

Following the implementation of relative urls (see announcement at https://blog.wikimedia.org/2011/10/03/native-https-support-enabled-for-all-wikimedia-foundation-wikis/) I have modified the urls to be relative, which should allow a smooth transition. If not, then please revert and get back to me and I will seek an expert's opinion. — billinghurst sDrewth 12:57, 4 October 2011 (UTC)

Could you get that last one at the bottom? Prosody (talk) 06:52, 15 October 2011 (UTC)
Yes check.svg Done - hope that is correct; please let me know if it is not. -- George Orwell III (talk) 07:19, 15 October 2011 (UTC)
For the record, the oldws link was broken before this edit. I think it broke during the 1.18 upgrade. Prosody (talk) 07:33, 15 October 2011 (UTC)
???? If it was/is not working, is there any reason to keep the line at all? -- George Orwell III (talk) 08:00, 15 October 2011 (UTC)
Good point. I was banking on the script being fixed soonish, but that may not be the case. As is, even if we remove that include we still have a bunch of broken interlanguage links to Arab wikisource everywhere, and it wouldn't be worthwhile to go about removing them unless we decided that we were just going to give up on on old ws links through that js for good. Prosody (talk) 01:14, 17 October 2011 (UTC)
Nevermind, it works. I was under the impression that Chrome only reported insecure js but it apparently refuses to run it also. Prosody (talk) 01:20, 17 October 2011 (UTC)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Print/export