1/** 2 * videojs-vjsdownload 3 * @version 1.0.4 4 * @copyright 2019 7Ds7 5 * @license Apache-2.0 6 */ 7(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.videojsVjsdownload = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 8(function (global){ 9'use strict'; 10 11Object.defineProperty(exports, '__esModule', { 12 value: true 13}); 14 15var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); 16 17var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; 18 19function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 20 21function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 22 23function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 24 25var _videoJs = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); 26 27var _videoJs2 = _interopRequireDefault(_videoJs); 28 29// Default options for the plugin. 30var defaults = { 31 beforeElement: 'fullscreenToggle', 32 textControl: 'Download video', 33 name: 'downloadButton', 34 downloadURL: null 35}; 36 37var vjsButton = _videoJs2['default'].getComponent('Button'); 38 39var DownloadButton = (function (_vjsButton) { 40 _inherits(DownloadButton, _vjsButton); 41 42 function DownloadButton() { 43 _classCallCheck(this, DownloadButton); 44 45 _get(Object.getPrototypeOf(DownloadButton.prototype), 'constructor', this).apply(this, arguments); 46 } 47 48 /** 49 * Function to invoke when the player is ready. 50 * 51 * This is a great place for your plugin to initialize itself. When this 52 * function is called, the player will have its DOM and child components 53 * in place. 54 * 55 * @function onPlayerReady 56 * @param {Player} player 57 * @param {Object} [options={}] 58 */ 59 60 _createClass(DownloadButton, [{ 61 key: 'buildCSSClass', 62 63 /** 64 * Allow sub components to stack CSS class names 65 * 66 * @return {String} The constructed class name 67 * @method buildCSSClass 68 */ 69 value: function buildCSSClass() { 70 return 'vjs-vjsdownload ' + _get(Object.getPrototypeOf(DownloadButton.prototype), 'buildCSSClass', this).call(this); 71 } 72 73 /** 74 * Handles click for full screen 75 * 76 * @method handleClick 77 */ 78 }, { 79 key: 'handleClick', 80 value: function handleClick() { 81 var p = this.player(); 82 83 window.open(this.options_.downloadURL || p.currentSrc(), 'Download'); 84 p.trigger('downloadvideo'); 85 } 86 }]); 87 88 return DownloadButton; 89})(vjsButton); 90 91var onPlayerReady = function onPlayerReady(player, options) { 92 var DButton = player.controlBar.addChild(new DownloadButton(player, options), {}); 93 94 DButton.controlText(player.localize(options.textControl)); 95 96 player.controlBar.el().insertBefore(DButton.el(), player.controlBar.getChild(options.beforeElement).el()); 97 98 player.addClass('vjs-vjsdownload'); 99}; 100 101/** 102 * A video.js plugin. 103 * 104 * In the plugin function, the value of `this` is a video.js `Player` 105 * instance. You cannot rely on the player being in a "ready" state here, 106 * depending on how the plugin is invoked. This may or may not be important 107 * to you; if not, remove the wait for "ready"! 108 * 109 * @function vjsdownload 110 * @param {Object} [options={}] 111 * An object of options left to the plugin author to define. 112 */ 113var vjsdownload = function vjsdownload(options) { 114 var _this = this; 115 116 this.ready(function () { 117 onPlayerReady(_this, _videoJs2['default'].mergeOptions(defaults, options)); 118 }); 119}; 120 121// Register the plugin with video.js. 122_videoJs2['default'].registerPlugin('vjsdownload', vjsdownload); 123 124exports['default'] = vjsdownload; 125module.exports = exports['default']; 126}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 127},{}]},{},[1])(1) 128});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.