diff --git a/dist/clappr-context-menu-plugin.esm.js b/dist/clappr-context-menu-plugin.esm.js index fb2effa6..b4eee49b 100644 --- a/dist/clappr-context-menu-plugin.esm.js +++ b/dist/clappr-context-menu-plugin.esm.js @@ -1,6 +1,4 @@ - -(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.head.appendChild(r) })(window.document); -import { template, version, Events, Styler, UICorePlugin } from 'clappr'; +import { version, template, Events, Styler, UICorePlugin } from '@clappr/core'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { @@ -141,6 +139,13 @@ var ContextMenuPlugin = /*#__PURE__*/function (_UICorePlugin) { get: function get() { return 'context_menu'; } + }, { + key: "supportedVersion", + get: function get() { + return { + min: version + }; + } }, { key: "attributes", get: function get() { diff --git a/dist/clappr-context-menu-plugin.js b/dist/clappr-context-menu-plugin.js index 95eba70e..84376688 100644 --- a/dist/clappr-context-menu-plugin.js +++ b/dist/clappr-context-menu-plugin.js @@ -1,10 +1,8 @@ - -(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.head.appendChild(r) })(window.document); (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('clappr')) : - typeof define === 'function' && define.amd ? define(['clappr'], factory) : + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@clappr/core')) : + typeof define === 'function' && define.amd ? define(['@clappr/core'], factory) : (global = global || self, global.ContextMenuPlugin = factory(global.Clappr)); -}(this, (function (clappr) { 'use strict'; +}(this, (function (core) { 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { @@ -145,6 +143,13 @@ get: function get() { return 'context_menu'; } + }, { + key: "supportedVersion", + get: function get() { + return { + min: core.version + }; + } }, { key: "attributes", get: function get() { @@ -155,7 +160,7 @@ }, { key: "template", get: function get() { - return clappr.template(templateHtml); + return core.template(templateHtml); } }, { key: "defaultMenuItems", @@ -171,7 +176,7 @@ key: "playerVersion", get: function get() { return { - label: "Clappr Player v".concat(clappr.version), + label: "Clappr Player v".concat(core.version), name: 'playerVersion', noAction: true }; @@ -248,11 +253,11 @@ var coreEventListenerData = [{ object: this.core, - event: clappr.Events.CORE_ACTIVE_CONTAINER_CHANGED, + event: core.Events.CORE_ACTIVE_CONTAINER_CHANGED, callback: this.containerChanged }, { object: this.core, - event: clappr.Events.CORE_RESIZE, + event: core.Events.CORE_RESIZE, callback: this.registerPlayerResize }]; coreEventListenerData.forEach(function (item) { @@ -270,11 +275,11 @@ var containerEventListenerData = [{ object: this.container, - event: clappr.Events.CONTAINER_CONTEXTMENU, + event: core.Events.CONTAINER_CONTEXTMENU, callback: this.toggleContextMenu }, { object: this.container, - event: clappr.Events.CONTAINER_CLICK, + event: core.Events.CONTAINER_CLICK, callback: this.hide }]; if (this.container) containerEventListenerData.forEach(function (item) { @@ -445,7 +450,7 @@ this.$el.html(this.template({ options: this.menuOptions })); - this.$el.append(clappr.Styler.getStyleFor(css_248z)); + this.$el.append(core.Styler.getStyleFor(css_248z)); this.core.$el[0].append(this.$el[0]); this.cacheElements(); this.hide(); @@ -457,7 +462,7 @@ }]); return ContextMenuPlugin; - }(clappr.UICorePlugin); + }(core.UICorePlugin); return ContextMenuPlugin; diff --git a/dist/clappr-context-menu-plugin.min.js b/dist/clappr-context-menu-plugin.min.js index 7a234f2d..a15953ad 100644 --- a/dist/clappr-context-menu-plugin.min.js +++ b/dist/clappr-context-menu-plugin.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("clappr")):"function"==typeof define&&define.amd?define(["clappr"],e):(t=t||self).ContextMenuPlugin=e(t.Clappr)}(this,(function(t){"use strict";function e(t,e){for(var n=0;n\n <% if(options) { %>\n <% for (var i = 0; i < options.length; i++) { %>\n
  • <% if(options[i].noAction) { %> data-no-action <% } %>\n ><%=options[i].label%>
  • \n <% } %>\n <% } %>\n\n')}},{key:"defaultMenuItems",get:function(){return[this.copyURL,this.copyURLCurrentTime,this.loop,this.playerVersion]}},{key:"loopEnable",get:function(){return this.core.activePlayback&&this.core.activePlayback.el&&this.core.activePlayback.el.loop}},{key:"playerVersion",get:function(){return{label:"Clappr Player v".concat(t.version),name:"playerVersion",noAction:!0}}},{key:"copyURL",get:function(){return{label:"Copy URL",name:"copyURL"}}},{key:"copyURLCurrentTime",get:function(){return{label:"Copy URL on current time",name:"copyURLCurrentTime"}}},{key:"loop",get:function(){return{label:"Loop: ",name:"loop",class:this.core.options.loop?"on":"off"}}},{key:"events",get:function(){var t=this,e={"click [data-copyURL]":"onCopyURL","click [data-copyURLCurrentTime]":"onCopyURLCurrentTime","click [data-loop]":"onToggleLoop"};return this.extraOptions&&this.extraOptions.forEach((function(n){if("function"==typeof n.callback){var o="".concat(n.name,"Callback");t[o]=n.callback,e["click [data-".concat(n.name,"]")]=o}})),e}}]),n(r,[{key:"init",value:function(){this.extraOptions=this.options.contextMenu&&this.options.contextMenu.extraOptions||[],this.delegateEvents(this.events),this.bindEvents()}},{key:"bindEvents",value:function(){var e=this,n=[{object:this.core,event:t.Events.CORE_ACTIVE_CONTAINER_CHANGED,callback:this.containerChanged},{object:this.core,event:t.Events.CORE_RESIZE,callback:this.registerPlayerResize}];n.forEach((function(t){return e.stopListening(t.object,t.event,t.callback)})),n.forEach((function(t){return e.listenTo(t.object,t.event,t.callback)})),this.bindCustomEvents()}},{key:"bindContainerEvents",value:function(){var e=this,n=[{object:this.container,event:t.Events.CONTAINER_CONTEXTMENU,callback:this.toggleContextMenu},{object:this.container,event:t.Events.CONTAINER_CLICK,callback:this.hide}];this.container&&n.forEach((function(t){return e.listenTo(t.object,t.event,t.callback)}))}},{key:"bindCustomEvents",value:function(){$("body").off("click",this.hide.bind(this)),$("body").on("click",this.hide.bind(this))}},{key:"destroy",value:function(){$("body").off("click",this.hide.bind(this)),this.isRendered=!1,c(o(r.prototype),"destroy",this).call(this)}},{key:"registerPlayerResize",value:function(t){t.width&&"number"==typeof t.width&&(this.playerSize=t)}},{key:"containerChanged",value:function(){this.container&&this.stopListening(this.container),this.container=this.core.activeContainer,this.bindContainerEvents()}},{key:"toggleContextMenu",value:function(t){t.preventDefault(),this.show(t.offsetY,t.offsetX)}},{key:"show",value:function(t,e){!this.playerElement&&this.calculateContextMenuLimit();var n=t>this.maxHeight?this.maxHeight:t,o=e>this.maxWidth?this.maxWidth:e;this.hide(),this.$el.css({top:n,left:o}),this.$el.show()}},{key:"calculateContextMenuLimit",value:function(){this.maxWidth=this.playerSize&&this.playerSize.width-160,this.maxHeight=this.playerSize&&this.playerSize.height-200}},{key:"hide",value:function(){this.$el.hide()}},{key:"copyToClipboard",value:function(t,e){if(e){var n=$('