|
@@ -248,7 +248,7 @@ $(document).ready(function(){
|
248
|
248
|
$('img.elements_more_loader').show();
|
249
|
249
|
$('ul.elements').html('');
|
250
|
250
|
|
251
|
|
- form = $('form[name="search"]');
|
|
251
|
+ var form = $('form[name="search"]');
|
252
|
252
|
remove_tags(form.attr('name'));
|
253
|
253
|
form.submit();
|
254
|
254
|
});
|
|
@@ -259,7 +259,7 @@ $(document).ready(function(){
|
259
|
259
|
$('img.elements_more_loader').show();
|
260
|
260
|
$('ul.elements').html('');
|
261
|
261
|
|
262
|
|
- form = $(this).parent('div').parent('form');
|
|
262
|
+ var form = $(this).parents('form[name="search"]');
|
263
|
263
|
|
264
|
264
|
$.getJSON(url_get_favorites_tags, function(response) {
|
265
|
265
|
if (response.status == 'mustbeconnected')
|
|
@@ -270,7 +270,7 @@ $(document).ready(function(){
|
270
|
270
|
remove_tags(form.attr('name'));
|
271
|
271
|
// if (tags.length)
|
272
|
272
|
// {
|
273
|
|
- inputTag = $("div#tags_prompt_"+form.attr('name')+" input.form-default-value-processed");
|
|
273
|
+ var inputTag = $("div#tags_prompt_"+form.attr('name')+" input.form-default-value-processed");
|
274
|
274
|
for (i in response.tags)
|
275
|
275
|
{
|
276
|
276
|
$('input#tags_selected_tag_'+form.attr('name')).val(i);
|
|
@@ -289,10 +289,11 @@ $(document).ready(function(){
|
289
|
289
|
// Tag cliqué dans la liste d'éléments
|
290
|
290
|
$('ul.element_tags li a.element_tag').live('click', function(){
|
291
|
291
|
// Si il y a une liste de tags (comme sur la page favoris, profil)
|
|
292
|
+ var id;
|
292
|
293
|
if ($('ul#favorite_tags').length)
|
293
|
294
|
{
|
294
|
|
- id = str_replace('#', '', $(this).attr('href'));
|
295
|
|
- link = $('ul#favorite_tags li a[href="#'+id+'"]');
|
|
295
|
+ id = str_replace('element_tag', '', $(this).attr('id'));
|
|
296
|
+ var link = $('ul#favorite_tags li a[href="#'+id+'"]');
|
296
|
297
|
list_tag_clicked(link, true);
|
297
|
298
|
}
|
298
|
299
|
|
|
@@ -300,10 +301,10 @@ $(document).ready(function(){
|
300
|
301
|
{
|
301
|
302
|
$('img.elements_more_loader').show();
|
302
|
303
|
$('ul.elements').html('');
|
303
|
|
- form = $('form[name="search"]');
|
304
|
|
- id = str_replace('#', '', $(this).attr('href'));
|
|
304
|
+ var form = $('form[name="search"]');
|
|
305
|
+ id = str_replace('element_tag', '', $(this).attr('id'));
|
305
|
306
|
remove_tags('search');
|
306
|
|
- inputTag = $("div#tags_prompt_search input.form-default-value-processed");
|
|
307
|
+ var inputTag = $("div#tags_prompt_search input.form-default-value-processed");
|
307
|
308
|
$('input#tags_selected_tag_search').val(id);
|
308
|
309
|
inputTag.val($(this).html());
|
309
|
310
|
inputTag.trigger("selectTag");
|
|
@@ -316,7 +317,7 @@ $(document).ready(function(){
|
316
|
317
|
// 1328283201_emblem-symbolic-link.png
|
317
|
318
|
$('a.element_embed_open_link').live("click", function(){
|
318
|
319
|
|
319
|
|
- li = $(this).parent('td').parent('tr').parent().parent().parent('li.element');
|
|
320
|
+ var li = $(this).parents('li.element');
|
320
|
321
|
|
321
|
322
|
li.find('a.element_embed_close_link').show();
|
322
|
323
|
li.find('a.element_embed_open_link_text').hide();
|
|
@@ -327,7 +328,7 @@ $(document).ready(function(){
|
327
|
328
|
|
328
|
329
|
$('a.element_name_embed_open_link').live("click", function(){
|
329
|
330
|
|
330
|
|
- li = $(this).parent('span').parent('td').parent('tr').parent().parent().parent('li.element');
|
|
331
|
+ var li = $(this).parents('li.element');
|
331
|
332
|
|
332
|
333
|
li.find('a.element_embed_close_link').show();
|
333
|
334
|
li.find('a.element_embed_open_link_text').hide();
|
|
@@ -339,7 +340,7 @@ $(document).ready(function(){
|
339
|
340
|
// Fermeture du embed si demandé
|
340
|
341
|
$('a.element_embed_close_link').live("click", function(){
|
341
|
342
|
|
342
|
|
- li = $(this).parent('td').parent('tr').parent().parent().parent('li.element');
|
|
343
|
+ var li = $(this).parents('li.element');
|
343
|
344
|
|
344
|
345
|
li.find('div.element_embed').hide();
|
345
|
346
|
li.find('a.element_embed_open_link_text').show();
|
|
@@ -353,8 +354,8 @@ $(document).ready(function(){
|
353
|
354
|
mouseenter:
|
354
|
355
|
function()
|
355
|
356
|
{
|
356
|
|
- td = $(this).parent('td');
|
357
|
|
- a = td.find('a.a_thumbnail');
|
|
357
|
+ var td = $(this).parent('td');
|
|
358
|
+ var a = td.find('a.a_thumbnail');
|
358
|
359
|
if (a.hasClass('embed'))
|
359
|
360
|
{
|
360
|
361
|
td.find('img.play').show();
|
|
@@ -367,8 +368,8 @@ $(document).ready(function(){
|
367
|
368
|
mouseleave:
|
368
|
369
|
function()
|
369
|
370
|
{
|
370
|
|
- td = $(this).parent('td');
|
371
|
|
- a = td.find('a.a_thumbnail');
|
|
371
|
+ var td = $(this).parent('td');
|
|
372
|
+ var a = td.find('a.a_thumbnail');
|
372
|
373
|
if (a.hasClass('embed'))
|
373
|
374
|
{
|
374
|
375
|
td.find('img.play').hide();
|
|
@@ -383,10 +384,10 @@ $(document).ready(function(){
|
383
|
384
|
|
384
|
385
|
// Mise en favoris
|
385
|
386
|
$('a.favorite_link').live("click", function(){
|
386
|
|
- link = $(this);
|
|
387
|
+ var link = $(this);
|
387
|
388
|
|
388
|
389
|
// Pour ne pas attendre la fin du chargement ajax:
|
389
|
|
- img = link.find('img');
|
|
390
|
+ var img = link.find('img');
|
390
|
391
|
if (!link.hasClass('loading'))
|
391
|
392
|
{
|
392
|
393
|
if (img.attr('src') == '/bundles/muzichcore/img/favorite_bw.png')
|
|
@@ -407,7 +408,7 @@ $(document).ready(function(){
|
407
|
408
|
$(location).attr('href', url_index);
|
408
|
409
|
}
|
409
|
410
|
|
410
|
|
- img = link.find('img');
|
|
411
|
+ var img = link.find('img');
|
411
|
412
|
link.attr('href', response.link_new_url);
|
412
|
413
|
img.attr('src', response.img_new_src);
|
413
|
414
|
img.attr('title', response.img_new_title);
|
|
@@ -440,12 +441,12 @@ $(document).ready(function(){
|
440
|
441
|
);
|
441
|
442
|
|
442
|
443
|
// Plus d'éléments
|
443
|
|
- last_id = null;
|
|
444
|
+ var last_id = null;
|
444
|
445
|
$('a.elements_more').click(function(){
|
445
|
|
- link = $(this);
|
446
|
|
- last_element = $('ul.elements li.element:last-child');
|
447
|
|
- id_last = str_replace('element_', '', last_element.attr('id'));
|
448
|
|
- invertcolor = 0;
|
|
446
|
+ var link = $(this);
|
|
447
|
+ var last_element = $('ul.elements li.element:last-child');
|
|
448
|
+ var id_last = str_replace('element_', '', last_element.attr('id'));
|
|
449
|
+ var invertcolor = 0;
|
449
|
450
|
if (last_element.hasClass('even'))
|
450
|
451
|
{
|
451
|
452
|
invertcolor = 1;
|
|
@@ -519,7 +520,7 @@ $(document).ready(function(){
|
519
|
520
|
cancelAnswer : string_element_delete_confirm_no,
|
520
|
521
|
onYes: function(link){
|
521
|
522
|
|
522
|
|
- li = link.parent('td').parent('tr').parent().parent().parent('li.element');
|
|
523
|
+ var li = $(this).parents('li.element');
|
523
|
524
|
li.find('img.element_loader').show();
|
524
|
525
|
$.getJSON(link.attr('href'), function(response){
|
525
|
526
|
if (response.status == 'mustbeconnected')
|
|
@@ -540,12 +541,12 @@ $(document).ready(function(){
|
540
|
541
|
return false;
|
541
|
542
|
},
|
542
|
543
|
onOpen: function(link){
|
543
|
|
- li = link.parent('td').parent('tr').parent().parent().parent('li.element');
|
|
544
|
+ var li = $(this).parents('li.element');
|
544
|
545
|
li.find('a.element_edit_link').addClass('mustBeDisplayed');
|
545
|
546
|
li.find('a.element_remove_link').addClass('mustBeDisplayed');
|
546
|
547
|
},
|
547
|
548
|
onClose: function(link){
|
548
|
|
- li = link.parent('td').parent('tr').parent().parent().parent('li.element');
|
|
549
|
+ var li = $(this).parents('li.element');
|
549
|
550
|
li.find('a.element_edit_link').removeClass('mustBeDisplayed');
|
550
|
551
|
li.find('a.element_remove_link').removeClass('mustBeDisplayed');
|
551
|
552
|
li.find('a.element_edit_link').hide();
|
|
@@ -553,15 +554,15 @@ $(document).ready(function(){
|
553
|
554
|
}
|
554
|
555
|
});
|
555
|
556
|
|
556
|
|
- elements_edited = new Array();
|
|
557
|
+ var elements_edited = new Array();
|
557
|
558
|
// Ouverture du formulaire de modification
|
558
|
559
|
$('a.element_edit_link').live('click', function(){
|
559
|
560
|
|
560
|
|
- link = $(this);
|
561
|
|
- li = link.parent('td').parent('tr').parent().parent().parent('li.element');
|
|
561
|
+ var link = $(this);
|
|
562
|
+ var li = link.parents('li.element');
|
562
|
563
|
// On garde en mémoire l'élément édité en cas d'annulation
|
563
|
564
|
elements_edited[li.attr('id')] = li.html();
|
564
|
|
- div_loader = li.find('div.loader');
|
|
565
|
+ var div_loader = li.find('div.loader');
|
565
|
566
|
li.html(div_loader);
|
566
|
567
|
li.find('img.element_loader').show();
|
567
|
568
|
|
|
@@ -587,7 +588,7 @@ $(document).ready(function(){
|
587
|
588
|
|
588
|
589
|
// On rend ce formulaire ajaxFormable
|
589
|
590
|
$('form[name="'+response.form_name+'"] input[type="submit"]').live('click', function(){
|
590
|
|
- li = $(this).parent('form').parent('li');
|
|
591
|
+ var li = $(this).parents('li.element');
|
591
|
592
|
li.prepend(div_loader);
|
592
|
593
|
li.find('img.element_loader').show();
|
593
|
594
|
});
|
|
@@ -598,7 +599,7 @@ $(document).ready(function(){
|
598
|
599
|
$(location).attr('href', url_index);
|
599
|
600
|
}
|
600
|
601
|
|
601
|
|
- li = $('li#'+response.dom_id);
|
|
602
|
+ var li = $('li#'+response.dom_id);
|
602
|
603
|
|
603
|
604
|
if (response.status == 'success')
|
604
|
605
|
{
|
|
@@ -609,7 +610,7 @@ $(document).ready(function(){
|
609
|
610
|
{
|
610
|
611
|
li.find('img.element_loader').hide();
|
611
|
612
|
li.find('ul.error_list').remove();
|
612
|
|
- ul_errors = $('<ul>').addClass('error_list');
|
|
613
|
+ var ul_errors = $('<ul>').addClass('error_list');
|
613
|
614
|
|
614
|
615
|
for (i in response.errors)
|
615
|
616
|
{
|
|
@@ -626,15 +627,15 @@ $(document).ready(function(){
|
626
|
627
|
|
627
|
628
|
// Annulation d'un formulaire de modification d'élément
|
628
|
629
|
$('form.edit_element input.cancel_edit').live('click', function(){
|
629
|
|
- var li = $(this).parent('form').parent('li');
|
|
630
|
+ var li = link.parents('li.element');
|
630
|
631
|
li.html(elements_edited[li.attr('id')]);
|
631
|
632
|
delete(elements_edited[li.attr('id')]);
|
632
|
633
|
});
|
633
|
634
|
|
634
|
635
|
////////////////// TAG PROMPT ///////////////
|
635
|
636
|
|
636
|
|
- ajax_query_timestamp = null;
|
637
|
|
- tag_text_help = $('input.tag_text_help').val();
|
|
637
|
+ var ajax_query_timestamp = null;
|
|
638
|
+ var tag_text_help = $('input.tag_text_help').val();
|
638
|
639
|
|
639
|
640
|
// Les deux clicks ci-dessous permettent de faire disparaitre
|
640
|
641
|
// la div de tags lorsque l'on clique ailleurs
|
|
@@ -657,16 +658,16 @@ $(document).ready(function(){
|
657
|
658
|
{
|
658
|
659
|
|
659
|
660
|
// on met en variable l'input
|
660
|
|
- inputTag = input;
|
|
661
|
+ var inputTag = input;
|
661
|
662
|
|
662
|
663
|
// On récupére la div de tags
|
663
|
|
- divtags = $("#search_tag_"+form_name);
|
|
664
|
+ var divtags = $("#search_tag_"+form_name);
|
664
|
665
|
|
665
|
666
|
// Si la fenêtre de tags est caché
|
666
|
667
|
if (!divtags.is(':visible'))
|
667
|
668
|
{
|
668
|
669
|
// On la replace
|
669
|
|
- position = input.position();
|
|
670
|
+ var position = input.position();
|
670
|
671
|
divtags.css('left', Math.round(position.left) + 5);
|
671
|
672
|
divtags.css('top', Math.round(position.top) + 28);
|
672
|
673
|
// Et on l'affiche
|
|
@@ -675,12 +676,12 @@ $(document).ready(function(){
|
675
|
676
|
// On affiche le loader
|
676
|
677
|
$('#tag_loader_'+form_name).show();
|
677
|
678
|
// On cache la liste de tags
|
678
|
|
- search_tag_list = divtags.find('ul.search_tag_list');
|
|
679
|
+ var search_tag_list = divtags.find('ul.search_tag_list');
|
679
|
680
|
// On supprime les anciens li
|
680
|
681
|
search_tag_list.find('li').remove();
|
681
|
682
|
search_tag_list.hide();
|
682
|
683
|
// Et on affiche une info
|
683
|
|
- span_info = divtags.find('span.info');
|
|
684
|
+ var span_info = divtags.find('span.info');
|
684
|
685
|
span_info.show();
|
685
|
686
|
// TODO: multilingue !
|
686
|
687
|
span_info.text("Recherche des tags correspondants à \""+input.val()+"\" ...");
|
|
@@ -690,7 +691,7 @@ $(document).ready(function(){
|
690
|
691
|
|
691
|
692
|
// On récupère le timestamp pour reconnaitre la dernière requête effectué
|
692
|
693
|
ajax_query_timestamp = new Date().getTime();
|
693
|
|
-
|
|
694
|
+
|
694
|
695
|
// Récupération des tags correspondants
|
695
|
696
|
$.getJSON(url_search_tag+'/'+input.val()+'/'+ajax_query_timestamp, function(data) {
|
696
|
697
|
if (data.status == 'mustbeconnected')
|
|
@@ -702,8 +703,8 @@ $(document).ready(function(){
|
702
|
703
|
// ajax a été faite depuis.
|
703
|
704
|
if (data.timestamp == ajax_query_timestamp)
|
704
|
705
|
{
|
705
|
|
- status = data.status;
|
706
|
|
- tags = data.data;
|
|
706
|
+ var status = data.status;
|
|
707
|
+ var tags = data.data;
|
707
|
708
|
|
708
|
709
|
// Si on spécifie une erreur
|
709
|
710
|
if (status == 'error')
|
|
@@ -716,7 +717,7 @@ $(document).ready(function(){
|
716
|
717
|
{
|
717
|
718
|
if (tags.length > 0)
|
718
|
719
|
{
|
719
|
|
- more = false;
|
|
720
|
+ var more = false;
|
720
|
721
|
// Pour chaque tags retournés
|
721
|
722
|
for (i in tags)
|
722
|
723
|
{
|
|
@@ -725,24 +726,25 @@ $(document).ready(function(){
|
725
|
726
|
var t_string = tag_name
|
726
|
727
|
// On construit un li
|
727
|
728
|
|
728
|
|
- r_string = $.trim(input.val());
|
|
729
|
+ var r_string = $.trim(input.val());
|
729
|
730
|
var re = new RegExp(r_string, "i");
|
730
|
731
|
t_string = t_string.replace(re,"<strong>" + r_string + "</strong>");
|
731
|
732
|
|
732
|
733
|
|
733
|
|
- li_tag =
|
|
734
|
+ var li_tag =
|
734
|
735
|
$('<li>').append(
|
735
|
|
- $('<a>').attr('href','#'+tag_id+'#'+tag_name)
|
|
736
|
+ $('<a>').attr('id','searched_tag_'+tag_id+'_'+tag_name)
|
|
737
|
+ .attr('href', '#')
|
736
|
738
|
// qui réagit quand on clique dessus
|
737
|
739
|
.click(function(e){
|
738
|
740
|
// On récupère le nom du tag
|
739
|
|
- name = $(this).attr('href').substr(1,$(this).attr('href').length);
|
740
|
|
- name = name.substr(strpos(name, '#')+1, name.length);
|
741
|
|
-
|
742
|
|
- id = $(this).attr('href').substr(1,$(this).attr('href').length);
|
|
741
|
+ var name = $(this).attr('id').substr(13,$(this).attr('id').length);
|
|
742
|
+ name = name.substr(strpos(name, '_')+1, name.length);
|
|
743
|
+
|
|
744
|
+ var id = $(this).attr('id').substr(13,$(this).attr('id').length);
|
743
|
745
|
id = str_replace(name, '', id);
|
744
|
|
- id = str_replace('#', '', id);
|
745
|
|
-
|
|
746
|
+ id = str_replace('_', '', id);
|
|
747
|
+
|
746
|
748
|
$('input#tags_selected_tag_'+form_name).val(id);
|
747
|
749
|
inputTag.val(name);
|
748
|
750
|
// Et on execute l'évènement selectTag de l'input
|
|
@@ -793,7 +795,7 @@ $(document).ready(function(){
|
793
|
795
|
if (!data.same_found)
|
794
|
796
|
{
|
795
|
797
|
// Cette variable nous permettra de stocker le lien nouveau tag
|
796
|
|
- link_add_tag = null;
|
|
798
|
+ var link_add_tag = null;
|
797
|
799
|
|
798
|
800
|
li_tag =
|
799
|
801
|
$('<li>').addClass('new').append(
|
|
@@ -810,7 +812,7 @@ $(document).ready(function(){
|
810
|
812
|
link_add_tag = $(this);
|
811
|
813
|
|
812
|
814
|
// En premier lieux on fait apparaître la fenêtre de confirmation
|
813
|
|
- popup = $('<div>')
|
|
815
|
+ var popup = $('<div>')
|
814
|
816
|
.attr('id', 'add_tag')
|
815
|
817
|
.addClass('popin_block')
|
816
|
818
|
.css('width', '400px')
|
|
@@ -846,10 +848,10 @@ $(document).ready(function(){
|
846
|
848
|
$('#add_tag').remove();
|
847
|
849
|
|
848
|
850
|
// On récupère le nom du tag
|
849
|
|
- name = link_add_tag.attr('href').substr(1,link_add_tag.attr('href').length);
|
|
851
|
+ var name = link_add_tag.attr('href').substr(1,link_add_tag.attr('href').length);
|
850
|
852
|
name = name.substr(strpos(name, '#')+1, name.length);
|
851
|
853
|
|
852
|
|
- link_add_tag.parent('li').parent('ul').parent('div').find('img.tag_loader').show();
|
|
854
|
+ link_add_tag.parents('div.search_tag_list').find('img.tag_loader').show();
|
853
|
855
|
|
854
|
856
|
var url;
|
855
|
857
|
if (arguments)
|
|
@@ -869,8 +871,8 @@ $(document).ready(function(){
|
869
|
871
|
$(location).attr('href', url_index);
|
870
|
872
|
}
|
871
|
873
|
|
872
|
|
- tag_id = response.tag_id;
|
873
|
|
- tag_name = response.tag_name;
|
|
874
|
+ var tag_id = response.tag_id;
|
|
875
|
+ var tag_name = response.tag_name;
|
874
|
876
|
|
875
|
877
|
$('input#tags_selected_tag_'+form_name).val(tag_id);
|
876
|
878
|
inputTag.val(tag_name);
|
|
@@ -880,7 +882,7 @@ $(document).ready(function(){
|
880
|
882
|
divtags.hide();
|
881
|
883
|
inputTag.val(tag_text_help);
|
882
|
884
|
|
883
|
|
- link_add_tag.parent('li').parent('ul').parent('div').find('img.tag_loader').hide();
|
|
885
|
+ link_add_tag.parents('div.search_tag_list').find('img.tag_loader').hide();
|
884
|
886
|
});
|
885
|
887
|
|
886
|
888
|
return false;
|
|
@@ -922,7 +924,7 @@ $(document).ready(function(){
|
922
|
924
|
}
|
923
|
925
|
|
924
|
926
|
|
925
|
|
- last_keypress = 0;
|
|
927
|
+ var last_keypress = 0;
|
926
|
928
|
|
927
|
929
|
function check_timelaps_and_search(input, form_name, time_id, timed, info)
|
928
|
930
|
{
|
|
@@ -965,9 +967,7 @@ $(document).ready(function(){
|
965
|
967
|
// Autocompletion de tags
|
966
|
968
|
$("div.tags_prompt ul.tagbox li.input input").live('keypress', function(e){
|
967
|
969
|
|
968
|
|
- var form_name = $(this).parent('li').parent('ul.tagbox')
|
969
|
|
- .parent('div.tags_prompt').parent('form').attr('name')
|
970
|
|
- ;
|
|
970
|
+ var form_name = $(this).parents('form').attr('name');
|
971
|
971
|
var code = (e.keyCode ? e.keyCode : e.which);
|
972
|
972
|
|
973
|
973
|
if ((e.which !== 0 && e.charCode !== 0) || (code == 8 || code == 46))
|
|
@@ -1006,7 +1006,7 @@ $(document).ready(function(){
|
1006
|
1006
|
|
1007
|
1007
|
// Selection Réseau global / Mon réseau
|
1008
|
1008
|
$('div.select_network a').live('click', function(){
|
1009
|
|
- divSelect = $(this).parent('div');
|
|
1009
|
+ var divSelect = $(this).parent('div');
|
1010
|
1010
|
if ($(this).hasClass('all_network'))
|
1011
|
1011
|
{
|
1012
|
1012
|
divSelect.find('a.all_network').addClass('active');
|
|
@@ -1075,7 +1075,7 @@ $(document).ready(function(){
|
1075
|
1075
|
else if (response.status == 'error')
|
1076
|
1076
|
{
|
1077
|
1077
|
$('form[name="add"]').find('ul.error_list').remove();
|
1078
|
|
- ul_errors = $('<ul>').addClass('error_list');
|
|
1078
|
+ var ul_errors = $('<ul>').addClass('error_list');
|
1079
|
1079
|
|
1080
|
1080
|
for (i in response.errors)
|
1081
|
1081
|
{
|
|
@@ -1092,6 +1092,7 @@ $(document).ready(function(){
|
1092
|
1092
|
// TODO.
|
1093
|
1093
|
|
1094
|
1094
|
/////////////////////
|
|
1095
|
+ var tags_ids_for_filter = new Array();
|
1095
|
1096
|
// Filtre par tags (show, favorite)
|
1096
|
1097
|
function refresh_elements_with_tags_selected(link)
|
1097
|
1098
|
{
|
|
@@ -1101,7 +1102,7 @@ $(document).ready(function(){
|
1101
|
1102
|
$('ul.elements').html('');
|
1102
|
1103
|
$('div.no_elements').hide();
|
1103
|
1104
|
$('img.elements_more_loader').show();
|
1104
|
|
- $.getJSON($('input#get_elements_url').val()+'/'+array2json(tags_ids), function(response){
|
|
1105
|
+ $.getJSON($('input#get_elements_url').val()+'/'+array2json(tags_ids_for_filter), function(response){
|
1105
|
1106
|
|
1106
|
1107
|
if (response.status == 'mustbeconnected')
|
1107
|
1108
|
{
|
|
@@ -1139,15 +1140,15 @@ $(document).ready(function(){
|
1139
|
1140
|
}
|
1140
|
1141
|
|
1141
|
1142
|
// On construit notre liste de tags
|
1142
|
|
- tags_ids = new Array();
|
|
1143
|
+ tags_ids_for_filter = new Array();
|
1143
|
1144
|
$('ul#favorite_tags a.tag.active').each(function(index){
|
1144
|
|
- id = str_replace('#', '', $(this).attr('href'));
|
1145
|
|
- tags_ids[id] = id;
|
|
1145
|
+ var id = str_replace('filtering_tag_', '', $(this).attr('id'));
|
|
1146
|
+ tags_ids_for_filter[id] = id;
|
1146
|
1147
|
});
|
1147
|
1148
|
|
1148
|
1149
|
// On adapte le lien afficher plus de résultats
|
1149
|
|
- a_more = $('a.elements_more');
|
1150
|
|
- a_more.attr('href', $('input#more_elements_url').val()+'/'+array2json(tags_ids));
|
|
1150
|
+ var a_more = $('a.elements_more');
|
|
1151
|
+ a_more.attr('href', $('input#more_elements_url').val()+'/'+array2json(tags_ids_for_filter));
|
1151
|
1152
|
|
1152
|
1153
|
return check_timelaps_and_find_with_tags(link, new Date().getTime(), false);
|
1153
|
1154
|
}
|
|
@@ -1200,7 +1201,7 @@ $(document).ready(function(){
|
1200
|
1201
|
////////////////////////////////////////
|
1201
|
1202
|
/// Gestion de nouveaux éléments
|
1202
|
1203
|
|
1203
|
|
- do_check_new_elements = false;
|
|
1204
|
+ var do_check_new_elements = false;
|
1204
|
1205
|
|
1205
|
1206
|
function check_new_elements()
|
1206
|
1207
|
{
|
|
@@ -1220,7 +1221,7 @@ $(document).ready(function(){
|
1220
|
1221
|
+str_replace('element_', '', $('ul.elements li:first').attr('id'))
|
1221
|
1222
|
;
|
1222
|
1223
|
$.getJSON(url, function(response){
|
1223
|
|
-
|
|
1224
|
+
|
1224
|
1225
|
if (response.status == 'mustbeconnected')
|
1225
|
1226
|
{
|
1226
|
1227
|
$(location).attr('href', url_index);
|
|
@@ -1313,19 +1314,11 @@ $(document).ready(function(){
|
1313
|
1314
|
|
1314
|
1315
|
// Afficher les commentaires
|
1315
|
1316
|
$('td.element_content a.display_comments').live('click', function(){
|
1316
|
|
- display_comments(
|
1317
|
|
- $('li#element_'+
|
1318
|
|
- str_replace('#comments_', '', $(this).attr('href'))
|
1319
|
|
- )
|
1320
|
|
- );
|
|
1317
|
+ display_comments($(this).parents('li.element'));
|
1321
|
1318
|
});
|
1322
|
1319
|
|
1323
|
1320
|
$('td.element_content a.hide_comments').live('click', function(){
|
1324
|
|
- hide_comments(
|
1325
|
|
- $('li#element_'+
|
1326
|
|
- str_replace('#hide_comments_', '', $(this).attr('href'))
|
1327
|
|
- )
|
1328
|
|
- );
|
|
1321
|
+ hide_comments($(this).parents('li.element'));
|
1329
|
1322
|
});
|
1330
|
1323
|
|
1331
|
1324
|
function display_comments(li_element)
|
|
@@ -1344,13 +1337,11 @@ $(document).ready(function(){
|
1344
|
1337
|
|
1345
|
1338
|
// Ajouter un commentaire
|
1346
|
1339
|
$('li.element a.add_comment').live('click', function(){
|
1347
|
|
- display_add_comment($('li#element_'+
|
1348
|
|
- str_replace('#add_comment_', '', $(this).attr('href'))
|
1349
|
|
- ));
|
|
1340
|
+ display_add_comment($(this).parents('li.element'));
|
1350
|
1341
|
});
|
1351
|
1342
|
|
1352
|
1343
|
$('form.add_comment input[type="submit"]').live('click', function(){
|
1353
|
|
- $(this).parent('div').parent('form').parent('div.comments').find('img.comments_loader').show();
|
|
1344
|
+ $(this).parents('div.comments').find('img.comments_loader').show();
|
1354
|
1345
|
});
|
1355
|
1346
|
|
1356
|
1347
|
function display_add_comment(li_element)
|
|
@@ -1376,7 +1367,7 @@ $(document).ready(function(){
|
1376
|
1367
|
else if (response.status == 'error')
|
1377
|
1368
|
{
|
1378
|
1369
|
li_element.find('form.add_comment').find('ul.error_list').remove();
|
1379
|
|
- ul_errors = $('<ul>').addClass('error_list');
|
|
1370
|
+ var ul_errors = $('<ul>').addClass('error_list');
|
1380
|
1371
|
|
1381
|
1372
|
for (i in response.errors)
|
1382
|
1373
|
{
|
|
@@ -1392,7 +1383,7 @@ $(document).ready(function(){
|
1392
|
1383
|
}
|
1393
|
1384
|
|
1394
|
1385
|
$('form.add_comment input.cancel').live('click', function(){
|
1395
|
|
- li_element = $(this).parent('div').parent('form').parent('div.comments').parent('li.element');
|
|
1386
|
+ var li_element = $(this).parents('li.element');
|
1396
|
1387
|
hide_add_comment(li_element);
|
1397
|
1388
|
});
|
1398
|
1389
|
|
|
@@ -1434,7 +1425,7 @@ $(document).ready(function(){
|
1434
|
1425
|
cancelAnswer : string_comment_delete_confirm_no,
|
1435
|
1426
|
onYes: function(link){
|
1436
|
1427
|
|
1437
|
|
- li = link.parent('li.comment');
|
|
1428
|
+ var li = link.parents('li.comment');
|
1438
|
1429
|
li.find('img.comment_loader').show();
|
1439
|
1430
|
|
1440
|
1431
|
$.getJSON(link.attr('href'), function(response){
|
|
@@ -1455,12 +1446,12 @@ $(document).ready(function(){
|
1455
|
1446
|
return false;
|
1456
|
1447
|
},
|
1457
|
1448
|
onOpen: function(link){
|
1458
|
|
- li = link.parent('li.comment');
|
|
1449
|
+ var li = link.parents('li.comment');
|
1459
|
1450
|
li.find('a.comment_edit_link').addClass('mustBeDisplayed');
|
1460
|
1451
|
li.find('a.comment_remove_link').addClass('mustBeDisplayed');
|
1461
|
1452
|
},
|
1462
|
1453
|
onClose: function(link){
|
1463
|
|
- li = link.parent('li.comment');
|
|
1454
|
+ var li = link.parents('li.comment');
|
1464
|
1455
|
li.find('a.comment_edit_link').removeClass('mustBeDisplayed');
|
1465
|
1456
|
li.find('a.comment_remove_link').removeClass('mustBeDisplayed');
|
1466
|
1457
|
li.find('a.comment_edit_link').hide();
|
|
@@ -1468,17 +1459,17 @@ $(document).ready(function(){
|
1468
|
1459
|
}
|
1469
|
1460
|
});
|
1470
|
1461
|
|
1471
|
|
- comments_edited = new Array();
|
|
1462
|
+ var comments_edited = new Array();
|
1472
|
1463
|
|
1473
|
1464
|
// Modification
|
1474
|
1465
|
// Ouverture du formulaire de modification
|
1475
|
1466
|
$('a.comment_edit_link').live('click', function(){
|
1476
|
1467
|
|
1477
|
|
- link = $(this);
|
1478
|
|
- li = link.parent('li.comment');
|
|
1468
|
+ var link = $(this);
|
|
1469
|
+ var li = link.parents('li.comment');
|
1479
|
1470
|
// On garde en mémoire l'élément édité en cas d'annulation
|
1480
|
1471
|
comments_edited[li.attr('id')] = li.html();
|
1481
|
|
- loader = li.find('img.comment_loader');
|
|
1472
|
+ var loader = li.find('img.comment_loader');
|
1482
|
1473
|
li.html(loader);
|
1483
|
1474
|
li.find('img.comment_loader').show();
|
1484
|
1475
|
|
|
@@ -1492,7 +1483,7 @@ $(document).ready(function(){
|
1492
|
1483
|
li.html(response.html);
|
1493
|
1484
|
// On rend ce formulaire ajaxFormable
|
1494
|
1485
|
$('li#'+li.attr('id')+' form.edit_comment input[type="submit"]').live('click', function(){
|
1495
|
|
- li_current = $(this).parent('div').parent('form').parent('li');
|
|
1486
|
+ var li_current = $(this).parents('li.comment');
|
1496
|
1487
|
li_current.prepend(loader);
|
1497
|
1488
|
li_current.find('img.comment_loader').show();
|
1498
|
1489
|
});
|
|
@@ -1515,7 +1506,7 @@ $(document).ready(function(){
|
1515
|
1506
|
else if (response.status == 'error')
|
1516
|
1507
|
{
|
1517
|
1508
|
li.find('ul.error_list').remove();
|
1518
|
|
- ul_errors = $('<ul>').addClass('error_list');
|
|
1509
|
+ var ul_errors = $('<ul>').addClass('error_list');
|
1519
|
1510
|
|
1520
|
1511
|
for (i in response.errors)
|
1521
|
1512
|
{
|
|
@@ -1532,7 +1523,7 @@ $(document).ready(function(){
|
1532
|
1523
|
|
1533
|
1524
|
// Annulation d'un formulaire de modification d'un comment
|
1534
|
1525
|
$('form.edit_comment input.cancel').live('click', function(){
|
1535
|
|
- var li = $(this).parent('div').parent('form').parent('li');
|
|
1526
|
+ var li = $(this).parents('li.comment');
|
1536
|
1527
|
li.html(comments_edited[li.attr('id')]);
|
1537
|
1528
|
delete(comments_edited[li.attr('id')]);
|
1538
|
1529
|
});
|
|
@@ -1578,11 +1569,11 @@ $(document).ready(function(){
|
1578
|
1569
|
return false;
|
1579
|
1570
|
},
|
1580
|
1571
|
onOpen: function(link){
|
1581
|
|
- li = link.parent('li.element_tag');
|
|
1572
|
+ var li = link.parents('li.element_tag');
|
1582
|
1573
|
li.find('a.tag_to_favorites').addClass('mustBeDisplayed');
|
1583
|
1574
|
},
|
1584
|
1575
|
onClose: function(link){
|
1585
|
|
- li = link.parent('li.element_tag');
|
|
1576
|
+ var li = link.parents('li.element_tag');
|
1586
|
1577
|
li.find('a.tag_to_favorites').removeClass('mustBeDisplayed');
|
1587
|
1578
|
li.find('a.element_tag').removeClass('element_tag_large_for_fav');
|
1588
|
1579
|
li.find('a.tag_to_favorites').hide();
|
|
@@ -1595,12 +1586,12 @@ $(document).ready(function(){
|
1595
|
1586
|
|
1596
|
1587
|
$('a.added_element_add_to_group').live('click', function(){
|
1597
|
1588
|
|
1598
|
|
- div = $(this).parent('li').parent('ul').parent('div');
|
1599
|
|
- div.find('img.loader').show();
|
|
1589
|
+ var loader = $('div#added_element_to_group').find('img.loader');
|
|
1590
|
+ loader.show();
|
1600
|
1591
|
|
1601
|
1592
|
$.getJSON($(this).attr('href'), function(response) {
|
1602
|
1593
|
|
1603
|
|
- div.find('img.loader').hide();
|
|
1594
|
+ loader.hide();
|
1604
|
1595
|
|
1605
|
1596
|
if (response.status == 'mustbeconnected')
|
1606
|
1597
|
{
|
|
@@ -1660,8 +1651,8 @@ $(document).ready(function(){
|
1660
|
1651
|
|
1661
|
1652
|
$('li.element a.vote').live('click', function(){
|
1662
|
1653
|
|
1663
|
|
- img = $(this).find('img');
|
1664
|
|
- link = $(this);
|
|
1654
|
+ var img = $(this).find('img');
|
|
1655
|
+ var link = $(this);
|
1665
|
1656
|
img.attr('src', url_img_ajax_loader);
|
1666
|
1657
|
|
1667
|
1658
|
$.getJSON(link.attr('href'), function(response){
|
|
@@ -1675,7 +1666,7 @@ $(document).ready(function(){
|
1675
|
1666
|
{
|
1676
|
1667
|
link.attr('href', response.data.a.href);
|
1677
|
1668
|
img.attr('src', response.data.img.src);
|
1678
|
|
- link.parent('li').parent('ul').find('li.score span.score').html(response.data.element.points);
|
|
1669
|
+ link.parents('td.right').find('li.score span.score').html(response.data.element.points);
|
1679
|
1670
|
}
|
1680
|
1671
|
|
1681
|
1672
|
});
|
|
@@ -1689,7 +1680,7 @@ $(document).ready(function(){
|
1689
|
1680
|
|
1690
|
1681
|
$('img.elements_more_loader').show();
|
1691
|
1682
|
$('ul.elements').html('');
|
1692
|
|
- link = $(this);
|
|
1683
|
+ var link = $(this);
|
1693
|
1684
|
|
1694
|
1685
|
$.getJSON(link.attr('href'), function(response){
|
1695
|
1686
|
|
|
@@ -1720,8 +1711,8 @@ $(document).ready(function(){
|
1720
|
1711
|
// Ouverture du formulaire de modification
|
1721
|
1712
|
$('a.element_propose_tags').live('click', function(){
|
1722
|
1713
|
|
1723
|
|
- link = $(this);
|
1724
|
|
- li = link.parent('td').parent('tr').parent().parent().parent('li.element');
|
|
1714
|
+ var link = $(this);
|
|
1715
|
+ var li = link.parents('li.element');
|
1725
|
1716
|
|
1726
|
1717
|
li.find('img.element_loader').show();
|
1727
|
1718
|
|
|
@@ -1738,7 +1729,7 @@ $(document).ready(function(){
|
1738
|
1729
|
{
|
1739
|
1730
|
|
1740
|
1731
|
// On prépare le tagBox
|
1741
|
|
- table = li.find('table:first');
|
|
1732
|
+ var table = li.find('table:first');
|
1742
|
1733
|
li.find('div.tag_proposition').remove();
|
1743
|
1734
|
table.after(response.html);
|
1744
|
1735
|
|
|
@@ -1755,7 +1746,7 @@ $(document).ready(function(){
|
1755
|
1746
|
|
1756
|
1747
|
// On rend ce formulaire ajaxFormable
|
1757
|
1748
|
$('form[name="'+response.form_name+'"] input[type="submit"]').live('click', function(){
|
1758
|
|
- li = $(this).parent('form').parent('div').parent('li');
|
|
1749
|
+ li = $(this).parents('li.element');
|
1759
|
1750
|
li.find('img.element_loader').show();
|
1760
|
1751
|
});
|
1761
|
1752
|
$('form[name="'+response.form_name+'"]').ajaxForm(function(response){
|
|
@@ -1776,7 +1767,7 @@ $(document).ready(function(){
|
1776
|
1767
|
{
|
1777
|
1768
|
li.find('img.element_loader').hide();
|
1778
|
1769
|
li.find('ul.error_list').remove();
|
1779
|
|
- ul_errors = $('<ul>').addClass('error_list');
|
|
1770
|
+ var ul_errors = $('<ul>').addClass('error_list');
|
1780
|
1771
|
|
1781
|
1772
|
for (i in response.errors)
|
1782
|
1773
|
{
|
|
@@ -1795,13 +1786,13 @@ $(document).ready(function(){
|
1795
|
1786
|
|
1796
|
1787
|
// Annulation d'un formulaire de modification d'élément
|
1797
|
1788
|
$('div.tag_proposition input.cancel').live('click', function(){
|
1798
|
|
- $(this).parent('form').parent('div').slideUp();
|
|
1789
|
+ $(this).parents('div.tag_proposition').slideUp();
|
1799
|
1790
|
});
|
1800
|
1791
|
|
1801
|
1792
|
$('a.element_view_propositions_link').live('click', function(){
|
1802
|
1793
|
|
1803
|
|
- link = $(this);
|
1804
|
|
- li = link.parent('td').parent('tr').parent().parent().parent('li.element');
|
|
1794
|
+ var link = $(this);
|
|
1795
|
+ li = link.parents('li.element');
|
1805
|
1796
|
|
1806
|
1797
|
li.find('img.element_loader').show();
|
1807
|
1798
|
|
|
@@ -1816,7 +1807,7 @@ $(document).ready(function(){
|
1816
|
1807
|
|
1817
|
1808
|
if (response.status == 'success')
|
1818
|
1809
|
{
|
1819
|
|
- table = li.find('table:first');
|
|
1810
|
+ var table = li.find('table:first');
|
1820
|
1811
|
li.find('div.tags_proposition_view').remove();
|
1821
|
1812
|
table.after(response.html);
|
1822
|
1813
|
}
|
|
@@ -1827,9 +1818,8 @@ $(document).ready(function(){
|
1827
|
1818
|
|
1828
|
1819
|
$('a.accept_tag_propotision').live('click', function(){
|
1829
|
1820
|
|
1830
|
|
- link = $(this);
|
1831
|
|
- li = link.parent('li.tag_proposition').parent('ul.tag_propositions')
|
1832
|
|
- .parent('div.tags_proposition_view').parent('li.element');
|
|
1821
|
+ var link = $(this);
|
|
1822
|
+ var li = link.parents('li.element');
|
1833
|
1823
|
|
1834
|
1824
|
li.find('img.element_loader').show();
|
1835
|
1825
|
|
|
@@ -1854,8 +1844,8 @@ $(document).ready(function(){
|
1854
|
1844
|
//
|
1855
|
1845
|
$('a.refuse_tag_propositions').live('click', function(){
|
1856
|
1846
|
|
1857
|
|
- link = $(this);
|
1858
|
|
- li = link.parent('div.tags_proposition_view').parent('li.element');
|
|
1847
|
+ var link = $(this);
|
|
1848
|
+ var li = link.parents('li.element');
|
1859
|
1849
|
|
1860
|
1850
|
li.find('img.element_loader').show();
|
1861
|
1851
|
|