forked from GithubBackups/vichan
hover video fixes
On index pages, restore original behavior (temp fix) On thread pages, fixed multiple file posts so all posts hover - still need to fix width for multiple posts as the ones on the right side of the page extend beyond the page (on original method they become tiny) - fix catalog long term i am thinking of just redoing the whole hover file (unless someone else does first).
This commit is contained in:
parent
1df89e2a87
commit
d2faa943b0
@ -131,14 +131,66 @@ function setupVideo(thumb, url) {
|
|||||||
expanded = false;
|
expanded = false;
|
||||||
hovering = true;
|
hovering = true;
|
||||||
|
|
||||||
var pageURL = window.location.href;
|
|
||||||
var jsonURL = pageURL.replace(/\.html$/, ".json");
|
|
||||||
var vidName = video.src.split('/').pop().split(".").shift();
|
var vidName = video.src.split('/').pop().split(".").shift();
|
||||||
|
var isMod = (window.location.pathname.split("/")[1]=="mod.php");
|
||||||
|
var thisBoard = isMod?window.location.href.split("/")[4]:window.location.pathname.split("/")[1];
|
||||||
|
var pageType = window.active_page;
|
||||||
|
var pageURL = isMod?window.location.href:window.location.pathname;
|
||||||
|
var jsonURL;
|
||||||
|
|
||||||
$.getJSON(jsonURL, function (result) {
|
var thisThread;
|
||||||
$.each(result.posts, function(){
|
var thisPost;
|
||||||
if (vidName==this.tim) {
|
|
||||||
|
|
||||||
|
if (pageType==="thread") {
|
||||||
|
jsonURL = pageURL.replace(/\.html$/, ".json");
|
||||||
|
} else
|
||||||
|
if (pageType==="index"){
|
||||||
|
var thisPage = isMod?window.location.href.split("/")[5].split(".")[0]:window.location.pathname.split("/")[2].split(".")[0];
|
||||||
|
if (thisPage=="index") { thisPage="0"; } else { thisPage-=1;}
|
||||||
|
jsonURL = pageURL.replace(/[a-z0-9]+.html$/, thisPage+".json");
|
||||||
|
}
|
||||||
|
|
||||||
|
$.getJSON(jsonURL, function (thread) {
|
||||||
|
$this = thread;
|
||||||
|
if(typeof thread.threads != "undefined" && thread.threads != null && thread.threads.length > 0){
|
||||||
|
console.log("index page");
|
||||||
|
var docRight = document.documentElement.getBoundingClientRect().right;
|
||||||
|
var thumbRight = thumb.querySelector("img, video").getBoundingClientRect().right;
|
||||||
|
var maxWidth = docRight - thumbRight - 20;
|
||||||
|
if (maxWidth < 250) maxWidth = 250;
|
||||||
|
video.style.position = "fixed";
|
||||||
|
video.style.right = "0px";
|
||||||
|
video.style.top = "0px";
|
||||||
|
var docRight = document.documentElement.getBoundingClientRect().right;
|
||||||
|
var thumbRight = thumb.querySelector("img, video").getBoundingClientRect().right;
|
||||||
|
video.style.maxWidth = maxWidth + "px";
|
||||||
|
video.style.maxHeight = "100%";
|
||||||
|
video.style.pointerEvents = "none";
|
||||||
|
|
||||||
|
video.style.display = "inline";
|
||||||
|
videoHide.style.display = "none";
|
||||||
|
videoContainer.style.display = "inline";
|
||||||
|
videoContainer.style.position = "fixed";
|
||||||
|
video.muted = (setting("videovolume") == 0);
|
||||||
|
video.volume = setting("videovolume");
|
||||||
|
video.controls = false;
|
||||||
|
video.play();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
$.each($this.posts, function(){
|
||||||
|
var tim = this.tim;
|
||||||
|
var fileNum = vidName.split('-').pop();
|
||||||
|
if(typeof this.extra_files != "undefined" && this.extra_files != null && this.extra_files.length > 0){
|
||||||
|
console.log("extra file exists");
|
||||||
|
$.each(this.extra_files, function() {
|
||||||
|
if (vidName==this.tim){
|
||||||
|
tim = this.tim;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log("tim = "+tim);
|
||||||
|
if (vidName==tim) {
|
||||||
var vidX = e.clientX;
|
var vidX = e.clientX;
|
||||||
var vidY = e.clientY;
|
var vidY = e.clientY;
|
||||||
var vidWidth = this.w;
|
var vidWidth = this.w;
|
||||||
@ -182,7 +234,7 @@ function setupVideo(thumb, url) {
|
|||||||
video.play();
|
video.play();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
}); } //else*/
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user