added embeddable videos - hackathon

This commit is contained in:
Ron Gilchrist 2019-01-10 15:05:28 -08:00
Родитель 0de68aa6ab 562a5682aa
Коммит 4338224931
3 изменённых файлов: 25 добавлений и 14 удалений

Просмотреть файл

@ -133,7 +133,7 @@
};
$scope.expanded = false;
var annotations = null;
var annotations = [];
var checkAnnotations = function(){
if (annotations){
annotations.forEach(function(a){
@ -143,14 +143,17 @@
var col = $scope.collection;
var hasAnnotations = false;
col.forEach(function(place){
if (ss.canCast(place, wwtlib.Place)/*&&annotationn*/){
if (ss.canCast(place, wwtlib.Place) &&
place.annotation && place.annotation.indexOf('embed:') === 0){
hasAnnotations = true;
var a = wwt.wc.createCircle({r:255,g:255,b:255,a:127});
a.set_id('?v=lBfCQt6TTms');
var a = wwt.wc.createCircle('#ddffdd');
a.set_id(place.annotation);
annotations.push(place.annotation);
a.setCenter(place.get_RA() * 15, place.get_dec());
a.set_lineColor('#00ff00');
a.set_skyRelative(true);
a.set_radius(.01);
a.set_radius(.005);
wwt.wc.addAnnotation(a);
console.log(a);
}

Просмотреть файл

@ -1,4 +1,4 @@
wwt.app.factory('UILibrary', ['$rootScope','AppState','Util', 'Localization','$modal', function ($rootScope, appState, util, loc,$modal) {
wwt.app.factory('UILibrary', ['$rootScope','AppState','Util', 'Localization','$modal','$sce', function ($rootScope, appState, util, loc,$modal,$sce) {
$rootScope.layerManagerHidden = appState.get('layerManagerHidden') ? true : false;
@ -199,10 +199,10 @@
});
};
var embedVideo = function(url){
var embedVideo = function(videoid){
console.warn(videoid);
var modalScope = $rootScope.$new();
modalScope.url = url;
modalScope.url = $sce.trustAsResourceUrl('//www.youtube.com/embed/' + videoid + '?rel=0?wmode=transparent&fs=1&rel=0&enablejsapi=1&version=3');
modalScope.customClass = 'wizard';
$modal({
scope: modalScope,
@ -218,9 +218,17 @@
return {
addDialogHooks:function(){
wwt.wc.add_annotationClicked(function(interface,event){
var videoid = event.get_id().split('?v=')[1];
if (videoid)
console.log(videoid);{}
var s = event.get_id();
var split = s.split('?v=');
var videoid;
if (split[1]){
videoid=split[1];
}else {
split = split[0].split('be/');
videoid = split[1];
}
console.log(videoid);
embedVideo(videoid)
});
wwt.wc.add_voTableDisplay(wwt.loadVOTableModal);

Просмотреть файл

@ -4,7 +4,7 @@
<span localize="Video"></span>
</h5>
</div>
<div class="modal-body embed" style="height:500px">
<iframe src="//www.youtube.com/embed/{{url}}?rel=0?wmode=transparent&amp;fs=1&amp;rel=0&amp;enablejsapi=1&amp;version=3" frameborder="0" />
<div class="modal-body embed" style="height:500px" ng-if="url">
<iframe ng-src="{{url}}" frameborder="0"></iframe>
</div>