ergildo / Bular Java no Sankhya-W

// ==UserScript==
// @name         Bular Java no Sankhya-W
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Ergildo C. Dias
// @match        http://198.178.126.175:8080/mge/system.jsp
// @include	     http://198.178.126.175:8080/mge/system.jsp
// @grant        none
// ==/UserScript==
/* jshint -W097 */
var scrpts = document.getElementsByTagName('script');
var loaderPanels = document.getElementsByClassName('loaderPanel');
var applets = document.getElementsByTagName('embed'); 
//var body = document.getElementsByTagName('body')[0];
//alert(body.onload);
//body.onload=null;


for (i = 0; i < loaderPanels.length; i++) { 
 // loaderPanels[i].remove();   
}


//alert(scrpts.length);
for (i = 0; i < scrpts.length; i++) { 
    var  scrpt = scrpts[i];
    if(scrpt.text.indexOf('init()')!=-1){
      //  alert('text:'+scrpt.text);
        scrpt.parentNode.removeChild(scrpt);
        var onloadScript = document.createElement('script');

        onloadScript.setAttribute('src','https://openuserjs.org/src/libs/ergildo/init.js');
        onloadScript.setAttribute('name','onloadScript');
        onloadScript.setAttribute('id','onloadScript');

        document.head.appendChild(onloadScript);
    }


   /* if(scrpt.src=='http://198.178.126.174:8080/mge/js/SANAppletObject.js' )
    {
        // alert('Index:'+i+'src:'+scrpt.src+'name:'+scrpt.name+'text:'+scrpt.text);
        //  scrpt.parentNode.removeChild(scrpt);
    }*/
    //  scrpt.parentNode.removeChild(scrpt);
  //  scrpt.name='script'+i;

}

for (i = 0; i < applets.length; i++) { 
    //application/x-java-applet
    // alert(applets[i].type);
    applets[i].remove();   
}