User:Hippietrail/softtemplates.js

/*

// soft CSS templates function softTemplates {

// TODO: IF getElementById('editform') THEN process DIV CLASS=previewnote // TODO: ELSE process DIV ID=bodyContent var theDiv;

theDiv = document.getElementById('bodyContent'); var dh = theDiv.innerHTML; var newdh = dh; var re;

// something straightforward re = new RegExp('foo', 'gm'); newdh = newdh.replace(re, "xx foo xx");

// something real re = new RegExp('(?:\\n| )See also:? ([^<]*)(?:\\n| )', 'gm'); newdh = newdh.replace(re, "xx see xx");

// something else real // re = new RegExp('(?:\\(|\\([^)]*)(?:<\/i>\\)|\\)<\/i>):?', 'gm');  re = new RegExp('([^)]*)<\/i>', 'g'); newdh = newdh.replace(re, "xx italbrac xx");

// something else straightforward re = new RegExp('bar', 'gm'); newdh = newdh.replace(re, "xx bar xx");

///////////////// // var oldbc = document.getElementById('bodyContent'); // var newbc = document.createElement('div'); // oldbc.parentNode.insertBefore(newbc, oldbc); // oldbc.parentNode.insertBefore(document.createElement('hr'), oldbc); //// oldbc.style.display = 'none'; // newbc.innerHTML = newbch; theDiv.innerHTML = newdh; ///////////////// }

/*