Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Put game list as groups (doesn't have to be like this, can be one long string separating each title with same character, e.g. comma+spacebar [although some silly games use that in their names] - this will require to mild adaptation of code)
- var group1 = ["1954 Alcatraz", "90 Minute Fever"];
- var group2 = ["200% Mixed Juice!", "60 Parsecs!"];
- var group3 = ["A New Beginning - Final Cut", "A Space For The Unbound - Prologue"];
- var group4 = [];
- var group5 = [];
- var group6 = [];
- var group7 = [];
- var group8 = [];
- var colorMe = true; //if games without choices should have background color changed...
- var theColor = "darkred"; //color to change div... (row in table)
- var count = document.querySelector('.steam_table > tbody:nth-child(2)').children.length; //Get number of games to import...
- for ( let i = 1; i <= count; i++ )
- {
- var option = null; //Option default - we are going to replace it with rules below...
- var gameName = document.querySelector('tr.spreadsheet:nth-child('+i+') > td:nth-child(1)').textContent; //Get game's name from table...
- var playTime = document.querySelector('tr.spreadsheet:nth-child('+i+') > td:nth-child(2)').textContent.trim();
- //No play time gives this string: "--"
- document.querySelector('tr.spreadsheet:nth-child('+i+')').style.backgroundColor = ""; //Reset color (just in case it was changed before);
- if ( group1.indexOf(gameName) > -1 ) { option = 1 } //check if game's name is in group1 of games, if it is, assign this game to group1 - aka it will select first option on list (Playing)
- else if ( group2.indexOf(gameName) > -1 ) { option = 2 } //Backlog
- else if ( group3.indexOf(gameName) > -1 ) { option = 3 } //Replay
- else if ( group4.indexOf(gameName) > -1 ) { option = 4 } //Custom Tab 1 [MPOnline for me]
- else if ( group5.indexOf(gameName) > -1 ) { option = 5 } //Custom Tab 2 [VR for me]
- else if ( group6.indexOf(gameName) > -1 ) { option = 6 } //Custom Tab 3 [CustomTab for me]
- else if ( group7.indexOf(gameName) > -1 ) { option = 7 } //Completed
- else if ( group8.indexOf(gameName) > -1 ) { option = 8 } //Retired
- else {
- option = 0;
- console.log(gameName+" can't be detected in any groups.");
- if ( colorMe === true ) {
- document.querySelector('tr.spreadsheet:nth-child('+i+')').style.backgroundColor = theColor; //changing color
- }
- }
- //Custom rules here. Put any number you want instead of "number". E.g. for rule with VR, I would use my custom tab 2, which is option 5.
- //Example 1, if time is empty
- //if ( playTime === "--" ) { option = number }
- //Example 2, if time is not empty...
- //if ( playTime.length > 2 ) { option = number }
- //Example 3, if game has "VR" in name (case-sensitive)
- //if ( gameName.indexOf("VR") > -1 ) { option = number }
- document.querySelector('tr.spreadsheet:nth-child('+i+') > td:nth-child(3) > select:nth-child(1)').selectedIndex = option;
- }
Add Comment
Please, Sign In to add comment