SteamGifts - Steam Profile Autosync

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

目前為 2017-01-17 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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;
    //    }
});