Advertisement
xenoside

phpschool automate

Jan 19th, 2017
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        phpschool
  3. // @namespace   phpschool
  4. // @description phpschool automate
  5. // @author      shj@xenosi.de
  6. // @include     http://phpschool.com/*
  7. // @include     http://www.phpschool.com/*
  8. // @include     https://phpschool.com/*
  9. // @include     https://www.phpschool.com/*
  10. // @version     1
  11. // @grant       GM_getValue
  12. // @grant       GM_setValue
  13. // @require https://code.jquery.com/jquery-3.1.1.min.js
  14. // ==/UserScript==
  15.  
  16. $(function() {
  17.     var userid = '******', passwd = '******', today = (new Date()).getDay();
  18.  
  19.     if($('form[name=fmblogin]').each(function() {
  20.             this.mb_id.value = userid;
  21.             this.mb_password.value = passwd;
  22.             this.auto_login = 1;
  23.             this.action = 'https://phpschool.com/gnuboard4/bbs/login_check.php';
  24.             this.target = '_self';
  25.             this.submit();
  26.         }).length != 0) return;
  27.  
  28.     function goNotYet() {
  29.         if(GM_getValue('usercheck', -1) != today) {
  30.             location.href = 'http://phpschool.com/guild_new/guild_attend.php';
  31.             return;
  32.         }
  33.         if(GM_getValue('guildcheck', -1) != today) {
  34.             location.href = 'http://phpschool.com/guild_new/guild_attend_cmt.php';
  35.             return;
  36.         }
  37.         if(GM_getValue('gbbcheck', -1) != today) {
  38.             location.href = 'http://phpschool.com/community/rock_paper_scissors.php';
  39.             return;
  40.         }
  41.     }
  42.     setTimeout(function() {
  43.         switch(location.href) {
  44.             case 'https://www.phpschool.com/gnuboard4/bbs/member_confirm.php?url=register_form.php':
  45.             case 'https://phpschool.com/gnuboard4/bbs/member_confirm.php?url=register_form.php':
  46.                 $('[name=mb_password]').val(passwd).closest('form').attr('action', 'register_form.php').trigger('submit');
  47.                 break;
  48.             case 'http://phpschool.com/gnuboard4/bbs/write.php?bo_table=talkbox2':
  49.             case 'http://www.phpschool.com/gnuboard4/bbs/write.php?bo_table=talkbox2':
  50.                 $('[name=wr_subject]').attr('autocomplete', 'off');
  51.                 break;
  52.             case 'http://phpschool.com/guild_new/guild_attend.php':
  53.             case 'http://www.phpschool.com/guild_new/guild_attend.php':
  54.                 var ret = true;
  55.                 $('td.today.btn_link').each(function() {
  56.                     if(GM_getValue('usercheck', -1) != today) {
  57.                         GM_setValue('usercheck', today);
  58.                         $(this).trigger('click');
  59.                         ret = false;
  60.                     }
  61.                 });
  62.                 if(ret) goNotYet();
  63.                 break;
  64.             case 'http://phpschool.com/guild_new/guild_attend_cmt.php':
  65.             case 'http://www.phpschool.com/guild_new/guild_attend_cmt.php':
  66.                 var ret = true;
  67.                 $('[name=fregisterform]').each(function() {
  68.                     if(GM_getValue('guildcheck', -1) != today) {
  69.                         GM_setValue('guildcheck', today);
  70.                         var c = ['ㅊ', 'c'], ch = c[Math.round(Math.random() * 1)], text = '';
  71.                         for(var i = 0; i < Math.ceil(Math.random() * 20 + 10); i++) {
  72.                             text += ch;
  73.                         }
  74.                         this.ga_memo.value = text;
  75.                         this.action = '/guild_new/guild_attend_cmt.php';
  76.                         ret = false;
  77.                         this.submit();
  78.                     }
  79.                 });
  80.                 if(ret) goNotYet();
  81.                 break;
  82.             case 'http://phpschool.com/community/rock_paper_scissors.php':
  83.             case 'http://www.phpschool.com/community/rock_paper_scissors.php':
  84.                 GM_setValue('gbbcheck', today);
  85.                 var rsps = ['rock', 'scissors', 'paper'];
  86.  
  87.                 function clickOk() {
  88.                     var $ok = $('div.ui-dialog-buttonset button:first');
  89.                     if(!$ok.length) {
  90.                         setTimeout(clickOk, 600);
  91.                         return;
  92.                     }
  93.                     $ok.trigger('click');
  94.                     setTimeout(gameClickingStart, 1000);
  95.                 }
  96.  
  97.                 function clickRSP() {
  98.                     var $rsp = $('#human input[name=' + rsps[Math.floor(Math.random() * 3)] + ']');
  99.                     if(!$rsp.length) {
  100.                         setTimeout(clickRSP, 600);
  101.                         return;
  102.                     }
  103.                     $rsp.trigger('click');
  104.                     clickOk();
  105.                 }
  106.  
  107.                 function gameClickingStart() {
  108.                     var cnt = $('span.game_count').html() * 1;
  109.                     if(!cnt) return;
  110.                     $('#game_point').val('50');
  111.                     $('#gameStart').trigger('click');
  112.                     clickRSP();
  113.                 }
  114.  
  115.                 gameClickingStart();
  116.                 break;
  117.             case 'https://phpschool.com/gnuboard4/bbs/login_check.php':
  118.                 break;
  119.             default:
  120.                 goNotYet();
  121.                 break;
  122.         }
  123.     }, 1000);
  124. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement