ROBLOX Soundloader

Download songs from ROBLOX!

  1. // ==UserScript==
  2. // @name ROBLOX Soundloader
  3. // @namespace RBLXSNDLDR
  4. // @version 2.1
  5. // @description Download songs from ROBLOX!
  6. // @author SFOH
  7. // @match http://www.roblox.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
  12. var isChrome = !!window.chrome && !isOpera;
  13. var isFirefox = typeof InstallTrigger !== 'undefined'; //just for robloxian4545 because he uses firefox like a CHUMP
  14.  
  15. function downloadURI(uri,name) { //allows user to download the asset
  16. var link = document.createElement("a");
  17. link.download = name;
  18. link.href = uri;
  19. if(isChrome){
  20. alert("Warning! If the file doesn't play - it may be an .ogg! Try renaming it if it doesn't work.");
  21. link.click();
  22. } else {
  23. alert("Warning! You will have to press Ctrl+S to save this file! (try chrome?)");
  24. var event = document.createEvent("MouseEvents"); //stolen as fuck
  25. event.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  26. link.dispatchEvent(event);
  27. };
  28. };
  29.  
  30. function createDownloadBtn(pElement,type,uri){ //where pElement is the frame to add the button to
  31. if(type==="audio"){
  32. var b = document.createElement("input");
  33. b.setAttribute("class","downloadButton");
  34. b.setAttribute("type","image");
  35. b.setAttribute("src","http://vavvi.com/images/2015/06/a99x0ghdgnfv9ls16rww.png");
  36. b.setAttribute("style","background-position:0px 0px;display:inline-block;background:url(http://vavvi.com/images/2015/06/ncrr1l5xcu0qbyvwwzye.png) 0px 0px;border:0;margin:0;padding:0;cursor:pointer;color:transparent;position:relative;background-repeat:no-repeat;width:25px;height:25px;left:-25px;top:-25px;z-index:9");
  37. b.onclick=function(){
  38. downloadURI(uri,".mp3");
  39. }
  40. b.onmouseenter=function(){
  41. b.setAttribute("style","background-position:-25px 0px;display:inline-block;background:url(http://vavvi.com/images/2015/06/ncrr1l5xcu0qbyvwwzye.png) -25px 0px;border:0;margin:0;padding:0;cursor:pointer;color:transparent;position:relative;background-repeat:no-repeat;width:25px;height:25px;left:-25px;top:-25px;z-index:9")
  42. }
  43. b.onmouseleave=function(){
  44. b.setAttribute("style","background-position:0px 0px;display:inline-block;background:url(http://vavvi.com/images/2015/06/ncrr1l5xcu0qbyvwwzye.png) 0px 0px;border:0;margin:0;padding:0;cursor:pointer;color:transparent;position:relative;background-repeat:no-repeat;width:25px;height:25px;left:-25px;top:-25px;z-index:9")
  45. }
  46. pElement.appendChild(b);
  47. }
  48. }
  49.  
  50. function assetPuller(){
  51. var objects = document.getElementsByClassName("MediaPlayerIcon Play");
  52. for(var i = 0;i < objects.length;i++){
  53. var playbutton = objects[i];
  54. var parent = playbutton.parentElement;
  55. var asseturi = playbutton.getAttribute("data-mediathumb-url");
  56. createDownloadBtn(parent,"audio",asseturi);
  57. }
  58. }
  59.  
  60. function checkForUpdates(){
  61. if(!document.getElementsByClassName("downloadButton").length>0){
  62. assetPuller();
  63. }
  64. }
  65.  
  66. setInterval(checkForUpdates,500)