SteamGifts - Steam Profile Autosync

Automatically sync your steam profile (once a day), when visiting steamgifts.com

当前为 2016-04-09 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         SteamGifts - Steam Profile Autosync
// @version      1.3
// @description  Automatically sync your steam profile (once a day), when visiting steamgifts.com
// @author       Royalgamer06
// @include      *steamgifts.com*
// @grant        none
// @namespace    https://greasyfork.org/users/13642
// ==/UserScript==

var oncePerDay = false;

$(document).ready(function() {
    var currentDate = new Date().toJSON().slice(0,10).replace("-", "").replace("-", "");
    var oldDate = localStorage.date;
    var data =  "xsrf_token=" + document.getElementsByName("xsrf_token")[0].value + "&do=sync";
    
    if (currentDate > oldDate || oldDate === undefined || !oncePerDay) {
        $.ajax({
            url: "/ajax.php",
            type: "POST",
            dataType: "json",
            data: data
        });
    }

    //    $('body').append('<iframe src="http://www.steamgifts.com/account/profile/sync" style="display:none;" id="steamsyncframe"></iframe>');
    //    window.onbeforeunload = function() {
    //        var iframe = document.getElementById("steamsyncframe");
    //        var innerDoc = iframe.contentDocument || iframe.contentWindow.document
    //        innerDoc.getElementsByClassName("form__sync-default")[0].click();
    //        localStorage.date = currentDate;
    //    }
});