Still WIP

This commit is contained in:
calzoneman 2014-11-11 19:48:08 -06:00
parent 2c45177cc0
commit 9f18a6978e
3 changed files with 31 additions and 15 deletions

View File

@ -148,8 +148,6 @@ var VimeoPlayer = function (data) {
if(USEROPTS.wmode_transparent)
iframe.attr("wmode", "transparent");
iframe.css("border", "none");
iframe.width(VWIDTH);
iframe.height(VHEIGHT);
$f(iframe[0]).addEvent("ready", function () {
self.player = $f(iframe[0]);
@ -438,14 +436,16 @@ var SoundcloudPlayer = function (data) {
waitUntilDefined(window, "SC", function () {
unfixSoundcloudShit();
var iframe = $("<iframe/>");
removeOld(iframe);
removeOld();
iframe.appendTo($("#ytapiplayer"));
iframe.attr("id", "ytapiplayer");
iframe.attr("id", "scplayer");
iframe.attr("src", "https://w.soundcloud.com/player/?url="+self.videoId);
iframe.css("width", "100%").attr("height", "166");
iframe.css("height", "166px");
iframe.css("border", "none");
var volslider = $("<div/>").attr("id", "sc_volume")
.css("top", "170px")
.insertAfter(iframe);
volslider.slider({
@ -457,7 +457,7 @@ var SoundcloudPlayer = function (data) {
}
});
self.player = SC.Widget("ytapiplayer");
self.player = SC.Widget("scplayer");
self.player.bind(SC.Widget.Events.READY, function () {
self.player.load(self.videoId, { auto_play: true });
@ -768,8 +768,7 @@ var UstreamPlayer = function (data) {
removeOld(iframe);
iframe.attr("width", VWIDTH);
iframe.attr("height", VHEIGHT);
var prto = location.protocol;
iframe.attr("src", prto+"//www.ustream.tv/embed/"+self.videoId+"?v=3&wmode=direct");
iframe.attr("src", "//www.ustream.tv/embed/"+self.videoId+"?v=3&wmode=direct");
iframe.attr("frameborder", "0");
iframe.attr("scrolling", "no");
iframe.css("border", "none");

View File

@ -761,16 +761,17 @@ applyOpts();
if (!record.addedNodes || record.addedNodes.length === 0) return;
var elem = record.addedNodes[0];
if (elem.id === "ytapiplayer") {
handleVideoResize();
$(elem).parent().resize(function () {
console.log('resized');
});
}
if (elem.id === "ytapiplayer") handleVideoResize();
});
});
mr.observe($("#videowrap").find(".embed-responsive")[0], { childList: true });
var mr2 = new MutationObserver(function (records) {
handleVideoResize();
});
mr2.observe(document.body, { attributes: true, attributeFilter: ["class"] });
} else {
/*
* DOMNodeInserted is deprecated. This code is here only as a fallback
@ -779,5 +780,11 @@ applyOpts();
$("#videowrap").find(".embed-responsive")[0].addEventListener("DOMNodeInserted", function (ev) {
if (ev.target.id === "ytapiplayer") handleVideoResize();
});
document.body.addEventListener("DOMAttrModified", function (ev) {
if (ev.target !== document.body || ev.attrName !== "class") return;
console.log(ev);
handleVideoResize();
});
}
})();

View File

@ -1530,6 +1530,8 @@ function compactLayout() {
$("#messagebuffer, #userlist").css("max-height", "");
$("body").removeClass("hd");
}
$("body").addClass("compact");
}
function fluidLayout() {
@ -1642,6 +1644,7 @@ function handleWindowResize() {
}
function handleVideoResize() {
console.trace();
var intv, ticks = 0;
var resize = function () {
if (++ticks > 10) clearInterval(intv);
@ -1649,15 +1652,22 @@ function handleVideoResize() {
clearInterval(intv);
var height = $("#ytapiplayer").height() - $("#chatline").outerHeight() - 2;
//console.log(height);
$("#messagebuffer").height(height);
$("#userlist").height(height);
//$("#ytapiplayer").attr("height", VHEIGHT = $("#ytapiplayer").height());
//$("#ytapiplayer").attr("width", VWIDTH = $("#ytapiplayer").width());
};
if ($("#ytapiplayer").height() > 0) resize();
var intv = setInterval(resize, 500);
else intv = setInterval(resize, 500);
}
$(window).resize(handleWindowResize);
//setInterval(function () { console.log($("#ytapiplayer").height()); }, 10);
handleWindowResize();
console.log('after');
function removeVideo() {
try {