{"version":3,"sources":["https:\/\/elearning.unipd.it\/cur\/local\/annoto\/amd\/src\/annoto.js"],"names":["define","$","log","notification","Ajax","VimeoPlayer","videoJsPlayer","window","moodleAnnoto","sessionStorage","getItem","console","err","init","courseid","modid","document","find","get","info","call","methodname","args","done","response","result","warn","params","JSON","parse","hasAnnotoTag","tilesInit","icontent","setupKaltura","setupWistiaIframeEmbed","checkVimeoTime","ready","bootstrap","bind","fail","exception","maKApp","kApp","setupKalturaKdpMap","kdpMap","length","findPlayer","container","parent","body","h5p","first","youtube","vimeo","videojs","jwplayer","wistia","html5","playerElement","playerType","youtubeSrc","src","search","id","Math","random","toString","substr","playerId","element","bootsrapDone","findMultiplePlayers","annotoPlayer","require","bootstrapUrl","bootWidget","prepareConfig","config","widgets","player","type","timeline","overlay","indexOf","backend","domain","deploymentDomain","demoMode","clientId","hooks","mediaDetails","details","title","mediaTitle","description","mediaDescription","outcomes","isExpected","ssoAuthRequestHandle","location","replace","loginUrl","group","mediaGroupId","mediaGroupTitle","mediaGroupDescription","locale","Annoto","on","annotoReady","requirejs","self","vjs","boot","api","annotoAPI","jwt","userToken","auth","catch","error","checkWidgetVisibility","authKalturaPlayer","kdpMapKey","hasOwnProperty","setupKalturaKdp","kdp","setupDone","doneCb","kBind","setupKalturaPlugin","getPageUrl","href","enrichMediaDetails","mediaParams","retVal","courseFormat","M","tabtopics","format_grid","format_topcoll","snapTheme","reloadAnnoto","mutationList","mutationTarget","filter","m","target","classList","contains","destroy","then","offsetParent","load","observerNodeTargets","querySelectorAll","Object","values","grid","topcoll","tabs","snap","modtab","join","observerConfig","attributes","childList","subtree","observer","MutationObserver","forEach","observe","wistiaplayers","desiredParam","name","value","iframe","iframeSrc","URL","targetParam","searchParams","host","match","setupWistiaIframeEmbedPlugin","AnnotoIframeApi","annoto","Client","onSetup","next","onReady","token","isVimeoTime","getElementById","setupRetry","isReady","vimeoPlayer","querySelector","setTimeout","attributeName","isloaded","tiles","wrapper","idIcontentPages","addEventListener","event","matches","vimeos","allPlayers","multiplePlayers","activePlayerId","validatePlayerId","reloadAnnotoWidget","players","playerJs","entries"],"mappings":"k7EAuBAA,OAAM,uBAAC,CACL,QADK,CAEL,UAFK,CAGL,mBAHK,CAIL,WAJK,CAKL,wCALK,CAML,4CANK,CAAD,CAOH,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA\/B,CAAqCC,CAArC,CAAkDC,CAAlD,CAAiE,CAEhEC,MAAM,CAACC,YAAP,CAAsBD,MAAM,CAACC,YAAP,EAAuB,EAA7C,CAEA,GAAI,CACA,GAAID,MAAM,CAACE,cAAP,CAAsBC,OAAtB,CAA8B,mBAA9B,CAAJ,CAAwD,CACpDR,CAAG,CAAGS,OACT,CACJ,CAAC,MAAOC,CAAP,CAAY,CAAE,CAEhB,MAAO,CACHC,IAAI,CAAE,cAASC,CAAT,CAAmBC,CAAnB,CAA0B,CAG5B,GAAId,CAAC,CAACe,QAAD,CAAD,CAAYC,IAAZ,CAAiB,wBAAjB,EAA2CC,GAA3C,CAA+C,CAA\/C,CAAJ,CAAsD,CAClD,MACH,CAEDhB,CAAG,CAACiB,IAAJ,CAAS,2BAAT,EACAf,CAAI,CAACgB,IAAL,CAAU,CAAC,CACPC,UAAU,CAAE,cADL,CAEPC,IAAI,CAAE,CACFR,QAAQ,CAAEA,CADR,CAEFC,KAAK,CAAEA,CAFL,CAFC,CAMPQ,IAAI,CAAE,SAASC,CAAT,CAAmB,CACrB,GAAI,CAACA,CAAQ,CAACC,MAAd,CAAsB,CAClBvB,CAAG,CAACwB,IAAJ,CAAS,6CAAT,EACA,MACH,CACD,KAAKC,MAAL,CAAcC,IAAI,CAACC,KAAL,CAAWL,CAAQ,CAACG,MAApB,CAAd,CAGA,GAAI,KAAKG,YAAL,EAAJ,CAAyB,CACrB5B,CAAG,CAACiB,IAAJ,CAAS,uEAAT,EACA,MACH,CAED,KAAKY,SAAL,GACA,KAAKC,QAAL,GACA,KAAKC,YAAL,GACA,KAA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C4D,CAAM,CAAChB,EAA9C,GAEAoJ,CAAkB,CAACpI,CAAD,CAASpB,CAAT,CACrB,CARD,EASA,MACJ,IAAK,SAAL,CACI,GAAI0J,CAAAA,CAAQ,CAAG\/M,CAAa,CAACyE,CAAD,CAA5B,CACAsI,CAAQ,CAACtI,MAAT,GAAkB6B,EAAlB,CAAqB,MAArB,CAA6B,UAAW,CACpC,GAAI7B,CAAM,CAAChB,EAAP,GAAckJ,CAAlB,CAAkC,CAC9B,MACH,CACDA,CAAc,CAAGlI,CAAM,CAAChB,EAAxB,CACA7D,CAAG,CAACiB,IAAJ,sCAAuC4D,CAAM,CAAChB,EAA9C,GAEAoJ,CAAkB,CAACpI,CAAD,CAASpB,CAAT,CACrB,CARD,EASA,MAxBR,CA0BH,CA9BD,CADJ,QAAoCiG,MAAM,CAAC0D,OAAP,CAAeP,CAAf,CAApC,gBAAgE,IAgC\/D,CAED,MAAOC,CAAAA,CACV,CAlnBE,CAqnBV,CAtoBK,CAAN","sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/\n\/\/\n\/\/ Moodle is free software: you can redistribute it and\/or modify\n\/\/ it under the terms of the GNU General Public License as published by\n\/\/ the Free Software Foundation, either version 3 of the License, or\n\/\/ (at your option) any later version.\n\/\/\n\/\/ Moodle is distributed in the hope that it will be useful,\n\/\/ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\/\/ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\/\/ GNU General Public License for more details.\n\/\/\n\/\/ You should have received a copy of the GNU General Public License\n\/\/ along with Moodle. If not, see .\n\n\/**\n * javscript for component 'local_annoto'.\n *\n * @package\n * @copyright Annoto Ltd.\n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\ndefine([\n 'jquery',\n 'core\/log',\n 'core\/notification',\n 'core\/ajax',\n 'https:\/\/player.vimeo.com\/api\/player.js',\n 'https:\/\/vjs.zencdn.net\/7.20.1\/video.min.js',\n], function($, log, notification, Ajax, VimeoPlayer, videoJsPlayer) {\n\n window.moodleAnnoto = window.moodleAnnoto || {};\n\n try {\n if (window.sessionStorage.getItem('moodleAnnotoDebug')) {\n log = console;\n }\n } catch (err) {}\n\n return {\n init: function(courseid, modid) {\n\n \/\/ if page is 'edit settings' then return\n if ($(document).find('body#page-mod-page-mod').get(0)){\n return;\n }\n\n log.info('AnnotoMoodle: plugin init');\n Ajax.call([{\n methodname: 'get_jsparams',\n args: {\n courseid: courseid,\n modid: modid\n },\n done: function(response) {\n if (!response.result) {\n log.warn('AnnotoMoodle: action not permitted for user');\n return;\n }\n this.params = JSON.parse(response.params);\n\n \/\/ Return if has tag.\n if (this.hasAnnotoTag()) {\n log.info('AnnotoMoodle: plugin is disabled for this page using the Atto plugin.');\n return;\n }\n\n this.tilesInit();\n this.icontent();\n this.setupKaltura();\n this.setupWistiaIframeEmbed();\n this.checkVimeoTime();\n $(document).ready(this.bootstrap.bind(this));\n\n }.bind(this),\n fail: notification.exception\n }]);\n\n },\n setupKaltura: function() {\n const maKApp = window.moodleAnnoto.kApp;\n window.moodleAnnoto.setupKalturaKdpMap = this.setupKalturaKdpMap.bind(this);\n\n if (maKApp) {\n log.info('AnnotoMoodle: Kaltura loaded on init');\n this.setupKalturaKdpMap(maKApp.kdpMap);\n } else {\n log.info('AnnotoMoodle: Kaltura not loaded on init');\n }\n },\n hasAnnotoTag: function() {\n return ($('annoto').length > 0 && $('annotodisable').length === 0);\n },\n findPlayer: function(container) {\n log.info('AnnotoMoodle: detecting player');\n const parent = container || document.body,\n h5p = $(parent).find('iframe.h5p-iframe').first().get(0),\n youtube = $(parent).find('iframe[src*=\"youtube.com\"]').first().get(0),\n vimeo = $(parent).find('iframe[src*=\"vimeo.com\"]').first().get(0),\n videojs = $(parent).find('.video-js').first().get(0),\n jwplayer = $(parent).find('.jwplayer').first().get(0),\n wistia = $(parent).find('.wistia_embed').first().get(0),\n html5 = $(parent).find('video').first().get(0);\n let playerElement = null;\n\n if (videojs) {\n playerElement = videojs;\n this.params.playerType = 'videojs';\n } else if (jwplayer) {\n playerElement = jwplayer;\n this.params.playerType = 'jw';\n } else if (h5p) {\n playerElement = h5p;\n this.params.playerType = 'h5p';\n } else if (youtube) {\n const youtubeSrc = youtube.src;\n if (youtubeSrc.search(\/enablejsapi\/i) === -1) {\n youtube.src = (youtubeSrc.search(\/[?]\/) === -1) ? youtubeSrc + '?enablejsapi=1' : youtubeSrc + '&enablejsapi=1';\n }\n playerElement = youtube;\n this.params.playerType = 'youtube';\n } else if (vimeo) {\n playerElement = vimeo;\n this.params.playerType = 'vimeo';\n } else if (wistia) {\n playerElement = wistia;\n this.params.playerType = 'wistia';\n } else if (html5) {\n playerElement = html5;\n this.params.playerType = 'html5';\n } else {\n log.info('AnnotoMoodle: no player was founded');\n return;\n }\n if (!playerElement.id || playerElement.id === '') {\n playerElement.id = 'annoto_player_id_' + Math.random().toString(36).substr(2, 6);\n }\n this.params.playerId = `#${playerElement.id}`;\n this.params.element = playerElement;\n\n return playerElement;\n },\n bootstrap: function() {\n if (this.bootsrapDone) {\n return;\n }\n \/\/ Check if we have multiple players\n this.findMultiplePlayers();\n let annotoPlayer = this.findPlayer.call(this);\n if (annotoPlayer) {\n this.bootsrapDone = true;\n require([this.params.bootstrapUrl], this.bootWidget.bind(this));\n log.info(`AnnotoMoodle: detected ${this.params.playerType} : ${this.params.playerId}`);\n }\n },\n prepareConfig: function() {\n const config = this.config,\n params = this.params,\n nonOverlayTimelinePlayers = ['youtube', 'vimeo'];\n\n config.widgets[0].player.type = params.playerType;\n config.widgets[0].player.element = params.playerId;\n config.widgets[0].timeline = {\n overlay: (nonOverlayTimelinePlayers.indexOf(params.playerType) === -1),\n };\n },\n bootWidget: function() {\n const params = this.params;\n const config = {\n backend: {\n domain: params.deploymentDomain\n },\n demoMode: false,\n clientId: params.clientId,\n widgets: [{player: {}}],\n hooks: {\n mediaDetails: function() {\n return {\n details: {\n title: params.mediaTitle,\n description: params.mediaDescription,\n },\n outcomes: {\n isExpected: true\n }\n };\n },\n ssoAuthRequestHandle: function() {\n window.location.replace(params.loginUrl);\n },\n },\n group: {\n id: params.mediaGroupId,\n title: params.mediaGroupTitle,\n description: params.mediaGroupDescription,\n },\n ... (params.locale) && {locale: params.locale},\n };\n\n this.config = config;\n\n this.prepareConfig.call(this);\n\n if (window.Annoto) {\n window.Annoto.on('ready', this.annotoReady.bind(this));\n if (this.params.playerType === 'videojs' && window.requirejs) {\n const self = this;\n window.require(['media_videojs\/video-lazy'], function(vjs) {\n self.config.widgets[0].player.params = {\n videojs: vjs\n };\n window.Annoto.boot(self.config);\n });\n } else {\n window.Annoto.boot(this.config);\n }\n\n } else {\n log.warn('AnnotoMoodle: bootstrap didn`t load');\n }\n },\n\n annotoReady: function(api) {\n \/\/ Api is the API to be used after Annoot is setup\n \/\/ It can be used for SSO auth.\n this.annotoAPI = api;\n const jwt = this.params.userToken;\n log.info('AnnotoMoodle: annoto ready');\n if (api && jwt && jwt !== '') {\n api.auth(jwt).catch(function() {\n log.error('AnnotoMoodle: SSO auth error');\n });\n this.checkWidgetVisibility();\n } else {\n log.info('AnnotoMoodle: SSO auth skipped');\n }\n },\n\n authKalturaPlayer: function(api) {\n \/\/ Api is the API to be used after Annoot is setup\n \/\/ It can be used for SSO auth.\n const jwt = this.params.userToken;\n log.info('AnnotoMoodle: annoto ready');\n if (api && jwt && jwt !== '') {\n api.auth(jwt).catch(function() {\n log.error('AnnotoMoodle: SSO auth error');\n });\n } else {\n log.info('AnnotoMoodle: SSO auth skipped');\n }\n },\n\n setupKalturaKdpMap: function(kdpMap) {\n if (!kdpMap) {\n log.info('AnnotoMoodle: skip setup Kaltura players - missing map');\n return;\n }\n log.info('AnnotoMoodle: setup Kaltura players');\n for (let kdpMapKey in kdpMap) {\n if (kdpMap.hasOwnProperty(kdpMapKey)) {\n this.setupKalturaKdp(kdpMap[kdpMapKey]);\n }\n }\n },\n setupKalturaKdp: function(kdp) {\n if (!kdp.config || kdp.setupDone || !kdp.doneCb) {\n log.info('AnnotoMoodle: skip Kaltura player: ' + kdp.id);\n return;\n }\n log.info('AnnotoMoodle: setup Kaltura player: ' + kdp.id);\n kdp.setupDone = true;\n kdp.player.kBind('annotoPluginReady', this.authKalturaPlayer.bind(this));\n this.setupKalturaPlugin(kdp.config);\n kdp.doneCb();\n },\n setupKalturaPlugin: function(config) {\n \/*\n * Config will contain the annoto widget configuration.\n * This hook provides a chance to modify the configuration if required.\n * Below we use this chance to attach the ssoAuthRequestHandle and mediaDetails hooks.\n * https:\/\/github.com\/Annoto\/widget-api\/blob\/master\/lib\/config.d.ts#L128\n *\n * NOTICE: config is already setup by the Kaltura Annoto plugin,\n * so we need only to override the required configuration, such as\n * clientId, features, etc. DO NOT CHANGE THE PLAYER TYPE OR PLAYER ELEMENT CONFIG.\n *\/\n const params = this.params;\n\n config.clientId = params.clientId;\n config.hooks = {\n getPageUrl: function() {\n return window.location.href;\n },\n ssoAuthRequestHandle: function() {\n window.location.replace(params.loginUrl);\n },\n mediaDetails: this.enrichMediaDetails.bind(this),\n };\n config.group = {\n id: params.mediaGroupId,\n title: params.mediaGroupTitle,\n description: params.mediaGroupDescription,\n };\n if (params.locale) {\n config.locale = params.locale;\n }\n },\n\n enrichMediaDetails: function(mediaParams) {\n \/\/ The details contains MediaDetails the plugin has managed to obtain\n \/\/ This hook gives a change to enrich the details, for example\n \/\/ providing group information for private discussions per course\/playlist\n \/\/ https:\/\/github.com\/Annoto\/widget-api\/blob\/master\/lib\/media-details.d.ts#L6.\n \/\/ Annoto Kaltura plugin, already has some details about the media like title.\n \/\/\n const retVal = (mediaParams && mediaParams.details) || {};\n\n retVal.title = retVal.title || this.params.mediaTitle;\n retVal.description = retVal.description || this.params.mediaDescription;\n\n return retVal;\n },\n\n checkWidgetVisibility: function() {\n const formatSelectors = {\n grid: 'body.format-grid .grid_section, body.format-grid #gridshadebox',\n topcoll: 'body.format-topcoll .ctopics.topics .toggledsection ',\n tabs: 'body.format-tabtopics .yui3-tab-panel',\n snap: 'body.format-topics.theme-snap .topics .section.main',\n modtab: '#page-mod-tab-view .TabbedPanelsContentGroup .TabbedPanelsContent'\n };\n let courseFormat = '',\n playerElement = this.params.element,\n self = this;\n\n if (typeof M.tabtopics !== 'undefined') {\n courseFormat = 'tabs';\n } else if (typeof M.format_grid !== 'undefined') {\n courseFormat = 'grid';\n } else if (typeof M.format_topcoll !== 'undefined') {\n courseFormat = 'topcoll';\n } else if (typeof M.snapTheme !== 'undefined') {\n courseFormat = 'snap';\n } else if (document.body.id === 'page-mod-tab-view') {\n courseFormat = 'modtab';\n }\n\n const reloadAnnoto = function(mutationList) {\n let mutationTarget = null;\n\n if (mutationList) {\n switch (courseFormat) {\n case 'tabs':\n mutationTarget = mutationList.filter(function(m) {\n return m.target.classList.contains('yui3-tab-panel-selected');\n })[0].target;\n break;\n case 'grid':\n mutationTarget = mutationList.filter(function(m) {\n return !m.target.classList.contains('hide_section');\n })[0].target;\n break;\n case 'topcoll':\n mutationTarget = mutationList[0].target;\n break;\n case 'snap':\n mutationTarget = mutationList.filter(function(m) {\n return m.target.classList.contains('state-visible');\n })[0].target;\n break;\n case 'modtab':\n mutationTarget = mutationList.filter(function(m) {\n return m.target.classList.contains('TabbedPanelsContentVisible');\n })[0].target;\n break;\n }\n }\n\n playerElement = self.findPlayer(mutationTarget);\n if (playerElement) {\n self.params.element = playerElement;\n self.prepareConfig();\n }\n\n self.annotoAPI.destroy().then(function() {\n if (playerElement.offsetParent) {\n self.annotoAPI.load(self.config);\n }\n });\n };\n\n const observerNodeTargets = document.querySelectorAll(Object.values(formatSelectors).join(', '));\n\n if (observerNodeTargets.length > 0) {\n const observerConfig = {attributes: true, childList: true, subtree: false},\n observer = new MutationObserver(reloadAnnoto);\n\n observerNodeTargets.forEach(function(target) {\n observer.observe(target, observerConfig);\n });\n\n if (playerElement.offsetParent === null) {\n reloadAnnoto();\n }\n }\n\n },\n\n setupWistiaIframeEmbed: function() {\n const wistiaplayers = document.querySelectorAll('iframe');\n const annotoIframeClient = \"https:\/\/cdn.annoto.net\/widget-iframe-api\/latest\/client.js\";\n const targetHost = 'fast.wistia.net';\n const desiredParam = {\n name: 'plugin[annoto][src]',\n value: 'cdn.annoto.net'\n };\n\n wistiaplayers.forEach((iframe) => {\n let iframeSrc;\n try {\n iframeSrc = new URL(iframe.src);\n } catch (err) {\n return;\n }\n const targetParam = iframeSrc.searchParams.get(desiredParam.name);\n if (iframeSrc.host !== targetHost) {\n return;\n }\n\n if (targetParam && targetParam.match(desiredParam.value)) {\n require([annotoIframeClient], this.setupWistiaIframeEmbedPlugin.bind(this, iframe));\n return;\n }\n });\n },\n\n setupWistiaIframeEmbedPlugin: function(iframe, AnnotoIframeApi) {\n const params = this.params,\n annoto = new AnnotoIframeApi.Client(iframe);\n\n annoto.onSetup(function(next) {\n next({\n clientId: params.clientId,\n hooks: {\n mediaDetails: function() {\n return {\n details: {\n title: params.mediaTitle,\n description: params.mediaDescription,\n },\n outcomes: {\n isExpected: true\n }\n };\n },\n ssoAuthRequestHandle: function() {\n window.location.replace(params.loginUrl);\n },\n getPageUrl: function() {\n return window.location.href;\n },\n },\n group: {\n id: params.mediaGroupId,\n title: params.mediaGroupTitle,\n description: params.mediaGroupDescription,\n },\n ... (params.locale) && {locale: params.locale},\n });\n });\n\n annoto.onReady(function(api) {\n const token = params.userToken;\n api.auth(token, function(err) {\n if (err) {\n log.error('AnnotoMoodle: SSO auth error', err);\n }\n });\n });\n },\n\n checkVimeoTime: function() {\n const isVimeoTime = document.getElementById('page-mod-videotime-view');\n const self = this;\n let setupRetry = 0;\n\n const isReady = function() {\n let vimeoPlayer = document.querySelector('iframe[src*=\"vimeo.com\"]');\n if (!vimeoPlayer && setupRetry < 50) {\n setupRetry++;\n setTimeout(isReady, 100);\n } else {\n self.bootstrap();\n }\n };\n\n if (isVimeoTime) {\n isReady();\n }\n },\n\n tilesInit: function() {\n if (!document.body.classList.contains('format-tiles')) {\n return;\n }\n const self = this;\n const formatSelectors = {\n tiles: 'body.format-tiles #multi_section_tiles li.section.main.moveablesection'\n };\n\n const reloadAnnoto = function(mutationList) {\n let mutationTarget = null;\n\n if (mutationList) {\n mutationTarget = mutationList.filter(function(m) {\n return m.attributeName === 'class' && m.target.classList.contains('state-visible');\n });\n }\n\n if (!mutationTarget.length) {\n if (self.annotoAPI && self.isloaded) {\n self.annotoAPI.destroy().then(self.isloaded = false);\n }\n return;\n }\n setTimeout(function() {\n const player = self.findPlayer(mutationTarget[0].target);\n\n if (player) {\n self.params.playerId = `#${player.id}`;\n if (self.bootsrapDone) {\n self.prepareConfig();\n self.annotoAPI.load(self.config).then(self.isloaded = true);\n } else {\n self.bootsrapDone = self.isloaded = true;\n require([self.params.bootstrapUrl], self.bootWidget.bind(self));\n log.info('AnnotoMoodle: detected ' + self.params.playerType + ':' + self.params.playerId);\n }\n }\n }, 2000);\n };\n\n const observerNodeTargets = document.querySelectorAll(Object.values(formatSelectors).join(', '));\n\n if (observerNodeTargets.length > 0) {\n const observerConfig = {attributes: true, childList: false, subtree: false},\n observer = new MutationObserver(reloadAnnoto);\n\n observerNodeTargets.forEach(function(target) {\n observer.observe(target, observerConfig);\n });\n }\n },\n\n icontent: function(){\n if (!document.body.classList.contains('path-mod-icontent')) {\n return;\n }\n const wrapper = document.getElementById('region-main');\n const idIcontentPages = document.getElementById('idicontentpages');\n const self = this;\n\n const reloadAnnoto = function() {\n\n if (self.annotoAPI && self.isloaded) {\n self.annotoAPI.destroy().then(self.isloaded = false);\n }\n\n setTimeout(function() {\n const player = self.findPlayer(idIcontentPages);\n\n if (player) {\n self.params.playerId = `#${player.id}`;\n if (self.bootsrapDone) {\n self.prepareConfig();\n self.annotoAPI.load(self.config).then(self.isloaded = true);\n } else {\n self.bootsrapDone = self.isloaded = true;\n require([self.params.bootstrapUrl], self.bootWidget.bind(self));\n log.info('AnnotoMoodle: detected ' + self.params.playerType + ':' + self.params.playerId);\n }\n }\n }, 2000);\n };\n\n wrapper.addEventListener('click', function(event){\n if (!event.target.matches('.load-page')) {\n return;\n }\n reloadAnnoto();\n });\n },\n\n findMultiplePlayers: function() {\n const self = this;\n const vimeos = $('body').find('iframe[src*=\"vimeo.com\"]').get();\n const videojs = $('body').find('.video-js').get();\n const allPlayers = {\n ... (vimeos.length > 1) && {'vimeo': [...vimeos]},\n ... (videojs.length > 1) && {'videojs': [...videojs]},\n };\n\n let multiplePlayers = false;\n let activePlayerId = null;\n\n if (allPlayers.length) {\n return multiplePlayers;\n }\n multiplePlayers = true;\n log.info('AnnotoMoodle: setup multiple players');\n\n const validatePlayerId = function(element){\n if (!element.id || element.id === '') {\n element.id = 'annoto_player_id_' + Math.random().toString(36).substr(2, 6);\n }\n return element.id;\n };\n\n const reloadAnnotoWidget = function(element, playerType){\n self.params.playerId = `#${element.id}`;\n self.params.element = element;\n self.params.playerType = playerType;\n self.prepareConfig();\n\n self.annotoAPI.destroy().then(function () {\n self.annotoAPI.load(self.config);\n log.info(`AnnotoMoodle: reload Player: ${element.id}`);\n });\n };\n\n for (const [playerType, players] of Object.entries(allPlayers)) {\n players.forEach((player) => {\n validatePlayerId(player);\n\n log.info(`AnnotoMoodle: setup Player: ${player.id}`);\n switch (playerType) {\n case 'vimeo':\n let vimeoPlayer = new VimeoPlayer(player);\n vimeoPlayer.on('play', function () {\n if (player.id === activePlayerId) {\n return;\n }\n activePlayerId = player.id;\n log.info(`AnnotoMoodle: Player play: ${player.id}`);\n\n reloadAnnotoWidget(player, playerType);\n });\n break;\n case 'videojs':\n let playerJs = videoJsPlayer(player);\n playerJs.player().on('play', function() {\n if (player.id === activePlayerId) {\n return;\n }\n activePlayerId = player.id;\n log.info(`AnnotoMoodle: Player play: ${player.id}`);\n\n reloadAnnotoWidget(player, playerType);\n });\n break;\n }\n });\n }\n\n return multiplePlayers;\n }\n\n };\n});\n"],"file":"annoto.min.js"}