// ==UserScript==
// @name     4399
// @include  http://my.4399.com*
// @include  https://my.4399.com*
// @version  1
// @grant    none
// ==/UserScript==

var my4399_url = new RegExp("^(http|https):\/\/my\.4399\.com");
var ssjj_url = new RegExp("^http:\/\/my\.4399\.com\/yxssjj");

//my.4399.com
window.setTimeout(function(){
   var cur_url = window.location;
   var test = my4399_url.test(cur_url);
   if (test){
       var loginform = document.getElementsByClassName('my_unlogin')[0].firstChild;
       if (loginform) {
           loginform.click();
       }
   }
},3000);

window.setTimeout(function(){
  var cur_url = window.location;
  var test = my4399_url.test(cur_url);
  if (test){
     var frame = document.getElementById('popup_login_frame').contentDocument;
     if (frame){
         frame.getElementById('password').value = "111111";
         frame.getElementById('login_autoLogin').checked = true;
         var loginBtn = frame.getElementsByClassName('ptlogin_btn')[0];
         loginBtn.click();
     };
  };
},4000);

window.setTimeout(function(){     
  var cur_url = window.location;
  var test = my4399_url.test(cur_url);
  if (test){
      var sign_btn = document.getElementById('j-btn-sign');
      if (sign_btn){
          sign_btn.click();
      }
  }

},5000);

//ssjj
window.setTimeout(function(){
   var cur_url = window.location;
   var test = ssjj_url.test(cur_url);
   if (test){
       var zone = document.getElementById('3_2');
       zone.click();
   };

},6000);