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
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
addOnloadHook(function(){
addOnloadHook(function(){
   var editTab = document.getElementById('ca-edit');
   var editTab = document.getElementById('ca-edit');
  var editPanel = document.getElementById('control_edit');
   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;
  var alink = document.createElement('a');
  alink.href = editTab.href + '&externaledit=true';
  alink.title = 'Edit with External Editor';
  alink.className = 'ca-extedit';
  alink.innerHTML = ' ';
  editPanel.appendChild(alink);
})
})
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;
}

Latest revision as of 01:26, 16 December 2009

//add ExtEdit link 
addOnloadHook(function(){
  var editTab = document.getElementById('ca-edit');
  var editPanel = document.getElementById('control_edit');
  if (!editTab) return;
  if (!editPanel) return;
  var alink = document.createElement('a');
  alink.href = editTab.href + '&externaledit=true';
  alink.title = 'Edit with External Editor';
  alink.className = 'ca-extedit';
  alink.innerHTML = ' →';
  editPanel.appendChild(alink);
})