This commit is contained in:
mstfyldz
2026-02-16 18:56:01 +03:00
parent 192dfc2de8
commit bc423156cf
2975 changed files with 1171022 additions and 0 deletions

69
yaren/temp/js/Sswitch.js Normal file
View File

@@ -0,0 +1,69 @@
/*
* Author: Gopal Joshi
* Website: www.sgeek.org
*/
(function($) {
$.fn.Sswitch = function(element, options ) {
this.$element = $(this);
this.options = $.extend({}, $.fn.Sswitch.defaults, {
state: this.$element.is(":checked"),
disabled: this.$element.is(":disabled"),
readonly: this.$element.is("[readonly]"),
parentClass: this.$element.data("parent"),
onSwitchChange: element.onSwitchChange
},options);
this.$container = $("<div>", {
"class": (function(_this){
return function(){
var classes;
classes = [_this.options.parentClass];
classes.push(_this.options.state ? "" + _this.options.parentClass + "-on" : "" + _this.options.parentClass + "-off");
if (_this.options.disabled) {
classes.push("" + _this.options.parentClass + "-disabled");
}
if (_this.options.readonly) {
classes.push("" + _this.options.parentClass + "-readonly");
}
if (_this.$element.attr("id")) {
classes.push("" + _this.options.parentClass + "-id-" + (_this.$element.attr("id")));
}
return classes.join(" ");
};
})(this)()
});
this.$label = $("<span>", {
html: this.options.labelText,
"class": "" + this.options.parentClass + "-label"
});
this.$container = this.$element.wrap(this.$container).parent();
this.$element.before(this.$label);
return this.$container.on("click", (function(_this) {
return function(event) {
event.preventDefault();
event.stopPropagation();
if (_this.options.readonly || _this.options.disabled) {
return _this.target;
}
_this.options.state = !_this.options.state;
_this.$element.prop("checked", _this.options.state);
_this.$container.addClass(_this.options.state ? "" + _this.options.parentClass + "-on" : "" + _this.options.parentClass + "-off").removeClass(_this.options.state ? "" + _this.options.parentClass + "-off" : "" + _this.options.parentClass + "-on");
_this.options.onSwitchChange.call(_this);
return _this;
};
})(this));
return this.$element;
},
$.fn.Sswitch.defaults = {
text : 'Default Title',
fontsize : 10,
state: true,
disabled: false,
readonly: false,
parentClass: "s-switch",
onSwitchChange: function() {}
};
}(jQuery));

7
yaren/temp/js/bootstrap.bundle.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7
yaren/temp/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

698
yaren/temp/js/flowplayer.js Normal file
View File

