integration/js/editor.js
changeset 73 475e5fb0ea2b
parent 69 e56b4456668f
child 92 54cd42adea33
--- a/integration/js/editor.js	Wed Nov 28 15:46:05 2012 +0100
+++ b/integration/js/editor.js	Wed Nov 28 17:21:26 2012 +0100
@@ -9,11 +9,6 @@
             url_params: _({}).extend(options.filter),
             serializer: IriSP.serializers.content
         }),
-/*        project = directory.remoteSource({
-            url: options.url,
-            serializer: IriSP.serializers.medialist
-        }),
-*/
         mashup = new IriSP.Model.Mashup(false, project),
         mediatemplate = _.template(
             '<li class="item-video media" data-media-id="<%= id %>"><div class="media-count-wrap"><span class="media-count"></span></div>'
@@ -655,6 +650,21 @@
         return false;
     });
     
+    $(".mashup-frise").click(function(evt) {
+        if (!mashup.duration.milliseconds) {
+            return;
+        }
+        var el = $(this), t = ( evt.pageX - el.offset().left ) * mashup.duration / el.width(), segment = mashup.getAnnotationAtTime(t);
+        if (segment) {
+            if (currentMedia === mashup) {
+                project.trigger("click-annotation", segment.annotation);
+            } else {
+                currentSegment = segment.annotation;
+                setMedia(currentSegment.getMedia());
+            }
+        }
+    });
+    
     /* Tangles */
     var tangleMsPerPixel = 100,
         activeTangle,
@@ -858,6 +868,8 @@
         postproject.modified = new Date();
         postproject.title = mashup.title;
         postproject.description = mashup.description;
+        var waitscreen = $('<div class="full-wait">');
+        waitscreen.appendTo('body');
         $.ajax({
             type: "POST",
             url: IriSP.endpoints.project,
@@ -874,11 +886,10 @@
                 document.location.href = destination;
             },
             error: function(jqXHR, textStatus, errorThrown){
-                console.log(arguments);
                 alert(IriSP.translate("Server error\nYour hashcut couldn't be published"));
+                waitscreen.remove();
             }
         });
-        //TODO: ADD WAITING SCREEN
         
         return false;
     });