integration/js/editor.js
changeset 73 475e5fb0ea2b
parent 69 e56b4456668f
child 92 54cd42adea33
equal deleted inserted replaced
72:aa85db611fb7 73:475e5fb0ea2b
     7         project = directory.remoteSource({
     7         project = directory.remoteSource({
     8             url: IriSP.endpoints.content,
     8             url: IriSP.endpoints.content,
     9             url_params: _({}).extend(options.filter),
     9             url_params: _({}).extend(options.filter),
    10             serializer: IriSP.serializers.content
    10             serializer: IriSP.serializers.content
    11         }),
    11         }),
    12 /*        project = directory.remoteSource({
       
    13             url: options.url,
       
    14             serializer: IriSP.serializers.medialist
       
    15         }),
       
    16 */
       
    17         mashup = new IriSP.Model.Mashup(false, project),
    12         mashup = new IriSP.Model.Mashup(false, project),
    18         mediatemplate = _.template(
    13         mediatemplate = _.template(
    19             '<li class="item-video media" data-media-id="<%= id %>"><div class="media-count-wrap"><span class="media-count"></span></div>'
    14             '<li class="item-video media" data-media-id="<%= id %>"><div class="media-count-wrap"><span class="media-count"></span></div>'
    20             + '<img class="thumbnail" src="<%= thumbnail %>" alt="<%= title %>" />'
    15             + '<img class="thumbnail" src="<%= thumbnail %>" alt="<%= title %>" />'
    21             + '<div class="video-info"><h3 class="title-video"><%= title %></h3><p class="description"><%= description %></p>'
    16             + '<div class="video-info"><h3 class="title-video"><%= title %></h3><p class="description"><%= description %></p>'
   653             showEmpty();
   648             showEmpty();
   654         }
   649         }
   655         return false;
   650         return false;
   656     });
   651     });
   657     
   652     
       
   653     $(".mashup-frise").click(function(evt) {
       
   654         if (!mashup.duration.milliseconds) {
       
   655             return;
       
   656         }
       
   657         var el = $(this), t = ( evt.pageX - el.offset().left ) * mashup.duration / el.width(), segment = mashup.getAnnotationAtTime(t);
       
   658         if (segment) {
       
   659             if (currentMedia === mashup) {
       
   660                 project.trigger("click-annotation", segment.annotation);
       
   661             } else {
       
   662                 currentSegment = segment.annotation;
       
   663                 setMedia(currentSegment.getMedia());
       
   664             }
       
   665         }
       
   666     });
       
   667     
   658     /* Tangles */
   668     /* Tangles */
   659     var tangleMsPerPixel = 100,
   669     var tangleMsPerPixel = 100,
   660         activeTangle,
   670         activeTangle,
   661         tangleStartX,
   671         tangleStartX,
   662         tangleStartVal,
   672         tangleStartVal,
   856         postproject.creator = options.creator;
   866         postproject.creator = options.creator;
   857         postproject.created = new Date();
   867         postproject.created = new Date();
   858         postproject.modified = new Date();
   868         postproject.modified = new Date();
   859         postproject.title = mashup.title;
   869         postproject.title = mashup.title;
   860         postproject.description = mashup.description;
   870         postproject.description = mashup.description;
       
   871         var waitscreen = $('<div class="full-wait">');
       
   872         waitscreen.appendTo('body');
   861         $.ajax({
   873         $.ajax({
   862             type: "POST",
   874             type: "POST",
   863             url: IriSP.endpoints.project,
   875             url: IriSP.endpoints.project,
   864             data: IriSP.serializers.ldt.serialize(postproject),
   876             data: IriSP.serializers.ldt.serialize(postproject),
   865             contentType: "application/cinelab",
   877             contentType: "application/cinelab",
   872                     destination = IriSP.endpoints.hashcut_page + projid;
   884                     destination = IriSP.endpoints.hashcut_page + projid;
   873                 $(window).off("beforeunload", onLeave);
   885                 $(window).off("beforeunload", onLeave);
   874                 document.location.href = destination;
   886                 document.location.href = destination;
   875             },
   887             },
   876             error: function(jqXHR, textStatus, errorThrown){
   888             error: function(jqXHR, textStatus, errorThrown){
   877                 console.log(arguments);
       
   878                 alert(IriSP.translate("Server error\nYour hashcut couldn't be published"));
   889                 alert(IriSP.translate("Server error\nYour hashcut couldn't be published"));
   879             }
   890                 waitscreen.remove();
   880         });
   891             }
   881         //TODO: ADD WAITING SCREEN
   892         });
   882         
   893         
   883         return false;
   894         return false;
   884     });
   895     });
   885     
   896     
   886     mashup.trigger("change");
   897     mashup.trigger("change");