_ _    _ _____  ___   __                       
 __      _(_) | _(_)___ / ( _ ) / /_   ___ ___  _ __ ___  
 \ \ /\ / / | |/ / | |_ \ / _ \| '_ \ / __/ _ \| '_ ` _ \ 
  \ V  V /| |   <| |___) | (_) | (_) | (_| (_) | | | | | |
   \_/\_/ |_|_|\_\_|____/ \___/ \___(_)___\___/|_| |_| |_|

User:Saintrain/J/deSpamWiki.js

In today's article we are going to delve into the fascinating world of User:Saintrain/J/deSpamWiki.js, exploring its various aspects, applications and meanings. User:Saintrain/J/deSpamWiki.js is a topic that has aroused the interest of countless people over time, its relevance has been maintained over the years and it has been the subject of debate and analysis in different areas. On this occasion, we will delve into its history, its current implications and its impact on society. We will also examine the different perspectives that exist on User:Saintrain/J/deSpamWiki.js and how these have evolved over time. We will begin by exploring its origin, going through its different interpretations until reaching its relevance today. Join us on this tour of User:Saintrain/J/deSpamWiki.js and discover the importance that this topic has in our daily lives.
//<pre>
//================  deSpamWiki  ============================================================
function deSpamWiki()
{
var GBUG = false;
var  BUG = GBUG;

var SpamObj = { id:"", class:"", clsNdx:0,   act:"" };

var spamList = new Array();

var sndx  = 0;
///-m- spamList = SpamObj = { id : "newarticletext",         act : "delete node" };  sndx++;
///-m- spamList = SpamObj = { id : "userinvalidcssjstitle",  act : "delete node" };  sndx++;
///-m- spamList = SpamObj = { id : "editpage-copywarn",      act : "delete node" };  sndx++;
///-m- spamList = SpamObj = { id : "editpage-copywarn2",     act : "delete node" };  sndx++;
///-m- spamList = SpamObj = { id : "editpage-copywarn3",     act : "delete node" };  sndx++;
spamList = SpamObj = { id : "editpage-specialchars",  act : "hide node" };    sndx++;
///-m- spamList = SpamObj = { id : "talkpagetext",           act : "delete node" };  sndx++;

for(var s=0; s<spamList.length; s++) {
  if(BUG)console.log('dSW: spamList.id={',spamList.id,'}  .class={',spamList.class,'}  .act={',spamList.act,'} ');
  var spamStr;
  with( spamList ) {
    if( "" != id ) {
      spamStr = id;
      var spam = document.getElementById( id );
      }
     else if( "" != class ) {
      spamStr = class;
      var hits = document.getElementsByClass( class, null, null );
      if( hits )
        var spam = hits;  // this is silly!  just use 1st.
      }
     else { if(BUG)console.log('dSW: spamList.id == .class == "" '); continue; }

    if ( !spam ) { if(BUG)console.log('dSW: NO FIND spam={',spamStr,'}' ); continue; }

    switch( act ) {
      case "delete node":  //==========  "delete node"  =======================================
        if( !GBUG ) BUG = false;
        var spamMom = spam.parentNode;
        if ( !spamMom ) { if(BUG)console.log('dSW: NO FIND spam={',spamStr,'}.parentNode' ); continue; }
        spamMom.removeChild( spam );
        spam = null;
        break;

      case "hide node":  //==========  "hide node"  =======================================
        if( !GBUG ) BUG = false;
        var spamMom = spam.parentNode;
        if ( !spamMom ) { if(BUG)console.log('dSW: NO FIND spam={',spamStr,'}.parentNode' ); continue; }
  
        var hndx = 666 + s;  // bump index so as not to interfere with "legit" navframe stuff
  
        var NavFrame = document.createElement("div");
        NavFrame.setAttribute('id', 'NavFrame' + hndx );
        NavFrame.className = 'NavFrame';
        spamMom.insertBefore( NavFrame, spam );
  
        var NavHead = document.createElement( "div" );
        NavHead.textContent = spamStr;
        NavHead.className = 'NavHead';
        NavFrame.appendChild( NavHead );
  
        var NavToggle = document.createElement("a");
        NavHead.appendChild( NavToggle );
        NavToggle.className = 'NavToggle';
        NavToggle.setAttribute('id', 'NavToggle' + hndx );
        NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + hndx + ');');
        NavToggle.textContent = "";
  
        spam.id = "NavFrame" + hndx;
        spam.className += " NavContent";
        NavFrame.appendChild( spam );  // re-parents "spam"
  
        toggleNavigationBar( hndx );
        break;
  

      case "delete last kids":  //==========  "delete last kids"  =======================================
        if( !GBUG ) BUG = false;
        if( ! spam.hasChildNodes()) { if(BUG)console.log('dSW: NO FIND spam={',spamStr,'}.hasChildNodes()' ); continue; }
        var c0 = spam.firstChild;
          if(BUG)console.log('dSW: LEAVING: tagName={',c0.tagName,'}, name={',c0.name,'}, kid=',c0 );
          if(BUG)console.log('  innerHTML={',c0.innerHTML,'}' );
        while( 1 < spam.childNodes.length ) {
        var lc = spam.lastChild;
          if(BUG)console.log('dSW: removing: tagName={',lc.tagName,'}, name={',lc.name,'}, kid=',lc );
          if(BUG)console.log('  innerHTML={',lc.innerHTML,'}' );
          spam.removeChild( spam.lastChild ); 
          if(BUG)console.log(' ');
          }
        break;
  
      case "delete last tags":  //==========  "delete last tags"  =======================================
        if( !GBUG ) BUG = false;      
        if( ! spam.hasChildNodes()) { if(BUG)console.log('dSW: NO FIND spam={',spamStr,'}.hasChildNodes()' ); continue; }
        var it0 = -1;
        for(k=0; k<spam.childNodes.length; k++) {
          if( spam.childNodes.tagName ) {  // 1st tag
            it0 = k + 1; 
            break;
            }
          }
        if( it0 < 0 )  // no tags
          break;
        var tag0 = spam.childNodes;
          if(BUG)console.log('dSW: LEAVING: tagName={',tag0.tagName,'}, name={',tag0.name,'}, kid=',tag0 );
          if(BUG)console.log('  innerHTML={',tag0.innerHTML,'}' );
        while( it0 < spam.childNodes.length ) {
          var lc = spam.lastChild;
            if(BUG)console.log('dSW: removing: tagName={',lc.tagName,'}, name={',lc.name,'}, kid=',lc );
            if(BUG)console.log('  innerHTML={',lc.innerHTML,'}' );
          spam.removeChild( spam.lastChild ); 
            if(BUG)console.log(' ');
          }
        break;
  
      default:
        if(BUG)console.log('dSW: UNKNOWN act = {',act,'}.' ); 
        continue; 
      }  // switch
    }  // with( spam )
  BUG = GBUG;
  }  // for(s)
}
//============================================================================
addOnloadHook( deSpamWiki);



//</pre>