Користувач:NickK/comments.js

Матеріал з Вікіновин — вільних новин.

Увага: Після публікування слід очистити кеш браузера, щоб побачити зміни.

  • Firefox / Safari: тримайте Shift, коли натискаєте Оновити, або натисніть Ctrl-F5 чи Ctrl-Shift-R (⌘-R на Apple Mac)
  • Google Chrome: натисніть Ctrl-Shift-R (⌘-Shift-R на Apple Mac)
  • Internet Explorer / Edge: тримайте Ctrl, коли натискаєте Оновити, або натисніть Ctrl-F5
  • Opera: натисніть Ctrl-F5
/* <source lang="javascript"> Top of Javascript */
/* tooltips and access keys */ 
// Додавання вкладки коментарів на основі [[commons:MediaWiki:Extra-tabs.js]], [[:ru:MediaWiki:Comments.js]] та [[:en:MediaWiki:Comments.js]].
 
// Switch for people that don't want the extra tabs.
if (load_extratabs == true && skin == 'monobook')
{
 
// project URL without protocol handler
var tab_project = wgServer.replace("http://", "");
 
// namespace names (there is only wgCanonicalNamespace variable; although not a
// problem for Commons but for non-english wikis, we make it easier for them
// reusing the script with these variables)
var tab_ns_main = '';

var tab_comments = 'коментарі';
 
// Appends a new tab.
 
function global_append_tab(url, name, id)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);
 
  var txt = document.createTextNode(name);
  na.appendChild(txt);
 
  var li = document.createElement('li');
  if(id) li.id = id;
  li.appendChild(na);
 
  // Grab the element we want to append the tab and append the tab to it.
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
  tabs.appendChild(li);
}
 
function global_add_main_tabs(commenttitle)
{
  global_append_tab('http://uk.wikinews.org/wiki/Коментарі:' + title, 'ca-commtit');
}

function global_do_onload()
{
    var title = encodeURIComponent (wgTitle.split (" ").join ("_"));
 
    // Namespace numbers are (see [[m:Help:Variables]]):
    // -1: Special
    // 2:  User
    // 3:  User_talk
    // 6:  Image
    // 7:  Image_talk
    // 14: Category
    switch(wgNamespaceNumber)
    {
        case 0:
            global_add_main_tabs(commenttitle);
            break;
        case 1:
            global_add_main_tabs(commenttitle);
            break;
        default:
            // nothing
    }
}
 
$( global_do_onload );
 
}
// END: MediaWiki interface button definition for Duesentrieb's image tools.
// ========================================================================
 
/* Bottom of Javascript </source> */