|
@@ -23,7 +23,7 @@ function hideAllMessages()
|
23
|
23
|
|
24
|
24
|
function ResponseController()
|
25
|
25
|
{
|
26
|
|
- var propagate = function(response)
|
|
26
|
+ var propagate = function(response, after_login_success_callback)
|
27
|
27
|
{
|
28
|
28
|
if (response.status === 'error')
|
29
|
29
|
{
|
|
@@ -35,18 +35,19 @@ function ResponseController()
|
35
|
35
|
}
|
36
|
36
|
else if (response.error === 'UserNotConnected')
|
37
|
37
|
{
|
38
|
|
- open_connection_or_subscription_window();
|
|
38
|
+ open_connection_or_subscription_window(false, {}, after_login_success_callback);
|
39
|
39
|
}
|
40
|
40
|
}
|
41
|
41
|
else if (response.status === 'mustbeconnected')
|
42
|
42
|
{
|
43
|
|
- open_connection_or_subscription_window(true);
|
|
43
|
+ open_connection_or_subscription_window(true, {}, after_login_success_callback);
|
44
|
44
|
}
|
45
|
|
- }
|
|
45
|
+ };
|
46
|
46
|
|
47
|
|
- this.execute = function(response, success_callback, failure_callback)
|
|
47
|
+ this.execute = function(response, success_callback, failure_callback, after_login_success_callback)
|
48
|
48
|
{
|
49
|
|
- propagate(response);
|
|
49
|
+ propagate(response, after_login_success_callback);
|
|
50
|
+
|
50
|
51
|
if (response.status === 'success')
|
51
|
52
|
{
|
52
|
53
|
success_callback(response);
|
|
@@ -55,7 +56,7 @@ function ResponseController()
|
55
|
56
|
{
|
56
|
57
|
failure_callback(response);
|
57
|
58
|
}
|
58
|
|
- }
|
|
59
|
+ };
|
59
|
60
|
}
|
60
|
61
|
|
61
|
62
|
window.ResponseController = new ResponseController();
|
|
@@ -635,6 +636,8 @@ $(document).ready(function(){
|
635
|
636
|
if (response.count)
|
636
|
637
|
{
|
637
|
638
|
$('ul.elements').append(response.html);
|
|
639
|
+ refresh_social_buttons();
|
|
640
|
+
|
638
|
641
|
$('img.elements_more_loader').hide();
|
639
|
642
|
recolorize_element_list();
|
640
|
643
|
|
|
@@ -685,6 +688,7 @@ $(document).ready(function(){
|
685
|
688
|
);
|
686
|
689
|
|
687
|
690
|
$('ul.elements').html(response.html);
|
|
691
|
+ refresh_social_buttons();
|
688
|
692
|
|
689
|
693
|
if (response.count)
|
690
|
694
|
{
|
|
@@ -1252,7 +1256,7 @@ $(document).ready(function(){
|
1252
|
1256
|
});
|
1253
|
1257
|
|
1254
|
1258
|
// Selection Réseau global / Mon réseau
|
1255
|
|
- $('a.all_network, a.my_network').live('click', function(){
|
|
1259
|
+ $('ul#tabs_tag_search_buttons a.all_network, ul#tabs_tag_search_buttons a.my_network').live('click', function(){
|
1256
|
1260
|
|
1257
|
1261
|
if ($('form[name="search"]').length)
|
1258
|
1262
|
{
|
|
@@ -1282,6 +1286,7 @@ $(document).ready(function(){
|
1282
|
1286
|
{
|
1283
|
1287
|
$('form[name="add"]').find('ul.error_list').remove();
|
1284
|
1288
|
$('ul.elements').prepend(response.html);
|
|
1289
|
+ refresh_social_buttons();
|
1285
|
1290
|
$('form[name="add"] input[type="text"]').val('');
|
1286
|
1291
|
|
1287
|
1292
|
if ($('form[name="search"]').length)
|
|
@@ -1320,6 +1325,17 @@ $(document).ready(function(){
|
1320
|
1325
|
|
1321
|
1326
|
form_add_hide_errors();
|
1322
|
1327
|
|
|
1328
|
+ // Dans le cas d'un ajout depuis l'extérieur (iframe)
|
|
1329
|
+ if ($('form[name="add"] input[name="shared_from"]').val() === "1")
|
|
1330
|
+ {
|
|
1331
|
+ var elements = $('<ul class="elements"></ul>')
|
|
1332
|
+ elements.prepend(response.html);
|
|
1333
|
+ $('div#share_from_content').append(elements);
|
|
1334
|
+ $('div#share_from_message').text(response.message);
|
|
1335
|
+ $('form[name="add"]').append($('<input type="hidden" name="shared_from_finished" id="shared_from_finished" value="1" />'));
|
|
1336
|
+ refresh_social_buttons();
|
|
1337
|
+ }
|
|
1338
|
+
|
1323
|
1339
|
return true;
|
1324
|
1340
|
}
|
1325
|
1341
|
else if (response.status == 'error')
|
|
@@ -1540,11 +1556,25 @@ $(document).ready(function(){
|
1540
|
1556
|
});
|
1541
|
1557
|
$('form[name="add"]').ajaxForm(function(response) {
|
1542
|
1558
|
|
|
1559
|
+ var callback_login = function(){
|
|
1560
|
+ $('#form_add_loader').show();
|
|
1561
|
+ JQueryJson(url_csrf, {}, function(response){
|
|
1562
|
+ if (response.status == 'success')
|
|
1563
|
+ {
|
|
1564
|
+ $('form[name="add"] input[name="element_add[_token]"]').val(response.data);
|
|
1565
|
+ $('form[name="add"]').submit();
|
|
1566
|
+ $('#form_add_loader').hide();
|
|
1567
|
+ }
|
|
1568
|
+ });
|
|
1569
|
+ };
|
|
1570
|
+
|
|
1571
|
+
|
1543
|
1572
|
$('form[name="add"] img.tag_loader').hide();
|
1544
|
1573
|
window.ResponseController.execute(
|
1545
|
1574
|
response,
|
1546
|
1575
|
function(){},
|
1547
|
|
- function(){}
|
|
1576
|
+ function(){},
|
|
1577
|
+ callback_login
|
1548
|
1578
|
);
|
1549
|
1579
|
|
1550
|
1580
|
// Si on en est a la première étape la réponse sera des données récupérés auprès
|
|
@@ -1626,6 +1656,7 @@ $(document).ready(function(){
|
1626
|
1656
|
);
|
1627
|
1657
|
|
1628
|
1658
|
$('ul.elements').html(response.html);
|
|
1659
|
+ refresh_social_buttons();
|
1629
|
1660
|
|
1630
|
1661
|
if (response.count)
|
1631
|
1662
|
{
|
|
@@ -1732,7 +1763,7 @@ $(document).ready(function(){
|
1732
|
1763
|
|
1733
|
1764
|
function check_new_elements()
|
1734
|
1765
|
{
|
1735
|
|
- if ($('ul.elements li').length)
|
|
1766
|
+ if ($('ul.elements li').length && $('ul.elements').data('context') === 'home')
|
1736
|
1767
|
{
|
1737
|
1768
|
// Si l'utilisateur a quitté la page on reporte le check
|
1738
|
1769
|
if ($('body.blurred').length)
|
|
@@ -1832,6 +1863,7 @@ $(document).ready(function(){
|
1832
|
1863
|
}
|
1833
|
1864
|
|
1834
|
1865
|
$('ul.elements').prepend(response.html);
|
|
1866
|
+ refresh_social_buttons();
|
1835
|
1867
|
recolorize_element_list();
|
1836
|
1868
|
}
|
1837
|
1869
|
|
|
@@ -1939,10 +1971,23 @@ $(document).ready(function(){
|
1939
|
1971
|
li_element.find('form.add_comment').show();
|
1940
|
1972
|
|
1941
|
1973
|
li_element.find('form.add_comment').ajaxForm(function(response) {
|
|
1974
|
+
|
1942
|
1975
|
window.ResponseController.execute(
|
1943
|
1976
|
response,
|
1944
|
1977
|
function(){},
|
1945
|
|
- function(){}
|
|
1978
|
+ function(){},
|
|
1979
|
+ function(){
|
|
1980
|
+
|
|
1981
|
+ JQueryJson(url_csrf, {}, function(response){
|
|
1982
|
+ if (response.status === 'success')
|
|
1983
|
+ {
|
|
1984
|
+ li_element.find('form.add_comment').attr('action', str_replace('unknown', response.data, li_element.find('form.add_comment').attr('action')));
|
|
1985
|
+ li_element.find('form.add_comment').submit();
|
|
1986
|
+ }
|
|
1987
|
+ });
|
|
1988
|
+ scrollTo(li_element);
|
|
1989
|
+
|
|
1990
|
+ }
|
1946
|
1991
|
);
|
1947
|
1992
|
|
1948
|
1993
|
li_element.find('img.comments_loader').hide();
|
|
@@ -2159,6 +2204,7 @@ $(document).ready(function(){
|
2159
|
2204
|
});
|
2160
|
2205
|
|
2161
|
2206
|
$('div.question').fadeOut();
|
|
2207
|
+ $('a.tag_to_favorites').removeClass('mustBeDisplayed');
|
2162
|
2208
|
return false;
|
2163
|
2209
|
},
|
2164
|
2210
|
onOpen: function(link){
|
|
@@ -2166,10 +2212,7 @@ $(document).ready(function(){
|
2166
|
2212
|
li.find('a.tag_to_favorites').addClass('mustBeDisplayed');
|
2167
|
2213
|
},
|
2168
|
2214
|
onClose: function(link){
|
2169
|
|
- var li = link.parents('li.element_tag');
|
2170
|
|
- li.find('a.tag_to_favorites').removeClass('mustBeDisplayed');
|
2171
|
|
- li.find('a.element_tag').removeClass('element_tag_large_for_fav');
|
2172
|
|
- li.find('a.tag_to_favorites').hide();
|
|
2215
|
+ $('a.tag_to_favorites').removeClass('mustBeDisplayed');
|
2173
|
2216
|
}
|
2174
|
2217
|
});
|
2175
|
2218
|
|
|
@@ -2568,6 +2611,12 @@ $(document).ready(function(){
|
2568
|
2611
|
$(this).hide();
|
2569
|
2612
|
});
|
2570
|
2613
|
|
|
2614
|
+ $('a.display_all_cloud_tag').click(function(){
|
|
2615
|
+ $(this).parents('ul.tags_cloud').find('li').show();
|
|
2616
|
+ $(this).parent().remove();
|
|
2617
|
+ return false;
|
|
2618
|
+ });
|
|
2619
|
+
|
2571
|
2620
|
$('input#cloud_tags_filter').keyup(function(){
|
2572
|
2621
|
var search_string = $(this).val();
|
2573
|
2622
|
|
|
@@ -3009,7 +3058,9 @@ $(document).ready(function(){
|
3009
|
3058
|
* MUSTBECONNECTED links
|
3010
|
3059
|
*/
|
3011
|
3060
|
|
3012
|
|
- $('a.mustbeconnected').live('click', function(){open_connection_or_subscription_window();});
|
|
3061
|
+ $('a.mustbeconnected').live('click', function(){
|
|
3062
|
+ open_connection_or_subscription_window();
|
|
3063
|
+ });
|
3013
|
3064
|
$('a.mustbeconnected').off('click').on('click',function(){
|
3014
|
3065
|
open_connection_or_subscription_window();
|
3015
|
3066
|
});
|
|
@@ -3141,9 +3192,16 @@ $(document).ready(function(){
|
3141
|
3192
|
function(){}
|
3142
|
3193
|
);
|
3143
|
3194
|
|
|
3195
|
+ line.find('img.loader').hide();
|
3144
|
3196
|
if (response.status === 'success')
|
3145
|
3197
|
{
|
3146
|
3198
|
line.find('div.content_opened').html('<ul class="elements">' + response.data + '</ul>');
|
|
3199
|
+ refresh_social_buttons();
|
|
3200
|
+ }
|
|
3201
|
+ else
|
|
3202
|
+ if (response.status === 'error')
|
|
3203
|
+ {
|
|
3204
|
+ line.find('div.content_opened').html(response.message);
|
3147
|
3205
|
}
|
3148
|
3206
|
});
|
3149
|
3207
|
}
|
|
@@ -3271,7 +3329,17 @@ $(document).ready(function(){
|
3271
|
3329
|
$.getJSON(link.attr('href'), function(response) {
|
3272
|
3330
|
window.ResponseController.execute(
|
3273
|
3331
|
response,
|
3274
|
|
- function(){},
|
|
3332
|
+ function(response){
|
|
3333
|
+
|
|
3334
|
+ if (response.data.element_remove_links.length)
|
|
3335
|
+ {
|
|
3336
|
+ for (index in response.data.element_remove_links)
|
|
3337
|
+ {
|
|
3338
|
+ $($('ul.playlist_elements li.playlist_element').get(index)).find('a.remove_element').attr('href', response.data.element_remove_links[index]);
|
|
3339
|
+ }
|
|
3340
|
+ }
|
|
3341
|
+
|
|
3342
|
+ },
|
3275
|
3343
|
function(){}
|
3276
|
3344
|
);
|
3277
|
3345
|
});
|
|
@@ -3318,8 +3386,56 @@ $(document).ready(function(){
|
3318
|
3386
|
window.sidebar_topsticked = true;
|
3319
|
3387
|
}
|
3320
|
3388
|
|
|
3389
|
+ /*
|
|
3390
|
+ * Playlist private links lien privés
|
|
3391
|
+ *
|
|
3392
|
+ */
|
|
3393
|
+
|
|
3394
|
+ $('a.open_playlist_private_links').click(function(){
|
|
3395
|
+ $('div.private_links').slideDown();
|
|
3396
|
+ });
|
|
3397
|
+
|
|
3398
|
+ $('div.private_links input.cancel').click(function(){
|
|
3399
|
+ $('div.private_links').slideUp();
|
|
3400
|
+ });
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+ /*
|
|
3404
|
+ * SOCIAL BUTTONS
|
|
3405
|
+ *
|
|
3406
|
+ */
|
|
3407
|
+
|
|
3408
|
+ refresh_social_buttons();
|
|
3409
|
+
|
3321
|
3410
|
});
|
3322
|
3411
|
|
|
3412
|
+var facebook_like_rendereds = new Array();
|
|
3413
|
+var facebook_like_rendereds_autoplay = new Array();
|
|
3414
|
+
|
|
3415
|
+function refresh_social_buttons(autoplay)
|
|
3416
|
+{
|
|
3417
|
+ proceed_facebook_like_buttons(autoplay);
|
|
3418
|
+ gapi.plusone.go();
|
|
3419
|
+ twttr.widgets.load();
|
|
3420
|
+}
|
|
3421
|
+
|
|
3422
|
+function proceed_facebook_like_buttons(autoplay)
|
|
3423
|
+{
|
|
3424
|
+ $('ul.elements li.element, ul#autoplay_element li.element').each(function(){
|
|
3425
|
+
|
|
3426
|
+ if ( ($.inArray($(this).get(0), facebook_like_rendereds) === -1 && !autoplay) || ($.inArray($(this).get(0), facebook_like_rendereds_autoplay) === -1 && autoplay))
|
|
3427
|
+ {
|
|
3428
|
+ FB.XFBML.parse($(this).get(0));
|
|
3429
|
+ }
|
|
3430
|
+
|
|
3431
|
+ if (!autoplay)
|
|
3432
|
+ facebook_like_rendereds.push($(this).get(0));
|
|
3433
|
+ if (autoplay)
|
|
3434
|
+ facebook_like_rendereds_autoplay.push($(this).get(0));
|
|
3435
|
+ });
|
|
3436
|
+
|
|
3437
|
+}
|
|
3438
|
+
|
3323
|
3439
|
function open_ajax_popin(url, callback, data)
|
3324
|
3440
|
{
|
3325
|
3441
|
if (!popin_opened)
|
|
@@ -3349,7 +3465,7 @@ function open_ajax_popin(url, callback, data)
|
3349
|
3465
|
}
|
3350
|
3466
|
}
|
3351
|
3467
|
|
3352
|
|
-function open_connection_or_subscription_window(open_login_part, data)
|
|
3468
|
+function open_connection_or_subscription_window(open_login_part, data, login_success_callback)
|
3353
|
3469
|
{
|
3354
|
3470
|
if (window_login_or_subscription_opened == false)
|
3355
|
3471
|
{
|
|
@@ -3378,7 +3494,16 @@ function open_connection_or_subscription_window(open_login_part, data)
|
3378
|
3494
|
$('div.login form').find('img.loader').hide();
|
3379
|
3495
|
if (response.status == 'success')
|
3380
|
3496
|
{
|
3381
|
|
- $(location).attr('href', response.data.redirect_url);
|
|
3497
|
+ if (login_success_callback)
|
|
3498
|
+ {
|
|
3499
|
+ $('a#helpbox_close').click();
|
|
3500
|
+ login_success_callback();
|
|
3501
|
+ reload_top_and_side();
|
|
3502
|
+ }
|
|
3503
|
+ else
|
|
3504
|
+ {
|
|
3505
|
+ $(location).attr('href', response.data.redirect_url);
|
|
3506
|
+ }
|
3382
|
3507
|
}
|
3383
|
3508
|
else if (response.status == 'error')
|
3384
|
3509
|
{
|
|
@@ -3395,7 +3520,16 @@ function open_connection_or_subscription_window(open_login_part, data)
|
3395
|
3520
|
$('div.register form.fos_user_registration_register').find('img.loader').hide();
|
3396
|
3521
|
if (response.status == 'success')
|
3397
|
3522
|
{
|
3398
|
|
- $(location).attr('href', url_home);
|
|
3523
|
+ if (login_success_callback)
|
|
3524
|
+ {
|
|
3525
|
+ $('a#helpbox_close').click();
|
|
3526
|
+ login_success_callback();
|
|
3527
|
+ reload_top_and_side();
|
|
3528
|
+ }
|
|
3529
|
+ else
|
|
3530
|
+ {
|
|
3531
|
+ $(location).attr('href', url_home);
|
|
3532
|
+ }
|
3399
|
3533
|
}
|
3400
|
3534
|
else if (response.status == 'error')
|
3401
|
3535
|
{
|
|
@@ -3408,6 +3542,8 @@ function open_connection_or_subscription_window(open_login_part, data)
|
3408
|
3542
|
|
3409
|
3543
|
}, data);
|
3410
|
3544
|
}
|
|
3545
|
+
|
|
3546
|
+ $('div.playlists_prompt').remove();
|
3411
|
3547
|
}
|
3412
|
3548
|
|
3413
|
3549
|
function close_popin()
|
|
@@ -3441,4 +3577,27 @@ function sidebar_fix_to_bottom_finish()
|
3441
|
3577
|
$('.sidebar').css('bottom', '')
|
3442
|
3578
|
});
|
3443
|
3579
|
}
|
|
3580
|
+}
|
|
3581
|
+
|
|
3582
|
+function reload_top_and_side()
|
|
3583
|
+{
|
|
3584
|
+ JQueryJson(url_reload_top_and_side, {}, function(response){
|
|
3585
|
+ if (response.status == 'success')
|
|
3586
|
+ {
|
|
3587
|
+ if ($('div#header'))
|
|
3588
|
+ {
|
|
3589
|
+ $('div#header').html(response.data.top);
|
|
3590
|
+ }
|
|
3591
|
+
|
|
3592
|
+ if ($('aside#sidebar div.sidebar'))
|
|
3593
|
+ {
|
|
3594
|
+ $('aside#sidebar div.sidebar').html(response.data.right);
|
|
3595
|
+ }
|
|
3596
|
+ }
|
|
3597
|
+ });
|
|
3598
|
+}
|
|
3599
|
+
|
|
3600
|
+function scrollTo(element)
|
|
3601
|
+{
|
|
3602
|
+ $('html, body').animate({ scrollTop: element.offset().top }, 'fast');
|
3444
|
3603
|
}
|