Discussions » Creation Requests

Please help me convert bookmarklet in user script in order to download artwork on soundcloud

§
Posted: 2014-11-21

Please help me convert bookmarklet in user script in order to download artwork on soundcloud

i found a very useful bookmarklet which let me enlarge as well SAVE artwork on soundcloud ,i d like to convert it to a userscript for chrome /firefox to run automatically
here is the bookmarklet code:
javascript:function%20aEv(e,ev,f,c){c=(c)?c:false;if(e.addEventListener){e.addEventListener(ev,f,c)}else%20if(e.attachEvent){e.attachEvent("on"+ev,f)}else{e["on"+ev]=f}}var%20a=[[/45cat\./,/-s\.jpg/i,/-s\.jpg/gi,".jpg"],[/45cat\./,/-s\.png/i,/-s\.png/gi,".png"],[/allmusic\./,/\/JPG_\d{3}\//i,/\/JPG_\d{3}\//gi,"/JPG_1080/"],[/amazon\./,/\._[A-Z]{2}\d{3}_[\w_,-]*\.jpg/i,/\._[A-Z]{2}\d{3}_[\w_,-]*\.jpg/gi,".jpg"],[/amazon\./,/\._[A-Z]{2}\d{3}_[\w_,-]*\.png/i,/\._[A-Z]{2}\d{3}_[\w_,-]*\.png/gi,".png"],[/bandcamp\./,/_\d\.jpg/i,/_\d\.jpg/gi,"_0.jpg"],[/bandcamp\./,/_\d\.png/i,/_\d\.png/gi,"_0.png"],[/cdbaby\./,/images\..*_small\.[jpgpng]{3}/i,/_small\./gi,"."],[/cdbaby\./,/images\..*\.jpg/i,/\.jpg/gi,"_large.jpg"],[/cdbaby\./,/images\..*\.png/i,/\.png/gi,"_large.png"],[/itunes\.apple\./,/1\d0x1\d0-75\./i,/1\d0x1\d0-75\./gi,"1200x1200-75."],[/jamendo\./,/1\.\d00\.jpg/i,/1\.\d00\.jpg/gi,"1.0.jpg"],[/jamendo\./,/1\.\d00\.png/i,/1\.\d00\.png/gi,"1.0.png"],[/last(fm)?\.[a-z]{2,3}/,/\/serve\/\d{3}[^\/]*\//i,/\/serve\/\d{3}[^\/]*\//gi,"/serve/_/"],[/magnatune\./,/cover_\d{2,3}\./i,/cover_\d{2,3}\./gi,"cover."],[/musicbrainz\.org/,/_thumb\d{3}\./i,/_thumb\d{3}\./gi,"."],[/musicbrainz\.org/,/-\d{3}\.jpg/i,/-\d{3}\.jpg/gi,".jpg"],[/musicbrainz\.org/,/-\d{3}\.png/i,/-\d{3}\.png/gi,".png"],[/musicdiner\./,/1\d0x1\d0-75\./i,/1\d0x1\d0-75\./gi,"1200x1200-75."],[/soundcloud\./,/t\d\d0x\d\d0\./i,/t\d\d0x\d\d0\./gi,"original."],[/play\.google\.com/,/googleusercontent\.com.*\=w\d{3}/,/\=w\d{3}$/,"=w1200"]];var%20w=null,n=0,m=20,d=document;if(d.location.hostname.search(/soundcloud\./)>-1){spans=document.querySelectorAll("span[style*=background-image]");for(i=0;i";}}}o:for(var%20v=0;v-1){w=a[v];var%20l=d.getElementsByTagName("img");if(l)for(var%20i=0;i-1){l[i].style.border="1px%20#FB0%20solid";if(l[i].naturalWidth)l[i].onmouseover=function(){this.title=""+this.naturalWidth+"x"+this.naturalHeight};aEv(l[i],"load",function(){if(this.style){this.style.borderColor="#F00";if(this.naturalWidth%20&&%20this.naturalWidth>999)this.style.borderWidth="2px"}});aEv(l[i],"click",function(){if(this.src)location=this.src});l[i].src=l[i].src.replace(w[2],w[3]);n++;if(n==m)if(confirm(""+n+"%20images%20requested.%20Continue?"))m=m+20;else%20break%20o;}};};if(w==null)self.open("http://rockland.dk/BCA?v=2.01","BCA");void(0);

here is what i tried without success!!!!!!!!!!!!!:

//=================TEMPLATE BELOW===================//

// ==UserScript==
// @name SoundcloudAddArtwork



// @include https://soundcloud.com/*


// @version 0.0.1
// ==/UserScript==
function aEv(e,ev,f,c){c=(c)?c:false;if(e.addEventListener){e.addEventListener(ev,f,c)}else if(e.attachEvent){e.attachEvent("on"+ev,f)}else{e["on"+ev]=f}}var a=[[/45cat\./,/-s\.jpg/i,/-s\.jpg/gi,".jpg"],[/45cat\./,/-s\.png/i,/-s\.png/gi,".png"],[/allmusic\./,/\/JPG_\d{3}\//i,/\/JPG_\d{3}\//gi,"/JPG_1080/"],[/amazon\./,/\._[A-Z]{2}\d{3}_[\w_,-]*\.jpg/i,/\._[A-Z]{2}\d{3}_[\w_,-]*\.jpg/gi,".jpg"],[/amazon\./,/\._[A-Z]{2}\d{3}_[\w_,-]*\.png/i,/\._[A-Z]{2}\d{3}_[\w_,-]*\.png/gi,".png"],[/bandcamp\./,/_\d\.jpg/i,/_\d\.jpg/gi,"_0.jpg"],[/bandcamp\./,/_\d\.png/i,/_\d\.png/gi,"_0.png"],[/cdbaby\./,/images\..*_small\.[jpgpng]{3}/i,/_small\./gi,"."],[/cdbaby\./,/images\..*\.jpg/i,/\.jpg/gi,"_large.jpg"],[/cdbaby\./,/images\..*\.png/i,/\.png/gi,"_large.png"],[/itunes\.apple\./,/1\d0x1\d0-75\./i,/1\d0x1\d0-75\./gi,"1200x1200-75."],[/jamendo\./,/1\.\d00\.jpg/i,/1\.\d00\.jpg/gi,"1.0.jpg"],[/jamendo\./,/1\.\d00\.png/i,/1\.\d00\.png/gi,"1.0.png"],[/last(fm)?\.[a-z]{2,3}/,/\/serve\/\d{3}[^\/]*\//i,/\/serve\/\d{3}[^\/]*\//gi,"/serve/_/"],[/magnatune\./,/cover_\d{2,3}\./i,/cover_\d{2,3}\./gi,"cover."],[/musicbrainz\.org/,/_thumb\d{3}\./i,/_thumb\d{3}\./gi,"."],[/musicbrainz\.org/,/-\d{3}\.jpg/i,/-\d{3}\.jpg/gi,".jpg"],[/musicbrainz\.org/,/-\d{3}\.png/i,/-\d{3}\.png/gi,".png"],[/musicdiner\./,/1\d0x1\d0-75\./i,/1\d0x1\d0-75\./gi,"1200x1200-75."],[/soundcloud\./,/t\d\d0x\d\d0\./i,/t\d\d0x\d\d0\./gi,"original."],[/play\.google\.com/,/googleusercontent\.com.*\=w\d{3}/,/\=w\d{3}$/,"=w1200"]];var w=null,n=0,m=20,d=document;if(d.location.hostname.search(/soundcloud\./)>-1){spans=document.querySelectorAll("span[style*=background-image]");for(i=0;i";}}}o:for(var v=0;v-1){w=a[v];var l=d.getElementsByTagName("img");if(l)for(var i=0;i-1){l[i].style.border="1px #FB0 solid";if(l[i].naturalWidth)l[i].onmouseover=function(){this.title=""+this.naturalWidth+"x"+this.naturalHeight};aEv(l[i],"load",function(){if(this.style){this.style.borderColor="#F00";if(this.naturalWidth && this.naturalWidth>999)this.style.borderWidth="2px"}});aEv(l[i],"click",function(){if(this.src)location=this.src});l[i].src=l[i].src.replace(w[2],w[3]);n++;if(n==m)if(confirm(""+n+" images requested. Continue?"))m=m+20;else break o;}};};if(w==null)self.open("http://rockland.dk/BCA?v=2.01","BCA");void(0);

wOxxOmMod
§
Posted: 2014-11-21
Edited: 2014-11-26

Some of the special characters were mangled by the forum so please edit your post and place the original bookmarklet code between <code> </code> and delete the converted userscript code since it's not helpful anyway.

§
Posted: 2014-11-23

and don't forget to visit http://jsbeautifier.org/

wOxxOmMod
§
Posted: 2014-11-23

No, don't use jsbeautifier - it destroys this code, I already tried it.

§
Posted: 2014-11-24
Edited: 2014-11-24

jsbeautifier isn't guilty, the posted code is damaged.

forum's parser removed pieces of code following after `<` char

§
Posted: 2014-11-27

thanks for the reply here pastebin
http://pastebin.com/dJK3jry7 for correct code

§
Posted: 2014-11-29
i d like to convert it to a userscript for chrome /firefox to run automatically

MutationObserver is required in this case :(

Post reply

Sign in to post a reply.