1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2016-05-05 00:18:35 -04:00
parent 0209b950a1
commit 25b5198fa7
2 changed files with 54 additions and 5 deletions

View file

@ -600,6 +600,24 @@
var xhr = new XMLHttpRequest();
xhr.open('GET', baseUrl + '/tvguide.template.html', true);
var supportsCaptureOption = false;
try {
var opts = Object.defineProperty({}, 'capture', {
get: function () {
supportsCaptureOption = true;
}
});
window.addEventListener("test", null, opts);
} catch (e) { }
function addEventListenerWithOptions(target, type, handler, options) {
var optionsOrCapture = options;
if (!supportsCaptureOption) {
optionsOrCapture = options.capture;
}
target.addEventListener(type, handler, optionsOrCapture);
}
xhr.onload = function (e) {
var template = this.response;
@ -610,13 +628,17 @@
var timeslotHeaders = context.querySelector('.timeslotHeaders');
programGrid.addEventListener('focus', onProgramGridFocus, true);
programGrid.addEventListener('scroll', function () {
addEventListenerWithOptions(programGrid, 'scroll', function () {
onProgramGridScroll(context, this, timeslotHeaders);
}, {
passive: true
});
timeslotHeaders.addEventListener('scroll', function () {
addEventListenerWithOptions(timeslotHeaders, 'scroll', function () {
onTimeslotHeadersScroll(context, this, programGrid);
}, {
passive: true
});
context.querySelector('.btnSelectDate').addEventListener('click', function () {

View file

@ -43,6 +43,24 @@ define(['visibleinviewport', 'imageFetcher'], function (visibleinviewport, image
}
}
var supportsCaptureOption = false;
try {
var opts = Object.defineProperty({}, 'capture', {
get: function () {
supportsCaptureOption = true;
}
});
window.addEventListener("test", null, opts);
} catch (e) { }
function addEventListenerWithOptions(target, type, handler, options) {
var optionsOrCapture = options;
if (!supportsCaptureOption) {
optionsOrCapture = options.capture;
}
target.addEventListener(type, handler, optionsOrCapture);
}
function unveilElements(images) {
if (!images.length) {
@ -103,10 +121,19 @@ define(['visibleinviewport', 'imageFetcher'], function (visibleinviewport, image
}, 1);
}
document.addEventListener('scroll', unveil, true);
addEventListenerWithOptions(document, 'scroll', unveil, {
capture: true,
passive: true
});
document.addEventListener('focus', unveil, true);
document.addEventListener(wheelEvent, unveil, true);
window.addEventListener('resize', unveil, true);
addEventListenerWithOptions(document, wheelEvent, unveil, {
capture: true,
passive: true
});
addEventListenerWithOptions(window, 'resize', unveil, {
capture: true,
passive: true
});
unveil();
}