From b28028ac4082842143b0f528d6bc539da6ccb419 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Thu, 21 Sep 2017 12:49:18 -0400 Subject: mega changes, including updates and X --- www/lib/videogular-cuepoints/cuepoints.js | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 www/lib/videogular-cuepoints/cuepoints.js (limited to 'www/lib/videogular-cuepoints/cuepoints.js') diff --git a/www/lib/videogular-cuepoints/cuepoints.js b/www/lib/videogular-cuepoints/cuepoints.js new file mode 100644 index 00000000..6bfc3c6f --- /dev/null +++ b/www/lib/videogular-cuepoints/cuepoints.js @@ -0,0 +1,52 @@ +(function(){ +'use strict'; +angular.module('uk.ac.soton.ecs.videogular.plugins.cuepoints', []) + .directive( + 'vgCuepoints', + [function() { + return { + restrict: 'E', + require: '^videogular', + templateUrl: function(element, attrs) { + return attrs.templateUrl || 'videogular-cuepoints/cuepoints.html'; + }, + scope: { + cuepoints: '=vgCuepointsConfig', + theme: '=vgCuepointsTheme', + }, + link: function($scope, elem, attr, API) { + // shamelessly stolen from part of videogular's updateTheme function + function updateTheme(value) { + if (value) { + var headElem = angular.element(document).find("head"); + headElem.append(""); + } + } + + var calcLeft = function(cuepoint) { + if (API.totalTime === 0) return '-1000'; + + var videoLength = API.totalTime / 1000; + return (cuepoint.time * 100 / videoLength).toString(); + }; + + $scope.onCuepointClick = function(cuepoint){ + API.seekTime(cuepoint.time); + }; + + $scope.cuepointStyle = function(cuepoint) { + return { + left: calcLeft(cuepoint) + '%' + }; + } + + updateTheme($scope.theme); + }, + }; + }]) + .run(['$templateCache', function($templateCache) { + $templateCache.put('videogular-cuepoints/cuepoints.html', + '' + ); + }]); +})(); -- cgit v1.2.3