Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:(function()%7BsetTimeout(function()%7B%0A %2F%2F Create "Add" button%0A var btn_add %3D document.createElement("BUTTON")%3B%0A var collection_window %3D document.querySelector('div.collectionAddItemsSection')%0A collection_window.insertBefore(btn_add%2Ccollection_window.firstChild)%3B%0A btn_add.setAttribute('id'%2C'ASCM_addall')%3B%0A jQuery('button%23ASCM_addall').html('%2B')%0A btn_add.style.position %3D 'absolute'%3B%0A btn_add.style.top %3D '110px'%3B%0A btn_add.style.right %3D '50px'%3B%0A btn_add.style%5B'border-radius'%5D %3D '10px'%3B%0A btn_add.style.color %3D 'white'%3B%0A btn_add.style%5B'font-size'%5D %3D '40px'%3B%0A btn_add.style.background %3D '%2300c417'%3B%0A btn_add.style.width %3D '60px'%3B%0A btn_add.style.height %3D '60px'%3B%0A btn_add.style%5B'text-decoration'%5D %3D 'none'%3B%0A %2F%2F Create "Remove" button%0A var btn_rem %3D document.createElement("BUTTON")%3B%0A var collection_window %3D document.querySelector('div.collectionAddItemsSection')%0A collection_window.insertBefore(btn_rem %2Ccollection_window.firstChild)%3B%0A btn_rem .setAttribute('id'%2C'ASCM_removeall')%3B%0A jQuery('button%23ASCM_removeall').html('-')%0A btn_rem.style.position %3D 'absolute'%3B%0A btn_rem.style.top %3D '110px'%3B%0A btn_rem.style.right %3D '120px'%3B%0A btn_rem.style%5B'border-radius'%5D %3D '10px'%3B%0A btn_rem.style.color %3D 'white'%3B%0A btn_rem.style%5B'font-size'%5D %3D '40px'%3B%0A btn_rem.style.background %3D '%23c20000'%3B%0A btn_rem.style.width %3D '60px'%3B%0A btn_rem.style.height %3D '60px'%3B%0A btn_rem.style%5B'text-decoration'%5D %3D 'none'%3B%0A %2F%2F Bind "Add" button%0A jQuery('button%23ASCM_addall').click(function()%7B%0A var items %3D %5B%5D%3B%0A var collection_name %3D jQuery('div.manageCollectionHeader div.breadcrumbs a').eq(2).text().trim()%3B%0A var url %3D new URL(document.location.href)%3B%0A var collection_id %3D url.searchParams.get('id')%3B%0A jQuery('div%23MySubscribedItems div.itemChoice%3Anot(.inCollection)').each(function()%7B%0A var data %3D %7B%0A id%3A collection_id%2C%0A sessionid%3A window.g_sessionID%2C%0A childid%3A jQuery(this).attr('id').replace('choice_MySubscribedItems_'%2C'')%2C%0A activeSection%3A collection_name%0A %7D%3B%0A addToCollection(data%2C jQuery(this))%3B%0A %7D)%3B%0A %7D)%3B%0A %2F%2F Bind "Remove" button%0A jQuery('button%23ASCM_removeall').click(function()%7B%0A jQuery('div%23MySubscribedItems div.itemChoice.inCollection').each(function()%7B%0A window.RemoveChildFromCollection(jQuery(this).attr('id').replace('choice_MySubscribedItems_'%2C''))%0A %7D)%3B%0A %7D)%3B%0A %2F%2F Function to send a request to add item to a collection%0A function addToCollection(data%2C object)%7B%0A jQuery.ajax(%7B%0A type%3A "POST"%2C%0A url%3A 'https%3A%2F%2Fsteamcommunity.com%2Fsharedfiles%2Faddchild'%2C%0A data%3A data%2C%0A success%3A function(response)%7B%0A if(object %26%26 response.success %3D%3D 1)%7B%0A object.addClass('inCollection')%3B%0A %7D%0A %7D%0A %7D)%3B%0A %7D%0A%7D%2C 0)%3B%7D)()%3B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement