# HG changeset patch # User clebeaupin # Date 1272468607 -7200 # Node ID fd776c2b30629cf698b2f75d12d8083c777b5806 # Parent 8e4e2f2a2fdf9314a69331c5ede4f6621d28a77d FIx tag editor when no tags are created diff -r 8e4e2f2a2fdf -r fd776c2b3062 web/thdProject/apps/frontend/modules/editor/templates/_player.php --- a/web/thdProject/apps/frontend/modules/editor/templates/_player.php Wed Apr 28 17:20:48 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/editor/templates/_player.php Wed Apr 28 17:30:07 2010 +0200 @@ -72,14 +72,13 @@ function playerLoaded(player) { - // Charge les tags - $("#segmentMarkerButtons").css("opacity",1); - $("#btMarkIn").removeAttr("disabled"); - $.getJSON("getSlugUrl()}");?>", "", function(data) { - tagTool.segments = data; - tagTool.setupHandlers($f("player")); - window.setTimeout("loadSegments()", 2000); + $("#segmentMarkerButtons").css("opacity",1); + $("#btMarkIn").removeAttr("disabled"); + $.getJSON("getSlugUrl()}");?>", "", function(data) { + tagTool.segments = data; + tagTool.setupHandlers($f("player")); + window.setTimeout("loadSegments()", 2000); }); tagTool.player = $f("player"); diff -r 8e4e2f2a2fdf -r fd776c2b3062 web/thdProject/web/js/segmentation/tagtool.js --- a/web/thdProject/web/js/segmentation/tagtool.js Wed Apr 28 17:20:48 2010 +0200 +++ b/web/thdProject/web/js/segmentation/tagtool.js Wed Apr 28 17:30:07 2010 +0200 @@ -61,23 +61,26 @@ setupHandlers: function(player) { cuepoints = new Array(); + for (seg in this.segments) { cuepoint = {time: parseInt(this.segments[seg]['in']), tag: this.segments[seg]['tags'].join(', ')}; cuepoints.push(cuepoint); cuepoint = {time: parseInt(this.segments[seg]['out']), tag: this.segments[seg]['tags'].join(', '), out: 'true'}; cuepoints.push(cuepoint); } - player.onCuepoint(cuepoints, function(clip, cuepoint) { - if (cuepoint.out) { - tagTool.removeTag(cuepoint.tag); - if (tagTool.stopOnSegment == cuepoint.time) { - this.pause(); - tagTool.stopOnSegment = false; - } - } else { - tagTool.addTag(cuepoint.tag); - } - }); - + + if (cuepoints.length > 0) { + player.onCuepoint(cuepoints, function(clip, cuepoint) { + if (cuepoint.out) { + tagTool.removeTag(cuepoint.tag); + if (tagTool.stopOnSegment == cuepoint.time) { + this.pause(); + tagTool.stopOnSegment = false; + } + } else { + tagTool.addTag(cuepoint.tag); + } + }); + } } } \ No newline at end of file