// ==UserScript==
// @name Import/Export Steam Ignore List
// @language English
// @namespace https://greasyfork.org/users/2205
// @description Imports/Exports Steam Ignore List
// @include https://store.steampowered.com/account/notinterested/*
// @include http://store.steampowered.com/account/notinterested/*
// @version 1.0
// @grant none
// @downloadURL none
// ==/UserScript==
var anchor = document.getElementsByClassName("ignoredapps")[0];
//Export
var ExportBtn=document.createElement("div");
ExportBtn.setAttribute("class","btn_darkblue_white_innerfade btn_medium");
ExportBtn.setAttribute("style","margin-right: 5px !important;");
ExportBtn.appendChild(document.createElement("span"));
ExportBtn.firstChild.appendChild(document.createTextNode("Export"));
var newExportBtn=anchor.parentElement.insertBefore(ExportBtn,anchor);
newExportBtn.addEventListener("click",function(){
$J.get("/dynamicstore/userdata/", {t: new Date().getTime()}, function(data) {
var strdata=data.rgIgnoredApps.toString();
var exportDialog=ShowAlertDialog("Ignore List", '
'+strdata.replace(/\,/g, ",
")+'
', "OK");
},"json").fail(function() {
ShowAlertDialog("Export Error","There was an error retrieving ignore list","OK");
});
});
//Import
var ImportBtn=document.createElement("div");
ImportBtn.setAttribute("class","btn_darkblue_white_innerfade btn_medium");
ImportBtn.setAttribute("style","margin-right: 5px !important;");
ImportBtn.appendChild(document.createElement("span"));
ImportBtn.firstChild.appendChild(document.createTextNode("Import"));
var newImportBtn=anchor.parentElement.insertBefore(ImportBtn,anchor);
var successfull=0;
var failed=0;
var totalitems;
newImportBtn.addEventListener("click",function(){
importDialog=ShowPromptWithTextAreaDialog( "Import Ignore List", "", "OK", "Cancel", 32765 ).done( function(newIgnoreListText){
if (/^[0-9]+(,\s*[0-9]+)*$/.test(newIgnoreListText)) {
var IgnoreListTextItems=newIgnoreListText.split(",");
successfull=0;
failed=0;
totalitems=IgnoreListTextItems.length;
for (var i=0; iPress \"OK\" to reload page.", "OK" ).done(function(){
window.location.reload();
});
}
}
).fail(function() {
failed++;
if ((successfull+failed)===totalitems) {
ShowAlertDialog( "Import", "Import Finished.
Press \"OK\" to reload page.", "OK" ).done(function(){
window.location.reload();
});
}
}
);
}
} else {
ShowAlertDialog( "Import Error", "Wrong list syntax!", "OK" );
}
});
});
var ClearBtn=document.createElement("div");
ClearBtn.setAttribute("class","btn_darkblue_white_innerfade btn_medium");
ClearBtn.setAttribute("style","margin-right: 5px !important;");
ClearBtn.appendChild(document.createElement("span"));
ClearBtn.firstChild.appendChild(document.createTextNode("Clear"));
var newClearBtn=anchor.parentElement.insertBefore(ClearBtn,anchor);
newClearBtn.addEventListener("click",function(){
ShowConfirmDialog( "Clear Ignore List", "Are you sure you want to clear ignore list?", "Yes", "No").done(function(){
$J.get("/dynamicstore/userdata/", {t: new Date().getTime()}, function(data) {
successfull=0;
failed=0;
totalitems=data.rgIgnoredApps.length;
for (var j=0;j0){
ShowAlertDialog( "Clear", "Cleanup finished, unable to remove "+failed+" items.
Press \"OK\" to reload page.", "OK" ).done(function(){
window.location.reload();
});
} else {
ShowAlertDialog( "Clear", "Ignore list cleared successfuly
Press \"OK\" to reload page.", "OK" ).done(function(){
window.location.reload();
});
}
}
}
).fail(function(){
failed++;
if ((successfull+failed)===totalitems) {
ShowAlertDialog( "Clear", "Cleanup finished, unable to remove "+failed+" items.
Press \"OK\" to reload page.", "OK" ).done(function(){
window.location.reload();
});
}
});
}
},"json").fail(function() {
ShowAlertDialog("Clean Error","There was an error retrieving ignore list","OK");
});
});
});