위키낱말사전:JavaScript & CSS/Portlet Links

위키낱말사전, 말과 글의 누리

Portlet Links

  • 프로그래머: 미상
  • Mediawiki:Common.js (필요하면 추가)
  • Portlet 을 나름대로 바꾸고자 할 때
 function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) {
  var node = document.getElementById(portlet);
  if ( !node ) return null;
   node = node.getElementsByTagName( "ul" )[0];
   if ( !node ) return null;
     var link = document.createElement( "a" );
     link.appendChild( document.createTextNode( text ) );
     link.href = href;
     var item = document.createElement( "li" );
     item.appendChild( link );
     if ( id ) item.id = id;
      if ( accesskey ) {
       link.setAttribute( "accesskey", accesskey );
       tooltip += " ["+accesskey+"]";
      }
     if ( tooltip ) {
      link.setAttribute( "title", tooltip );
     }
     if ( accesskey && tooltip ) {
      updateTooltipAccessKeys( new Array( link ) );
     }
     if ( nextnode && nextnode.parentNode == node )
      node.insertBefore( item, nextnode );
     else
      node.appendChild( item );
 return item;
 }