Greasy Fork

Common Framework

Framework to be used by most DF requesters/scripts

目前为 2017-10-29 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.icu/scripts/34464/226784/Common%20Framework.js

// ==UserScript==
// @name         Common Framework
// @version      0.6
// @description  Framework to be used by most DF requesters/scripts
// @author       A Meaty Alt
// @grant        none
// ==/UserScript==
var params = $("#flashAlt1")[0].children[0].value;
var sc = params.match(/sc=(.*?)\&/)[1];
var userId = params.match(/userID=(.*?)\&/)[1];
var hashedPassword = params.match(/password=(.*?)\&/)[1];
var pageTime = parseInt($("input[name=r_ts]").value);
setInterval(() => {
    $.get("http://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=35",
      (response) => {
          pageTime = response.match(/pagetime=(.*?)\&/)[1];
      });
}, 60000);

function buildSecureBody(){
    return {
        pagetime: pageTime,
        userId: userId,
        sc: sc,
        password: hashedPassword
    };
}

function isOldFirefox(){
    var match = navigator.userAgent.match(/Firefox\/(.*?)\./);
    if(match){
        var version = match[1];
        return version <= 40;
    }
    return false;
}

function isOldishFirefox(){
    var match = navigator.userAgent.match(/Firefox\/(.*?)\./);
    if(match){
        var version = match[1];
        return 40 < version && version <= 50;
    }
    return false;
}