User:Yes0song/base.js

/*

文書 미리보기


// document.write(' '); //

/*

Talk page section tabs
wikipedia:Wikipedia:WikiProject User scripts/Scripts/Talk page section tabs

토론 페이지가 비어있으면, 붉은 색 Talk Page 버튼(action=edit)을 New Section 추가 버튼으로 바꾸어줌. */

//

function talkpageplus { var talkpagelink = document.getElementById('ca-talk'); if (talkpagelink.className == 'new') { talkpagelink.firstChild.href += '&section=new'; } }

addOnloadHook(talkpageplus); //

/*

HighlightEditSections
wikipedia:User:Magnus Manske/HighlightEditSections.js

섹션 편집 버튼 위에 마우스를 갖다 대면 해당 섹션이 하이라이트됨. IE에서 정상적으로 작동되지 않으므로 웹브라우저가 IE인지 식별한 뒤, IE에서는 작동 안 되게 함. */

// if (navigator.appName != "Microsoft Internet Explorer") { document.write(' '); } //

/*

ShortLink
참 고한 문서: wikipedia:WP:US/R#toolbox· · ·

Permanent Link에서 긴 유니코드 문서 표제 제거. */

//

function getElementByAttribute(aAttribute,aValue,aInElement) { var ElementVerifier; var Elements=new Array; function SearchElement(aElement) { if(aElement==null||aElement==undefined) return; if(ElementVerifier(aElement)) { Elements[Elements.length]=aElement; }       SearchElement(aElement.firstChild); SearchElement(aElement.nextSibling); }   if (aInElement==undefined) aInElement=document.body; str="if(Element."+aAttribute+"=='"+aValue+"'){return true;}else{return false}"; ElementVerifier=function(aElement) { Element=aElement; if(aElement.nodeName=='#text')return false; var E=new Function(str); if(E){return true;}else{return false}; }   SearchElement(aInElement); return Elements; }

/* 사용법 foundElements=getElementByAttribute('style.width','100px'); alert(foundElements.length); foundElements=getElementByAttribute('tagName','DIV'); alert(foundElements.length); foundElements=getElementByAttribute('className','test-'); alert(foundElements.length);

function shortLink{ var permLink = document.getElementById('t-permalink') if (permLink) permLink.firstChild.href = permLink.firstChild.href.replace(/title=[^&]*&/,''); var printLink = document.getElementById('t-print') if (printLink) printLink.firstChild.href = printLink.firstChild.href.replace(/title=[^&]*&/,''); if (document.URL.indexOf('action=history') != -1) { diffLinks = getElementByAttribute('href',/diff=/); for (i=0; i<diffLinks.length; i++) { diffLinks[i].replace(/title=[^&]*&/,''); }   }    if (document.URL.indexOf('diff=') != -1) { diffLinks = getElementByAttribute('id',/differences/); for (i=0; i<diffLinks.length; i++) { diffLinks[i].replace(/title=[^&]*&/,''); }   } }

addOnloadHook(shortLink);

//

/*

preStyler


//

function preStyler { var pre = document.getElementsByTagName('pre'); for (i=0;i<pre.length;i++) { var pretext = pre[i].innerHTML; pretext = pretext.replace(/\n/g,' \n '); preconvert = ' ' + pretext + ' ' pre[i].innerHTML = preconvert; } }

addOnloadHook(preStyler);

//