User:Milnivri/monaco.js: Difference between revisions

From Wikifang, a definitive guide to Telefang, Dino Device and Bugsite
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) {
var root = document.getElementById(portlet);
if ( !root ) return null;
var node = root.getElementsByTagName( "ul" )[0];
if ( !node ) return null;
// unhide portlet if it was hidden before
root.className = root.className.replace( /(^| )emptyPortlet( |$)/, "$2" );
var span = document.createElement( "span" );
span.appendChild( document.createTextNode( text ) );
var link = document.createElement( "a" );
link.appendChild( span );
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 ); // IE compatibility (?)
return item;
}
//add ExtEdit link  
//add ExtEdit link  
addOnloadHook(function(){
addOnloadHook(function(){
   var editTab = document.getElementById('ca-edit');
   var editTab = document.getElementById('ca-edit');
  var editPanel = document.getElementById('control_edit').getElementByTagName('div');
   if (!editTab) return;
   if (!editTab) return;
   addPortletLink('p-cactions', editTab.firstChild.href + '&externaledit=true', '→', 'ca-exted', 'Edit with External Editor ',, editTab.nextSibling);
   if (!editPanel) return;
  //addPortletLink('p-cactions', editTab.firstChild.href + '&externaledit=true', '→', 'ca-exted', 'Edit with External Editor ',, editTab.nextSibling);
  var alink = document.createElement('a');
  alink.href = editTab.href + '&externaledit=true';
  editPanel.appendChild(alink);
})
})

Revision as of 01:21, 16 December 2009

//add ExtEdit link 
addOnloadHook(function(){
  var editTab = document.getElementById('ca-edit');
  var editPanel = document.getElementById('control_edit').getElementByTagName('div');
  if (!editTab) return;
  if (!editPanel) return;
  //addPortletLink('p-cactions', editTab.firstChild.href + '&externaledit=true', '→', 'ca-exted', 'Edit with External Editor ',, editTab.nextSibling);
  var alink = document.createElement('a');
  alink.href = editTab.href + '&externaledit=true';
  editPanel.appendChild(alink);
})