起点自动领经验

自动领取起点经验,过0点自动刷新。

目前為 2017-03-14 提交的版本,檢視 最新版本

// ==UserScript==
// @name         起点自动领经验
// @namespace    http://tampermonkey.net/
// @version      2.2
// @description  自动领取起点经验,过0点自动刷新。 
// @author       菠菜
// @match        http://t.qidian.com/Profile/Score.php
// @grant        none
// ==/UserScript==


(function() {
    'use strict';
    jQuery(function($) {
        $(document).ready(function(){
            var quanbu = $("a.btn").text();
            var linga=quanbu.indexOf("可领取");


            if (linga>0)
            {
                $('a[id^=online-exp-get]').each(function()
                                                {
                    var id = $(this).attr('id');
                    var mins = parseInt(id.replace('online-exp-get', ''), 10);
                    $.closeAllDialog();
                    $.loading();
                    $.ajax(
                        {
                            type: "get",
                            url: "/Ajax/Occupation.php",
                            data: { ajaxMethod: 'getonlineexp', minutes: mins, random: Math.random() },
                            dataType: "json",
                            success: function(result)
                            {
                                $.loadingClose();
                                if (result.returnCode === true)
                                {
                                    location.reload(true);
                                }
                                else
                                {
                                    location.reload(true);
                                }
                            }
                        });
                });
            }
            else
            {
                ( function startTime(){
                    var newtime=new Date();
                    newtime.setFullYear(2020,1,1);
                    var settime = new Date(2020,1,1,0,0,5);
                    if (newtime<settime)
                    {
                        setTimeout(function(){
                            location.reload(true);
                        },6000);
                    }
                    else
                    {
                        setTimeout(startTime,1000);
                    }
                }
                )();

            }

        }
                         );

    })();
})();