ROBLOX Soundloader

Download songs from ROBLOX!

当前为 2015-06-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name ROBLOX Soundloader
  3. // @namespace RBLXSNDLDR
  4. // @version 1.2
  5. // @description Download songs from ROBLOX!
  6. // @author SFOH
  7. // @match http://www.roblox.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. function downloadURI(uri,name) { //allows user to download the asset
  12. var link = document.createElement("a");
  13. link.download = name;
  14. link.href = uri;
  15. link.click();
  16. }
  17.  
  18. function createDownloadBtn(pElement,type,uri){ //where pElement is the frame to add the button to
  19. if(type==="audio"){
  20. var b = document.createElement("input");
  21. console.log(pElement);
  22. b.setAttribute("class","downloadButton");
  23. b.setAttribute("type","image");
  24. b.setAttribute("style","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");
  25. b.onclick=function(){
  26. alert("Warning! If the file doesn't play - it may be an .ogg! Try renaming it if it doesn't work.")
  27. downloadURI(uri,"");
  28. }
  29. b.onmouseenter=function(){
  30. b.setAttribute("style","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")
  31. }
  32. b.onmouseleave=function(){
  33. b.setAttribute("style","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")
  34. }
  35. pElement.appendChild(b);
  36. }
  37. }
  38.  
  39. function assetPuller(){
  40. if(this.document.title.indexOf("by")){ //if the url specifies an asset
  41. if(this.document.title.indexOf("Audio") != -1){ //if the asset is a sound then
  42. var objects = document.getElementsByClassName("MediaPlayerIcon Play");
  43. for (var i = 0;i < objects.length;i++){
  44. var playbutton = objects[i];
  45. var parent = playbutton.parentElement;
  46. var asseturi = playbutton.getAttribute("data-mediathumb-url");
  47. createDownloadBtn(parent,"audio",asseturi);
  48. }
  49. }
  50. }
  51. }
  52.  
  53. assetPuller()