init
This commit is contained in:
commit
d83c6b7efe
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/web-ext-artifacts
|
5
README.md
Normal file
5
README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Steam Game Deleter
|
||||||
|
|
||||||
|
- Unter about:debugging#/runtime/this-firefox -> Temporäres Addon laden -> manifest.json auswählen.
|
||||||
|
- https://store.steampowered.com/account/licenses/ (mit abschließendem slash) aufrufen
|
||||||
|
- Skript sollte laufen
|
BIN
icons/icon.png
Normal file
BIN
icons/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
31
manifest.json
Normal file
31
manifest.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 2,
|
||||||
|
"name": "Steam Game Delete",
|
||||||
|
"description": "Deletes Free Steam games from library",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"icons": {
|
||||||
|
"128": "icons/icon.png"
|
||||||
|
},
|
||||||
|
"permissions": [
|
||||||
|
"tabs",
|
||||||
|
"https://store.steampowered.com/account/licenses/"
|
||||||
|
],
|
||||||
|
"background": {
|
||||||
|
"scripts": ["parsers.js", "background.js"]
|
||||||
|
},
|
||||||
|
"browser_specific_settings": {
|
||||||
|
"gecko": {
|
||||||
|
"id": "steam-games-delete@scode.ovh"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"content_scripts": [
|
||||||
|
{
|
||||||
|
"matches": ["https://store.steampowered.com/account/licenses/"],
|
||||||
|
"js": ["site_script.js"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"browser_action": {
|
||||||
|
"default_icon": "icons/icon.png",
|
||||||
|
"default_title": "Steam Game Deleter"
|
||||||
|
}
|
||||||
|
}
|
210
site_script.js
Normal file
210
site_script.js
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
(function() {
|
||||||
|
const delay = 500;
|
||||||
|
const licensesUrl = `https://store.steampowered.com/account/licenses/`;
|
||||||
|
const removeLicensesUrl = `https://store.steampowered.com/account/removelicense`;
|
||||||
|
const warningString = 'Code cannot be executed here. You will be automatically redirected to the correct page. Please run this code on Steam\'s account page details: store.steampowered.com/account/licenses';
|
||||||
|
const analysisHeader = 'Analyzing...';
|
||||||
|
const analysisText = 'Please wait until analysis is complete.';
|
||||||
|
const headerString = 'Games removing';
|
||||||
|
const okString = 'Remove';
|
||||||
|
const cancelString = 'Cancel';
|
||||||
|
const mainInfo = 'You have <b id="numberGames"></b> game(s) can be removed.<br/>Enter the number of games you want to remove.';
|
||||||
|
const errorMessage = 'Enter number from 0 to ';
|
||||||
|
const removingHeader = 'In Progress...';
|
||||||
|
const removingText = 'Don\'t forget to say thanks if you like the script ;) Removed:';
|
||||||
|
const noGamesToRemoveMessage = 'There are no games available for removing.'
|
||||||
|
const rateLimitedMessage = 'You have been rate limited, try again later!'
|
||||||
|
const errorMessage2 = 'An error was encountered while processing your request:'
|
||||||
|
if (location.href != (licensesUrl)) {
|
||||||
|
alert(warningString);
|
||||||
|
window.location = (licensesUrl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var freeLicensePackages = [];
|
||||||
|
var modal = ShowBlockingWaitDialog(analysisHeader, analysisText);
|
||||||
|
|
||||||
|
jQuery('.free_license_remove_link a').each(function(i, el) {
|
||||||
|
var matched = decodeURI(el.href).match(/\d{4,}/);
|
||||||
|
if (matched !== null) {
|
||||||
|
freeLicensePackages.push(+matched);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
modal.Dismiss();
|
||||||
|
|
||||||
|
var total = freeLicensePackages.length;
|
||||||
|
if (total == 0) {
|
||||||
|
alert(noGamesToRemoveMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var enteredNumber = total;
|
||||||
|
|
||||||
|
var desc = jQuery(`<div class="newmodal_prompt_description">${mainInfo}</div><div><div class="newmodal_prompt_input gray_bevel for_text_input fullwidth"><input type="text" id="games_number" value="0"/><span style="display: none; color: rgb(255, 0, 0);"><small>${errorMessage}${total}</small></span></div></div>`);
|
||||||
|
var main = jQuery(`<div class="newmodal" style="position: fixed; z-index: 1000; max-width: 900px; left: 300px; top: 95px;"><div class="newmodal_header_border"><div class="newmodal_header"><div class="ellipsis">${headerString}</div></div></div><div class="newmodal_content_border"><div class="newmodal_content" style="max-height: 205px;"><div id="mainDiv"></div><div class="newmodal_buttons"><div class="btn_green_white_innerfade btn_medium"><span id="okButton">${okString}</span></div><div class="btn_grey_white_innerfade btn_medium"><span id="cancelButton">${cancelString}</span></div></div></div></div></div><div class="newmodal_background" style="opacity: 0.8;"></div>`);
|
||||||
|
|
||||||
|
jQuery('body').append(main);
|
||||||
|
jQuery('#cancelButton').on('click', function (event) {
|
||||||
|
jQuery('.newmodal').remove();
|
||||||
|
jQuery('.newmodal_background').remove();
|
||||||
|
});
|
||||||
|
jQuery('#mainDiv').html(desc);
|
||||||
|
jQuery('#numberGames').text(total);
|
||||||
|
jQuery('#games_number').val(total);
|
||||||
|
jQuery('#games_number').on('change', function (event) {
|
||||||
|
var input = jQuery(this);
|
||||||
|
var value = +input.val();
|
||||||
|
if (!Number.isInteger(value) || value > total || value <= 0) {
|
||||||
|
input.css('border-color', 'red');
|
||||||
|
input.next('span').show();
|
||||||
|
jQuery('#okButton').hide();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enteredNumber = value;
|
||||||
|
input.css('border-color', '');
|
||||||
|
input.next('span').hide();
|
||||||
|
jQuery('#okButton').show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var removed = 0;
|
||||||
|
jQuery('#okButton').on('click', function (event) {
|
||||||
|
jQuery('.newmodal').remove();
|
||||||
|
jQuery('.newmodal_background').remove();
|
||||||
|
proceed();
|
||||||
|
});
|
||||||
|
const proceed = () => {
|
||||||
|
if (modal) {
|
||||||
|
modal.Dismiss();
|
||||||
|
}
|
||||||
|
if (removed >= enteredNumber) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
modal = ShowBlockingWaitDialog(removingHeader, `${removingText} <b>${removed}</b>/${enteredNumber}.`);
|
||||||
|
deleteFunc(removed++);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const deleteFunc = (index) => {
|
||||||
|
jQuery.ajax({url: removeLicensesUrl,
|
||||||
|
type: 'POST',
|
||||||
|
data: { packageid: freeLicensePackages[index], sessionid: g_sessionID },
|
||||||
|
success: function ( response ) {
|
||||||
|
if ( response.success == 1 ) {
|
||||||
|
setTimeout(() => proceed(), delay)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
modal.Dismiss();
|
||||||
|
if (response.success = 84)
|
||||||
|
ShowAlertDialog( 'Error', rateLimitedMessage + ' Error: ' + response.success);
|
||||||
|
else
|
||||||
|
ShowAlertDialog( 'Error', errorMessage2 + ' ' + response.success);
|
||||||
|
... (5 lines left)
|
||||||
|
Collapse
|
||||||
|
message.txt
|
||||||
|
5 KB
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
const delay = 500;
|
||||||
|
const licensesUrl = `https://store.steampowered.com/account/licenses/`;
|
||||||
|
const removeLicensesUrl = `https://store.steampowered.com/account/removelicense`;
|
||||||
|
const warningString = 'Code cannot be executed here. You will be automatically redirected to the correct page. Please run this code on Steam\'s account page details: store.steampowered.com/account/licenses';
|
||||||
|
const analysisHeader = 'Analyzing...';
|
||||||
|
const analysisText = 'Please wait until analysis is complete.';
|
||||||
|
const headerString = 'Games removing';
|
||||||
|
const okString = 'Remove';
|
||||||
|
const cancelString = 'Cancel';
|
||||||
|
const mainInfo = 'You have <b id="numberGames"></b> game(s) can be removed.<br/>Enter the number of games you want to remove.';
|
||||||
|
const errorMessage = 'Enter number from 0 to ';
|
||||||
|
const removingHeader = 'In Progress...';
|
||||||
|
const removingText = 'Don\'t forget to say thanks if you like the script ;) Removed:';
|
||||||
|
const noGamesToRemoveMessage = 'There are no games available for removing.'
|
||||||
|
const rateLimitedMessage = 'You have been rate limited, try again later!'
|
||||||
|
const errorMessage2 = 'An error was encountered while processing your request:'
|
||||||
|
if (location.href != (licensesUrl)) {
|
||||||
|
alert(warningString);
|
||||||
|
window.location = (licensesUrl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var freeLicensePackages = [];
|
||||||
|
var modal = ShowBlockingWaitDialog(analysisHeader, analysisText);
|
||||||
|
|
||||||
|
jQuery('.free_license_remove_link a').each(function(i, el) {
|
||||||
|
var matched = decodeURI(el.href).match(/\d{4,}/);
|
||||||
|
if (matched !== null) {
|
||||||
|
freeLicensePackages.push(+matched);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
modal.Dismiss();
|
||||||
|
|
||||||
|
var total = freeLicensePackages.length;
|
||||||
|
if (total == 0) {
|
||||||
|
alert(noGamesToRemoveMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var enteredNumber = total;
|
||||||
|
|
||||||
|
var desc = jQuery(`<div class="newmodal_prompt_description">${mainInfo}</div><div><div class="newmodal_prompt_input gray_bevel for_text_input fullwidth"><input type="text" id="games_number" value="0"/><span style="display: none; color: rgb(255, 0, 0);"><small>${errorMessage}${total}</small></span></div></div>`);
|
||||||
|
var main = jQuery(`<div class="newmodal" style="position: fixed; z-index: 1000; max-width: 900px; left: 300px; top: 95px;"><div class="newmodal_header_border"><div class="newmodal_header"><div class="ellipsis">${headerString}</div></div></div><div class="newmodal_content_border"><div class="newmodal_content" style="max-height: 205px;"><div id="mainDiv"></div><div class="newmodal_buttons"><div class="btn_green_white_innerfade btn_medium"><span id="okButton">${okString}</span></div><div class="btn_grey_white_innerfade btn_medium"><span id="cancelButton">${cancelString}</span></div></div></div></div></div><div class="newmodal_background" style="opacity: 0.8;"></div>`);
|
||||||
|
|
||||||
|
jQuery('body').append(main);
|
||||||
|
jQuery('#cancelButton').on('click', function (event) {
|
||||||
|
jQuery('.newmodal').remove();
|
||||||
|
jQuery('.newmodal_background').remove();
|
||||||
|
});
|
||||||
|
jQuery('#mainDiv').html(desc);
|
||||||
|
jQuery('#numberGames').text(total);
|
||||||
|
jQuery('#games_number').val(total);
|
||||||
|
jQuery('#games_number').on('change', function (event) {
|
||||||
|
var input = jQuery(this);
|
||||||
|
var value = +input.val();
|
||||||
|
if (!Number.isInteger(value) || value > total || value <= 0) {
|
||||||
|
input.css('border-color', 'red');
|
||||||
|
input.next('span').show();
|
||||||
|
jQuery('#okButton').hide();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enteredNumber = value;
|
||||||
|
input.css('border-color', '');
|
||||||
|
input.next('span').hide();
|
||||||
|
jQuery('#okButton').show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var removed = 0;
|
||||||
|
jQuery('#okButton').on('click', function (event) {
|
||||||
|
jQuery('.newmodal').remove();
|
||||||
|
jQuery('.newmodal_background').remove();
|
||||||
|
proceed();
|
||||||
|
});
|
||||||
|
const proceed = () => {
|
||||||
|
if (modal) {
|
||||||
|
modal.Dismiss();
|
||||||
|
}
|
||||||
|
if (removed >= enteredNumber) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
modal = ShowBlockingWaitDialog(removingHeader, `${removingText} <b>${removed}</b>/${enteredNumber}.`);
|
||||||
|
deleteFunc(removed++);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const deleteFunc = (index) => {
|
||||||
|
jQuery.ajax({url: removeLicensesUrl,
|
||||||
|
type: 'POST',
|
||||||
|
data: { packageid: freeLicensePackages[index], sessionid: g_sessionID },
|
||||||
|
success: function ( response ) {
|
||||||
|
if ( response.success == 1 ) {
|
||||||
|
setTimeout(() => proceed(), delay)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
modal.Dismiss();
|
||||||
|
if (response.success = 84)
|
||||||
|
ShowAlertDialog( 'Error', rateLimitedMessage + ' Error: ' + response.success);
|
||||||
|
else
|
||||||
|
ShowAlertDialog( 'Error', errorMessage2 + ' ' + response.success);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}());
|
Loading…
x
Reference in New Issue
Block a user