diff -r 265a5f1cc7cf -r 43ac4bd80e71 integration/js/editor.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/integration/js/editor.js Thu Oct 25 16:41:19 2012 +0200
@@ -0,0 +1,84 @@
+(function() {
+ var Hashcut = function() {
+ var directory = new IriSP.Model.Directory(),
+ project = directory.remoteSource({
+ url: "data/bpidata.json",
+ serializer: IriSP.serializers.medialist
+ }),
+ mediatemplate = '
'
+ + '{{title}}{{description}}'
+ + 'Durée : {{duration}}';
+ project.onLoad(function() {
+ var html = '';
+ project.getMedias().forEach(function(_m) {
+ html += Mustache.to_html(mediatemplate, _m);
+ });
+ $(".col-left .list-video").html(html);
+ });
+
+ $(".col-left input").on("keyup change input paste", function() {
+ var val = $(this).val();
+ if (val) {
+ var find = IriSP.Model.regexpFromTextOrArray(val, true),
+ replace = IriSP.Model.regexpFromTextOrArray(val, false);
+ }
+ $(".col-left .item-video").each(function() {
+ var li = $(this),
+ title = $(this).find(".title-video"),
+ titletext = title.text();
+ if (val && find.test(titletext)) {
+ title.html(titletext.replace(replace, '$1'));
+ li.show();
+ } else {
+ title.text(titletext);
+ if (val) {
+ li.hide();
+ } else {
+ li.show();
+ }
+ }
+ })
+ });
+
+ $(".tab-segment").click(function() {
+ $(".col-middle").removeClass("empty-mode pvw-mode").addClass("segment-mode");
+ return false;
+ });
+ $(".tab-pvw").click(function() {
+ $(".col-middle").removeClass("empty-mode segment-mode").addClass("pvw-mode");
+ return false;
+ });
+
+ function disableMoveItemVideo() {
+ $(".organize-segments .top, .organize-segments .bottom").removeClass("disable");
+ $(".organize-segments .item-video:last-child .bottom, .organize-segments .item-video:first-child .top").addClass("disable");
+ }
+
+ $(".organize-segments").sortable({
+ stop : function(){
+ disableMoveItemVideo();
+ }
+ });
+
+ $(".organize-segments .top").click(function(e){
+ var currentItem = $(this).parents(".item-video");
+ currentItem.insertBefore(currentItem.prev());
+ disableMoveItemVideo();
+ });
+
+ $(".organize-segments .bottom").click(function(e){
+ var currentItem = $(this).parents(".item-video");
+ currentItem.insertAfter(currentItem.next());
+ disableMoveItemVideo();
+ });
+
+
+ }
+
+ IriSP.Hashcut = Hashcut;
+}
+)();
+
+$(function() {
+ var hashcut = new IriSP.Hashcut();
+});