Greasy Fork

Greasy Fork is available in English.

咕咕镇沙滩自动刷新

每天睡饱饱~

当前为 2021-07-03 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         咕咕镇沙滩自动刷新
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  每天睡饱饱~
// @author       ikarosf
// @match        http*://*/fyg_beach.php
// @grant        unsafeWindow
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

function FLASHbeach() {
    'use strict';
    var flashbyxingshaNUM = 0;
    if(FM_getValue('flashbyxingshaNUM')!=null){
        flashbyxingshaNUM = FM_getValue('flashbyxingshaNUM');
    }
    unsafeWindow.FM_getValue = FM_getValue;

    var flashbyxingshaNUMbox = document.createElement("div")
    flashbyxingshaNUMbox.setAttribute('style',"display: inline-block;float: right!important;");

    let flashbyxingshaNUMlabel = document.createElement('i');
    flashbyxingshaNUMlabel.innerText = "使用星沙刷新次数:";
    flashbyxingshaNUMbox.appendChild(flashbyxingshaNUMlabel);

    let flashbyxingshaNUMInput = document.createElement('input');
    flashbyxingshaNUMInput.setAttribute('type','text');
    flashbyxingshaNUMInput.setAttribute('oninput',"value=value.replace(/[^\\d]/g,'')");
    flashbyxingshaNUMInput.setAttribute('style',"width: 40px;margin-right:15px;");
    flashbyxingshaNUMInput.value = flashbyxingshaNUM;
    flashbyxingshaNUMInput.onchange = function(){
        var localNUM = parseInt(flashbyxingshaNUMInput.value);
        if(isNaN(localNUM)){
            flashbyxingshaNUM = 0;
        }else{
            if(localNUM>2){
                localNUM = 2;
            }else if(localNUM<0){
                localNUM = 0;
            }
            flashbyxingshaNUM = localNUM;
        }
        FM_setValue('flashbyxingshaNUM',flashbyxingshaNUM );
    };
    flashbyxingshaNUMbox.appendChild(flashbyxingshaNUMInput);
    $(".btn-group.pull-right").after(flashbyxingshaNUMbox)





    var text = document.getElementsByClassName("pull-right")[1].textContent;
    var patt1 = /\d+/;
    var minute = text.match(patt1)
    minute = parseInt(minute[0]) + 1
    setTimeout(function(){
        FM_setValue('xingshaflashremainder',flashbyxingshaNUM );
        location.reload();
    }, minute*60*1000);
    document.getElementsByTagName("span")[0].textContent = text + " 将自动刷新"

    var reflashbyxingsha = unsafeWindow.gx_sxst;

    var xingshaflashremainder = 0;
    if(FM_getValue('xingshaflashremainder')!=null){
        xingshaflashremainder = FM_getValue('xingshaflashremainder');
    }
    if(xingshaflashremainder>0){
        reflashbyxingsha();
        xingshaflashremainder = xingshaflashremainder-1;
        FM_setValue('xingshaflashremainder',xingshaflashremainder );

        setTimeout(function(){
            location.reload();
        }, 2000);
    }


    // Yocode here...
}
var user = document.getElementsByClassName('icon-user')[0].parentNode.innerText.split(' ')[1];

function FM_setValue(name, value){
    var oldvalue = GM_getValue(user);
    if(oldvalue === undefined){
        oldvalue = {};}
    oldvalue[name] = value;
    GM_setValue(user,oldvalue);
}

function FM_getValue(name, defaultValue){
    var thisvalue = GM_getValue(user);
    if(thisvalue != undefined&&name in thisvalue){
        return thisvalue[name]
    }
    if(defaultValue != null){
        return defaultValue;
    }
    return null;
}

FLASHbeach();