plyr.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/Plugin/plyr", ["exports", "jquery", "Plugin"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(exports, require("jquery"), require("Plugin"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(mod.exports, global.jQuery, global.Plugin);
  11. global.PluginPlyr = mod.exports;
  12. }
  13. })(this, function (_exports, _jquery, _Plugin2) {
  14. "use strict";
  15. Object.defineProperty(_exports, "__esModule", {
  16. value: true
  17. });
  18. _exports.default = void 0;
  19. _jquery = babelHelpers.interopRequireDefault(_jquery);
  20. _Plugin2 = babelHelpers.interopRequireDefault(_Plugin2);
  21. var NAME = 'plyr';
  22. (0, _jquery.default)(document).ready(function () {
  23. var a = new XMLHttpRequest();
  24. var d = document;
  25. var u = 'https://cdn.plyr.io/1.1.5/sprite.svg';
  26. var b = d.body; // Check for CORS support
  27. if ('withCredentials' in a) {
  28. a.open('GET', u, true);
  29. a.send();
  30. a.onload = function () {
  31. var c = d.createElement('div');
  32. c.style.display = 'none';
  33. c.innerHTML = a.responseText;
  34. b.insertBefore(c, b.childNodes[0]);
  35. };
  36. }
  37. });
  38. var Plyr =
  39. /*#__PURE__*/
  40. function (_Plugin) {
  41. babelHelpers.inherits(Plyr, _Plugin);
  42. function Plyr() {
  43. babelHelpers.classCallCheck(this, Plyr);
  44. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Plyr).apply(this, arguments));
  45. }
  46. babelHelpers.createClass(Plyr, [{
  47. key: "getName",
  48. value: function getName() {
  49. return NAME;
  50. }
  51. }, {
  52. key: "render",
  53. value: function render() {
  54. if (typeof plyr === 'undefined') {
  55. return;
  56. }
  57. plyr.setup(this.$el[0], this.options);
  58. }
  59. }], [{
  60. key: "getDefaults",
  61. value: function getDefaults() {
  62. return {};
  63. }
  64. }]);
  65. return Plyr;
  66. }(_Plugin2.default);
  67. _Plugin2.default.register(NAME, Plyr);
  68. var _default = Plyr;
  69. _exports.default = _default;
  70. });