├── AddAllToCollection.js └── README.md /AddAllToCollection.js: -------------------------------------------------------------------------------- 1 | setTimeout(function(){ 2 | // Create "Add" button 3 | var btn_add = document.createElement("BUTTON"); 4 | var collection_window = document.querySelector('div.collectionAddItemsSection') 5 | collection_window.insertBefore(btn_add,collection_window.firstChild); 6 | btn_add.setAttribute('id','ASCM_addall'); 7 | jQuery('button#ASCM_addall').html('+') 8 | btn_add.style.position = 'absolute'; 9 | btn_add.style.top = '110px'; 10 | btn_add.style.right = '50px'; 11 | btn_add.style['border-radius'] = '10px'; 12 | btn_add.style.color = 'white'; 13 | btn_add.style['font-size'] = '40px'; 14 | btn_add.style.background = '#00c417'; 15 | btn_add.style.width = '60px'; 16 | btn_add.style.height = '60px'; 17 | btn_add.style['text-decoration'] = 'none'; 18 | // Create "Remove" button 19 | var btn_rem = document.createElement("BUTTON"); 20 | var collection_window = document.querySelector('div.collectionAddItemsSection') 21 | collection_window.insertBefore(btn_rem ,collection_window.firstChild); 22 | btn_rem .setAttribute('id','ASCM_removeall'); 23 | jQuery('button#ASCM_removeall').html('-') 24 | btn_rem.style.position = 'absolute'; 25 | btn_rem.style.top = '110px'; 26 | btn_rem.style.right = '120px'; 27 | btn_rem.style['border-radius'] = '10px'; 28 | btn_rem.style.color = 'white'; 29 | btn_rem.style['font-size'] = '40px'; 30 | btn_rem.style.background = '#c20000'; 31 | btn_rem.style.width = '60px'; 32 | btn_rem.style.height = '60px'; 33 | btn_rem.style['text-decoration'] = 'none'; 34 | // Bind "Add" button 35 | jQuery('button#ASCM_addall').click(function(){ 36 | var items = []; 37 | var collection_name = jQuery('div.manageCollectionHeader div.breadcrumbs a').eq(2).text().trim(); 38 | var url = new URL(document.location.href); 39 | var collection_id = url.searchParams.get('id'); 40 | jQuery('div#MySubscribedItems div.itemChoice:not(.inCollection)').each(function(){ 41 | var data = { 42 | id: collection_id, 43 | sessionid: window.g_sessionID, 44 | childid: jQuery(this).attr('id').replace('choice_MySubscribedItems_',''), 45 | activeSection: collection_name 46 | }; 47 | addToCollection(data, jQuery(this)); 48 | }); 49 | }); 50 | // Bind "Remove" button 51 | jQuery('button#ASCM_removeall').click(function(){ 52 | jQuery('div#MySubscribedItems div.itemChoice.inCollection').each(function(){ 53 | window.RemoveChildFromCollection(jQuery(this).attr('id').replace('choice_MySubscribedItems_','')) 54 | }); 55 | }); 56 | // Function to send a request to add item to a collection 57 | function addToCollection(data, object){ 58 | jQuery.ajax({ 59 | type: "POST", 60 | url: 'https://steamcommunity.com/sharedfiles/addchild', 61 | data: data, 62 | success: function(response){ 63 | if(object && response.success == 1){ 64 | object.addClass('inCollection'); 65 | } 66 | } 67 | }); 68 | } 69 | }, 0); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # steamcollectionjs 2 | Original Post: https://www.reddit.com/r/CitiesSkylines/comments/8hrdsd/add_all_subscribed_items_to_steam_collections_at/ 3 | Tutorial 4 | 5 | Definitely tell steam we need this as a default feature! 6 | 7 | Interested in a gaming community? Join Below! 8 | https://discord.gg/BtWdVTQDrM 9 | --------------------------------------------------------------------------------