XCOM 2
Not enough ratings
一键从已订阅列表中创建合集
By Frigid
XCOM 的mod十分零碎分散,动不动就需要一下订阅数百个,要是出现订阅列表不小心清空的情况,都要心碎一地。
创意工坊有创建合集的功能,可以用于备份,但选择已订阅物品时,每选一个物品页面都刷新一次,然后还要下拉滚轮再选择,实在一言难尽。
这里采用Chrome控制台的方法,实现一键将已订阅模组加入合集,免去繁琐的点击刷新过程。

原方法取自:
https://www.reddit.com/r/CitiesSkylines/comments/8hrdsd/add_all_subscribed_items_to_steam_collections_at/
   
Award
Favorite
Favorited
Unfavorite
一、创建合集
创建合集后在【添加 / 编辑子物品】界面按Ctrl+Shift+I,打开控制台(Console)
二、复制代码
复制以下代码在控制台粘贴并回车

setTimeout(function(){ // Create "Add" button var btn_add = document.createElement("BUTTON"); var collection_window = document.querySelector('div.collectionAddItemsSection') collection_window.insertBefore(btn_add,collection_window.firstChild); btn_add.setAttribute('id','ASCM_addall'); jQuery('button#ASCM_addall').html('+') btn_add.style.position = 'absolute'; btn_add.style.top = '110px'; btn_add.style.right = '50px'; btn_add.style['border-radius'] = '10px'; btn_add.style.color = 'white'; btn_add.style['font-size'] = '40px'; btn_add.style.background = '#00c417'; btn_add.style.width = '60px'; btn_add.style.height = '60px'; btn_add.style['text-decoration'] = 'none'; // Create "Remove" button var btn_rem = document.createElement("BUTTON"); var collection_window = document.querySelector('div.collectionAddItemsSection') collection_window.insertBefore(btn_rem ,collection_window.firstChild); btn_rem .setAttribute('id','ASCM_removeall'); jQuery('button#ASCM_removeall').html('-') btn_rem.style.position = 'absolute'; btn_rem.style.top = '110px'; btn_rem.style.right = '120px'; btn_rem.style['border-radius'] = '10px'; btn_rem.style.color = 'white'; btn_rem.style['font-size'] = '40px'; btn_rem.style.background = '#c20000'; btn_rem.style.width = '60px'; btn_rem.style.height = '60px'; btn_rem.style['text-decoration'] = 'none'; // Bind "Add" button jQuery('button#ASCM_addall').click(function(){ var items = []; var collection_name = jQuery('div.manageCollectionHeader div.breadcrumbs a').eq(2).text().trim(); var url = new URL(document.location.href); var collection_id = url.searchParams.get('id'); jQuery('div#MySubscribedItems div.itemChoice:not(.inCollection)').each(function(){ var data = { id: collection_id, sessionid: window.g_sessionID, childid: jQuery(this).attr('id').replace('choice_MySubscribedItems_',''), activeSection: collection_name }; addToCollection(data, jQuery(this)); }); }); // Bind "Remove" button jQuery('button#ASCM_removeall').click(function(){ jQuery('div#MySubscribedItems div.itemChoice.inCollection').each(function(){ window.RemoveChildFromCollection(jQuery(this).attr('id').replace('choice_MySubscribedItems_','')) }); }); // Function to send a request to add item to a collection function addToCollection(data, object){ jQuery.ajax({ type: "POST", url: 'https://gtm.steamproxy.vip/sharedfiles/addchild', data: data, success: function(response){ if(object && response.success == 1){ object.addClass('inCollection'); } } }); } }, 0);
三、点击按钮
点击页面新出现的加号按钮,此时不要立刻刷新网页


再点击控制台旁的网络(Network)标签页
观察变动直到最后一个物品加入完成,显示返回值为200即可刷新页面
另:用脚本导出已订阅列表为本地字符串