Workshop - Unsubscribe from All

Lets just add a nice juicy button here to unsubscribe from all of those addons. Still slow, but not as slow as doing it 1 by 1.

  1. // ==UserScript==
  2. // @name Workshop - Unsubscribe from All
  3. // @namespace http://facepunch.com/
  4. // @version 1.0
  5. // @description Lets just add a nice juicy button here to unsubscribe from all of those addons. Still slow, but not as slow as doing it 1 by 1.
  6. // @author Shigbeard
  7. // @match http://steamcommunity.com/id/*/myworkshopfiles/?appid=*&browsefilter=mysubscriptions*
  8. // @match https://steamcommunity.com/id/*/myworkshopfiles/?appid=*&browsefilter=mysubscriptions*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. function UnsubscribeFromAll() {
  13. var divs = document.getElementsByTagName("div");
  14. var t = 0;
  15. for(var i = 0; i < divs.length; i++){
  16. var currentid = divs[i].id;
  17. var n = currentid.search(/Subscription\d+/g);
  18. if(n != -1){
  19. var t = t + 1;
  20. var m = currentid.search(/\d+/g);
  21. var wid = currentid.substr(m);
  22. console.log(wid);
  23. UnsusbcribeItem(wid, sharedFilesQueryParams['appid']);
  24. }
  25. }
  26. console.log("Results");
  27. console.log(t);
  28. console.log(i);
  29. }
  30.  
  31. document.getElementById('rightContents').getElementsByClassName("rightDetailsBlock")[0].innerHTML += "<div class=\"workshopLink\"><a href=\"javascript:UnsubscribeFromAll()\">Unsubscribe from everything you see here</a></div>";