@@ -0,0 +1,698 @@
'use strict';
var extend = require('extend-object'),
isFunction = require('is-function'),
bean = require('bean'),
slider = require('./ext/ui/slider'),
barSlider = require('./ext/ui/bar-slider'),
common = require('./common'),
events = require('./ext/events');
var instances = [],
extensions = [];
var oldHandler = window.onbeforeunload;
window.onbeforeunload = function(ev) {
instances.forEach(function(api) {
if (api.conf.splash) {
api.unload();
} else {
api.bind("error", function () {
common.find('.flowplayer.is-error .fp-message').forEach(common.removeNode);
});
}
});
if (oldHandler) return oldHandler(ev);
};
var isSafari = /Safari/.exec(navigator.userAgent) && !/Chrome/.exec(navigator.userAgent),
m = /(\d+\.\d+) Safari/.exec(navigator.userAgent),
safariVersion = m ? Number(m[1]) : 100;
/* flowplayer() */
var flowplayer = module.exports = function(fn, opts, callback) {
if (isFunction(fn)) return extensions.push(fn);
if (typeof fn == 'number' || typeof fn === 'undefined') return instances[fn || 0];
if (fn.nodeType) { // Is an element
if (fn.getAttribute('data-flowplayer-instance-id') !== null) { // Already flowplayer instance
return instances[fn.getAttribute('data-flowplayer-instance-id')];
}
if (!opts) return; // Can't initialize without data
return initializePlayer(fn, opts, callback);
}
if (fn.jquery) return flowplayer(fn[0], opts, callback);
if (typeof fn === 'string') {
var el = common.find(fn)[0];
return el && flowplayer(el, opts, callback);
}
};
extend(flowplayer, {
version: '@VERSION',
engines: [],
engine: function(name) {
return flowplayer.engines.filter(function(e) { return e.engineName === name; })[0];
},
extensions: [],
conf: {},
set: function(key, value) {
if (typeof key === 'string') flowplayer.conf[key] = value;
else extend(flowplayer.conf, key);
},
registerExtension: function(js, css) {
flowplayer.extensions.push([js, css]);
},
support: {},
defaults: {
debug: false,
// true = forced playback
disabled: false,
fullscreen: window == window.top,
// keyboard shortcuts
keyboard: true,
// default aspect ratio
ratio: 9 / 16,
adaptiveRatio: false,
rtmp: 0,
proxy: 'best',
hlsQualities: true,
seekStep: false,
splash: false,
live: false,
livePositionOffset: 120,
swf: "//@CDN/@VERSION/@CDN_PATHflowplayer.swf",
swfHls: "//@CDN/@VERSION/@CDN_PATHflowplayerhls.swf",
speeds: [0.25, 0.5, 1, 1.5, 2],
tooltip: true,
mouseoutTimeout: 5000,
mutedAutoplay: true,
clickToUnMute: true,
// initial volume level
volume: 1,
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#error-codes
errors: [
// video exceptions
'',
'Video loading aborted',
'Network error',
'Video not properly encoded',
'Video file not found',
// player exceptions
'Unsupported video',
'Skin not found',
'SWF file not found',
'Subtitles not found',
'Invalid RTMP URL',
'Unsupported video format. Try installing Adobe Flash.'
],
errorUrls: ['','','','','','','','','','',
'http://get.adobe.com/flashplayer/'
],
playlist: [],
hlsFix: isSafari && safariVersion < 8,
disableInline: false
},
// Expose utilities for plugins
bean: bean,
common: common,
slider: slider,
barSlider: barSlider,
extend: extend
});
// keep track of players
var playerCount = 0;
var URLResolver = require('./ext/resolve');
if (typeof window.jQuery !== 'undefined') {
var $ = window.jQuery;
// auto-install (any video tag with parent .flowplayer)
$(function() {
if (typeof $.fn.flowplayer == 'function') {
$('.flowplayer:has(video:not(.fp-engine),script[type="application/json"])').flowplayer();
}
});
// jQuery plugin
var videoTagConfig = function(videoTag) {
if (!videoTag.length) return {};
var clip = videoTag.data() || {}, conf = {};
$.each(['autoplay', 'loop', 'preload', 'poster'], function(i, key) {
var val = videoTag.attr(key);
if (val !== undefined && ['autoplay', 'poster'].indexOf(key) !== -1) conf[key] = val ? val : true;
else if (val !== undefined) clip[key] = val ? val : true;
});
videoTag[0].autoplay = videoTag[0].preload = false;
clip.subtitles = videoTag.find('track').map(function() {
var tr = $(this);
return {
src: tr.attr('src'),
kind: tr.attr('kind'),
label: tr.attr('label'),
srclang: tr.attr('srclang'),
'default': tr.prop('default')
};
}).get();
clip.sources = (new URLResolver()).sourcesFromVideoTag(videoTag, $);
return extend(conf, {clip: clip});
};
$.fn.flowplayer = function(opts, callback) {
return this.each(function() {
if (typeof opts == 'string') opts = { swf: opts };
if (isFunction(opts)) { callback = opts; opts = {}; }
var root = $(this),
scriptConf = root.find('script[type="application/json"]'),
confObject = scriptConf.length ? JSON.parse(scriptConf.text()) : videoTagConfig(root.find('video')),
conf = $.extend({}, opts || {}, confObject, root.data());
var api = initializePlayer(this, conf, callback);
events.EVENTS.forEach(function(evName) {
api.on(evName + '.jquery', function(ev) {
root.trigger.call(root, ev.type, ev.detail && ev.detail.args);
});
});
root.data('flowplayer', api);
});
};
}
function initializePlayer(element, opts, callback) {
if (opts && opts.embed) opts.embed = extend({}, flowplayer.defaults.embed, opts.embed);
var supportLocalStorage = false;
try {
if (typeof flowplayer.conf.storage === 'undefined' && typeof window.localStorage == "object") {
window.localStorage.flowplayerTestStorage = "test";
supportLocalStorage = true;
}
} catch (ignored) {}
var root = element,
conf = extend({}, flowplayer.defaults, flowplayer.conf, opts),
storage = {},
originalClass = root.className,
lastSeekPosition,
engine,
urlResolver = new URLResolver();
common.addClass(root, 'is-loading');
common.toggleClass(root, 'no-flex', !flowplayer.support.flex);
common.toggleClass(root, 'no-svg', !flowplayer.support.svg);
try {
storage = flowplayer.conf.storage || (supportLocalStorage ? window.localStorage : storage);
} catch(e) {}
conf.volume = storage.muted === "true" ? 0 : conf.volume !== flowplayer.defaults.volume ? conf.volume : !isNaN(storage.volume) ? storage.volume : conf.volume;
conf.debug = !!storage.flowplayerDebug || conf.debug;
if (conf.aspectRatio && typeof conf.aspectRatio === 'string') {
var parts = conf.aspectRatio.split(/[:\/]/);
conf.ratio = parts[1] / parts[0];
}
var isRTL = (root.currentStyle && root.currentStyle.direction === 'rtl') ||
(window.getComputedStyle && window.getComputedStyle(root, null) !== null && window.getComputedStyle(root, null).getPropertyValue('direction') === 'rtl');
if (isRTL) common.addClass(root, 'is-rtl');
/*** API ***/
var api = {
// properties
conf: conf,
currentSpeed: 1,
volumeLevel: conf.muted ? 0 : typeof conf.volume === "undefined" ? storage.volume * 1 : conf.volume,
video: {},
// states
disabled: false,
finished: false,
loading: false,
muted: storage.muted == "true" || conf.muted,
paused: false,
playing: false,
ready: false,
splash: false,
rtl: isRTL,
// methods
//
hijack: function(hijack) {
try {
api.engine.suspendEngine();
} catch (e) { /* */ }
api.hijacked = hijack;
},
release: function() {
try {
api.engine.resumeEngine();
} catch (e) { /* */ }
api.hijacked = false;
},
debug: function() {
if (!conf.debug) return;
console.log.apply(console, ['DEBUG'].concat([].slice.call(arguments)));
},
load: function(video, callback) {
if (api.error || api.loading) return;
api.video = {};
api.finished = false;
video = video || conf.clip;
// resolve URL
video = extend({}, urlResolver.resolve(video, conf.clip.sources));
if (api.playing || api.engine) video.autoplay = true;
var engineImpl = selectEngine(video);
if (!engineImpl) return setTimeout(function() { api.trigger("error", [api, { code: flowplayer.support.flashVideo ? 5 : 10 }]); }) && api;
if (!engineImpl.engineName) throw new Error('engineName property of factory should be exposed');
if (!api.engine || engineImpl.engineName !== api.engine.engineName) {
api.ready = false;
if (api.engine) {
api.engine.unload();
api.conf.autoplay = true;
}
engine = api.engine = engineImpl(api, root);
api.one('ready', function() {
setTimeout(function() {
if (api.muted) api.mute(true, true);
else engine.volume(api.volumeLevel);
});
});
}
extend(video, engine.pick(video.sources.filter(function(source) { // Filter out sources explicitly configured for some other engine
if (!source.engine) return true;
return source.engine === engine.engineName;
})));
if (video.src) {
var e = api.trigger('load', [api, video, engine], true);
if (!e.defaultPrevented) {
api.ready = false;
engine.load(video);
// callback
if (isFunction(video)) callback = video;
if (callback) api.one("ready", callback);
} else {
api.loading = false;
}
}
return api;
},
pause: function(fn) {
if (api.hijacked) return api.hijacked.pause(fn) | api;
if (api.ready && !api.seeking && !api.loading) {
engine.pause();
api.one("pause", fn);
}
return api;
},
resume: function() {
var ev = api.trigger('beforeresume', [api], true);
if (ev.defaultPrevented) return;
if (api.hijacked) return api.hijacked.resume() | api;
if (api.ready && api.paused) {
engine.resume();
// Firefox (+others?) does not fire "resume" after finish
if (api.finished) {
api.trigger("resume", [api]);
api.finished = false;
}
}
return api;
},
toggle: function() {
return api.ready ? api.paused ? api.resume() : api.pause() : api.load();
},
/*
seek(1.4) -> 1.4s time
seek(true) -> 10% forward
seek(false) -> 10% backward
*/
seek: function(time, callback) {
if (typeof time == "boolean") {
var delta = api.conf.seekStep || api.video.duration * 0.1;
time = api.video.time + (time ? delta : -delta);
time = Math.min(Math.max(time, 0), api.video.duration - 0.1);
}
if (typeof time === 'undefined') return api;
if (api.hijacked) return api.hijacked.seek(time, callback) | api;
if (api.ready) {
lastSeekPosition = time;
var ev = api.trigger('beforeseek', [api, time], true);
if (!ev.defaultPrevented) {
engine.seek(time);
if (isFunction(callback)) api.one("seek", callback);
} else {
api.seeking = false;
common.toggleClass(root, 'is-seeking', api.seeking); // remove loading indicator
}
}
return api;
},
/*
seekTo(1) -> 10%
seekTo(2) -> 20%
seekTo(3) -> 30%
...
seekTo() -> last position
*/
seekTo: function(position, fn) {
if (position === undefined) return api.seek(lastSeekPosition, fn);
if (api.video.seekOffset !== undefined) { // Live stream
return api.seek(api.video.seekOffset + (api.video.duration - api.video.seekOffset) * 0.1 * position, fn);
}
return api.seek(api.video.duration * 0.1 * position, fn);
},
mute: function(flag, skipStore) {
if (flag === undefined) flag = !api.muted;
api.muted = flag;
if (!skipStore) {
storage.muted = flag;
storage.volume = !isNaN(storage.volume) ? storage.volume : conf.volume; // make sure storage has volume
}
if (typeof engine.mute !== 'undefined') engine.mute(flag);
else {
api.volume(flag ? 0 : storage.volume, true);
api.trigger("mute", [api, flag]);
}
return api;
},
volume: function(level, skipStore) {
if (api.ready) {
level = Math.min(Math.max(level, 0), 1);
if (!skipStore) storage.volume = level;
engine.volume(level);
}
return api;
},
speed: function(val, callback) {
if (api.ready) {
// increase / decrease
if (typeof val == "boolean") {
val = conf.speeds[conf.speeds.indexOf(api.currentSpeed) + (val ? 1 : -1)] || api.currentSpeed;
}
engine.speed(val);
if (callback) root.one("speed", callback);
}
return api;
},
stop: function() {
if (api.ready) {
api.pause();
if (!api.live || api.dvr) {
api.seek(0, function() {
api.trigger("stop", [api]);
});
} else {
api.trigger("stop", [api]);
}
}
return api;
},
unload: function() {
if (conf.splash) {
api.trigger("unload", [api]);
if (engine) {
engine.unload();
api.engine = engine = 0;
}
} else {
api.stop();
}
return api;
},
shutdown: function() {
api.unload();
api.trigger('shutdown', [api]);
bean.off(root);
delete instances[root.getAttribute('data-flowplayer-instance-id')];
root.removeAttribute('data-flowplayer-instance-id');
},
disable: function(flag) {
if (flag === undefined) flag = !api.disabled;
if (flag != api.disabled) {
api.disabled = flag;
api.trigger("disable", flag);
}
return api;
},
registerExtension: function(jsUrls, cssUrls) {
jsUrls = jsUrls || [];
cssUrls = cssUrls || [];
if (typeof jsUrls === 'string') jsUrls = [jsUrls];
if (typeof cssUrls === 'string') cssUrls = [cssUrls];
jsUrls.forEach(function(url) { api.extensions.js.push(url); });
cssUrls.forEach(function(url) { api.extensions.css.push(url); });
}
};
api.conf = extend(api.conf, conf);
api.extensions = { js: [], css: [] };
flowplayer.extensions.forEach(function(i) {
api.registerExtension(i[0], i[1]);
});
/* event binding / unbinding */
events(api);
var selectEngine = function(clip) {
var engine;
var engines = flowplayer.engines;
if (conf.engine) {
var eng = engines.filter(function(e) { return e.engineName === conf.engine; })[0];
if (eng && clip.sources.some(function(source) {
if (source.engine && source.engine !== eng.engineName) return false;
return eng.canPlay(source.type, api.conf);
})) return eng;
}
if (conf.enginePreference) engines = flowplayer.engines.filter(function(one) { return conf.enginePreference.indexOf(one.engineName) > -1; }).sort(function(a, b) {
return conf.enginePreference.indexOf(a.engineName) - conf.enginePreference.indexOf(b.engineName);
});
clip.sources.some(function(source) {
var eng = engines.filter(function(engine) {
if (source.engine && source.engine !== engine.engineName) return false;
return engine.canPlay(source.type, api.conf);
}).shift();
if (eng) engine = eng;
return !!eng;
});
return engine;
};
/*** Behaviour ***/
if (!root.getAttribute('data-flowplayer-instance-id')) { // Only bind once
root.setAttribute('data-flowplayer-instance-id', playerCount++);
api.on('boot', function() {
var support = flowplayer.support;
// splash
if (conf.splash || common.hasClass(root, "is-splash") ||
!support.firstframe) {
api.forcedSplash = !conf.splash && !common.hasClass(root, "is-splash");
api.splash = true;
if (!conf.splash) conf.splash = true;
common.addClass(root, "is-splash");
}
if (conf.splash) common.find('video', root).forEach(common.removeNode);
if (conf.dvr || conf.live || common.hasClass(root, 'is-live')) {
api.live = conf.live = true;
api.dvr = conf.dvr = !!conf.dvr || common.hasClass(root, 'is-dvr');
common.addClass(root, 'is-live');
common.toggleClass(root, 'is-dvr', api.dvr);
}
// extensions
extensions.forEach(function(e) {
e(api, root);
});
// instances
instances.push(api);
// start
if (conf.splash) api.unload(); else api.load();
// disabled
if (conf.disabled) api.disable();
// initial callback
api.one("ready", callback);
api.one('shutdown', function() { root.className = originalClass; });
}).on("load", function(e, api, video) {
// unload others
if (conf.splash) {
common.find('.flowplayer.is-ready,.flowplayer.is-loading').forEach(function(el) {
var playerId = el.getAttribute('data-flowplayer-instance-id');
if (playerId === root.getAttribute('data-flowplayer-instance-id')) return;
var a = instances[Number(playerId)];
if (a && a.conf.splash) a.unload();
});
}
// loading
common.addClass(root, "is-loading");
api.loading = true;
if (typeof video.live !== 'undefined' || typeof video.dvr !== 'undefined') {
common.toggleClass(root, 'is-live', video.dvr || video.live);
common.toggleClass(root, 'is-dvr', !!video.dvr);
api.live = video.dvr || video.live;
api.dvr = !!video.dvr;
}
}).on("ready", function(e, api, video) {
video.time = 0;
api.video = video;
common.removeClass(root, "is-loading");
api.loading = false;
// saved state
if (api.muted) api.mute(true, true);
else api.volume(api.volumeLevel);
// see https://github.com/flowplayer/flowplayer/issues/479
var hlsFix = api.conf.hlsFix && /mpegurl/i.exec(video.type);
common.toggleClass(root, 'hls-fix', !!hlsFix);
}).on("unload", function() {
common.removeClass(root, "is-loading");
api.loading = false;
}).on("ready unload", function(e) {
var is_ready = e.type == "ready";
common.toggleClass(root, 'is-splash', !is_ready);
common.toggleClass(root, 'is-ready', is_ready);
api.ready = is_ready;
api.splash = !is_ready;
}).on("progress", function(e, api, time) {
api.video.time = time;
}).on('buffer', function(e, api, buffered) {
api.video.buffer = typeof buffered === 'number' ? buffered : buffered.length ? buffered[buffered.length - 1].end : 0;
}).on("speed", function(e, api, val) {
api.currentSpeed = val;
}).on("volume", function(e, api, level) {
api.volumeLevel = Math.round(level * 100) / 100;
if (api.muted && level) api.mute(false);
}).on("beforeseek seek", function(e) {
api.seeking = e.type == "beforeseek";
common.toggleClass(root, 'is-seeking', api.seeking);
}).on("ready pause resume unload finish stop", function(e) {
// PAUSED: pause / finish
api.paused = /pause|finish|unload|stop/.test(e.type);
api.paused = api.paused || e.type === 'ready' && !conf.autoplay && !api.playing;
// the opposite
api.playing = !api.paused;
// CSS classes
common.toggleClass(root, 'is-paused', api.paused);
common.toggleClass(root, 'is-playing', api.playing);
// sanity check
if (!api.load.ed) api.pause();
}).on("finish", function() {
api.finished = true;
}).on("error", function() {
});
}
// boot
api.trigger('boot', [api, root]);
return api;
}

