Anonymous Anonymous - 1 month ago
181 0

No description

ActionScript

Popup-2

$(".qbtn-delete").after('<button class="btn btn-xs btn-default btn-frame"><span class="glyphicon glyphicon-flag"></span> Фрейм</button>');
$(".btn-frame").click(function(){var classes = ($(this).parents("li.queue_entry").attr("class").split(' '));var uid = getuid(classes); newframe(uid);});



function getuid(classes) {
var pluid = classes.splice(1);
console.log(pluid);
var uid = pluid.toString();
uid = uid.substr(6);
console.log(uid);
return uid;
}

//Popup
function popupCenter(url, title, w, h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 



function newframe (uid){
socket.on("playlist", function(data){
console.log(data[uid].media.type);

switch(data[uid].media.type)
{
case 'yt'	:   var src = "http://youtube.com/watch?v=" + data[uid].media.id; 
				break;
case 'us'	:   var src = "http://ustream.tv/embed/"+data[uid].media.id+"?v=3&wmode=direct&autoplay=1"; 
				break;
case 'fi'	:	var src = data[uid].media.id; 
				break;
case 'cu'	:	var src = data[uid].media.meta.embed.src; 
				break;
case 'tw'	:	var src = "http://twitch.tv/" + data[uid].media.id; 
				break;
default		:	break;
}
if (src)
{
popupCenter(src,"Frame",640,320);
}
else alert("Это пока не поддерживается");
});
socket.emit("requestPlaylist");
}