User:Hippietrail/debugportlet.js

/*

// output text to the debug portlet function debugPrint( dbtxt ) { var p_db = document.getElementById('p-debug');

if (p_db) p_db.style.display = 'block';

//document.getElementById('dbTextarea').innerHTML += dbtxt; //document.dbForm.dbTextarea.innerHTML += dbtxt;

//document.dbForm.dbTextarea.value += dbtxt; document.getElementById('dbTextarea').value += dbtxt; }

// add a portlet for outputting debug messages function addDebugPortlet {

// find the search portlet. we want to be after it var p_search = document.getElementById('p-search');

if (p_search) { var p_db; var newh; var pbody; var newform; var newdiv; var newtextarea;

p_db = document.createElement('div'); p_db.id = 'p-debug'; p_db.className = 'portlet'; p_db.style.display = 'none';

newh = document.createElement('h5'); newh.appendChild(document.createTextNode('Debug')); p_db.appendChild(newh);

pbody = document.createElement('div'); pbody.className = 'pBody'; p_db.appendChild(pbody);

newform = document.createElement('form'); newform.id = 'dbForm'; newform.name = 'dbForm'; pbody.appendChild(newform);

newdiv = document.createElement('div'); newform.appendChild(newdiv);

newtextarea = document.createElement('textarea'); newtextarea.id = 'dbTextarea'; newtextarea.name = 'dbTextarea'; //newtextarea.readOnly = 'readonly'; newdiv.appendChild(newtextarea);

// insert our constructed portlet between the search and toolbox portlets p_search.parentNode.insertBefore(p_db, p_search.nextSibling); } }

/*