OwlCyberSecurity - MANAGER
Edit File: p-c14329a3.js.map
{"version":3,"names":["learndash","player","learndash_video_data","videos_found_provider","resumeProgress","window","videos_auto_complete","prestoPlayer","lesson_video_auto_complete","videos_hide_complete_button","videos_shown","lesson_video_hide_complete_button","videos_auto_complete_delay","lesson_video_auto_complete_delay","videos_auto_complete_delay_message","video_track_path","jQuery","video_debug","console","log","document","querySelectorAll","length","LearnDash_disable_assets","LearnDash_watchPlayers","forEach","element","index","element_key","element_id","getAttribute","setAttribute","ld_video_players","closest","LearnDash_Video_Progress_initSettings","LearnDash_Video_Progress_getSetting","LearnDash_watchPlayersEnd","wp","hooks","addAction","LearnDash_Video_Progress_setSetting","duration","currentTime"],"sources":["src/components/core/player/integrations/learndash.js"],"sourcesContent":["import { resumeProgress } from '../functions/save-time';\n\nexport default player => {\n if (typeof learndash_video_data === 'undefined' || learndash_video_data?.videos_found_provider !== 'presto') {\n return;\n }\n\n resumeProgress(player, true); // maybe resume progress\n\n // Learndash has this logic in a shitty method on their php class\n // we have to fake it here since we don't have access to it\n window.learndash_video_data.videos_auto_complete = prestoPlayer?.learndash?.lesson_video_auto_complete === 'on';\n window.learndash_video_data.videos_hide_complete_button = 'AFTER' === learndash_video_data?.videos_shown && prestoPlayer?.learndash?.lesson_video_hide_complete_button === 'on';\n window.learndash_video_data.videos_auto_complete_delay = prestoPlayer?.learndash?.lesson_video_auto_complete_delay;\n window.learndash_video_data.videos_auto_complete_delay_message = prestoPlayer?.learndash?.videos_auto_complete_delay_message;\n\n // Temporarily set the video track path to '/' to set the cookie globally\n window.learndash_video_data.video_track_path = '/';\n\n // Set learndash video players\n jQuery(function () {\n if (learndash_video_data.video_debug === '1') {\n console.log('PRESTO: init');\n }\n\n if (document.querySelectorAll('presto-player[data-video-progression=\"true\"][data-video-provider=\"' + learndash_video_data.videos_found_provider + '\"]').length) {\n if (learndash_video_data.video_debug === '1') {\n console.log('PRESTO: calling LearnDash_disable_assets(true)');\n }\n\n // Disable learndash assets and watch players.\n LearnDash_disable_assets(true);\n LearnDash_watchPlayers();\n\n // Go through all the <presto-player> instances\n document\n .querySelectorAll('presto-player[data-video-progression=\"true\"][data-video-provider=\"' + learndash_video_data.videos_found_provider + '\"]')\n .forEach(function (element, index) {\n console.log({element});\n var element_key = 'presto-player__wrapper-player-' + index;\n var element_id = element.getAttribute('id');\n\n if (typeof element_id === 'undefined' || element_id == '') {\n element_id = element_key;\n element.setAttribute('id', element_id);\n }\n\n ld_video_players[element_key] = {};\n ld_video_players[element_key]['player_key'] = element_key;\n ld_video_players[element_key]['player_type'] = learndash_video_data.videos_found_provider;\n ld_video_players[element_key]['player_id'] = element_id;\n ld_video_players[element_key]['player_wrapper'] = element.closest('presto-player');\n if (typeof ld_video_players[element_key]['player_wrapper'] !== 'undefined') {\n ld_video_players[element_key]['player_cookie_key'] = ld_video_players[element_key]['player_wrapper'].getAttribute('data-video-cookie-key');\n } else {\n ld_video_players[element_key]['player_cookie_key'] = '';\n }\n ld_video_players[element_key]['player_cookie_values'] = LearnDash_Video_Progress_initSettings(ld_video_players[element_key]);\n\n // Check if video has been completed already.\n // If yes, enable the assets back and end watch players function.\n // If no, then apply all the filters and performs the actions again.\n if (LearnDash_Video_Progress_getSetting(ld_video_players[element_key], 'video_state') === 'complete') {\n LearnDash_disable_assets(false);\n LearnDash_watchPlayersEnd();\n } else {\n // Player Seeked.\n wp.hooks.addAction('presto.playerTimeUpdate', 'presto-player', player => {\n if (learndash_video_data.video_debug === '1') {\n console.log('PRESTO: Video is playing');\n }\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_duration', player.duration);\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_time', player.currentTime);\n\n if (player.duration && player.duration === player.currentTime) {\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_state', 'complete');\n\n if (learndash_video_data.video_debug === '1') {\n console.log('PRESTO: calling LearnDash_disable_assets(false)');\n }\n LearnDash_disable_assets(false);\n\n // Stop watching players.\n LearnDash_watchPlayersEnd();\n }\n });\n\n // Player Playing.\n wp.hooks.addAction('presto.playerPlaying', 'presto-player', player => {\n if (learndash_video_data.video_debug === '1') {\n console.log('PRESTO: Video is playing');\n }\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_duration', player.duration);\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_time', player.currentTime);\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_state', 'play');\n });\n\n // Player Paused.\n wp.hooks.addAction('presto.playerPause', 'presto-player', player => {\n if (learndash_video_data.video_debug === '1') {\n console.log('PRESTO: Video is paused');\n }\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_time', player.currentTime);\n console.log(player.duration);\n console.log(player.currentTime);\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_state', 'pause');\n });\n\n // Player Ended.\n wp.hooks.addAction('presto.playerEnded', 'presto-player', player => {\n if (learndash_video_data.video_debug === '1') {\n console.log('PRESTO: video ended');\n }\n\n if (learndash_video_data.video_debug === '1') {\n console.log(\"PRESTO: setting 'video_state' to 'complete'\");\n }\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_time', player.currentTime);\n LearnDash_Video_Progress_setSetting(ld_video_players[element_key], 'video_state', 'complete');\n\n if (learndash_video_data.video_debug === '1') {\n console.log('PRESTO: calling LearnDash_disable_assets(false)');\n }\n LearnDash_disable_assets(false);\n\n // Stop watching players.\n LearnDash_watchPlayersEnd();\n });\n }\n });\n }\n });\n};\n"],"mappings":"oFAEA,MAAAA,EAAeC,IACb,UAAWC,uBAAyB,aAAeA,sBAAsBC,wBAA0B,SAAU,CAC3G,MACJ,CAEEC,EAAeH,EAAQ,MAIvBI,OAAOH,qBAAqBI,qBAAuBC,cAAcP,WAAWQ,6BAA+B,KAC3GH,OAAOH,qBAAqBO,4BAA8B,UAAYP,sBAAsBQ,cAAgBH,cAAcP,WAAWW,oCAAsC,KAC3KN,OAAOH,qBAAqBU,2BAA6BL,cA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