PageSourceSearch

https://lemuz.org/wp-content/themes/lemuz_wordpress_theme/js/scripts.js

js lemuz.org collected 2026-10-02 11:16:58 UTC 91,569 bytes, 2,318 lines download raw bytes

1function genererTemplateOeuvre(data) {
2    var template = _.template($('#template_oeuvre_details').html());
3    return template(data);
4}
5
6function injecterTemplateOeuvreDansDOM(html, data) {
7    $('.oeuvre-container').remove();
8    $('#content-oeuvre').append(html);
9    $('#content-oeuvre').css({'z-index': 99999});
10
11    $('body').append('<div id="overlay" style="z-index:99998;"></div>');
12    $('#overlay').fadeIn(100);
13    $('#content-oeuvre').fadeIn(100);
14    $('.oeuvre-container').fadeOut(100);
15    $('.oeuvre_' + data.id).fadeIn(100);
16}
17var $ = jQuery.noConflict();
18$(document).ready(function() {
19    $('.ssba img').each(function () {
20            this.style.setProperty( 'width', '34px', 'important' );
21        });
22
23    $('.scrollbar-outer').scrollbar({
24        "ignoreMobile": false,
25        "disableBodyScroll": true
26    });
27
28    $('#timeline').imagesLoaded( function() {
29        $('#timeline').isotope({
30            itemSelector: '.item-collection',
31            layoutMode: 'fitRows',
32            gutter: 17
33        });
34    });
35
36    $('#timeline-parrain').imagesLoaded( function() {
37        $('#timeline-parrain').isotope({
38            itemSelector: '.item-collection-parrain',
39            layoutMode: 'fitRows',
40            gutter: 17
41        });
42    });
43
44    $('#timeline-vote').imagesLoaded( function() {
45        $('#timeline-vote').isotope({
46            itemSelector: '.item-collection-container',
47            layoutMode: 'fitRows',
48            gutter: 17
49        });
50    });
51
52    $('#timeline-expo').imagesLoaded( function() {
53        $('#timeline-expo').isotope({
54            itemSelector: '.item-exposition',
55            layoutMode: 'fitRows',
56            gutter: 17
57        });
58    });
59
60    $('#sort-filters').change(function(){
61
62        $('#form_oeuvre_autoload input[name=orderby]').val($(this).val());
63
64        doAjaxFilters();
65    });
66
67    $('.themes-filtres').change(function(){
68        var data    = $('input[name="themes[]"]:checked').map(function(_, el) {
69            return $(el).val();
70        }).get();
71        $('#form_oeuvre_autoload input[name=themes]').val(JSON.stringify(data));
72
73        doAjaxFilters();
74    });
75
76    $('.techniques-filtres').change(function(){
77        var data    = $('input[name="techniques[]"]:checked').map(function(_, el) {
78            return $(el).val();
79        }).get();
80        $('#form_oeuvre_autoload input[name=techniques]').val(JSON.stringify(data));
81
82        doAjaxFilters();
83    });
84
85    function doAjaxFilters(){
86        $('#form_oeuvre_autoload input[name=offset]').val(0);
87
88        var json        = ajaxurl;
89        var template    = _.template($($('#form_oeuvre_autoload input[name=template]').val()).html());
90        var selector    = $($('#form_oeuvre_autoload input[name=selector]').val());
91        var request     = $.ajax({
92            url: json,
93            type: 'post',
94            dataType: 'json',
95            data: $('#form_oeuvre_autoload').serialize(),
96            beforeSend: function() {
97                $('.oeuvres-loader').addClass('load');
98            }
99        });
100        request.done(function(data) {
101            var oeuvres   = [];
102            data.oeuvres.forEach(function(item){
103                oeuvres.push(template(item));
104            });
105
106            selector.isotope('remove', $('.item-collection'));
107            selector.isotope( 'insert', $(oeuvres.join('')) );
108
109            selector.imagesLoaded( function() {
110                selector.isotope('layout');
111            });
112
113            console.log(data.total);
114            $('.collection-count span').html(data.total);
115            $('#form_oeuvre_autoload input[name=total]').val(data.total);
116            $('#form_oeuvre_autoload input[name=offset]').val($('#form_oeuvre_autoload input[name=paging]').val());
117
118            $('.oeuvres-loader').removeClass('load');
119            $('footer').waypoint('enable');
120        });
121        request.fail(function(jqXHR, textStatus) {
122            $('.oeuvres-loader').removeClass('load');
123            console.log('Error text : '+jqXHR.statusText+'\n'+textStatus)
124        });
125    }
126
127    // Accordion themes
128    /*$(function() {
129        $( "#accordion" ).accordion({
130            heightStyle: "content"
131        });
132    });*/
133
134    // Searchpage
135    $('.header-searchform').click(function() {
136        $('.searchpage').fadeIn(300);
137    });
138    $('.searchpage .button-close').click(function() {
139        $('.searchpage').fadeOut(300);
140    });
141
142
143    // Newsletter
144
145    $('button[name="newsletter"]').click(function() {
146        $('.newsletterpage').fadeIn(300);
147    });
148    $('.newsletterpage .button-close').click(function() {
149        $('.newsletterpage').fadeOut(300);
150    });
151
152
153    // Carousels
154
155    $(".fancybox").fancybox({
156        'transitionIn'  :   'elastic',
157        'transitionOut' :   'elastic',
158        'speedIn'       :   600,
159        'speedOut'      :   200
160    });
161
162    var $mqLandscape = window.matchMedia('only screen and (min-device-width : 768px) and (max-device-width : 1200px) and (orientation : landscape)');
163    
164    /*LANDSCAPE*/
165    if ($mqLandscape) {
166 
167        $('#carousel-collection').flexslider({
168            animation: "slide",
169            animationLoop: true,
170            itemWidth: 150,
171            itemMargin: 20,
172            minItems: 1,
173            maxItems: 7
174        });
175
176       $('#carousel-nouvelles-oeuvres').flexslider({
177            animation: "slide",
178            animationLoop: true,
179            itemWidth: 150,
180            itemMargin: 20,
181            minItems: 1,
182            maxItems: 7
183        });
184    }
185
186
187    $(window).load(function() {
188        
189        $('#carousel-collection').flexslider({
190            animation: "slide",
191            animationLoop: true,
192            itemWidth: 150,
193            itemMargin: 20,
194            minItems: 3,
195            maxItems: 7
196        });
197    });
198
199    $(window).load(function() {
200        $('#carousel-nouvelles-oeuvres').flexslider({
201            animation: "slide",
202            animationLoop: true,
203            itemWidth: 150,
204            itemMargin: 20,
205            minItems: 3,
206            maxItems: 7
207        });
208    });
209
210    $(window).load(function() {
211        $('#carousel-salles').flexslider({
212            animation: "slide",
213            animationLoop: false,
214            slideshow: false,
215            itemWidth: 150,
216            itemMargin: 20,
217            minItems: 1
218        });
219    });
220
221    // Exposition details
222    $('#carousel-salles li:first-child img').addClass('exposition-active');
223    $('#carousel-salles li').click(function() {
224        $('#carousel-salles img').removeClass('exposition-active');
225        $('#carousel-salles p').animate({'color':'#999'}, 100);
226        $(this).find('img').addClass('exposition-active');
227        $(this).find('p').animate({'color':'#fff'}, 100);
228    });
229
230    function initCollection(){
231
232        var holder = '';
233
234        // Collection
235        $('.item-collection').on("mouseover",function(e) {
236            $('.item-collection').addClass('item-collection-off');
237            $(this).removeClass('item-collection-off');
238        });
239
240        $('.item-collection').on("mouseout",function(e) {
241            $('.item-collection').removeClass('item-collection-off');
242        });
243
244        $('body').on('click', '.item-collection, .collection-home-item, .nouvelle-home-item', function(e) {
245            e.preventDefault();
246            $(".oeuvre-left").animate({ left: "0" }, {duration: 500,easing: 'easeInOutExpo'});
247            $(".oeuvre-right").animate({ right: "0" }, {duration: 500,easing: 'easeInOutExpo'});
248        });
249
250        $('body').on('click', '.oeuvre-container .button-close', function(e) {
251            e.preventDefault();
252            $(".oeuvre-left, .oeuvre-left-content").animate({ left: "-70%" }, {duration: 700,easing: 'easeInOutExpo'});
253            $(".oeuvre-right,.oeuvre-right-content").animate({ right: "-50%" }, {duration: 500,easing: 'easeInOutExpo'});
254            $('.loader-collection').removeClass('load');
255        });
256
257        $('#carousel-collection .collection-home-item').mouseover(function() {
258            $('#carousel-collection .collection-home-item').addClass('item-collection-off');
259            $(this).removeClass('item-collection-off');
260        });
261        
262        $('#carousel-collection .collection-home-item').mouseout(function() {
263            $('#carousel-collection .collection-home-item').removeClass('item-collection-off');
264        });
265
266        $('#carousel-nouvelles-oeuvres .nouvelle-home-item').mouseover(function() {
267            $('#carousel-nouvelles-oeuvres .nouvelle-home-item').addClass('item-collection-off');
268            $(this).removeClass('item-collection-off');
269        });
270
271        $('#carousel-nouvelles-oeuvres .nouvelle-home-item').mouseout(function() {
272            $('#carousel-nouvelles-oeuvres .nouvelle-home-item').removeClass('item-collection-off');
273        });
274        $('body').on('click', '.share-button-fb', function(e) {
275            var _this   = this;
276            var imagee      = $(this).data('image');
277            var overrideLink=window.location.href; 
278            var overrideTitle=$('.content > h2').text();
279            var overrideDescription =$('#descriptioooon ').text(); 
280            var overrideImage=$('.imgzoom').attr('src'); 
281            shareOverrideOGMeta(overrideLink,overrideDescription, overrideTitle, imagee);
282        });
283
284        // Open artwork popup if an artwork is clicked
285        $('body').on('click', '.item-collection, .nouvelle-home-item, .dk-oeuvre-details', function(e) {
286            e.preventDefault();
287            var _this   = this;
288            var id      = $(this).data('id');
289			window.id = id;
290            holder = '.'+_this.classList[0];
291            $('.loader-collection').addClass('load');
292            $.ajax({
293                url: ajaxurl,
294                data: {
295                    'action':'getOeuvreDetails',
296                    'id':id
297                },
298                dataType: 'json',
299                success:function(data) {
300                    if(data){
301						//console.log(data);
302
303                        if($(_this).next(holder).length){
304                            data.next   = true;
305                        } else {
306                            data.next   = false;
307                        }
308
309                        if($(_this).prev(holder).length){
310                            data.prev   = true;
311                        } else {
312                            data.prev   = false;
313                        }
314
315                        var html = genererTemplateOeuvre(data);
316                        injecterTemplateOeuvreDansDOM(html, data);
317                        // window.location.hash = data.slug;
318
319                        //console.log('my id : '+data.url_d);
320                        $.each(data.images, function(index, value) {
321
322                            var tmpImg = new Image();
323                            tmpImg.src = value; //or  document.images[i].src;
324
325                            $(tmpImg).one('load', function () {
326                                var th_width = tmpImg.width;
327                                var th_height = tmpImg.height;
328
329                                var maxWidth = 680; // Max width for the image
330                                var maxHeight = 650;    // Max height for the image
331                                var ratio = 0;  // Used for aspect ratio
332
333                                var max_size = 680;
334
335                                var width,height;
336                                width = tmpImg.width;
337                                height = tmpImg.height;
338
339                                if (height > width) {
340                                    width=Math.ceil(width / height * max_size);
341                                    height=max_size;
342                                } else {
343                                    width=max_size;
344                                    height=Math.ceil(height / width * max_size);
345                                }
346
347                                console.info("ok");
348                                $('#imgzoom_'+index).cropimg({
349									maxContainerWidth:             200,
350									resultWidth:                   300,
351									resultHeight:                  200,
352									inputPrefix:                   'ci-',
353                                    zoomDelay:                     15,
354                                    zoomStep:                      20,
355									mouseWheelZoomTimes:           5,
356									displayZoomingButtons:         true,
357									displayFixingPositionsButtons: true,
358									displayFixingSizeButtons:      true,
359									showBtnTips:                   true,
360									btnTipsFadeTime:               100,
361									textBtnTipZoomIn:              'Zoom in',
362									textBtnTipZoomOut:             'Zoom out',
363									textBtnTipRTW:                 'Resize to container width',
364									textBtnTipRTH:                 'Resize to container height',
365									textBtnTipFPTL:                'Move image to Top Left Corner',
366									textBtnTipFPTC:                'Move image to Top Center',
367									textBtnTipFPTR:                'Move image to Top Right Corner',
368									textBtnTipFPCL:                'Move image to Center Left',
369									textBtnTipFPCC:                'Move image to Center of container',
370									textBtnTipFPCR:                'Move image to Center Right',
371									textBtnTipFPBL:                'Move image to Bottom Left Corner',
372									textBtnTipFPBC:                'Move image to Bottom Center',
373									textBtnTipFPBR:                'Move image to Bottom Right Corner',
374                                    onInit: function() {
375                                    },
376                                    onChange: function(w, h, x, y, image) {
377                                      /*alert('cropimg changed: w: '+w+', h: '+h+', x: '+x+', y: '+y);*/
378                                 
379                                      // Image jQuery object was changed
380                                      console.log(image);
381                                    }
382                                });
383                                
384                                $('#carousel').flexslider({
385                                    animation: "slide",
386                                    controlNav: false,
387                                    animationLoop: false,
388                                    slideshow: false,
389                                    itemWidth: 150,
390                                    itemMargin: 5,
391                                    asNavFor: '#slider-oeuvres'
392                                });
393
394                                $('#slider-oeuvres').flexslider({
395                                    animation: "fade",
396                                    controlNav: false,
397                                    startAt:0,
398                                    itemWidth: 600,
399                                    slideToStart: 0,
400                                    animationLoop: false,
401                                    slideshow: false,
402                                    sync: "#carousel",
403                                    start: function(slider) {
404                                        if(index==slider.currentSlide){
405
406                                        }
407                                    },
408                                    after: function(slider) {
409                                        if(index==slider.currentSlide){
410
411                                        }
412                                    }
413                                });
414
415                            });
416                        });
417
418                        $('.scrollbar-outer').scrollbar({
419                            "ignoreMobile": false,
420                            "disableBodyScroll": true
421                        });
422
423                        $(".fancybox").mouseover(function() {
424                            $(this).addClass('more-info');
425                        });
426
427                        $(".fancybox").mouseout(function() {
428                            $(this).removeClass('more-info');
429                        });
430
431                        $('.oeuvre-left-content, .oeuvre-right-content').fadeIn(220);
432                        $('.loader-collection').removeClass('load');
433
434                        var urlMuz = encodeURIComponent(window.location.hostname + '/oeuvre/' + data.slug + '/');
435                        var titleMuz = encodeURIComponent(data.title);
436
437                        $('a.ssba_facebook_share').attr('href', 'http://www.facebook.com/sharer.php?u='+urlMuz);
438                        $('a.ssba_twitter_share').attr('href', 'http://twitter.com/share?url='+urlMuz+'&text='+titleMuz);
439                        $('a.ssba_google_share').attr('href', 'https://plus.google.com/share?url='+urlMuz);
440                        $('a.ssba_tumblr_share').attr('href', 'http://www.tumblr.com/share/link?url='+urlMuz+'&name='+titleMuz);
441                        $('a.ssba_email_share').attr('href', 'mailto:?Subject='+titleMuz+'&Body='+urlMuz);
442                    }
443                },
444                error: function(errorThrown){
445                    console.log(errorThrown);
446                }
447            });
448        });
449
450
451        $('body').on('click', '.item-collection, .item-collection-vote', function(e) {
452            e.preventDefault();
453            $(".oeuvre-left").animate({ left: "0" }, {duration: 500,easing: 'easeInOutExpo'});
454            $(".oeuvre-right").animate({ right: "0" }, {duration: 500,easing: 'easeInOutExpo'});
455        });
456
457        $('body').on('click', '.oeuvre-container .button-close', function(e) {
458            e.preventDefault();
459            $('#overlay,.login-popup').fadeOut('300',function(){//use 3000 in place of 300m
460                $('#overlay').remove();
461            });
462
463            //$(".oeuvre-left, .oeuvre-left-content").animate({ left: "-70%" }, {duration: 700,easing: 'easeInOutExpo'});
464            //$(".oeuvre-right,.oeuvre-right-content").animate({ right: "-50%" }, {duration: 500,easing: 'easeInOutExpo'});
465            $('.loader-collection').removeClass('load');
466            //window.location.hash = '#_';
467			//console.log('madiha');
468				if ( $( "video.progression-single.progression-skin" ).length ) {
469						$('video').get(0).pause();
470					}
471        });
472
473        $('body').on('click', '.oeuvre-container .button-next', function(e) {
474            e.preventDefault();
475            var id  = $(this).parents('.oeuvre-container').data('id');
476            //$('.oeuvre-container .button-close').click();
477            $(holder+'[data-id=' + id + ']').next(holder+':first').click();
478
479            var nextid=$(holder+'[data-id=' + id + ']').next(holder+':first').data("id");
480            // console.log(nextid);
481        });
482
483        $('body').on('click', '.oeuvre-container .button-prev', function(e) {
484            e.preventDefault();
485            var id  = $(this).parents('.oeuvre-container').data('id');
486            //$('.oeuvre-container .button-close').click();
487            $(holder+'[data-id=' + id + ']').prev(holder+':first').click();
488        });
489
490        if(window.location.hash && window.location.hash != "#_") {
491            var slug    = window.location.hash;
492
493            console.log('detect hash');
494
495            if (/^\/exposition\/.*/.test(window.location.pathname)) {
496            }
497            else if(window.location.pathname == '/ateliers/'){
498                $.ajax({
499                    url: ajaxurl,
500                    data: {
501                        'action':'getAtelierDetailsBySlug',
502                        'slug':slug
503                    },
504                    dataType: 'json',
505                    success:function(data) {
506                        // This outputs the result of the ajax request
507                        if(data && data.succes){
508
509                            data.next   = false;
510                            data.prev   = false;
511
512                            // window.location.hash = data.slug;
513
514                            var template    = _.template($('#template_oeuvre_details').html());
515                            var html        = template(data);
516                            // alert(template);
517
518                            $('.oeuvre-container').remove();
519                            $('#content-oeuvre').append(html);
520
521                            var content = $('#content-oeuvre').html();
522
523                            // Add our overlay to the body and fade it in.
524                            $('body').append('<div id="overlay"></div>');
525                            $('#overlay').fadeIn(100);
526
527                            // Fade in the modal window.
528                            var width_page=$(window).width();
529                            var height_page=$(window).height();
530                            height_page=height_page-30;
531                            width_page=width_page-30;
532
533                            $.each(data.images, function(index, value) {
534
535                                var tmpImg = new Image();
536                                tmpImg.src = value; //or  document.images[i].src;
537
538                                $(tmpImg).one('load', function () {
539                                    var th_width = tmpImg.width;
540                                    var th_height = tmpImg.height;
541
542
543
544                                    var maxWidth = 800; // Max width for the image
545                                    var maxHeight = height_page;    // Max height for the image
546                                    var ratio = 0;  // Used for aspect ratio
547
548                                    // Check if the current width is larger than the max
549                                    if (th_width > maxWidth) {
550                                        ratio = maxWidth / th_width;   // get ratio for scaling image
551                                        th_height = th_height * ratio;    // Reset height to match scaled image
552                                        th_width = maxWidth;    // Reset width to match scaled image
553                                    }
554
555                                    // Check if current height is larger than max
556                                    if (th_height > maxHeight) {
557                                        ratio = maxHeight / th_height; // get ratio for scaling image
558                                        th_width = th_width * ratio;    // Reset width to match scaled image
559                                    }
560
561                                    if(th_height>height_page){
562                                        th_height=height_page;
563                                    }
564
565
566
567                                    $('#content-oeuvre').fadeIn(100);
568                                    $('.oeuvre-container').fadeOut(100);
569                                    $('.oeuvre_'+data.id).fadeIn(100);
570
571
572                                    width_page=(th_width+415);
573                                    console.log(th_width+'---'+th_height+'--'+index);
574                                    $('#content-oeuvre').css({'width': width_page,'height': th_height});
575                                    $(".oeuvre-left-content").css({'max-width': th_width,'height': th_height});
576                                    //$("#imgzoom_"+index).css({'width': th_width,'height': th_height});
577
578                                    var picture = $('#imgzoom_'+index);
579
580                                    // Make sure the image is completely loaded before calling the plugin
581                                    picture.one('load', function(){
582                                        // Initialize plugin (with custom event)
583                                        picture.guillotine({eventOnChange: 'guillotinechange',
584                                            width: th_width,
585                                            height: th_height,
586                                            init: { angle: 0, x: 0 , y:0 , scale: 0 }
587                                        });
588
589                                        // Display inital data
590                                        var data = picture.guillotine('getData');
591                                        for(var key in data) { $('#'+key).html(data[key]); }
592
593                                        // Bind button actions
594                                        $('#zoom_in_'+index).click(function(){ picture.guillotine('zoomIn'); });
595                                        $('#zoom_out_'+index).click(function(){ picture.guillotine('zoomOut'); });
596
597                                        // Update data on change
598                                        picture.on('guillotinechange', function(ev, data, action) {
599                                            data.scale = parseFloat(data.scale.toFixed(4));
600                                            for(var k in data) { $('#'+k).html(data[k]); }
601                                        });
602                                    });
603
604                                    // Make sure the 'load' event is triggered at least once (for cached images)
605                                    if (picture.prop('complete')) picture.trigger('load');
606
607
608                                    $('#carousel').flexslider({
609                                        animation: "slide",
610                                        controlNav: false,
611                                        animationLoop: false,
612                                        slideshow: false,
613                                        itemWidth: 150,
614                                        itemMargin: 5,
615                                        asNavFor: '#slider-oeuvres'
616                                    });
617
618                                    $('#slider-oeuvres').flexslider({
619                                        animation: "fade",
620                                        controlNav: false,
621                                        startAt:0,
622                                        itemWidth: 600,
623                                        slideToStart: 0,
624                                        animationLoop: false,
625                                        slideshow: false,
626                                        sync: "#carousel",
627                                        start: function(slider) {
628                                            if(index==slider.currentSlide){
629
630                                            }
631                                        },
632                                        after: function(slider) {
633                                            if(index==slider.currentSlide){
634
635                                            }
636                                        }
637                                    });
638
639
640
641                                    //$('.ci-main .ci-image-wrapper img').css('height', th_height);
642                                    //$('.login-popup #slider-oeuvres .slides > li').css('width', th_width);
643
644                                });
645                            });
646
647
648
649                            $( "#tabs" ).tabs({show: 'fade', hide: 'fade'});
650
651                            $('.scrollbar-outer').scrollbar({
652                                "ignoreMobile": false,
653                                "disableBodyScroll": true
654                            });
655
656                            TweenLite.to(".atelier-left", 0.8, {left:"0", ease:Expo.easeInOut});
657                            TweenLite.to(".atelier-right", 0.8, {right:"0", ease:Expo.easeInOut});
658
659                        } else {
660                            window.location.hash = '#_';
661                        }
662                    },
663                    error: function(errorThrown){
664                        console.log(errorThrown);
665                    }
666                });
667            } else {
668                var _this   = this;
669                var slug = window.location.hash.substring(1);
670                window.slug = slug;
671                holder      = '.item-collection';
672                $('.loader-collection').addClass('load');
673
674                $.ajax({
675                    url: ajaxurl,
676                    data: {
677                        'action':'getOeuvreDetailsBySlug',
678                        'slug':slug
679                    },
680                    dataType: 'json',
681                    success:function(data) {
682                        // This outputs the result of the ajax request
683                    if(data){
684                        console.log(data);
685                            data.next   = false;
686                            data.prev   = false;
687
688                        var html = genererTemplateOeuvre(data);
689                        injecterTemplateOeuvreDansDOM(html, data);
690                        // window.location.hash = data.slug;
691
692                        //console.log('my id : '+data.url_d);
693                        $.each(data.images, function(index, value) {
694
695                            var tmpImg = new Image();
696                            tmpImg.src = value; //or  document.images[i].src;
697
698                            $(tmpImg).one('load', function () {
699                                var th_width = tmpImg.width;
700                                var th_height = tmpImg.height;
701
702                                var maxWidth = 680; // Max width for the image
703                                var maxHeight = 650;    // Max height for the image
704                                var ratio = 0;  // Used for aspect ratio
705
706                                var max_size = 680;
707
708                                var width,height;
709                                width = tmpImg.width;
710                                height = tmpImg.height;
711
712                                if (height > width) {
713                                    width=Math.ceil(width / height * max_size);
714                                    height=max_size;
715                                } else {
716                                    width=max_size;
717                                    height=Math.ceil(height / width * max_size);
718                                }
719
720                                console.info("ok");
721                                $('#imgzoom_'+index).cropimg({
722                                    maxContainerWidth:             200,
723                                    resultWidth:                   300,
724                                    resultHeight:                  200,
725                                    inputPrefix:                   'ci-',
726                                    zoomDelay:                     15,
727                                    zoomStep:                      20,
728                                    mouseWheelZoomTimes:           5,
729                                    displayZoomingButtons:         true,
730                                    displayFixingPositionsButtons: true,
731                                    displayFixingSizeButtons:      true,
732                                    showBtnTips:                   true,
733                                    btnTipsFadeTime:               100,
734                                    textBtnTipZoomIn:              'Zoom in',
735                                    textBtnTipZoomOut:             'Zoom out',
736                                    textBtnTipRTW:                 'Resize to container width',
737                                    textBtnTipRTH:                 'Resize to container height',
738                                    textBtnTipFPTL:                'Move image to Top Left Corner',
739                                    textBtnTipFPTC:                'Move image to Top Center',
740                                    textBtnTipFPTR:                'Move image to Top Right Corner',
741                                    textBtnTipFPCL:                'Move image to Center Left',
742                                    textBtnTipFPCC:                'Move image to Center of container',
743                                    textBtnTipFPCR:                'Move image to Center Right',
744                                    textBtnTipFPBL:                'Move image to Bottom Left Corner',
745                                    textBtnTipFPBC:                'Move image to Bottom Center',
746                                    textBtnTipFPBR:                'Move image to Bottom Right Corner',
747                                    onInit: function() {
748                                    },
749                                    onChange: function(w, h, x, y, image) {
750                                      /*alert('cropimg changed: w: '+w+', h: '+h+', x: '+x+', y: '+y);*/
751                                 
752                                      // Image jQuery object was changed
753                                      console.log(image);
754                                    }
755                                });
756                                
757                                $('#carousel').flexslider({
758                                    animation: "slide",
759                                    controlNav: false,
760                                    animationLoop: false,
761                                    slideshow: false,
762                                    itemWidth: 150,
763                                    itemMargin: 5,
764                                    asNavFor: '#slider-oeuvres'
765                                });
766
767                                $('#slider-oeuvres').flexslider({
768                                    animation: "fade",
769                                    controlNav: false,
770                                    startAt:0,
771                                    itemWidth: 600,
772                                    slideToStart: 0,
773                                    animationLoop: false,
774                                    slideshow: false,
775                                    sync: "#carousel",
776                                    start: function(slider) {
777                                        if(index==slider.currentSlide){
778
779                                        }
780                                    },
781                                    after: function(slider) {
782                                        if(index==slider.currentSlide){
783
784                                        }
785                                    }
786                                });
787
788                            });
789                        });
790
791                        $('.scrollbar-outer').scrollbar({
792                            "ignoreMobile": false,
793                            "disableBodyScroll": true
794                        });
795
796                        $(".fancybox").mouseover(function() {
797                            $(this).addClass('more-info');
798                        });
799
800                        $(".fancybox").mouseout(function() {
801                            $(this).removeClass('more-info');
802                        });
803
804                        $('.oeuvre-left-content, .oeuvre-right-content').fadeIn(220);
805                        $('.loader-collection').removeClass('load');
806
807                        var urlMuz = encodeURIComponent(window.location.hostname + '/oeuvre/' + data.slug + '/');
808                        var titleMuz = encodeURIComponent(data.title);
809
810                        $('a.ssba_facebook_share').attr('href', 'http://www.facebook.com/sharer.php?u='+urlMuz);
811                        $('a.ssba_twitter_share').attr('href', 'http://twitter.com/share?url='+urlMuz+'&text='+titleMuz);
812                        $('a.ssba_google_share').attr('href', 'https://plus.google.com/share?url='+urlMuz);
813                        $('a.ssba_tumblr_share').attr('href', 'http://www.tumblr.com/share/link?url='+urlMuz+'&name='+titleMuz);
814                        $('a.ssba_email_share').attr('href', 'mailto:?Subject='+titleMuz+'&Body='+urlMuz);
815                    } else {
816                            window.location.hash = '#_';
817                            console.error("No data found for this artwork ID")
818                        }
819                    },
820                    error: function(errorThrown){
821                        console.log(errorThrown);
822                        $('.loader-collection').removeClass('load');
823                    }
824                });
825            }
826        }
827    }
828
829    initCollection();
830
831    $(document).ajaxComplete(function() {
832        // FB.XFBML.parse(); // For Facebook button.
833        // twttr.widgets.load(); // For Twitter button.
834        // gapi.plusone.go(); // For Google plus button.
835    });
836
837
838    // Proposer oeuvres
839    $('body').on('click', '.menu-item-57259', function(e) {
840        e.preventDefault();
841        $.ajax({
842            url: ajaxurl, 
843            data: {
844                'action':'CheckIfLogged'
845            },
846            success:function(data) {
847                // This outputs the result of the ajax request
848                if(data == 'logged'){
849                    TweenLite.to(".proposer-oeuvre", 0.8, {top:"0", ease:Expo.easeInOut});
850                    $(".proposer-oeuvre-content").fadeIn(100);
851                } else {
852                    $('.header-login').click();
853                }
854            },
855            error: function(errorThrown){
856                console.log(errorThrown);
857            }
858        });
859
860    });
861
862    $('.close-proposer').click(function() {
863        TweenLite.to(".proposer-oeuvre", 0.8, {top:"-100%", ease:Expo.easeInOut});
864        $(".proposer-oeuvre-content").delay(300).fadeOut(100);
865    });
866
867    // Ateliers
868    $('body').on('mouseover', '.ateliers-layer', function(e) {
869        $(this).find(".black-circle").stop().animate({'width':'100%', 'height':'300px', 'border-radius':'0px','margin-top':'0px'},150);
870    });
871    $('body').on('mouseout', '.ateliers-layer', function(e) {
872        $(this).find(".black-circle").stop().animate({'width':'150px', 'height':'150px', 'border-radius':'100px','margin-top':'70px'},150);
873    });
874    $('body').on('mouseover', '.concours-m-layer', function(e) {
875        $(this).find(".black-circle").stop().animate({'width':'100%', 'height':'300px', 'border-radius':'0px','margin-top':'0px'},150);
876    });
877    $('body').on('mouseout', '.concours-m-layer', function(e) {
878        $(this).find(".black-circle").stop().animate({'width':'150px', 'height':'150px', 'border-radius':'100px','margin-top':'70px'},150);
879    });
880
881    $('#ateliers-shortform').click(function() {
882        $(this).fadeOut(600);
883        $('#ateliers-fullform').fadeIn(1200);
884    });
885
886    /*$('.button-atelier').click(function() {
887        TweenLite.to(".creation-atelier", 0.8, {top:"0", ease:Expo.easeInOut});
888        $(".creation-atelier-content").fadeIn(100);
889    });
890
891    $('body').on('click', '.close-atelier', function(e) {
892        TweenLite.to(".creation-atelier", 0.8, {top:"-100%", ease:Expo.easeInOut});
893        $(".creation-atelier-content").delay(300).fadeOut(100);
894    });*/
895
896    $('body').on('click', '.vote_yes_concours', function(e) {
897        e.preventDefault();
898        var id      = $(this).data('id');
899
900        $.ajax({
901            url: ajaxurl,
902            data: {
903                'action':'voteYesConcours',
904                'id':id
905            },
906            success:function(data) {
907                // This outputs the result of the ajax request
908                if(data){
909                    if(data == 'ok'){
910                        location.reload(true);
911                    }
912                }
913            },
914            error: function(errorThrown){
915                console.log(errorThrown);
916            }
917        });
918    });
919
920    $('body').on('click', '.vote_yes', function(e) {
921        e.preventDefault();
922        var id      = $(this).data('id');
923
924        $.ajax({
925            url: ajaxurl,
926            data: {
927                'action':'voteYesOeuvre',
928                'id':id
929            },
930            success:function(data) {
931                // This outputs the result of the ajax request
932                if(data){
933                    if(data == 'ok'){
934                        location.reload(true);
935                    }
936                }
937            },
938            error: function(errorThrown){
939                console.log(errorThrown);
940            }
941        });
942    });
943
944    $('body').on('click', '.vote_no', function(e) {
945        e.preventDefault();
946        var id      = $(this).data('id');
947
948        $.ajax({
949            url: ajaxurl,
950            data: {
951                'action':'voteNoOeuvre',
952                'id':id
953            },
954            success:function(data) {
955                // This outputs the result of the ajax request
956                if(data){
957                    if(data == 'ok'){
958                        location.reload(true);
959                    }
960                }
961            },
962            error: function(errorThrown){
963                console.log(errorThrown);
964            }
965        });
966    });
967
968    $('body').on('click', '.delete_oeuvre', function(e) {
969        e.preventDefault();
970        var id      = $(this).data('id');
971        var _this   = $(this);
972
973        $.ajax({
974            url: ajaxurl,
975            data: {
976                'action':'deleteOeuvre',
977                'id':id
978            },
979            success:function(data) {
980                // This outputs the result of the ajax request
981                if(data){
982                    if(data == 'ok'){
983                        _this.parents('.item-collection-container').remove();
984                    }
985                }
986            },
987            error: function(errorThrown){
988                console.log(errorThrown);
989            }
990        });
991    });
992
993    $('.item-collection-container').mouseover(function() {
994        $('.item-collection-container').addClass('item-collection-off');
995        $(this).removeClass('item-collection-off');
996    });
997
998    $('.item-collection-container').mouseout(function() {
999        $('.item-collection-container').removeClass('item-collection-off');
1000    });
1001
1002    $('body').on('click', '.item-collection-vote', function(e) {
1003        e.preventDefault();
1004        var _this   = this;
1005        var id      = $(this).data('id');
1006
1007        $.ajax({
1008            url: ajaxurl,
1009            data: {
1010                'action':'getOeuvreDetails',
1011                'id':id
1012            },
1013            dataType: 'json',
1014            success:function(data) {
1015                // This outputs the result of the ajax request
1016                if(data){
1017
1018                    data.next   = false;
1019                    data.prev   = false;
1020
1021                    // window.location.hash = data.slug;
1022
1023                    var template    = _.template($('#template_oeuvre_details').html());
1024                    var html        = template(data);
1025                    // alert(template);
1026
1027                    $('.oeuvre-container').remove();
1028                    $('#content-oeuvre').append(html);
1029
1030                    var content = $('#content-oeuvre').html();
1031
1032                    // Add our overlay to the body and fade it in.
1033                    $('body').append('<div id="overlay"></div>');
1034                    $('#overlay').fadeIn(100);
1035
1036                    // Fade in the modal window.
1037                    var width_page=$(window).width();
1038                    var height_page=$(window).height();
1039                    height_page=height_page-30;
1040                    width_page=width_page-30;
1041
1042                    $.each(data.images, function(index, value) {
1043
1044                        var tmpImg = new Image();
1045                        tmpImg.src = value; //or  document.images[i].src;
1046
1047                        $(tmpImg).one('load', function () {
1048                            var th_width = tmpImg.width;
1049                            var th_height = tmpImg.height;
1050
1051
1052
1053                            var maxWidth = 800; // Max width for the image
1054                            var maxHeight = height_page;    // Max height for the image
1055                            var ratio = 0;  // Used for aspect ratio
1056
1057                            // Check if the current width is larger than the max
1058                            if (th_width > maxWidth) {
1059                                ratio = maxWidth / th_width;   // get ratio for scaling image
1060                                th_height = th_height * ratio;    // Reset height to match scaled image
1061                                th_width = maxWidth;    // Reset width to match scaled image
1062                            }
1063
1064                            // Check if current height is larger than max
1065                            if (th_height > maxHeight) {
1066                                ratio = maxHeight / th_height; // get ratio for scaling image
1067                                th_width = th_width * ratio;    // Reset width to match scaled image
1068                            }
1069
1070                            if(th_height>height_page){
1071                                th_height=height_page;
1072                            }
1073
1074
1075                            $('#content-oeuvre').fadeIn(100);
1076                            $('.oeuvre-container').fadeOut(100);
1077                            $('.oeuvre_'+data.id).fadeIn(100);
1078
1079
1080                            width_page=(th_width+415);
1081                            console.log(th_width+'---'+th_height+'--'+index);
1082                            $('#content-oeuvre').css({'width': width_page,'height': th_height});
1083                            $(".oeuvre-left-content").css({'max-width': th_width,'height': th_height});
1084                            //$("#imgzoom_"+index).css({'width': th_width,'height': th_height});
1085
1086                            var picture = $('#imgzoom_'+index);
1087
1088                            // Make sure the image is completely loaded before calling the plugin
1089                            picture.one('load', function(){
1090                                // Initialize plugin (with custom event)
1091                                picture.guillotine({eventOnChange: 'guillotinechange',
1092                                    width: th_width,
1093                                    height: th_height,
1094                                    init: { angle: 0, x: 0 , y:0 , scale: 0 }
1095                                });
1096
1097                                // Display inital data
1098                                var data = picture.guillotine('getData');
1099                                for(var key in data) { $('#'+key).html(data[key]); }
1100
1101                                // Bind button actions
1102                                $('#zoom_in_'+index).click(function(){ picture.guillotine('zoomIn'); });
1103                                $('#zoom_out_'+index).click(function(){ picture.guillotine('zoomOut'); });
1104
1105                                // Update data on change
1106                                picture.on('guillotinechange', function(ev, data, action) {
1107                                    data.scale = parseFloat(data.scale.toFixed(4));
1108                                    for(var k in data) { $('#'+k).html(data[k]); }
1109                                });
1110                            });
1111
1112                            // Make sure the 'load' event is triggered at least once (for cached images)
1113                            if (picture.prop('complete')) picture.trigger('load');
1114
1115
1116                            $('#carousel').flexslider({
1117                                animation: "slide",
1118                                controlNav: false,
1119                                animationLoop: false,
1120                                slideshow: false,
1121                                itemWidth: 150,
1122                                itemMargin: 5,
1123                                asNavFor: '#slider-oeuvres'
1124                            });
1125
1126                            $('#slider-oeuvres').flexslider({
1127                                animation: "fade",
1128                                controlNav: false,
1129                                startAt:0,
1130                                itemWidth: 600,
1131                                slideToStart: 0,
1132                                animationLoop: false,
1133                                slideshow: false,
1134                                sync: "#carousel",
1135                                start: function(slider) {
1136                                    if(index==slider.currentSlide){
1137
1138                                    }
1139                                },
1140                                after: function(slider) {
1141                                    if(index==slider.currentSlide){
1142
1143                                    }
1144                                }
1145                            });
1146                        });
1147                    });
1148
1149                    $('.scrollbar-outer').scrollbar({
1150                        "ignoreMobile": false,
1151                        "disableBodyScroll": true
1152                    });
1153
1154                    $(".fancybox").mouseover(function() {
1155                        $(this).addClass('more-info');
1156                    });
1157
1158                    $(".fancybox").mouseout(function() {
1159                        $(this).removeClass('more-info');
1160                    });
1161
1162                    $('.oeuvre-left-content, .oeuvre-right-content').fadeIn(500);
1163                    $('.loader-collection').removeClass('load');
1164
1165
1166                    var urlMuz = encodeURIComponent(window.location.hostname + '/oeuvre/' + data.slug + '/');
1167                    var titleMuz = encodeURIComponent(data.title);
1168
1169                }
1170            },
1171            error: function(errorThrown){
1172                console.log(errorThrown);
1173            }
1174        });
1175    });
1176
1177    $('body').on('click', '.atelier-container .button-close', function(e) {
1178        e.preventDefault();
1179        window.location.hash = '#_';
1180        TweenLite.to(".atelier-left", 0.8, {left:"-100%", ease:Expo.easeInOut});
1181        TweenLite.to(".atelier-right", 0.8, {right:"-100%", ease:Expo.easeInOut});
1182    });
1183
1184    $('body').on('click', '.atelier-container .button-next', function(e) {
1185        e.preventDefault();
1186        var id  = $(this).parents('.atelier-container').data('id');
1187        $('.atelier-right .button-close').click();
1188        $('.ateliers-layer[data-id=' + id + ']').next('.ateliers-layer:first').click();
1189
1190    });
1191
1192    $('body').on('click', '.atelier-container .button-prev', function(e) {
1193        e.preventDefault();
1194        var id  = $(this).parents('.atelier-container').data('id');
1195        $('.atelier-right .button-close').click();
1196        $('.ateliers-layer[data-id=' + id + ']').prev('.ateliers-layer:first').click();
1197
1198    });
1199
1200    // Fondateurs
1201    $('.fondateur').mouseover(function() {
1202        $(this).find('.fondateur-detail').stop().fadeIn(200);
1203    })
1204
1205    $('.fondateur').mouseout(function() {
1206        $(this).find('.fondateur-detail').stop().fadeOut(200);
1207    })
1208
1209
1210    // Etudes
1211    $('.etudes-bloc').mouseover(function() {
1212        $(this).find('h2').stop().animate({'background-position-x': '-100%'},50).delay(10).animate({'color':'#222222'},100);
1213    });
1214    $('.etudes-bloc').mouseout(function() {
1215        $(this).find('h2').stop().animate({'background-position-x': '0'},50).delay(10).animate({'color':'#ffffff'},100);
1216    });
1217
1218    $('.etudes-salles').click(function() {
1219        $('.etudes-rene, .etudes-claude').animate({'margin-top':'-100px'}, 200).fadeOut(200);
1220        $('.etudes-salles-detail').animate({'margin-top':'0px'}, 600).fadeIn(200);
1221    });
1222
1223    $('.rene').click(function() {
1224        $(".rene-baldy-left").animate({ left: "0" }, {duration: 500,easing: 'easeInOutExpo'});
1225        $(".rene-baldy-right").animate({ right: "0" }, {duration: 500,easing: 'easeInOutExpo'});
1226    });
1227
1228    $('.button-close').click(function() {
1229        $(".rene-baldy-left").animate({ left: "-50%" }, {duration: 500,easing: 'easeInOutExpo'});
1230        $(".rene-baldy-right").animate({ right: "-50%" }, {duration: 500,easing: 'easeInOutExpo'});
1231    });
1232
1233    $('.claude').click(function() {
1234        $(".claude-ponti-left").animate({ left: "0" }, {duration: 500,easing: 'easeInOutExpo'});
1235        $(".claude-ponti-right").animate({ right: "0" }, {duration: 500,easing: 'easeInOutExpo'});
1236    });
1237
1238    $('.button-close').click(function() {
1239        $(".claude-ponti-left").animate({ left: "-50%" }, {duration: 500,easing: 'easeInOutExpo'});
1240        $(".claude-ponti-right").animate({ right: "-50%" }, {duration: 500,easing: 'easeInOutExpo'});
1241    });
1242
1243    // Connexion
1244    $('body').on('click', '.header-login', function() {
1245        TweenLite.to(".wrapper", 0.6, {left:"-800px", ease:Expo.easeInOut});
1246        TweenLite.to(".bg-filter", 0.6, {left:"-800px", ease:Expo.easeInOut});
1247        TweenLite.to(".subscribepage", 0.6, {right:"-100%", ease:Expo.easeInOut});
1248        TweenLite.to(".loginpage", 0.6, {right:"0", ease:Expo.easeInOut});
1249    });
1250    $('.btn-close').click(function() {
1251        TweenLite.to(".wrapper", 0.6, {left:"0", ease:Expo.easeInOut});
1252        TweenLite.to(".bg-filter", 0.6, {left:"0", ease:Expo.easeInOut});
1253        TweenLite.to(".loginpage", 0.6, {right:"-100%", ease:Expo.easeInOut});
1254    });
1255
1256    // Missing
1257    $('.button-missing').click(function() {
1258        TweenLite.to(".wrapper", 0.6, {left:"0", ease:Expo.easeInOut});
1259        TweenLite.to(".bg-filter", 0.6, {left:"0", ease:Expo.easeInOut});
1260        TweenLite.to(".loginpage", 0.6, {right:"-800px", ease:Expo.easeInOut});
1261        TweenLite.to(".wrapper", 0.6, {left:"-800px", delay:0.6, ease:Expo.easeInOut});
1262        TweenLite.to(".missingpage", 0.6, {right:"0",delay:0.6, ease:Expo.easeInOut});
1263        TweenLite.to(".bg-filter", 0.6, {left:"-800px",delay:0.6, ease:Expo.easeInOut});
1264    });
1265    $('.button-close').click(function() {
1266        TweenLite.to(".wrapper", 0.6, {left:"0", ease:Expo.easeInOut});
1267        TweenLite.to(".bg-filter", 0.6, {left:"0", ease:Expo.easeInOut});
1268        TweenLite.to(".missingpage", 0.6, {right:"-800px", ease:Expo.easeInOut});
1269    });
1270
1271    // Subscribe
1272    $('.button-subscribe').click(function() {
1273        TweenLite.to(".wrapper", 0.6, {left:"0", ease:Expo.easeInOut});
1274        TweenLite.to(".loginpage", 0.6, {right:"-100%", ease:Expo.easeInOut});
1275        TweenLite.to(".wrapper", 0.6, {left:"-70%", delay:0.6, ease:Expo.easeInOut});
1276        TweenLite.to(".bg-filter", 0.6, {left:"-70%", delay:0.6, ease:Expo.easeInOut});
1277        TweenLite.to(".subscribepage", 0.6, {right:"0", delay:0.6, ease:Expo.easeInOut});
1278    });
1279    $('.btn-close').click(function() {
1280        TweenLite.to(".wrapper", 0.6, {left:"0", ease:Expo.easeInOut});
1281        TweenLite.to(".bg-filter", 0.6, {left:"0", ease:Expo.easeInOut});
1282		if($(window).width() > 992 ){
1283         TweenLite.to(".subscribepage", 0.6, {right:"-70%", ease:Expo.easeInOut});
1284		}else{
1285			TweenLite.to(".subscribepage", 0.6, {right:"-100%", ease:Expo.easeInOut});
1286		}
1287		
1288    });
1289		$(window).resize(function() {
1290		 $('.btn-close').click(function() { 
1291				if($(window).width() > 992 ){
1292				 TweenLite.to(".subscribepage", 0.6, {right:"-70%", ease:Expo.easeInOut});
1293				}else{
1294					TweenLite.to(".subscribepage", 0.6, {right:"-100%", ease:Expo.easeInOut});
1295				}
1296				
1297			});
1298		});
1299
1300    $('#user-register').submit(function(e){
1301        e.preventDefault();
1302        var data    = $(this).serializeArray();
1303        var vars    = {};
1304        console.log(data);
1305        _.each(data, function(item){
1306            vars[item.name] = item.value;
1307        });
1308        vars['action']  = 'register_user';
1309        console.log(vars);
1310
1311        $.ajax({
1312            type: 'post',
1313            url: ajaxurl,
1314            data: vars,
1315            dataType: 'json',
1316            success:function(data) {
1317                // This outputs the result of the ajax request
1318                if(data){
1319                    if(data.op == 1){
1320                        // message de confirmation
1321                        alert(data.msg);
1322                        $(':input', '#user-register').not(':button, :submit, :reset, :hidden').val('').removeAttr('checked').removeAttr('selected');
1323                        $('.button-close').click();
1324                        // window.location.href ='/';
1325                    } else {
1326                        // message d'erreur sur
1327                        alert(data.msg);
1328                    }
1329
1330
1331                }
1332                //console.log(data);
1333            },
1334            error: function(errorThrown){
1335                console.log(errorThrown);
1336            }
1337        });
1338
1339    });
1340
1341    $('#user-profile').submit(function(e){
1342        e.preventDefault();
1343        var data    = $(this).serializeArray();
1344        var vars    = {};
1345        console.log(data);
1346        _.each(data, function(item){
1347            vars[item.name] = item.value;
1348        });
1349        vars['action']  = 'profile_user';
1350        console.log(vars);
1351
1352        $.ajax({
1353            type: 'post',
1354            url: ajaxurl,
1355            data: vars,
1356            dataType: 'json',
1357            success:function(data) {
1358                // This outputs the result of the ajax request
1359                if(data.op == 1){
1360                    // message de confirmation
1361                    alert(data.msg);
1362                    $(':input', '#user-profile').not(':button, :submit, :reset, :hidden').val('').removeAttr('checked').removeAttr('selected');
1363                    $('.button-close').click();
1364
1365                } else {
1366                    // message d'erreur
1367                    alert(data.msg);
1368                }
1369
1370            },
1371            error: function(errorThrown){
1372                console.log(errorThrown);
1373            }
1374        });
1375
1376    });
1377
1378    $('#user-login').submit(function(e){
1379        e.preventDefault();
1380        var data    = $(this).serializeArray();
1381        var vars    = {};
1382        console.log(data);
1383        _.each(data, function(item){
1384            vars[item.name] = item.value;
1385        });
1386        vars['action']  = 'login_user';
1387        console.log(vars);
1388
1389        $.ajax({
1390            type: 'post',
1391            url: ajaxurl,
1392            data: vars,
1393            dataType: 'json',
1394            success:function(data) {
1395                // this outputs the result of the ajax request
1396                if(data){
1397                    if(data.op == 1){
1398                        alert(data.msg);
1399                        location.reload(true);
1400                        // message de confirmation sur obj.msg
1401                    } else {
1402                        // message d'erreur sur obj.msg
1403                        alert(data.msg);
1404                    }
1405                }
1406            },
1407            error: function(errorthrown){
1408                console.log(errorthrown);
1409            }
1410        });
1411
1412    });
1413
1414    $('#user-missing').on("submit", function(e){
1415        e.preventDefault();
1416        var data    = $(this).serializeArray();
1417        var vars    = {};
1418        console.log(data);
1419        _.each(data, function(item){
1420            vars[item.name] = item.value;
1421        });
1422        vars['action']  = 'user_missing';
1423
1424        $.ajax({
1425            type: 'post',
1426            url: ajaxurl,
1427            data: vars,
1428            dataType: 'json',
1429            success:function(data) {
1430                // this outputs the result of the ajax request
1431                if(data){
1432                    if(data.op == 1){
1433                        alert(data.msg);
1434                        // message de confirmation sur obj.msg
1435                    } else {
1436                        // message d'erreur sur obj.msg
1437                        alert(data.msg);
1438                    }
1439                }
1440            },
1441            error: function(errorthrown){
1442                console.log(errorthrown);
1443            }
1444        });
1445
1446    });
1447	function sendajaxoeuvre(data){
1448				
1449         $.ajax({
1450            type: 'post',
1451            url: '/wp-admin/admin-ajax.php?action=addOeuvre',
1452            data: data,
1453            cache: false,
1454            contentType: false,
1455            processData: false,
1456            dataType: 'json',
1457            success:function(data) {
1458                // This outputs the result of the ajax request
1459				console.log(data);
1460                if(data){
1461                    if(data.op === 1){
1462                        // message de confirmation
1463                        alert(data.msg);
1464                        $(':input', '#form-add-oeuvre').not(':button, :submit, :reset, :hidden').val('').removeAttr('checked').removeAttr('selected');
1465                        $('.button-close').click();
1466                        window.history.back();
1467                        return false;
1468                    } else {
1469                        // message d'erreur
1470                        alert(data.msg);
1471                        return false;
1472                    }
1473
1474                }
1475                console.log(data);
1476            },
1477            error: function(errorThrown){
1478                console.log(errorThrown);
1479            },
1480            beforeSend: function(){
1481                $('#loader-loader').fadeIn('normal');
1482            },
1483            complete: function(){
1484                $('#loader-loader').fadeOut('normal');
1485            }
1486        });
1487	}
1488
1489    $('#form-add-oeuvre').submit(function(e){
1490        e.preventDefault();
1491        var data    = new FormData($(this)[0]);
1492		var fileupImg = $("input[name='file_img_1']").val(); 
1493		var file_video = $("input[name='file_video']").val(); 
1494		var file_text = $("input[name='file_text']").val(); 
1495		
1496		if($('#edit-field-technique-value').val() === 'son-video'){
1497			if(file_video){
1498				sendajaxoeuvre(data)
1499			}else{
1500				alert('pas de video sélectionné');
1501			}
1502			
1503		} else if($('#edit-field-technique-value').val() === 'ecrits'){
1504			if(file_text){
1505				sendajaxoeuvre(data)
1506			}else{
1507				alert('pas de fichier sélectionné');
1508			}
1509		}else{
1510			if(fileupImg){
1511				sendajaxoeuvre(data)
1512			}else{
1513				alert('pas d\'image sélectionné');
1514			}
1515		}		
1516    });
1517
1518    $('body').on('submit', '#form-add-oeuvre-concours', function(e) {
1519        e.preventDefault();
1520        var data    = new FormData($(this)[0]);
1521
1522        $.ajax({
1523            type: 'post',
1524            url: '/wp-admin/admin-ajax.php?action=addOeuvreConcours',
1525            data: data,
1526            cache: false,
1527            contentType: false,
1528            processData: false,
1529            dataType: 'json',
1530            success:function(data) {
1531                // This outputs the result of the ajax request
1532                if(data){
1533                    if(data.op == 1){
1534                        // message de confirmation
1535                        alert(data.msg);
1536                        $('input[type=text],input[type=password], textarea').val('');
1537                        $('input[type=checkbox], input[type=radio]').attr('checked', false);
1538                        var btnClose = $('.button-close-participer')
1539                        if (btnClose && $(btnClose).click) {
1540                            $(btnClose).click();
1541                        }
1542						location.reload();
1543                    } else {
1544                        // message d'erreur
1545                        alert(data.msg);
1546                    }
1547                }
1548            },
1549            error: function(errorThrown){
1550                console.log(errorThrown);
1551            },
1552            beforeSend: function(){
1553                var loader = $('#loader-loader')
1554                if (loader && $(loader).fadeIn)
1555                {
1556                    $(loader).fadeIn("normal");
1557                }
1558            },
1559            complete: function(){
1560                var loader = $('#loader-loader')
1561                if (loader && $(loader).fadeOut)
1562                {
1563                    $(loader).fadeOut("normal");
1564                }
1565				location.reload();
1566            }
1567        });
1568    });
1569
1570    /* Menu */
1571    $(".menu-mobile-icon").click( function(event){
1572        event.preventDefault();
1573        if ($(this).hasClass("off-mobile") ) {
1574            $('.nav-mobile').animate({'top':'0'}, 600);
1575            $(this).removeClass("off-mobile");
1576            $(this).addClass("on-mobile");
1577        } else {
1578            /*$('.nav-mobile').animate({'top':'-1000px'}, 600);*/
1579            $(this).addClass("off-mobile");
1580            $(this).removeClass("on-mobile");
1581        }
1582        return false;
1583    });
1584
1585    $('.nav-mobile .sub-menu').hide();
1586
1587
1588    $('.nav-mobile .menu-item').mouseover(function() {
1589        $(this).find('ul.sub-menu').stop().show(300);
1590    });
1591
1592    $('.nav-mobile .menu-item').mouseout(function() {
1593        $(this).find('ul.sub-menu').stop().hide(300);
1594    });
1595
1596    /*Formulaire Proposer une oeuvre*/
1597    $('body').on('change', '#edit-field-technique-value', function(e) {
1598		$("input[type='file']").val('');
1599        if($('#edit-field-technique-value').val() === 'son-video'){
1600            $('.upload-image').fadeOut(300);
1601            $('.upload-text').fadeOut(300);
1602			$('.upload-image input').removeAttr('required');
1603            $('.upload-video').delay(300).fadeIn(300);
1604        } else if($('#edit-field-technique-value').val() === 'ecrits'){;
1605            $('.upload-video').fadeOut(300);
1606            $('.upload-image').fadeOut(300);
1607			$('.upload-image input').removeAttr('required');
1608            $('.upload-text').delay(300).fadeIn(300);
1609        } else {
1610            $('.upload-text').fadeOut(300);
1611            $('.upload-video').fadeOut(300);
1612			$('.upload-image input').attr('required');
1613            $('.upload-image').delay(300).fadeIn(300);
1614        }
1615    });
1616
1617    $('body').on('change', '#edit-field-technique-concours', function(e) {
1618        if($('#edit-field-technique-concours').val() === 'son-video'){
1619            $('.upload-image-concours').fadeOut(300);
1620            $('.upload-text-concours').fadeOut(300);
1621            $('.upload-video-concours').delay(300).fadeIn(300);
1622        } else if($('#edit-field-technique-concours').val() === 'ecrits'){
1623            $('.upload-video-concours').fadeOut(300);
1624            $('.upload-image-concours').fadeOut(300);
1625            $('.upload-text-concours').delay(300).fadeIn(300);
1626        } else {
1627            $('.upload-text-concours').fadeOut(300);
1628            $('.upload-video-concours').fadeOut(300);
1629            $('.upload-image-concours').delay(300).fadeIn(300);
1630        }
1631    });
1632
1633    /*Video player*/
1634    $('.progression-single').mediaelementplayer({
1635        audioWidth: 400, // width of audio player
1636        audioHeight:40, // height of audio player
1637        startVolume: 0.5, // initial volume when the player starts
1638        features: ['playpause','current','progress','duration','tracks','volume','fullscreen']
1639    });
1640
1641
1642    // Footer
1643    /*$('button[name="contact"]').click(function(){
1644        $(".contact-content").fadeIn(30).animate({bottom:"50px"}, 200);
1645        $('button[name="contact"]').addClass('active');
1646    });
1647
1648    $('.close-contact').click(function(){
1649        $(".contact-content").animate({bottom:"-550px"}, 200).delay(150).fadeOut(30);
1650        $('button[name="contact"]').removeClass('active');
1651    });*/
1652
1653    /*$('.button-conditions').click(function(){
1654        $(".conditions").fadeIn(30).animate({bottom:"50px"}, 200);
1655        $('.button-conditions').addClass('active');
1656    });
1657
1658    $('.close-conditions').click(function(){
1659        $(".conditions").animate({bottom:"-550px"}, 200).delay(150).fadeOut(30);
1660        $('.button-conditions').removeClass('active');
1661    });*/
1662
1663
1664    $('#timeline-atelier').imagesLoaded( function() {
1665        $('#timeline-atelier').isotope({
1666            itemSelector: '.ateliers-layer',
1667            layoutMode: 'fitRows'
1668        });
1669    });
1670
1671    $('body').on('click', '.filter_atelier', function(e) {
1672        e.preventDefault();
1673
1674        $('#form_atelier_autoload input[name=offset]').val(0);
1675
1676        var $title = $('#filter_atelier_title').val();
1677        if($title == 'Titre'){
1678            $title = '';
1679        }
1680
1681        var $institution = $('#filter_atelier_institution').val();
1682        if($institution == 'Tout'){
1683            $institution = '';
1684        }
1685
1686        var $ville = $('#filter_atelier_ville').val();
1687        if($ville == 'Ville'){
1688            $ville = '';
1689        }
1690
1691        $('#form_atelier_autoload input[name=title]').val($title);
1692        $('#form_atelier_autoload input[name=institution]').val($institution);
1693        $('#form_atelier_autoload input[name=ville]').val($ville);
1694
1695        var json        = ajaxurl;
1696        var template    = _.template($($('#form_atelier_autoload input[name=template]').val()).html());
1697        var selector    = $($('#form_atelier_autoload input[name=selector]').val());
1698        var request     = $.ajax({
1699            url: json,
1700            type: 'post',
1701            dataType: 'json',
1702            data: $('#form_atelier_autoload').serialize(),
1703            beforeSend: function() {
1704                $('.atelier-loader').addClass('load');
1705            }
1706        });
1707        request.done(function(data) {
1708            var ateliers   = [];
1709            data.ateliers.forEach(function(item){
1710                ateliers.push(template(item));
1711            });
1712
1713            selector.isotope('remove', $('.ateliers-layer'));
1714            selector.isotope( 'insert', $(ateliers.join('')) );
1715
1716            selector.imagesLoaded( function() {
1717                selector.isotope('layout');
1718            });
1719            $('#form_atelier_autoload input[name=total]').val(data.total);
1720            $('#form_atelier_autoload input[name=offset]').val($('#form_atelier_autoload input[name=paging]').val());
1721
1722            $('.atelier-loader').removeClass('load');
1723            $('footer').waypoint('enable');
1724        });
1725        request.fail(function(jqXHR, textStatus) {
1726            $('.atelier-loader').removeClass('load');
1727            console.log('Error text : '+jqXHR.statusText+'\n'+textStatus)
1728        });
1729    });
1730
1731    $('#form-request-atelier').submit(function(e){
1732        e.preventDefault();
1733        var data    = $(this).serializeArray();
1734        var vars    = {};
1735      //  console.log(data);
1736        _.each(data, function(item){
1737            vars[item.name] = item.value;
1738        });
1739        vars['action']  = 'atelierRequest';
1740        console.log(vars);
1741
1742        $.ajax({
1743            type: 'post',
1744            url: ajaxurl,
1745            data: vars,
1746            dataType: 'json',
1747            success:function(data) {
1748                // this outputs the result of the ajax request
1749                if(data){
1750                    if(data.op == 1){
1751                        alert(data.msg);
1752                        $('input[type=text],input[type=password], textarea').val('');
1753                        $('input[type=checkbox], input[type=radio]').attr('checked', false);
1754                        $('.close-atelier').click();
1755                        // message de confirmation
1756                    } else {
1757                        // message d'erreur
1758                        alert(data.msg);
1759                    }
1760                }
1761               // console.log(data);
1762            },
1763            error: function(errorthrown){
1764                console.log(errorthrown);
1765            }
1766        });
1767
1768    });
1769
1770
1771    $('body').on('mouseover', '.item-collection-parrain', function(e) {
1772        $('.item-collection-parrain').addClass('item-collection-off');
1773        $(this).removeClass('item-collection-off');
1774    });
1775
1776    $('body').on('mouseout', '.item-collection-parrain', function(e) {
1777        $('.item-collection-parrain').removeClass('item-collection-off');
1778    });
1779
1780    $('body').on('click', '.item-collection-parrain', function(e) {
1781        e.preventDefault();
1782        $(".parrain-left").animate({ left: "0" }, {duration: 500,easing: 'easeInOutExpo'});
1783        $(".parrain-right").animate({ right: "0" }, {duration: 500,easing: 'easeInOutExpo'});
1784    });
1785
1786    $('body').on('click', '.parrain-container .button-close', function(e) {
1787        e.preventDefault();
1788        $(".parrain-left, .parrain-left-content").animate({ left: "-50%" }, {duration: 500,easing: 'easeInOutExpo'});
1789        $(".parrain-right,.parrain-right-content").animate({ right: "-50%" }, {duration: 500,easing: 'easeInOutExpo'});
1790        $('.loader-collection').removeClass('load');
1791    });
1792
1793    $('body').on('click', '.parrain-container .button-next', function(e) {
1794        e.preventDefault();
1795        var id  = $(this).parents('.parrain-container').data('id');
1796        //$('.parrain-right .button-close').click();
1797        $('.item-collection-parrain[data-id=' + id + ']').next('.item-collection-parrain:first').click();
1798
1799    });
1800
1801    $('body').on('click', '.parrain-container .button-prev', function(e) {
1802        e.preventDefault();
1803        var id  = $(this).parents('.parrain-container').data('id');
1804        //$('.parrain-right .button-close').click();
1805        $('.item-collection-parrain[data-id=' + id + ']').prev('.item-collection-parrain:first').click();
1806
1807    });
1808
1809    $('body').on('click', '.item-collection-parrain', function(e) {
1810        e.preventDefault();
1811        var _this   = this;
1812        var id      = $(this).data('id');
1813        holder      = '.item-collection-parrain';
1814        $('.loader-collection').addClass('load');
1815
1816        $.ajax({
1817            url: ajaxurl,
1818            data: {
1819                'action':'getParrainDetails',
1820                'id':id
1821            },
1822            dataType: 'json',
1823            success:function(data) {
1824                // This outputs the result of the ajax request
1825                if(data){
1826
1827                    if($(_this).next('.item-collection-parrain').length){
1828                        data.next   = true;
1829                    } else {
1830                        data.next   = false;
1831                    }
1832
1833                    if($(_this).prev('.item-collection-parrain').length){
1834                        data.prev   = true;
1835                    } else {
1836                        data.prev   = false;
1837                    }
1838
1839                    var template    = _.template($('#template_parrain_details').html());
1840                    var html        = template(data);
1841
1842                    $('.parrain-container').fadeOut(500);
1843                    $('body').append(html);
1844
1845                    $( "#tabs" ).tabs({show: 'fade', hide: 'fade'});
1846
1847                    $('.scrollbar-outer').scrollbar({
1848                        "ignoreMobile": false,
1849                        "disableBodyScroll": true
1850                    });
1851
1852                    $('.parrain-left-content, .parrain-right-content').fadeIn(500);
1853                    $('.loader-collection').removeClass('load');
1854
1855                }
1856               // console.log(data);
1857            },
1858            error: function(errorThrown){
1859                console.log(errorThrown);
1860            }
1861        });
1862    });
1863
1864    // Concours
1865    $('body').on('click', '.button-o_concours', function(e) {
1866        e.preventDefault();
1867        var _this   = this;
1868        var id      = $(this).data('id');
1869        var concoursOeuvre = $('.concoursOeuvre.c_'+id).html();
1870		console.log($('.concoursOeuvre.c_'+id));
1871        $.ajax({
1872            url: ajaxurl,
1873            data: {'action':'CheckIfLogged'},
1874            success: function(response){
1875                    $.ajax({
1876                        url: ajaxurl,
1877                        data: {
1878                            'action':'getOeuvreConcours',
1879                            'id':id
1880                        },
1881                        dataType: 'json',
1882                        success:function(data) {
1883                            // This outputs the result of the ajax request
1884                            if(data){
1885
1886                                var template    = _.template($('#template_concours_oeuvre').html());
1887                                var html        = template(data);
1888
1889                                $('.concours-container').remove();
1890                                $('body').append(html);
1891								$('.oeuvrecontent').append(concoursOeuvre);
1892
1893                                TweenLite.to(".participer-left", 0.8, {left:"0", ease:Expo.easeInOut});
1894                                TweenLite.to(".participer-right", 0.8, {right:"0", ease:Expo.easeInOut});
1895
1896                            }
1897                            console.log(data);
1898                        },
1899                        error: function(errorThrown){
1900                            console.log(errorThrown);
1901                        }
1902                    });
1903               
1904            },
1905            error: function(errorThrown){
1906                console.log(errorThrown);
1907            }
1908        });
1909        
1910    });
1911
1912    // Concours
1913    $('body').on('click', '.button-participer', function(e) {
1914        e.preventDefault();
1915        var _this   = this;
1916        var id      = $(this).data('id');
1917        $.ajax({
1918            url: ajaxurl,
1919            data: {'action':'CheckIfLogged'},
1920            success: function(response){
1921                    $.ajax({
1922                        url: ajaxurl,
1923                        data: {
1924                            'action':'getParticiperConcours',
1925                            'id':id,
1926                        },
1927                        dataType: 'json',
1928                        success:function(data) {
1929                            // This outputs the result of the ajax request
1930                            if(data){
1931
1932                                var template    = _.template($('#template_concours_participer').html());
1933                                var html        = template(data);
1934
1935                                $('.concours-container').remove();
1936                                $('body').append(html);
1937
1938                                TweenLite.to(".participer-left", 0.8, {left:"0", ease:Expo.easeInOut});
1939                                TweenLite.to(".participer-right", 0.8, {right:"0", ease:Expo.easeInOut});
1940
1941                            }
1942                        },
1943                        error: function(errorThrown){
1944                            console.log(errorThrown);
1945                        }
1946                    });
1947                
1948            },
1949            error: function(errorThrown){
1950                console.log(errorThrown);
1951            }
1952        });
1953        
1954    });
1955
1956    $('body').on('click', '.button-close-participer', function(e) {
1957        TweenLite.to(".participer-left", 0.8, {left:"-50%", ease:Expo.easeInOut});
1958        TweenLite.to(".participer-right", 0.8, {right:"-50%", ease:Expo.easeInOut});
1959    });
1960	    // Concours
1961 
1962    $('body').on('click', '.button-reglement', function(e) {
1963        e.preventDefault();
1964        var _this   = this;
1965        var id      = $(this).data('id');
1966
1967        $.ajax({
1968            url: ajaxurl,
1969            data: {
1970                'action':'getReglementConcours',
1971                'id':id
1972            },
1973            dataType: 'json',
1974            success:function(data) {
1975                // This outputs the result of the ajax request
1976                if(data){
1977
1978                    var template    = _.template($('#template_concours_reglement').html());
1979                    var html        = template(data);
1980
1981                    $('.concours-container').remove();
1982                    $('body').append(html);
1983
1984                    $('.scrollbar-outer').scrollbar({
1985                        "ignoreMobile": false,
1986                        "disableBodyScroll": true
1987                    });
1988
1989                    TweenLite.to(".reglement-left", 0.8, {left:"0", ease:Expo.easeInOut});
1990                    TweenLite.to(".reglement-right", 0.8, {right:"0", ease:Expo.easeInOut});
1991
1992                }
1993               // console.log(data);
1994            },
1995            error: function(errorThrown){
1996                console.log(errorThrown);
1997            }
1998        });
1999    });
2000
2001    $('body').on('click', '.button-close-reglement', function(e) {
2002        TweenLite.to(".reglement-left", 0.8, {left:"-50%", ease:Expo.easeInOut});
2003        TweenLite.to(".reglement-right", 0.8, {right:"-50%", ease:Expo.easeInOut});
2004    });
2005
2006    $('body').on('click', '.button-resultats', function(e) {
2007        e.preventDefault();
2008        var _this   = this;
2009        var id      = $(this).data('id');
2010
2011        $.ajax({
2012            url: ajaxurl,
2013            data: {
2014                'action':'getResultatsConcours',
2015                'id':id
2016            },
2017            dataType: 'json',
2018            success:function(data) {
2019                // This outputs the result of the ajax request
2020                if(data){
2021
2022                    var template    = _.template($('#template_concours_resultats').html());
2023                    var html        = template(data);
2024
2025                    $('.concours-container').remove();
2026                    $('body').append(html);
2027
2028                    $('.scrollbar-outer').scrollbar({
2029                        "ignoreMobile": false,
2030                        "disableBodyScroll": true
2031                    });
2032
2033                    TweenLite.to(".resultats-left", 0.8, {left:"0", ease:Expo.easeInOut});
2034                    TweenLite.to(".resultats-right", 0.8, {right:"0", ease:Expo.easeInOut});
2035					
2036					/**
2037                     * Assignation des Oeuvres
2038                     */
2039                    var $oeuvres = $('#oeuvres');
2040					if(data.oeuvres){
2041					var oeuvres = data.oeuvres.oeuvres;
2042                    var attachements = data.oeuvres.attachements;
2043                    var votes = data.oeuvres.votes;
2044                    var count = oeuvres.length;
2045                    var first = true;
2046                    for(var i = 0; i < count; i++){
2047                        if(first){
2048                            $oeuvres.html('');
2049                            first = false;
2050                        }
2051                        var o = oeuvres[i];
2052                        var $row = $('<div>', {
2053                            'class': 'row-fluid'
2054                        });
2055                        
2056                        var $title = $('<div>', {
2057                            'class': 'span4',
2058                            html : $('<a>', {
2059                                href: o.guid,
2060                                html: o.post_title,
2061								'class': 'dk-oeuvre-details',
2062								'data-id': o.ID,
2063                            }),
2064                            title: o.post_content
2065                        });
2066                        var $img = $('<img>', {
2067                                src: attachements[o.ID].guid,
2068                                height: 48
2069                        });
2070                        var $link = $('<a>', {
2071                            href: o.guid,
2072                            'class': 'dk-oeuvre-details',
2073                            'data-id': o.ID,
2074                            html: $img
2075                        });
2076                        var $image = $('<div>', {
2077                            'class': 'span4',
2078                            html: $link,
2079                            style: 'text-align: center'
2080                        });
2081                        var vote = votes[o.ID];
2082                        var y = 0;
2083                        var n = 0;
2084                        if(vote){
2085                            y = vote.y;
2086                            n = vote.n;
2087                        }
2088                        var $votes = $('<div>', {
2089                            'class': 'span4',
2090                            html: '<i class="icon icon-thumbs-up" style="color: green"></i> : ' + y + '&nbsp;&nbsp;&nbsp; <i class="icon icon-thumbs-down" style="color: red"></i> : ' + n,
2091                            style: 'text-align: right'
2092                        });
2093                        $row.append($title).append($image).append($votes);
2094                        $oeuvres.append($row);
2095                    }
2096
2097					}
2098				}
2099                console.log(data);
2100            },
2101            error: function(errorThrown){
2102                console.log(errorThrown);
2103            }
2104        });
2105    });
2106
2107    $('body').on('click', '.button-close-resultats', function(e) {
2108        TweenLite.to(".resultats-left", 0.8, {left:"-50%", ease:Expo.easeInOut});
2109        TweenLite.to(".resultats-right", 0.8, {right:"-50%", ease:Expo.easeInOut});
2110    });
2111
2112    // Mon compte
2113
2114    $('.button-moncompte a').click(function() {
2115        $('.button-moncompte a').removeClass("active-edit");
2116        $(this).addClass("active-edit");
2117    })
2118
2119    $('.button-moncompte li').each(function(index,value){
2120		
2121        var num = index+1;
2122        $(this).click(function(){
2123            $('.informations').fadeOut(300);
2124            $('.informations-box'+num+'').delay(300).fadeIn(300);
2125
2126            if(num == 2){
2127                $('.footer').waypoint(function(direction) {
2128                    console.log(direction);
2129                    if(direction == "down") {
2130                        $('footer').waypoint('disable');
2131                        var paging   = parseInt($('#form_oeuvre_autoload input[name=paging]').val());
2132                        var offset   = parseInt($('#form_oeuvre_autoload input[name=offset]').val());
2133                        var total    = parseInt($('#form_oeuvre_autoload input[name=total]').val());
2134                        var json     = ajaxurl;
2135                        var template  = _.template($($('#form_oeuvre_autoload input[name=template]').val()).html());
2136                        var selector = $($('#form_oeuvre_autoload input[name=selector]').val());
2137
2138                        if(total > offset){
2139                            var request = $.ajax({
2140                                url: json,
2141                                type: 'post',
2142                                dataType: 'json',
2143                                data: $('#form_oeuvre_autoload').serialize(),
2144                                beforeSend: function() {
2145                                    $('.oeuvres-loader').addClass('load');
2146                                }
2147                            });
2148                            request.done(function(data) {
2149                                var oeuvres   = [];
2150                                data.oeuvres.forEach(function(item){
2151                                    oeuvres.push(template(item));
2152                                });
2153
2154                                selector.append($(oeuvres.join('')));
2155
2156                                $('.oeuvres-loader').removeClass('load');
2157
2158                                if(total > offset + paging){
2159                                    $('#form_oeuvre_autoload input[name=offset]').val(offset + paging);
2160                                    $('footer').waypoint('enable');
2161                                }else{
2162                                    console.log('no other posts');
2163                                }
2164                            });
2165                            request.fail(function(jqXHR, textStatus) {
2166                                $('.oeuvres-loader').removeClass('load');
2167                                console.log('Error text : '+jqXHR.statusText+'\n'+textStatus)
2168                            });
2169                        }
2170                    }
2171                }, { offset: '120%' });
2172            } else {
2173                $('footer').waypoint('disable');
2174            }
2175        })
2176    });
2177
2178    // Event clic sur le lien "Proposer une oeuvre" du menu
2179    $('.proposer-oeuvre-dk').click(function(e){
2180        e.preventDefault();
2181        var $this = $(this);
2182        $.ajax({
2183            url: ajaxurl, // Url défini par défaut :P
2184            data: {
2185                'action':'CheckIfLogged'
2186            },
2187            success:function(data) {
2188                // This outputs the result of the ajax request
2189                if(data == 'logged'){
2190                    console.log($this.attr('href'));
2191                    if(!$this.attr('href')){
2192                        var url = $this.find('a').attr('href');
2193                        console.log(url);
2194                        window.location.href = url;
2195                    }else{
2196                        window.location.href = $this.attr('href');
2197                    }
2198                } else {
2199                    $('.header-login').click();
2200                }
2201            },
2202            error: function(errorThrown){
2203                console.log(errorThrown);
2204            }
2205        });
2206    });
2207
2208
2209});
2210
2211$(document).ready(function(){
2212    var container_wrap = $(".ci-image-wrapper").height();
2213    var img_wrap = $(".imgzoom").height();
2214    var marginContainer = (container_wrap - img_wrap)/2;
2215    $(".imgzoom").css("padding-top", marginContainer);
2216
2217
2218
2219    //Toggle menu filtre in Collection page ' BY AK 21/11/2017  16:30
2220    $(function () {
2221
2222        if (window.matchMedia('(max-width: 767px)').matches) {
2223           // $('.page-id-53 #filtreContentCollection').hide();
2224           // $('.page-id-53 .nav-mobile').hide();
2225           // $( ".page-id-53 .header-left" ).after( "<a class='menu-mobile-icon off-mobile'><i class='fa fa-bars'></i></a>" );
2226        } 
2227
2228        if (window.matchMedia('(max-width: 767px)').matches) {
2229            // $('.page-id-53 .page-id-53 .collection-filter ').css('background', 'none', 'important');
2230        } 
2231
2232        var bckg = 0;
2233
2234
2235        $('#menuCollection').click( function() {
2236        
2237            if(bckg == 0){
2238                $('.page-id-53 .collection-filter ').css('background', '#f1f1f1', 'important');
2239                $('.page-id-53 .glyphicon-plus-sign').css('display', 'none', 'important');
2240                $('.page-id-53 .glyphicon-minus-sign').css('display', 'block', 'important');
2241                $('.page-id-53 #filtreContentCollection').slideToggle();
2242                
2243                bckg = 1;
2244            }else{
2245                $('.page-id-53 .collection-filter ').css('background', 'none', 'important');
2246                $('.page-id-53 .glyphicon-plus-sign').css('display', 'block', 'important');
2247                $('.page-id-53 .glyphicon-minus-sign').css('display', 'none', 'important');
2248                $('.page-id-53 #filtreContentCollection').slideToggle();
2249                
2250                bckg = 0;
2251            }
2252            
2253        });
2254
2255        $('.page-id-53 .menu-mobile-icon').click( function() {
2256            $('.page-id-53 .nav-mobile').slideToggle();
2257        });
2258		
2259
2260    }); //END AK
2261    
2262 
2263    $("#expositions").parent(".wrapper").parent("body").find(".mobile-page").css("display", "none");
2264
2265    $('body').on('submit', '.js-encherir', function(e) {
2266		e.preventDefault();
2267		var data = {
2268			id: $(this).find('#oeuvreid').val(),
2269			encherirencours: $(this).find('#encherirencours').val(),
2270			encherirmax: $(this).find('#encherirmax').val(),
2271			//encheremaximumencours: $(this).find('#encheremaximumencours').val() || 0,
2272			email: $(this).find('#encher_email').val(),
2273			//emailace: $(this).find('#ace').val(),
2274			otitle: $(this).find('#oeuvretitle').val(),
2275			firstname: $(this).find('#firstname').val(),
2276			lastname: $(this).find('#lastname').val(),
2277			//prenom_ancien_encherisseur: $(this).find('#prenom_ancien_encherisseur').val(),
2278			//nom_ancien_encherisseur: $(this).find('#nom_ancien_encherisseur').val()
2279		}
2280		$(this).find("input[type='submit']").attr('disabled');
2281        $.ajax({
2282            url: ajaxurl, 
2283            data: {
2284                'action':'postEncherir',
2285				'data' : data				
2286            },
2287            success:function(rep) {
2288				console.log(rep);
2289				if( rep == 1 || rep == 2 ||  rep == 3 || rep == 4 || rep == 14 || rep == 6) {
2290					if (window.confirm('Le Muz vous remercie pour votre enchère, vous allez recevoir un mail de confirmation sur '+data.email))
2291					{
2292						// location.reload();
2293						window.location = 'https://lemuz.org/remerciement-enchere/?id='+data.id;
2294					}
2295					
2296				} else if ( rep == "EnchereInsuffisante") {
2297					if (window.confirm("Votre enchère n'est pas suffisante car un autre utilisateur a enregistré un montant supérieur ou égal en enchère maximum"))
2298					{
2299						location.reload();
2300						//window.location = 'https://lemuz.org/encherir/';
2301						
2302					}
2303				} else if ( !rep || rep == "nodate" ) {
2304					if (window.confirm("Erreur dateTime"))
2305					{
2306						window.location = 'https://lemuz.org/';
2307					}
2308				}
2309               
2310            },
2311            error: function(errorThrown){
2312                console.log(errorThrown);
2313				//location.reload();
2314            }
2315        });
2316
2317    });
2318});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.