사용자:Theoteryi/monobook.js: 두 판 사이의 차이

내용 삭제됨 내용 추가됨
Theoteryi (토론 | 기여)
잔글 위백에서 가져옴
(차이 없음)

2008년 1월 20일 (일) 15:11 버전

/*
== 다이내믹 네비게이션 바 (시험적용) ==
설명: [[:en:Wikipedia:NavFrame]]
*/

// 단어 설정
var NavigationBarHide = '[숨기기]';
var NavigationBarShow = '[보기]';
 
// 네비게이션 바의 페이지당 최대 수
// 이 숫자 이상 있을 경우 모두 숨겨진다
var NavigationBarShowDefault = 3;
 
 
// shows and hides content and picture (if available) of navigation bars
// Parameters:
//     indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar)
{
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
 
    if (!NavFrame || !NavToggle) {
        return false;
    }
 
    // if shown now
    if (NavToggle.firstChild.data == NavigationBarHide) {
        for (
                var NavChild = NavFrame.firstChild;
                NavChild != null;
                NavChild = NavChild.nextSibling
            ) {
            if (NavChild.className == 'NavPic') {
                NavChild.style.display = 'none';
            }
            if (NavChild.className == 'NavContent') {
                NavChild.style.display = 'none';
            }
        }
    NavToggle.firstChild.data = NavigationBarShow;
 
    // if hidden now
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
        for (
                var NavChild = NavFrame.firstChild;
                NavChild != null;
                NavChild = NavChild.nextSibling
            ) {
            if (NavChild.className == 'NavPic') {
                NavChild.style.display = 'block';
            }
            if (NavChild.className == 'NavContent') {
                NavChild.style.display = 'block';
            }
        }
    NavToggle.firstChild.data = NavigationBarHide;
    }
}
 
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton()
{
    var indexNavigationBar = 0;
    // iterate over all < div >-elements
    for(
            var i=0; 
            NavFrame = document.getElementsByTagName("div")[i]; 
            i++
        ) {
        // if found a navigation bar
        if (NavFrame.className == "NavFrame") {
 
            indexNavigationBar++;
            var NavToggle = document.createElement("a");
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
            
            var NavToggleText = document.createTextNode(NavigationBarHide);
            NavToggle.appendChild(NavToggleText);
            // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
            for(
              var j=0; 
              j < NavFrame.childNodes.length; 
              j++
            ) {
              if (NavFrame.childNodes[j].className == "NavHead") {
                NavFrame.childNodes[j].appendChild(NavToggle);
              }
            }
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
        }
    }
    // if more Navigation Bars found than Default: hide all
    if (NavigationBarShowDefault < indexNavigationBar) {
        for(
                var i=1; 
                i<=indexNavigationBar; 
                i++
        ) {
            toggleNavigationBar(i);
        }
    }
  
}
 
addOnloadHook( createNavigationBarToggleButton );

/*
== [[위키백과:도구/네비게이션 팝업|네비게이션 팝업]] ==
*/
document.write('<script type="text/javascript" src="' 
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/*
== [[:en:User:Cacycle/wikEd|wikEd]] ==
*/
// 설정부분
var wikEdComboPresetOptions = [];
wikEdComboPresetOptions['summary'] = ['RV', 'make', '+', '+α', '+del', '+cat', '+dis', '+ex', '+tem', '+REDIRECT',  'stylebook', '-', '-del', '-cat', '-dis', '-ex', '-tem', '-REDIRECT (del)', 'update'
];
 
// 실행부분
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/*

== Talk page section tabs ==
토론 문서를 생성할 때 자동으로 '새 토론 시작' 사용
*/
function talkpageplus()
{
      var talkpagelink = document.getElementById('ca-talk');
      if (talkpagelink.className == 'new')
      {
          talkpagelink.firstChild.href += '&section=new';
      }
}
 
addOnloadHook(talkpageplus);

/*
== Changes since last load" link to watchlist ==
*/
addOnloadHook(function () {
if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return;
if (!document.forms[0] || !document.forms[0].namespace) return;
 
var link = document.createElement('a');
link.id = 'listSince';
link.href = '#listSince';  // must have a href to show as link!
 
var then = +(new Date());
var fixLinkHref = function () {
var url = window.location.href.split('#')[0];
var days = ( +(new Date()) - then )/(1000 * 3600 * 24);
if (url.match(/[?&]days=/))
this.href = url.replace(/([?&]days=)[^&]*/, '$1'+days);
else
this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days;
return true;
};
link.onclick = fixLinkHref;
link.onmousedown = fixLinkHref;  // react to middle clicks too
 
var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode(' | '));
frag.appendChild(link);
link.appendChild(document.createTextNode('Changes'));
frag.appendChild(document.createTextNode(' since last load.'));
 
// just one little ID attribute would be _so_ nice...
var nsSelectForm = document.getElementsByTagName('form')[0];
nsSelectForm.parentNode.insertBefore(frag, nsSelectForm);
});

/* </pre> */