Automatically sync your steam profile (once a day), when visiting steamgifts.com
目前為
// ==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;
// }
});