-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookmarklet.js
1 lines (1 loc) · 4.92 KB
/
bookmarklet.js
1
javascript:(function(){if(window.asdfzxvmasdfjkl!==true){var c='<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"><style>.sidebar{min-width:248px}#scw-buttons{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:moz-none;-ms-user-select:none;user-select:none;margin:0 0 18px}.scw-button{cursor:pointer;display:inline-block;white-space:nowrap;background:rgba(0,0,0,0.85);border:4px solid rgba(255,255,255,0.85);color:rgba(255,255,255,0.85);font-size:32px;transition:.25s all;border-radius:72px;vertical-align:middle;width:36px;height:36px;position:relative;top:6px;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:moz-none;-ms-user-select:none;user-select:none;margin:0 8px;padding:8px}.scw-button.large{font-size:48px;width:42px;height:42px;padding:14px}.scw-button.large > span{transition:none!important}.scw-button.large > span.icon-play{position:relative;top:-2px;left:4px}.scw-button.large > span.icon-pause{position:relative;top:-1px;left:1px;font-size:44px}.scw-button:not(.large) > span{position:relative;top:2px}.scw-button:hover{color:rgba(255,255,255,1);border:4px solid rgba(255,255,255,1);background:rgba(0,0,0,0.95)}#scw-volume{margin-top:24px;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:moz-none;-ms-user-select:none;user-select:none}#scw-volume-bar{width:100%;height:16px;border:1px solid rgba(0,0,0,0.5);background:rgba(0,0,0,0.3);border-radius:52px}#scw-volume-bar-active{background-color:#ffa332;float:left;width:96%;height:16px;border-radius:52px;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:moz-none;-ms-user-select:none;user-select:none}#scw-volume-bar-handle{float:right;position:relative;top:-5px;right:-13px;height:24px;width:24px;border:1px solid rgba(0,0,0,0.7);background:rgba(100,100,100,1);border-radius:52px;cursor:pointer;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:moz-none;-ms-user-select:none;user-select:none}#sc-widget,#sc-widget div{-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:moz-none;-ms-user-select:none;user-select:none}</style>',a=$(".header h2").text(),b=$(".header h2 span").text(),d;if(document.location.href.indexOf("artist.php")>0){d=a}else{if(document.location.href.indexOf("torrents.php")>0){d=b}}$.getJSON("http://api.soundcloud.com/tracks.json?q="+encodeURIComponent(d)+"&client_id=7568f7d549cbd2cfd5e33fc5d827afe7",function(e){if(e!==null&&e.length>0){$.getScript("https://w.soundcloud.com/player/api.js").done(function(){var m=$('<iframe id="sc-widget" src="https://w.soundcloud.com/player/?url='+encodeURIComponent(e[0].uri)+'" width="240" height="104" scrolling="no" frameborder="no" style="position:relative;left:5px;margin-bottom:12px;user-select:none;"></iframe>'),l=$('<div id="scw-buttons" align="center"></div>'),i=$('<div id="scw-volume" align="center"><div id="scw-volume-bar"><div id="scw-volume-bar-active"><div id="scw-volume-bar-handle" data-volume="50"></div></div></div></div>'),f=$('<div id="scw-play" class="scw-button large"><span class="icon-play"></span></div>'),j=$('<div id="scw-next" class="scw-button"><span class="icon-step-forward"></span></div>'),g=$('<div id="scw-prev" class="scw-button"><span class="icon-step-backward"></span></div>');m.insertBefore(".sidebar > .box:first-of-type"),l.append(g).append(f).append(j).append(i),$(c).appendTo("head");l.insertBefore("#sc-widget");var h=SC.Widget("sc-widget"),k=0,i=100,n=96;h.bind(SC.Widget.Events.READY,function(){h.bind(SC.Widget.Events.FINISH,function(){++k,h.load(e[k].uri);if(typeof e[k]===undefined){--k}});$("#scw-play").on("click",function(){if($(this).hasClass("pause")){h.pause();$(this).removeClass("pause").find("span").removeClass("icon-pause").addClass("icon-play")}else{h.play();$(this).addClass("pause").find("span").removeClass("icon-play").addClass("icon-pause")}});$("#scw-next").on("click",function(){++k,h.load(e[k].uri,{callback:function(){h.play(),$("#scw-play").addClass("pause").find("span").removeClass("icon-play").addClass("icon-pause")}});if(typeof e[k]===undefined){--k}});$("#scw-prev").on("click",function(){--k,h.load(e[k].uri,{callback:function(){h.play(),$("#scw-play").addClass("pause").find("span").removeClass("icon-play").addClass("icon-pause")}});if(typeof e[k]===undefined){++k}});$("#scw-volume-bar-handle").mousedown(function(u){var t=this,p=$(t).parents("#scw-volume-bar"),s=$(t).parents("#scw-volume-bar-active"),r=p.outerWidth(),o=p.offset().left,q=p.offset().left+r;$(window).bind("mouseup",function(){$(window).unbind("mousemove")});$(window).mousemove(function(w){var v=w.pageX;if(v>=o&&v<=q){i=((v-o)/r)*100;percent=(i<4)?4:(i>96?96:i);s.css("width",percent+"%");h.setVolume(i)}})});$("#scw-volume-bar").click(function(v){var u=v.pageX,q=$(this),t=$(this).children("#scw-volume-bar-active"),s=q.outerWidth(),o=q.offset().left,r=q.offset().left+s;if(u>=o&&u<=r){i=((u-o)/s)*100;percent=(i<4)?4:(i>96?96:i);t.css("width",percent+"%");h.setVolume(i)}})})})}});window.asdfzxvmasdfjkl=true}})(window);