diff -r 8a8b6097d382 -r 42c59d09670e integration/js/editor.js
--- a/integration/js/editor.js Wed Oct 24 15:58:27 2012 +0200
+++ b/integration/js/editor.js Wed Oct 24 17:44:18 2012 +0200
@@ -1,3 +1,50 @@
-$(function() {
+(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").bind("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();
+ }
+ }
+ })
+ });
+ }
+ IriSP.Hashcut = Hashcut;
+}
+)();
+
+$(function() {
+ var hashcut = new IriSP.Hashcut();
});