Skip to content

Instantly share code, notes, and snippets.

@JunaidQadirB
Created August 23, 2011 18:11
Show Gist options
  • Save JunaidQadirB/1166030 to your computer and use it in GitHub Desktop.
Save JunaidQadirB/1166030 to your computer and use it in GitHub Desktop.
This is a Bookmarklet which parses specific pages (those which are showing a list of linked audio files) for songs and adds to the MP# Player's (http://flash-mp3-player.net) playlist and displays the player on top of the page. * This is helpf
/*
* This is a Bookmarklet which parses specific pages (those which are showing a list of linked audio files) for songs and adds to the MP# Player's (http://flash-mp3-player.net) playlist and displays the player on top of the page.
* This is helpful suppose I want to download only the songs I like.
* @author Junaid Qadir Baloch ([email protected])
* @version 0.1 Tue Aug 23 15:04:14 PKT 2011
*
*/
javascript: (function (e, a, g, h, f, c, b, d) {
if (!(f = e.jQuery) || g > f.fn.jquery || h(f)) {
c = a.createElement("script");
c.type = "text/javascript";
c.id="jekeu_jquery";
c.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + g + "/jquery.min.js";
a.documentElement.childNodes[0].appendChild(c);
c.onload = c.onreadystatechange = function () {
if (!b && (!(d = this.readyState) || d == "loaded" || d == "complete")) {
h((f = e.jQuery).noConflict(1), b = 1);
f(c).remove();
}};
}
})(window, document, "1.3.2", function ($, L) {
var wlj = window.location.href.match("(http://|www\.)songs.pk");
if (!wlj) {
alert("This works with songs.pk album pages");
} else {
var h="",plUrls="",ht="", plTitles="";
$("tr%20td%20a").each(function () {
h=$(this).attr('href');
ht=$.trim($(this).text());
if(h.match("link[1-9]*\.songs.pk/(.*)\.php[?]songid")){
plUrls+=h+"|";
plTitles+=ht+"|";
}
});
plUrls=plUrls.substring(0,plUrls.length-1);
plUrls=plUrls.replace("undefined","");
plTitles=plTitles.substring(0,plTitles.length-1);
plTitles=plTitles.replace("undefined","");
var plr="<div id=\"player\" style=\"position:fixed; top:0px; left:'+playerPos+'; background: silver; margin:5px; padding:10px\"><div id=\"playerMenu\"><a href=\"javascript:(function(oPlayer){alert($(document).attr('title'));if(parseInt(oJQ(player).css('height'))>20){oJQ(oPlayer).css('height','20px');}else{oJQ(oPlayer).css('height','450px');}})('#player');\">-</a></div><object type=\"application/x-shockwave-flash\" data=\"http://flash-mp3-player.net/medias/player_mp3_multi.swf\" width=\"500\" height=\"250\"><param name=\"movie\" value=\"http://flash-mp3-player.net/medias/player_mp3_multi.swf\" /><param name=\"bgcolor\" value=\"#ffffff\" /><param name=\"FlashVars\" value=\"width=500&amp;height=250&mp3="+plUrls+"&title="+plTitles+"\" /></object></div>";
$('#player').empty();
$('#player').remove();
$('body').append(plr);
var playerPos=screen.width-(parseInt($('#player').css("width"))+50);
$('#player').css('left',playerPos+"px");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment