diff options
Diffstat (limited to 'www/external/origjs')
| -rw-r--r-- | www/external/origjs/videogular-cuepoints.css | 18 | ||||
| -rw-r--r-- | www/external/origjs/videogular-cuepoints.js | 52 |
2 files changed, 70 insertions, 0 deletions
diff --git a/www/external/origjs/videogular-cuepoints.css b/www/external/origjs/videogular-cuepoints.css new file mode 100644 index 00000000..24f1cfc7 --- /dev/null +++ b/www/external/origjs/videogular-cuepoints.css @@ -0,0 +1,18 @@ +videogular vg-cuepoints { + position: relative; + + display: block; + width: 100%; + height: 0px; +} + +videogular vg-cuepoints vg-cuepoint { + position: absolute; + top: -16px; + + display: block; + width: 2px; + height: 30px; + + background-color: red; +} diff --git a/www/external/origjs/videogular-cuepoints.js b/www/external/origjs/videogular-cuepoints.js new file mode 100644 index 00000000..6bfc3c6f --- /dev/null +++ b/www/external/origjs/videogular-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("<link rel='stylesheet' href='" + value + "'>"); + } + } + + 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', + '<vg-cuepoint ng-repeat="cuepoint in cuepoints.points" ng-click="onCuepointClick(cuepoint)" ng-style="cuepointStyle(cuepoint)"></vg-cuepoint>' + ); + }]); +})(); |
