Automatically sync your steam profile once a day, when visiting steamgifts.com
当前为
// ==UserScript==
// @name SteamGifts - Steam Profile Autosync
// @version 1.2
// @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==
$(document).ready(function() {
var currentDate = new Date().toJSON().slice(0,10).replace("-", "").replace("-", "");
var oldDate = localStorage.date;
if (currentDate > oldDate || oldDate === undefined) {
$('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;
}
}
});