Вход Регистрация
Файл: media/player/videojs/plugins/videojs-thumbnails-master/videojs.thumbnails.js
Строк: 198
<?php
(function() {
    var 
defaults = {
            
0: {
                
src'example-thumbnail.png'
            
}
        },
        
extend = function() {
            var 
argstargetiobjectproperty;
            
args = Array.prototype.slice.call(arguments);
            
target args.shift() || {};
            for (
i in args) {
                
object args[i];
                for (
property in object) {
                    if (
object.hasOwnProperty(property)) {
                        if (
typeof object[property] === 'object') {
                            
target[property] = extend(target[property], object[property]);
                        } else {
                            
target[property] = object[property];
                        }
                    }
                }
            }
            return 
target;
        },
        
getComputedStyle = function(elpseudo) {
            return function(
prop) {
                if (
window.getComputedStyle) {
                    return 
window.getComputedStyle(elpseudo)[prop];
                } else {
                    return 
el.currentStyle[prop];
                }
            };
        },
        
offsetParent = function(el) {
            if (
el.nodeName !== 'HTML' && getComputedStyle(el)('position') === 'static') {
                return 
offsetParent(el.offsetParent);
            }
            return 
el;
        },
        
getVisibleWidth = function(elwidth) {
            var 
clip;
            if (
width) {
                return 
parseFloat(width);
            }
            
clip getComputedStyle(el)('clip');
            if (
clip !== 'auto' && clip !== 'inherit') {
                
clip clip.split(/(?:(|))/)[1].split(/(?:,| )/);
                if (
clip.length === 4) {
                    return (
parseFloat(clip[1]) - parseFloat(clip[3]));
                }
            }
            return 
0;
        },
        
getScrollOffset = function() {
            if (
window.pageXOffset) {
                return {
                    
xwindow.pageXOffset,
                    
ywindow.pageYOffset
                
};
            }
            return {
                
xdocument.documentElement.scrollLeft,
                
ydocument.documentElement.scrollTop
            
};
        };
    
videojs.plugin('thumbnails', function(options) {
        var 
divsettingsimgplayerprogressControldurationmoveListenermoveCancel;
        
settings extend({}, defaultsoptions);
        
player this;
        (function() {
            var 
progressControladdFakeActiveremoveFakeActive;
            if (
navigator.userAgent.toLowerCase().indexOf("android") !== -1) {
                
progressControl player.controlBar.progressControl;
                
addFakeActive = function() {
                    
progressControl.addClass('fake-active');
                };
                
removeFakeActive = function() {
                    
progressControl.removeClass('fake-active');
                };
                
progressControl.on('touchstart'addFakeActive);
                
progressControl.on('touchend'removeFakeActive);
                
progressControl.on('touchcancel'removeFakeActive);
            }
        })();
        
div document.createElement('div');
        
div.className 'vjs-thumbnail-holder';
        
img document.createElement('img');
        
div.appendChild(img);
        
img.src settings['0'].src;
        
img.className 'vjs-thumbnail';
        
extend(img.stylesettings['0'].style);
        if (!
img.style.left && !img.style.right) {
            
img.onload = function() {
                
img.style.left = -(img.naturalWidth 2) + 'px';
            };
        }
        
duration player.duration();
        
player.on('durationchange', function(event) {
            
duration player.duration();
        });
        
player.on('loadedmetadata', function(event) {
            
duration player.duration();
        });
        
progressControl player.controlBar.progressControl;
        
progressControl.el().appendChild(div);
        
moveListener = function(event) {
            var 
mouseTimetimeactiveleftsettingpageXrightwidthhalfWidthpageXOffsetclientRect;
            
active 0;
            
pageXOffset getScrollOffset().x;
            
clientRect offsetParent(progressControl.el()).getBoundingClientRect();
            
right = (clientRect.width || clientRect.right) + pageXOffset;
            
pageX event.pageX;
            if (
event.changedTouches) {
                
pageX event.changedTouches[0].pageX;
            }
            
left pageX || (event.clientX document.body.scrollLeft document.documentElement.scrollLeft);
            
left -= offsetParent(progressControl.el()).getBoundingClientRect().left pageXOffset;
            var 
mouseTimeHMS = $(".vjs-mouse-display").attr("data-current-time").split(":");
            var 
mouseTime 0;
            for (var 
mouseTimeHMS.length 1>= 0i--) {
                
mouseTime += parseInt((== mouseTimeHMS.length 1) ? (mouseTimeHMS[i]) : ((== mouseTimeHMS.length 2) ? (mouseTimeHMS[i] * 60) : ((== mouseTimeHMS.length 3) ? (mouseTimeHMS[i] * 60 60) : (0))));
            }
            for (
time in settings) {
                if (
mouseTime time) {
                    
active Math.max(activetime);
                }
            }
            
setting settings[active];
            if (
setting.src && img.src != setting.src) {
                
img.src setting.src;
            }
            if (
setting.style && img.style != setting.style) {
                
extend(img.stylesetting.style);
            }
            
width getVisibleWidth(imgsetting.width || settings[0].width);
            
halfWidth width 2;
            if ((
left halfWidth) > right) {
                
left -= (left halfWidth) - right;
            } else if (
left halfWidth) {
                
left halfWidth;
            }
            
div.style.left left 'px';            
        };
        
progressControl.on('mousemove'moveListener);
        
progressControl.on('touchmove'moveListener);
        
moveCancel = function(event) {
            
div.style.left '-1000px';
        };
        
progressControl.on('mouseout'moveCancel);
        
progressControl.on('touchcancel'moveCancel);
        
progressControl.on('touchend'moveCancel);
        
player.on('userinactive'moveCancel);
    });
})();
?>
Онлайн: 0
Реклама