Littérature humoristique de langue française | l’Encyclopédie Canadienne

Recherche dans l’Encyclopédie canadienne

// 0 ) { $(this).parent().parent().removeClass(‘form-error-field’); $(this).parent().parent().parent().find(‘.js-submitedit-submit’).removeClass(‘disabled’); } else { $(this).parent().parent().addClass(‘form-error-field’); $(this).parent().parent().parent().find(‘.js-submitedit-submit’).addClass(‘disabled’); } }); $(document).ready(function(){ //======== Click on citation reference copy ======= $(‘.citation-reference .link a’).on(‘click’, function(e){ e.preventDefault(); var getVal = $(this).text(); $(this).empty(); $(this).addClass(‘copied’).delay(2000).queue(function(next){ $(this).removeClass(‘copied’); $(this).html(getVal); next(); }); }) //======== Send Edit form in a Ajax Call ======== $(«form.form-submit-edit»).submit(function(e){ var form = $(this); var url = form.attr(‘action’); var articleID = $(‘#articleID’).val(); $(‘.form-error-list ul’).empty(); $.ajax({ type: «POST», url: url, data: form.serialize(), // serializes the form’s elements. success: function(data){ // Trigger Close Popup // Show Thank You Popup + Overlay $(‘#popup-edit .popup-close’).trigger(‘click’); $(‘#popup-thankyou’).addClass(‘open’); $(‘#overlayPopup’).show(); // location.reload(); }, error: function(data) { var getErrors = data.responseJSON.data.errors; var errorObj = $.parseJSON(getErrors); $.each(errorObj, function () { var createErrorList = ‘

  • ‘+this+»; $(‘.form-error-list ul’).append(createErrorList); }); } }); e.preventDefault(); // avoid to execute the actual submit of the form. }); //======== Citation Copy ======== $(‘.citation-reference .link a’).on(‘click’, function(e){ e.preventDefault(); var getVal = $(this).text(); $(this).empty(); $(this).addClass(‘copied’).delay(2000).queue(function(next){ $(this).removeClass(‘copied’); $(this).html(getVal); next(); }); }) // We Copy The Selected Text $(‘article.article .article-content’).mouseup(function (e){ text = window.getSelection().toString(); getContainerSelected = window.getSelection().anchorNode.parentElement; getParent = window.getSelection().anchorNode.parentElement.parentElement; var getID = $(getParent).find(‘[name^=»teid»]’).val(); var menu = $(‘#highlight-menu’); if ( text.length > 0 ) { $(‘#text-editor’).trumbowyg(‘html’, text); $(‘#articleID’).val(getID); // Get Offset Element function offset(el) { var rect = el.getBoundingClientRect(), scrollLeft = window.pageXOffset || document.documentElement.scrollLeft, scrollTop = window.pageYOffset || document.documentElement.scrollTop; return { top: rect.top + scrollTop, left: rect.left + scrollLeft } } var s = document.getSelection(), r = s.getRangeAt(0); var divOffset = offset(r); if (r && s.toString()) { var p = r.getBoundingClientRect(); if (p.left || p.top) { menu.css({ //left: (p.left + (p.width / 2)) — (menu.width() / 2), //top: (p.top — menu.height() — 10), left: divOffset.left, top: ( divOffset.top — menu.height() ), display: ‘flex’, opacity: 0 }) .animate({ opacity:1 }, 300); setTimeout(function() { menu.addClass(‘highlight-menu-animate’); }, 10); return; } } menu.animate({ opacity:0 }, function () { menu.hide().removeClass(‘highlight-menu-animate’); }); } else { menu.animate({ opacity:0 }, function () { menu.hide().removeClass(‘highlight-menu-animate’); }); } }); // On Higlight Menu Click $(‘#highlight-menu’).on(‘click’, function (e) { e.preventDefault(); $(‘.js-edit-submit’).trigger(‘click’); }); }); ]]>
  • p.filename == myNewString); if ( getObject[0] ) { $(this).parent().append(»+ getObject[0].title +»+ getObject[0].source +»); } $(this).on(‘click’, function(e){ e.preventDefault(); var getImgSrc = $(this).attr(‘src’); getImgCaption = $(this).parent().parent().find(‘figcaption’).text(); openPictureModal(getImgSrc, fileNameImg, getImgCaption); }) }); // Open a popup modal. function openPictureModal(param, fileNameImg, imageCaption) { var getPicturesInfos = $(‘.js-picture-informations’).val(); var getPicturesInfosArray = JSON.parse(getPicturesInfos); var mySubString = fileNameImg.substring( fileNameImg.lastIndexOf(«/media/») + 1, fileNameImg.lastIndexOf(«.») ); var myNewString = mySubString.replace(‘media/’, »); var getObject = getPicturesInfosArray.filter(p => p.filename == myNewString) if ( getObject[0] ) { $(‘#image-modal-body .img-modal-title’).text(getObject[0].title); $(‘#image-modal-body .img-modal-creator’).text(getObject[0].creator); if (getObject[0].creator == null || getObject[0].creator == «»){ $(‘#image-modal-body .img-modal-creator’).text(getObject[0].source); } $(‘#image-modal-body .img-modal-desc’).text(imageCaption); } $(‘#image-modal-body img’).empty(); $(‘#image-modal-body img’).attr(‘src’,param); $(‘#image-modal-body img’).css(‘display’,’none’); $(‘#image-modal-body img’).on(‘load’,function(){ $(‘.popup-loading’).hide(); $(this).css(‘display’,’block’); }) $(‘#popup-image’).addClass(‘open’); $(‘#overlayPopup’).show(); } // If window width > 1024 then we open the sidebar by default. if( $( window ).width() >= 1024 ) { const menuArticle = document.getElementById(‘menu-open’); if(menuArticle){ menuArticle.click(); } } $(‘#menu-open’).on(‘click’, function(){ var isOpen = $(‘#menu-open’).is(«:checked»), getWidth = $( window ).width(); if ( getWidth < 1024 && isOpen) { $('#overlay').show(); $('#overlay').css('z-index','12'); $('.menu-article').css({ 'opacity': '1', 'z-index': '13' }); } else { $('#overlay').hide(); $('#overlay').css('z-index','inherit'); } }) $('#def h3' ).each(function() { var getTitle = $(this).text(); var name = getTitle.replace(/[^a-zA-Z0-9 ]/g, ""); var finalAnchor = name.replace(/s+/g, '')+"_def"; $(this).attr('id', finalAnchor); var txtToAdd = " «+$(this).text()+»»; $(txtToAdd).insertBefore( $( «.sb-hidden-anchor» ) ); }); } // ====== IF NOT IE 11 ======================= var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; if(!isIE11){ setTimeout(function(){ articleSlider = $(‘.bxslider’).bxSlider({ mode: ‘fade’, pager: true, controls: true, adaptiveHeight: true, captions: false }); }, 300) } $(document).ready(function(){ // ====== IF IE 11 ======================= if(isIE11){ articleSlider = $(‘.bxslider’).bxSlider({ pager: true, controls: true, captions: false }); } footerSizer(); // If window is resize $( window ).resize(function() { footerSizer(); }); // ===== Resize Footer width ======= function footerSizer(){ if ($(window).width() >= 1265) { $(‘footer’).css(‘padding-left’,’250px’); } else { $(‘footer’).css(‘padding-left’,’0px’); } } // ===== For each image on .article-content ======= $( «.article-content img» ).each(function( index ) { // We wrap each img tag with a link to apply popup. $(this).wrap(«») // Create div content at bottom var getPicturesInfos = $(‘.js-picture-informations’).val(); var getPicturesInfosArray = JSON.parse(getPicturesInfos); var fileNameImg = $(this).parent().parent().find(‘img’).attr(‘src’); var fileWithExtension = fileNameImg.split(‘/’).slice(-1)[0]; var myNewString = fileWithExtension.substring(0, fileWithExtension.lastIndexOf(«.»)); var getObject = getPicturesInfosArray.filter(p => p.filename == myNewString); if ( getObject[0] ) { $(this).parent().append(»+ getObject[0].title +»+ getObject[0].source +»); } $(this).on(‘click’, function(e){ e.preventDefault(); var getImgSrc = $(this).attr(‘src’); var getImgCaption = $(this).parent().parent().find(‘figcaption’).text(); openPictureModal(getImgSrc, fileNameImg, getImgCaption); }) }); // Open a popup modal. function openPictureModal(param, fileNameImg, imageCaption) { var getPicturesInfos = $(‘.js-picture-informations’).val(); var getPicturesInfosArray = JSON.parse(getPicturesInfos); var mySubString = fileNameImg.substring( fileNameImg.lastIndexOf(«/media/») + 1, fileNameImg.lastIndexOf(«.») ); var myNewString = mySubString.replace(‘media/’, »); var getObject = getPicturesInfosArray.filter(p => p.filename == myNewString) if ( getObject[0] ) { $(‘#image-modal-body .img-modal-title’).text(getObject[0].title); $(‘#image-modal-body .img-modal-creator’).text(getObject[0].creator); if (getObject[0].creator == null || getObject[0].creator == «»){ $(‘#image-modal-body .img-modal-creator’).text(getObject[0].source); } $(‘#image-modal-body .img-modal-desc’).text(imageCaption); } $(‘#image-modal-body img’).empty(); $(‘#image-modal-body img’).attr(‘src’,param); $(‘#image-modal-body img’).css(‘display’,’none’); $(‘#image-modal-body img’).on(‘load’,function(){ $(‘.popup-loading’).hide(); $(this).css(‘display’,’block’); }) $(‘#popup-image’).addClass(‘open’); $(‘#overlayPopup’).show(); } // Parse each h3 on article and create an anchor on the sidebar. $(‘.article-content h3, .article-widget-title’).each(function() { var getTitle = $(this).text(); var name = getTitle.replace(/[^a-zA-Z0-9 ]/g, «»); var finalAnchor = name.replace(/s+/g, »); $(this).attr(‘id’, finalAnchor); var txtToAdd = « «+$(this).text()+»»; $(txtToAdd).insertBefore( $( «.sb-hidden-anchor» ) ); }); // Smooth scroll when anchor click on the sidebar. $(document).on(‘click’, ‘.sb-anchor a’, function (event) { event.preventDefault(); $(this).addClass(‘current’); var getHeaderHeight = ($(‘header nav’).outerHeight()) + 20; $(‘html, body’).animate({ scrollTop: ($($.attr(this, ‘href’)).offset().top — getHeaderHeight) }, 500); }); // If window width > 1024 then we open the sidebar by default. if( $( window ).width() >= 1024 ) { const menuArticle = document.getElementById(‘menu-open’); if(menuArticle){ menuArticle.click(); } } $(‘#menu-open’).on(‘click’, function(){ var isOpen = $(‘#menu-open’).is(«:checked»), getWidth = $( window ).width(); if ( getWidth «+index._source.title+»»; $(‘.search-results’).append(valueToAppend); }) } } }); }, minLength: 3, select: function( event, ui ) { log( «Selected: » + ui.item.value + » aka » + ui.item.id ); } } ); $(‘.searchPanel-searchBtn’).on(‘click’, function(){ $.submit(); }) }); ]]>

     Login Popup if ( !isLogIn ) { $(‘.btn-login’).trigger(‘click’); return false; } } document.getElementById(m_ID).classList.add(‘open’); } } }) // On Login Click $(‘.btn-login’).on(‘click’, function(e){ e.preventDefault(); $(‘#overlayPopup’).show(); }) $(document).keyup(function(e) { if (e.key === «Escape») { // escape key maps to keycode `27` if($(‘.modal’).hasClass(‘open’)) { $(‘#overlayPopup’).hide(); var modal = document.querySelector(‘[class=»modal open»]’); modal.classList.remove(‘open’); } } }); // CLOSE POPUP ON CLOSE OR BACKGROUND CLICK $(‘.popup-close, .js-popup-close, #overlayPopup’).on(‘click’, function(e){ $(‘#overlayPopup’).hide(); e.preventDefault(); if( $(‘.iframe-video’).length > 0 ) { $(‘.iframe-video’)[0].contentWindow.postMessage(‘{«event»:»command»,»func»:»‘ + ‘stopVideo’ + ‘»,»args»:»»}’, ‘*’); $(‘.iframe-video’)[0].contentWindow.postMessage(‘{«method»:»unload»}’,’*’); } var modal = document.querySelector(‘[class=»modal open»]’); modal.classList.remove(‘open’); }) ]]>