diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/captions.js | 2 | ||||
-rw-r--r-- | src/js/controls.js | 2 | ||||
-rw-r--r-- | src/js/html5.js | 1 | ||||
-rw-r--r-- | src/js/listeners.js | 7 | ||||
-rw-r--r-- | src/js/plugins/ads.js | 1 | ||||
-rw-r--r-- | src/js/plugins/previewThumbnails.js | 4 | ||||
-rw-r--r-- | src/js/plugins/vimeo.js | 2 | ||||
-rw-r--r-- | src/js/plugins/youtube.js | 3 | ||||
-rw-r--r-- | src/js/plyr.js | 4 | ||||
-rw-r--r-- | src/js/plyr.polyfilled.js | 1 | ||||
-rw-r--r-- | src/js/utils/elements.js | 3 | ||||
-rw-r--r-- | src/js/utils/events.js | 1 | ||||
-rw-r--r-- | src/js/utils/loadSprite.js | 2 | ||||
-rw-r--r-- | src/js/utils/style.js | 1 | ||||
-rw-r--r-- | src/js/utils/time.js | 1 |
15 files changed, 2 insertions, 33 deletions
diff --git a/src/js/captions.js b/src/js/captions.js index b326d85e..a8bb4d77 100644 --- a/src/js/captions.js +++ b/src/js/captions.js @@ -85,7 +85,6 @@ const captions = { const browserLanguages = navigator.languages || [navigator.language || navigator.userLanguage || 'en']; const languages = dedupe(browserLanguages.map(language => language.split('-')[0])); - let language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase(); // Use first browser language when language is 'auto' @@ -166,7 +165,6 @@ const captions = { const { toggled } = this.captions; // Current state const activeClass = this.config.classNames.captions.active; - // Get the next state // If the method is called without parameter, toggle based on current value const active = is.nullOrUndefined(input) ? !toggled : input; diff --git a/src/js/controls.js b/src/js/controls.js index 9a960b38..d3e20a57 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -4,6 +4,7 @@ // ========================================================================== import RangeTouch from 'rangetouch'; + import captions from './captions'; import html5 from './html5'; import support from './support'; @@ -92,7 +93,6 @@ const controls = { const namespace = 'http://www.w3.org/2000/svg'; const iconUrl = controls.getIconUrl.call(this); const iconPath = `${!iconUrl.cors ? iconUrl.url : ''}#${this.config.iconPrefix}`; - // Create <svg> const icon = document.createElementNS(namespace, 'svg'); setAttributes( diff --git a/src/js/html5.js b/src/js/html5.js index 34f0c391..0d9a64ea 100644 --- a/src/js/html5.js +++ b/src/js/html5.js @@ -60,7 +60,6 @@ const html5 = { set(input) { // Get sources const sources = html5.getSources.call(player); - // Get first match for requested size const source = sources.find(source => Number(source.getAttribute('size')) === input); diff --git a/src/js/listeners.js b/src/js/listeners.js index d4d7bb32..ca527f1e 100644 --- a/src/js/listeners.js +++ b/src/js/listeners.js @@ -285,7 +285,6 @@ class Listeners { // Show, then hide after a timeout unless another control event occurs const show = ['touchstart', 'touchmove', 'mousemove'].includes(event.type); - let delay = 0; if (show) { @@ -351,7 +350,6 @@ class Listeners { } const isEnter = event.type === 'enterfullscreen'; - // Set the player size when entering fullscreen to viewport size const { padding, ratio } = setPlayerSize(isEnter); @@ -542,7 +540,6 @@ class Listeners { controls() { const { player } = this; const { elements } = player; - // IE doesn't support input event, so we fallback to change const inputEvent = browser.isIE ? 'change' : 'input'; @@ -678,7 +675,6 @@ class Listeners { // Was playing before? const play = seek.hasAttribute(attribute); - // Done seeking const done = ['mouseup', 'touchend', 'keyup'].includes(event.type); @@ -706,7 +702,6 @@ class Listeners { inputEvent, event => { const seek = event.currentTarget; - // If it exists, use seek-value instead of "value" for consistency with tooltip time (#954) let seekTo = seek.getAttribute('seek-value'); @@ -837,10 +832,8 @@ class Listeners { // Detect "natural" scroll - suppored on OS X Safari only // Other browsers on OS X will be inverted until support improves const inverted = event.webkitDirectionInvertedFromDevice; - // Get delta from event. Invert if `inverted` is true const [x, y] = [event.deltaX, -event.deltaY].map(value => (inverted ? -value : value)); - // Using the biggest delta, normalize to 1 or -1 (or 0 if no delta) const direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y); diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js index 2b083285..2acfaed9 100644 --- a/src/js/plugins/ads.js +++ b/src/js/plugins/ads.js @@ -303,7 +303,6 @@ class Ads { */ onAdEvent(event) { const { container } = this.player.elements; - // Retrieve the ad from the event. Some events (e.g. ALL_ADS_COMPLETED) // don't have ad object associated const ad = event.getAd(); diff --git a/src/js/plugins/previewThumbnails.js b/src/js/plugins/previewThumbnails.js index 3e4b17a3..f03abe69 100644 --- a/src/js/plugins/previewThumbnails.js +++ b/src/js/plugins/previewThumbnails.js @@ -121,7 +121,6 @@ class PreviewThumbnails { // If string, convert into single-element list const urls = is.string(src) ? [src] : src; - // Loop through each src URL. Download and process the VTT file, storing the resulting data in this.thumbnails const promises = urls.map(u => this.getThumbnail(u)); @@ -467,7 +466,6 @@ class PreviewThumbnails { const { urlPrefix } = this.thumbnails[0]; const thumbURL = urlPrefix + newThumbFilename; - const previewImage = new Image(); previewImage.src = thumbURL; previewImage.onload = () => { @@ -601,11 +599,9 @@ class PreviewThumbnails { const seekbarRect = this.player.elements.progress.getBoundingClientRect(); const plyrRect = this.player.elements.container.getBoundingClientRect(); const { container } = this.elements.thumb; - // Find the lowest and highest desired left-position, so we don't slide out the side of the video container const minVal = plyrRect.left - seekbarRect.left + 10; const maxVal = plyrRect.right - seekbarRect.left - container.clientWidth - 10; - // Set preview container position to: mousepos, minus seekbar.left, minus half of previewContainer.clientWidth let previewPos = this.mousePosX - seekbarRect.left - container.clientWidth / 2; diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js index 8d920eea..bef48708 100644 --- a/src/js/plugins/vimeo.js +++ b/src/js/plugins/vimeo.js @@ -91,7 +91,6 @@ const vimeo = { } const id = parseId(source); - // Build an iframe const iframe = createElement('iframe'); const src = format(player.config.urls.vimeo.iframe, id, params); @@ -102,7 +101,6 @@ const vimeo = { // Get poster, if already set const { poster } = player; - // Inject the package const wrapper = createElement('div', { poster, class: player.config.classNames.embedContainer }); wrapper.appendChild(iframe); diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js index 7abc05fe..a5b1dafd 100644 --- a/src/js/plugins/youtube.js +++ b/src/js/plugins/youtube.js @@ -107,7 +107,6 @@ const youtube = { // API ready ready() { const player = this; - // Ignore already setup (race condition) const currentId = player.media.getAttribute('id'); if (!is.empty(currentId) && currentId.startsWith('youtube-')) { @@ -125,10 +124,8 @@ const youtube = { // Replace the <iframe> with a <div> due to YouTube API issues const videoId = parseId(source); const id = generateId(player.provider); - // Get poster, if already set const { poster } = player; - // Replace media element const container = createElement('div', { id, poster }); player.media = replaceElement(container, player.media); diff --git a/src/js/plyr.js b/src/js/plyr.js index 7124c6ba..5ec5bf2e 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -151,7 +151,6 @@ class Plyr { // Set media type based on tag or data attribute // Supported: video, audio, vimeo, youtube const type = this.media.tagName.toLowerCase(); - // Embed properties let iframe = null; let url = null; @@ -514,7 +513,6 @@ class Plyr { get duration() { // Faux duration set via config const fauxDuration = parseFloat(this.config.duration); - // Media duration can be NaN or Infinity before the media has loaded const realDuration = (this.media || {}).duration; const duration = !is.number(realDuration) || realDuration === Infinity ? 0 : realDuration; @@ -1045,10 +1043,8 @@ class Plyr { if (this.supported.ui && !this.isAudio) { // Get state before change const isHidden = hasClass(this.elements.container, this.config.classNames.hideControls); - // Negate the argument if not undefined since adding the class to hides the controls const force = typeof toggle === 'undefined' ? undefined : !toggle; - // Apply and get updated state const hiding = toggleClass(this.elements.container, this.config.classNames.hideControls, force); diff --git a/src/js/plyr.polyfilled.js b/src/js/plyr.polyfilled.js index 95e14797..c87bbd8c 100644 --- a/src/js/plyr.polyfilled.js +++ b/src/js/plyr.polyfilled.js @@ -7,6 +7,7 @@ import 'custom-event-polyfill'; import 'url-polyfill'; + import Plyr from './plyr'; export default Plyr; diff --git a/src/js/utils/elements.js b/src/js/utils/elements.js index 9c1ddebc..94744771 100644 --- a/src/js/utils/elements.js +++ b/src/js/utils/elements.js @@ -17,7 +17,6 @@ export function wrap(elements, wrapper) { .reverse() .forEach((element, index) => { const child = index > 0 ? wrapper.cloneNode(true) : wrapper; - // Cache the current parent and sibling. const parent = element.parentNode; const sibling = element.nextSibling; @@ -145,12 +144,10 @@ export function getAttributesFromSelector(sel, existingAttributes) { const selector = s.trim(); const className = selector.replace('.', ''); const stripped = selector.replace(/[[\]]/g, ''); - // Get the parts and value const parts = stripped.split('='); const [key] = parts; const value = parts.length > 1 ? parts[1].replace(/["']/g, '') : ''; - // Get the first character const start = selector.charAt(0); diff --git a/src/js/utils/events.js b/src/js/utils/events.js index d304c312..87c35d26 100644 --- a/src/js/utils/events.js +++ b/src/js/utils/events.js @@ -35,7 +35,6 @@ export function toggleListener(element, event, callback, toggle = false, passive // Allow multiple events const events = event.split(' '); - // Build options // Default to just the capture boolean for browsers with no passive listener support let options = capture; diff --git a/src/js/utils/loadSprite.js b/src/js/utils/loadSprite.js index 917bd6ac..092f9986 100644 --- a/src/js/utils/loadSprite.js +++ b/src/js/utils/loadSprite.js @@ -15,7 +15,6 @@ export default function loadSprite(url, id) { const prefix = 'cache'; const hasId = is.string(id); let isCached = false; - const exists = () => document.getElementById(id) !== null; const update = (container, data) => { @@ -33,7 +32,6 @@ export default function loadSprite(url, id) { // Only load once if ID set if (!hasId || !exists()) { const useStorage = Storage.supported; - // Create container const container = document.createElement('div'); container.setAttribute('hidden', ''); diff --git a/src/js/utils/style.js b/src/js/utils/style.js index e51892e5..6f3069c9 100644 --- a/src/js/utils/style.js +++ b/src/js/utils/style.js @@ -64,7 +64,6 @@ export function setAspectRatio(input) { } const ratio = getAspectRatio.call(this, input); - const [w, h] = is.array(ratio) ? ratio : [0, 0]; const padding = (100 / w) * h; diff --git a/src/js/utils/time.js b/src/js/utils/time.js index 2deccf65..ffca88b2 100644 --- a/src/js/utils/time.js +++ b/src/js/utils/time.js @@ -18,7 +18,6 @@ export function formatTime(time = 0, displayHours = false, inverted = false) { // Format time component to add leading zero const format = value => `0${value}`.slice(-2); - // Breakdown to hours, mins, secs let hours = getHours(time); const mins = getMinutes(time); |