Shit ROBLOX Sound Downloader

enter something useful

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

  1. // ==UserScript==
  2. // @name Shit ROBLOX Sound Downloader
  3. // @namespace Shit ROBLOX Sound Downloader
  4. // @version 1.0
  5. // @description enter something useful
  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. downloadURI(uri,"file.mp3");
  27. }
  28. b.onmouseenter=function(){
  29. 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")
  30. }
  31. b.onmouseleave=function(){
  32. 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")
  33. }
  34. pElement.appendChild(b);
  35. }
  36. }
  37.  
  38. function assetPuller(){
  39. if(this.document.title.indexOf("by")){ //if the url specifies an asset
  40. if(this.document.title.indexOf("Audio") != -1){ //if the asset is a sound then
  41. var objects = document.getElementsByClassName("MediaPlayerIcon Play");
  42. for (var i = 0;i < objects.length;i++){
  43. var playbutton = objects[i];
  44. var parent = playbutton.parentElement;
  45. var asseturi = playbutton.getAttribute("data-mediathumb-url");
  46. createDownloadBtn(parent,"audio",asseturi);
  47. }
  48. }
  49. }
  50. }
  51.  
  52. assetPuller()