21517
yaren/temp/js/hls.js Normal file

File diff suppressed because it is too large Load Diff

1
yaren/temp/js/hls.js.map Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,205 @@
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
//alert(jQuery.easing.default);
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
/*
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright © 2001 Robert Penner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

10
yaren/temp/js/jquery.typeahead.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

5318
yaren/temp/js/jwplayer.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
<script>
$(document).ready(function(){
$("#myTab a").click(function(e){
e.preventDefault();
$(this).tab('show');
});
});
$("#myTab a:first").tab('show'); // show first tab
function ssiptv_upload() {
var mac = $("#ss_mac").val();
var username = $("#ss_username").val();
var password = $("#ss_password").val();
var pin = $("#ss_pin").val();
$.ajax({
type: "POST",
url: "app/_playlist.php",
data: {'mac': mac, 'username': username, 'password': password, 'pin': pin, 'type': 1},
dataType : "json",
success: function (response) {
if (response == 1) {
$("#modal_body_text").html("<?= GUIDES_MESSAGE_1; ?>");
$("#alert_modal").modal("show");
} else if (response == 0) {
$("#modal_body_text").html("<?= GUIDES_MESSAGE_2; ?>");
$("#alert_modal").modal("show");
} else {
$("#modal_body_text").html("<?= GUIDES_MESSAGE_3; ?>");
$("#alert_modal").modal("show");
}
}
});
}
function royaliptv_upload() {
var mac = $("#ry_mac").val();
var username = $("#ry_username").val();
var password = $("#ry_password").val();
var url = $("#ry_url").val();
$.ajax({
type: "POST",
url: "app/_playlist.php",
data: {'mac': mac, 'username': username, 'password': password, 'type': 2},
dataType : "json",
success: function (response) {
if (response == 1) {
$("#modal_body_text").html("<?= GUIDES_MESSAGE_1; ?>");
$("#alert_modal").modal("show");
} else {
$("#modal_body_text").html("<?= GUIDES_MESSAGE_3; ?>");
$("#alert_modal").modal("show");
}
}
});
}
</script>

View File

View File

@@ -0,0 +1,123 @@
<script>
<? if ($byakman->guvenlik($_GET["id"]) != "") { ?>
var player = jwplayer("myElement");
player.setup({
"file": "<?= $siteInfo->site_xtream;?>live/<?= $byakman->userInfo('username'); ?>/<?= $byakman->userInfo('password'); ?>/<?= $byakman->guvenlik($_GET['id']); ?>.m3u8",
aspectratio: '16:9',
autostart: true,
width: '100%'
});
player.play();
<? } ?>
var bouquet_id = $("#live_cat").val();
function bouquet_get(a) {
var bouguet_cat = a;
$.ajax({
type: "POST",
url: "app/_livetv.php",
data: { "type": 1, "cat": bouguet_cat},
dataType: "json",
success: function (response) {
$(".mobile").empty();
$(".desktop").empty();
$.each(response, function(index, item) {
if (item.epg_title != null) {
$(".mobile").append('<li onclick="yayin_ac(this);" class="list-group-item" data-id="'+ item.stream_id +'">'+ index +' - <img style="margin-right:5px" src="'+ item.stream_icon +'" width="25" />' + item.name + '<span class="epg_info">'+item.epg_title+'</span></li>');
$(".desktop").append('<li onclick="yayin_ac(this);" class="list-group-item" data-id="'+ item.stream_id +'">'+ index +' - <img style="margin-right:5px" src="'+ item.stream_icon +'" width="25" />' + item.name + '<span class="epg_info">'+item.epg_title+'</span></li>');
} else {
$(".mobile").append('<li onclick="yayin_ac(this);" class="list-group-item" data-id="'+ item.stream_id +'"><div style="float:left">'+ index +' - <img style="margin-right:5px" src="'+ item.stream_icon +'" width="25" />' + item.name + '</div></li>');
$(".desktop").append('<li onclick="yayin_ac(this);" class="list-group-item" data-id="'+ item.stream_id +'">'+ index +' - <img style="margin-right:5px" src="'+ item.stream_icon +'" width="25" />' + item.name + '</li>');
}
});
<? if ($byakman->guvenlik($_GET["id"]) == "") { ?>
$('.list-group-item:first-child').click();
<? } ?>
}
});
}
bouquet_get(bouquet_id);
$("#live_cat").change(function (e) {
e.preventDefault();
$("#live_cat2").removeClass("active");
$("#live_cat2").val(this.value).addClass("active");
bouquet_get(this.value);
});
$("#live_cat2").change(function (e) {
e.preventDefault();
$("#live_cat").removeClass("active");
$("#live_cat").val(this.value).addClass("active");
bouquet_get(this.value);
});
function yayin_ac(d){
var id = d.getAttribute("data-id");
$(".list-group-item").removeClass("active");
$(d).addClass("active");
if (id !== '') {
if (!isNaN(id)) {
$('.loader').addClass('active');
$.ajax({
url: 'app/_livetv.php',
type: 'POST',
data: {channel: id, type: 2},
dataType: 'html',
success: function (result) {
var player = jwplayer("myElement");
player.setup({
"file": result,
aspectratio: '16:9',
autostart: true,
width: '100%'
});
player.play();
$.ajax({
type: "POST",
url: "app/_livetv.php",
data: {"channel": id, type: 3},
dataType: "json",
success: function (response) {
$("#epg_list").empty();
$("#epg_list").html('<ul class="list-group">');
$.each(response, function(index, item) {
if (item.description != "") {
var description_item = "<p>"+item.description+"</p>";
} else {
var description_item = "";
}
$("#epg_list").append('<li id="epg_data" class="list-group-item">'+ item.start +' - '+ item.end +' ' + item.title + ''+ description_item +'</li>');
});
$("#epg_list").append("</ul>");
}
});
$('.loader').removeClass('active');
}
});
}
}
}
function open_live_menu() {
document.getElementById("mySidenav").style.width = "250px";
$("#fixed_header").css("position", "fixed");
$("#fixed_header").css("display", "contents");
$("#live_box2").css("display", "flex");
}
function close_live_menu() {
document.getElementById("mySidenav").style.width = "0";
$("#fixed_header").css("display", "none");
$("#live_box2").css("display", "none");
}
</script>

View File

@@ -0,0 +1,65 @@
<script>
$(document).on('keypress',function(e) {
if(e.which == 13) {
$("#login_user").click();
}
});
<? if ($siteInfo->recaptcha == 1) { ?>
grecaptcha.ready(function () {
grecaptcha.execute('<?= $siteInfo->recaptcha_key; ?>', { action: 'contact' }).then(function (token) {
var recaptchaResponse = document.getElementById('recaptcha_response');
recaptchaResponse.value = token;
});
});
<? } ?>
$("#login").click(function() {
var username = $("#username").val();
var sifre = $("#sifre").val();
var mac = $("#mac").val();
var remember = $("#remember").val();
var captcha = $("#recaptchaResponse").val();
$.ajax({
type: "POST",
url: "app/_login.php",
data: {'username': username, 'password': sifre, 'mac': mac, 'captcha': captcha, 'remember': remember, 'type': "1"},
success: function (response) {
if (response == 1) {
$("#modal_body_text").text("<?= LOGIN_ALERT_3; ?>");
$("#alert_modal").modal("show");
setTimeout(function(){ window.location.href="index.php?page=homepage"; }, 3000);
} else if (response == 2) {
$("#modal_body_text").text("<?= LOGIN_ALERT_4; ?>");
$("#alert_modal").modal("show");
} else if (response == 3) {
$("#modal_body_text").text("<?= LOGIN_ALERT_5; ?>");
$("#alert_modal").modal("show");
} else if (response == 4) {
$("#modal_body_text").text("<?= LOGIN_ALERT_6; ?>");
$("#alert_modal").modal("show");
} else if (response == 5) {
$("#modal_body_text").text("<?= LOGIN_ALERT_8; ?>");
$("#alert_modal").modal("show");
}
}
});
});
var $myGroup = $('#myGroup');
$myGroup.on('show.bs.collapse','.collapse', function() {
$myGroup.find('.collapse.show').collapse('hide');
});
var macAddress = document.getElementById("mac");
function formatMAC(e) {
var r = /([a-f0-9]{2})([a-f0-9]{2})/i,
str = e.target.value.replace(/[^a-f0-9]/ig, "");
while (r.test(str)) {
str = str.replace(r, '$1' + ':' + '$2');
}
e.target.value = str.slice(0, 17);
};
macAddress.addEventListener("keyup", formatMAC, false);
</script>

View File

View File

View File

@@ -0,0 +1,17 @@
<script>
$(document).on('click', '.ep-list-min', function (e) {
$("#youtube_fragman").YTPPause();
e.preventDefault();
});
$("#alert_modal").on('hide.bs.modal', function () {
var player = videojs("my-video");
player.pause();
$("#youtube_fragman").YTPPlay();
});
$(function(){
$("#youtube_fragman").YTPlayer();
});
</script>

View File

View File

@@ -0,0 +1,80 @@
<script>
var i = 0;
$('#change_bouquet').click(function(e) {
var arr = [];
$('#bq:checked').each(function () {
arr[i++] = $(this).val();
});
$.ajax({
type: "POST",
url: "app/_bouqet.php",
data: {'bouqet': arr},
success: function (response) {
if (response == 1) {
$("#modal_info_body").text("<?= PROFILE_BOUQET_ALERT_1; ?>");
$("#info_modal").modal("show");
} else {
$("#modal_info_body").text("<?= PROFILE_BOUQET_ALERT_2; ?>");
$("#info_modal").modal("show");
}
}
});
});
<? if ($siteInfo->password_change == 1) { ?>
$("#change_pass").click(function() {
var password = $("#password_c1").val();
var password_c = $("#password_c2").val();
if (password != password_c) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_1; ?>");
$("#info_modal").modal("show");
} else if (password.length < 8) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_2; ?>");
$("#info_modal").modal("show");
} else if (!password.match(/([A-Z])/)) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_3; ?>");
$("#info_modal").modal("show");
} else if ((password.length - password.replace(/[A-Z]/g, '').length) < 3) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_3; ?>");
$("#info_modal").modal("show");
} else if (!password.match(/([0-9])/)) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_4; ?>");
$("#info_modal").modal("show");
} else if ((password.length - password.replace(/[0-9]/g, '').length) < 3) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_4; ?>");
$("#info_modal").modal("show");
} else {
$.ajax({
type: "POST",
url: "app/_passchange.php",
data: {'password': password, 'password_c': password_c},
success: function (response) {
if (response == 1) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_5; ?>");
$("#info_modal").modal("show");
$('#info_modal').on('hidden.bs.modal', function (e) {
window.location.href="index.php?page=logout";
});
} else if (response == 2) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_6; ?>");
$("#info_modal").modal("show");
} else if (response == 3) {
$("#modal_info_body").text("<?= PROFILE_PASS_ALERT_7; ?>");
$("#info_modal").modal("show");
}
}
});
}
});
<?
}
?>
</script>

View File

View File

View File

@@ -0,0 +1,59 @@
<script>
$(document).on('click', '.ep-list-min', function (e) {
var data = $(this).data('id');
var type = $(this).data('type');
var val = $('#series_view').data('src');
var surl = val + data + '.'+type;
var player = videojs("maat-player");
player.pause();
player.src({
src:surl,
type: 'video/mp4'
});
player.load();
player.play();
e.preventDefault();
});
$("#alert_modal").on('hide.bs.modal', function () {
var player = videojs("maat-player");
player.pause();
});
$('.slide-sliders-full').owlCarousel({
loop:false,
margin:15,
nav:true,
autoplay:false,
dots:false,
items:5,
navText:['<img src="temp/images/left.png" alt="icon" />','<img src="temp/images/right.png" alt="icon" />'],
responsive:{
0:{
items:2,
},
600:{
items:3,
},
1200:{
items:6,
},
1600:{
items:6,
}
}
});
$('.top-episode a').eq(0).addClass('active');
$(document).on('click', '.top-episode a', function (e) {
var indis = $(this).index();
$('.top-episode a').removeClass('active');
$(this).addClass('active');
$('.tab_episode').hide().eq(indis).fadeIn();
e.preventDefault();
});
</script>

26
yaren/temp/js/plugin.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

10
yaren/temp/js/related.js Normal file

File diff suppressed because one or more lines are too long

240
yaren/temp/js/scripts.js Normal file
View File

@@ -0,0 +1,240 @@
$(document).ready(function() {
"use strict";
PageScroll();
// Loading Box (Preloader)
function handlePreloader() {
if ($('.preloader').length > 0) {
$('.preloader').delay(200).fadeOut(500);
}
}
handlePreloader();
$('.symptom').owlCarousel({
loop:false,
margin:25,
nav:false,
autoplay:false,
dots:false,
items:3,
responsive:{
0:{
items:1,
},
600:{
items:2,
},
900:{
items:2,
},
1000:{
items:3,
}
}
})
$('.banner-slider').owlCarousel({
loop:true,
margin:15,
nav:false,
autoplay:true,
dots:true,
items:1
})
$('.feedback-slider').owlCarousel({
loop:true,
margin:15,
nav:false,
autoplay:true,
dots:true,
items:1
})
$('.slide-slider-full').owlCarousel({
loop:true,
margin:15,
nav:true,
autoplay:false,
dots:false,
items:5,
navText:['<img src="temp/images/left.png" alt="icon" />','<img src="temp/images/right.png" alt="icon" />'],
responsive:{
0:{
items:2,
},
600:{
items:3,
},
1200:{
items:6,
},
1600:{
items:6,
}
}
})
$('.category-slider').owlCarousel({
loop:true,
margin:10,
nav:false,
autoplay:false,
dots:false,
items:6,
responsive:{
0:{
items:2,
},
600:{
items:4,
},
1200:{
items:5,
},
1600:{
items:6,
}
}
})
$('.team-slider').owlCarousel({
loop:true,
margin:15,
nav:false,
autoplay:false,
dots:false,
items:7 ,
responsive:{
0:{
items:2,
},
600:{
items:5,
},
1200:{
items:6,
},
1600:{
items:7,
}
}
})
$('.team-slider-full').owlCarousel({
loop:false,
margin:15,
nav:false,
autoplay:false,
dots:false,
items:9 ,
responsive:{
0:{
items:2,
},
600:{
items:5,
},
1200:{
items:6,
},
1600:{
items:9,
}
}
})
$('.member-bttn2').on('click', function() {
$('.member-1').fadeOut(0);
$('.member-2').fadeIn();
$('.member-ul').find('li:nth-child(2)').addClass('active');
return false;
});
$('.member-bttn3').on('click', function() {
$('.member-2').fadeOut(0);
$('.member-3').fadeIn();
$('.member-ul').find('li:nth-child(3)').addClass('active');
return false;
});
$('.member-bttn4').on('click', function() {
$('.member-3').fadeOut(0);
$('.member-4').fadeIn();
return false;
});
$('.add-wishlist').on('click', function() {
$(this).attr('src','images/checkmark.png')
return false;
});
$('.btn-video').on('click', function() {
$('.backdrop').addClass('open');
$('.player-container').fadeIn();
return false;
});
$('.btn-lightbox-close').on('click', function() {
$('.backdrop').removeClass('open');
$('.player-container').fadeOut();
return false;
});
$('.switchcolor').on('click', function() {
$(this).addClass('active');
$('.backdrop').addClass('active');
$('.switchcolor-wrap').addClass('active');
});
$('.sheet-close,.backdrop').on('click', function() {
$('.switchcolor').removeClass('active');
$('.backdrop').removeClass('active');
$('.switchcolor-wrap').removeClass('active');
});
$('.toggle input').on('change', function () {
if (this.checked) {
$('body').addClass('theme-dark');
} else {
$('body').removeClass('theme-dark');
}
});
$('input[name="color-radio"]').on('change', function () {
if (this.checked) {
$('body').removeClass('color-theme-pink color-theme-blue color-theme-red color-theme-black color-theme-gray color-theme-orange color-theme-yellow color-theme-green color-theme-white color-theme-brown color-theme-darkgreen color-theme-deeppink color-theme-darkorchid');
$('body').addClass('color-theme-' + $(this).val());
}
});
});
function PageScroll() {
$(".scroll-tiger").on("click", function(e) {
var $anchor = $(this);
$("html, body").stop().animate({
scrollTop: $($anchor.attr("href")).offset().top - 0
}, 1500, 'easeInOutExpo');
$('.overlay-section').removeClass('active');
e.preventDefault();
});
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,139 @@
//ELEMENT SELECTORS
var player = document.querySelector('.player');
var video = document.querySelector('#video');
var playBtn = document.querySelector('.play-btn');
var volumeBtn = document.querySelector('.volume-btn');
var volumeSlider = document.querySelector('.volume-slider');
var volumeFill = document.querySelector('.volume-filled');
var progressSlider = document.querySelector('.progress');
var progressFill = document.querySelector('.progress-filled');
var textCurrent = document.querySelector('.time-current');
var textTotal = document.querySelector('.time-total');
var speedBtns = document.querySelectorAll('.speed-item');
var fullscreenBtn =document.querySelector('.fullscreen');
//GLOBAL VARS
let lastVolume = 1;
let isMouseDown = false;
//PLAYER FUNCTIONS
function togglePlay() {
if (video.paused) {
video.play();
} else {
video.pause();
}
playBtn.classList.toggle('paused');
}
function togglePlayBtn() {
playBtn.classList.toggle('playing');
}
function toggleMute() {
if(video.volume) {
lastVolume = video.volume;
video.volume = 0;
volumeBtn.classList.add('muted');
volumeFill.style.width = 0;
} else {
video.volume = lastVolume;
volumeBtn.classList.remove('muted');
volumeFill.style.width = `${lastVolume*100}%`;
}
}
function changeVolume(e) {
volumeBtn.classList.remove('muted');
let volume = e.offsetX/volumeSlider.offsetWidth;
volume<0.1 ? volume = 0 : volume=volume;
volumeFill.style.width = `${volume*100}%`;
video.volume = volume;
if (volume > 0.7) {
volumeBtn.classList.add('loud');
} else if (volume < 0.7 && volume > 0) {
volumeBtn.classList.remove('loud');
} else if (volume == 0) {
volumeBtn.classList.add('muted');
}
lastVolume = volume;
}
function neatTime(time) {
var hours = Math.floor((time % 86400)/3600);
var minutes = Math.floor((time % 3600)/60);
var seconds = Math.floor(time % 60);
seconds = seconds>9?seconds:`0${seconds}`;
return `${hours}:${minutes}:${seconds}`;
}
function updateProgress(e) {
progressFill.style.width = `${video.currentTime/video.duration*100}%`;
textCurrent.innerHTML = `${neatTime(video.currentTime)} / ${neatTime(video.duration)}`;
// textTotal.innerHTML = neatTime(video.duration);
// console.log(progressFill.style.width);
}
function setProgress(e) {
const newTime = e.offsetX/progressSlider.offsetWidth;
progressFill.style.width = `${newTime*100}%`;
video.currentTime = newTime*video.duration;
}
function launchIntoFullscreen(element) {
if(element.requestFullscreen) {
element.requestFullscreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
} else if(element.msRequestFullscreen) {
element.msRequestFullscreen();
}
}
function exitFullscreen() {
if(document.exitFullscreen) {
document.exitFullscreen();
} else if(document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if(document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
var fullscreen = false;
function toggleFullscreen() {
fullscreen? exitFullscreen() : launchIntoFullscreen(player)
fullscreen = !fullscreen;
}
function setSpeed(e) {
console.log(parseFloat(this.dataset.speed));
video.playbackRate = this.dataset.speed;
speedBtns.forEach(speedBtn => speedBtn.classList.remove('active'));
this.classList.add('active');
}
function handleKeypress(e) {
switch (e.key) {
case " ":
togglePlay();
case "ArrowRight":
video.currentTime += 5;
case "ArrowLeft":
video.currentTime -= 5;
default:
return;
}
}
//EVENT LISTENERS
playBtn.addEventListener('click', togglePlay);
video.addEventListener('click', togglePlay);
video.addEventListener('play', togglePlayBtn);
video.addEventListener('pause', togglePlayBtn);
video.addEventListener('ended', togglePlayBtn);
video.addEventListener('timeupdate', updateProgress);
video.addEventListener('canplay', updateProgress);
volumeBtn.addEventListener('click', toggleMute);
window.addEventListener('mousedown', () => isMouseDown = true)
window.addEventListener('mouseup', () => isMouseDown = false)
// volumeSlider.addEventListener('mouseover', changeVolume);
volumeSlider.addEventListener('click', changeVolume);
progressSlider.addEventListener('click', setProgress);
fullscreenBtn.addEventListener('click', toggleFullscreen);
speedBtns.forEach(speedBtn => {
speedBtn.addEventListener('click', setSpeed);
})
window.addEventListener('keydown', handleKeypress);