La ricerca sarà presto disponibile in italiano, per favore scrivi in Inglese.
  • -
  • 0:00/0:00
BPM
10
300
or
KEYS
`, {boxWidth: 'calc(300px + 10%)',theme: 'cez-invitation-inscription'} ); setTimeout(function(){ $('.jconfirm-cez-invitation-inscription.jconfirme-box').attr('animation', ''); }, 1000); } /** Fin popup qui s'ouvre au out de 30s pour tout nouveau venu */ getAllIdMots = function(seriali){ if($('#type_enregistrer_resultats:checked').val()=="selected"){ var checkedVals = $('.selectidmot:checkbox:checked').map(function() { return this.value; }).get(); return checkedVals.join(","); }else{ // return tabTitlesPage.join(","); return "REQ::" + seriali; } } ///// TOAST NOTIFS var toasts = []; var sameToastsCpt = 1; const toastifyDefaultOptions = { duration: 6000, stopOnFocus: true, // Prevents dismissing of toast on hover type: 'cez', // bootstrap classes alert-{type} - cezame blue by default // close: true, // style: { background: "#1daee0" }, /// Replaced by bs classes alert-{type} onClick: function(){ toasts[this.tid].hideToast(); }, } function addNotifCustom(text, addOptions={}) { var options = {...toastifyDefaultOptions, ...addOptions}; /// Merges the objects with the last objects overriding first ones properties options.text = text; if ('className' in options) options.className += ' alert-'+options.type; else options.className = 'alert-'+options.type; var tmpToast = Toastify(options).showToast(); var tit = tmpToast.options.tid; toasts[tit] = tmpToast; return toasts[tit]; } /// duration in ms function addNotif(text, type='', seconds=0, addOptions={}) { if (type!='') addOptions.type = type; if (seconds!=0) addOptions.duration = seconds * 1000; /// Avoid cumulative notifs if (toasts.length > 0) { var lastToast = toasts[toasts.length - 1]; if (lastToast.options.text === text && $(lastToast.toastElement).hasClass('on')) { ///// Si le dernier toast est le même que celui à afficher on ajoute un badge avec le nombre de notifs similaires : /// Affichage du badge sameToastsCpt++; lastToast.toastElement.innerHTML = ''+sameToastsCpt+''+text; /// Reset le timeout de la notif d'origine window.clearTimeout(lastToast.toastElement.timeOutValue); lastToast.toastElement.timeOutValue = window.setTimeout(()=>{lastToast.removeElement(lastToast.toastElement);}, lastToast.options.duration); return lastToast; } else { sameToastsCpt = 1; } } return addNotifCustom(text, addOptions); } ///// END TOAST NOTIFS //milleryIt milleryIt = function(id_millery){ jQuery('.millery-container').hide(300); /**on vide tous les millery**/ //////jQuery.('.millery-container').remove(); jQuery('.btninsp').removeClass('selected'); jQuery('#btninsp-' + id_millery).addClass('selected'); var zecont = jQuery("#millery-"+id_millery).find(".millery-container"); if(zecont.length>0){ zecont.show(300); }else{ jQuery("#millery-" + id_millery).millery({ source: $("#millery-list-"+id_millery), panelType: "null", keepState: false, backButtonLabel: '', visibleColumns: 1, onnodeclick: function (instance, node, data) { //instance.setPanelData("Node " + node.text() + " clicked!"); return true; }, onafterappend: function(millery, column, def){ cptMilleryIntervalAppend=0; intervalMilleryAppend=setInterval( function(){ if(cptMilleryIntervalAppend>5000){ clearInterval(intervalMilleryAppend); return; } if(column.find('.millery-node').length>0){ recopierHandlersToMillery(column, id_millery); clearInterval(intervalMilleryAppend); }else{ cptMilleryIntervalAppend++; } }, 100); return true; // false prevents attachment }, oninit: function(millery){ cptMilleryInterval=0; intervalMillery=setInterval( function(){ if(cptMilleryInterval>5000){ clearInterval(intervalMillery); return; } if(millery.$elem.find('div.millery-node').length>0){ recopierHandlersToMillery(millery.$elem,id_millery); clearInterval(intervalMillery); }else{ cptMilleryInterval++; } }, 100); return true; } }); spinnerStart(); xajax_griser_mots(); } jQuery('#millery-container-' + id_millery).show(300); } recopierHandlersToMillery = function(M, id_millery){ var zulou = new Array(); M.find('div.millery-node').each(function(){ zet = $(this) .clone() //clone the element .children() //select all the children .remove() //remove all the children .end() //again go back to selected element .text(); zulou['millery-' + zet] = $(this); }); //var zul = M.parent().children('ul').first(); var zul = jQuery('#millery-list-' + id_millery); zul.find('li').each(function(){ var zea=$(this).children('a'); var zetxt = zea.text();//.replace(/\(/,"").replace(/\)/,""); var zeonclick=zea.attr('onClick'); var zeonmouseover=zea.attr('onmouseover'); var zeid=zea.attr('data-id'); var replacezul = zulou['millery-' + zetxt]; if(replacezul!=null) { replacezul.attr('id', zeid).attr('onClick', zeonclick); if(!replacezul.hasClass('millery-node-parent')) replacezul.append(""); } }); /////////xajax_griser_mots(); } removeThisInspirationWord = function(w){ var t = w.text(); //mot_sel_2050_134777 var att = w.attr('id').split(/_/); var id_liste_critere = att[3]; $(".text-label:contains('" + t +"')").parent().find('.text-remove').click(); $('#searchitem' + id_liste_critere).remove(); } //--- //- FANCYBOX //--- open_fancy = function(titre,url,w,h){ if(w!='' && h!=''){ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'no', 'width':w, 'height':h, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : url, 'overlayColor':'#000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true }); }else{ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'yes', 'width' :'95%', 'height' :'95%', 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : url, 'overlayColor':'#000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true }); } } open_fancy_cms =function(titre,url,w,h,oncloseid){ if(w!='' && h!=''){ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'no', 'width':w, 'height':h, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : url, 'overlayColor':'#0000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true, 'scrolling': 'yes', 'onClosed' : function(){document.location.href='/admin/admin_pages.php?id_page=' + oncloseid} }); }else{ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'yes', 'width' :'95%', 'height' :'95%', 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : url, 'overlayColor':'#0000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true, 'scrolling': 'yes', 'onClosed' : function(){document.location.href='/admin/admin_pages.php?id_page=' + oncloseid} }); } } open_fancy_video =function(titre,url,w,h){ if(w!='' && h!=''){ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'no', 'width':w, 'height':h, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : url, 'overlayColor':'#0000', 'opacity' : '0.9', 'onClosed' : function(){document.location.reload();}, 'titleShow':false, 'overlayShow': true, 'showCloseButton': false }); }else{ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'yes', 'width' :'95%', 'height' :'95%', 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : url, 'overlayColor':'#0000', 'opacity' : '0.9', 'onClosed' : function(){document.location.reload();}, 'titleShow':false, 'overlayShow': true, 'showCloseButton': false }); } } open_fancy_share = function(titre,url,w,h){ if(w!='' && h!=''){ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'no', 'width':w, 'height':h, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : url, 'overlayColor':'#000', 'opacity' : '0.9', 'titleShow':false, 'onClosed' : function(){document.location.reload();}, 'overlayShow': true }); }else{ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'yes', 'width' :'95%', 'height' :'95%', 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : url, 'overlayColor':'#000', 'opacity' : '0.9', 'titleShow':false, 'onClosed' : function(){document.location.reload();}, 'overlayShow': true }); } } open_login_lightbox =function(){ var url = ""; if(""!=""){ var url="?url_download_login="; } jQuery('html, body').animate({scrollTop:100}, 'slow'); $.fancybox({ 'autoScale': true, 'margin' :5, 'padding' :1, 'scrolling' :'no', 'width' : 655, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : '/login_lightbox.php'+url, 'overlayColor':'#00000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true }); $('#fancybox-wrap').removeClass('fancybox-wrap-very-pitah'); } open_subscribe_lightbox =function(){ event.preventDefault(); $.fancybox({ 'autoScale': true, 'margin' :5, 'padding' :1, 'scrolling' :'no', 'width' : 655, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : '/subscription_lightbox.php', 'overlayColor':'#00000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true }); $('#fancybox-wrap').removeClass('fancybox-wrap-very-pitah'); } open_embed_lightbox = function(url){ //var url = $(this).attr('data-embed'); //jQuery('html, body').animate({scrollTop:100}, 'slow'); $.fancybox({ scrolling :'no', 'width' : 320, 'height' : 320, 'maxHeight' : 320, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : '/assets/embed_lightbox.php', 'overlayColor':'#00000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true, 'beforeShow': function () { var newurl = ''; var $iframe = $('.fancybox-iframe'); $('textarea', $iframe.contents()).val(newurl); //$('textarea#embedcode').html(url); $('textarea', $iframe.contents()).select(); } }); } open_newsletter_lightbox = function(type,email){ //jQuery('html, body').animate({scrollTop:100}, 'slow'); $.fancybox({ scrolling :'no', 'width' : 400, 'height' : 510, 'fitToView' : false, 'autoSize' : false, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : '/assets/newsletter_lightbox.php?type='+type+'&email='+email, 'overlayColor':'#00000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true }); $('#fancybox-wrap').removeClass('fancybox-wrap-very-pitah'); } open_enquete_lightbox = function(){ $.fancybox({ scrolling :'no', 'width' : 551, 'height' : 322, 'maxHeight' : 322, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : '/assets/enquete_lightbox.php', 'overlayColor':'#00000', 'wrapCSS' : 'enquete_lightbox', 'opacity' : '0.9', 'titleShow' : false, 'closeClick' : false, 'overlayShow' : true, 'beforeClose' : function() { if($('.enquete_lightbox iframe').contents().find('input#ko_enquete').is(':checked')){ setCookie('enquete','ko_enquete_2024-12-23',365); } }, 'afterShow' : function(){ }, helpers : { overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox } }); } check_session_download_autorisation = function(ref,titre,id_media){ $.ajax({ url : "/ajax/check_conn.php", success : function(data,ref,titre,id_media){ if(data=="OK"){ if(preference_wav_telechargement=='WAV' || preference_wav_telechargement=='MP3' || preference_wav_telechargement=='AIFF'){ getDownloadFromPrefs(preference_wav_telechargement,'tracks','','','',''); }else{ Tip('
',BGCOLOR,'#FFFFFF',FONTCOLOR,'#000000',BORDERWIDTH,1,BORDERCOLOR,'#CCCCCC',CLOSEBTN, false,STICKY,true,OPACITY,90,PADDING,7,ABOVE,true,CENTERMOUSE,true, DURATION, -1000,WIDTH,560); xajax_tip_download(''); } }else{ open_autorisationContact_lightbox(ref,titre,id_media); } } }); } open_autorisationContact_lightbox = function(ref,titre,id_media){ $.fancybox({ 'width' : 550, 'height' : 650, 'maxHeight' : 650, 'fitToView' : true, 'autoScale': false, 'transitionIn': 'elastic', 'transitionOut': 'elastic', 'type': 'iframe', 'href': '/assets/autorisationContact_lightbox.php?ref='+ref+'&titre='+titre+'&id_media='+id_media, 'helpers' : { 'title': { type: 'inside'}, 'overlay' : {css : { 'background' : 'none'},locked: false} }, }); } open_tools_lightbox = function(){ $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'no', 'height' : 558, 'width' : 980, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'href' : '/private/index.php', 'overlayColor':'#0000', 'opacity' : '0.9', 'showCloseButton':false, 'titleShow':false, 'overlayShow': true }); $('#fancybox-wrap').addClass('fancybox-wrap-very-pitah'); } open_tools_box = function(){ var left = $('#voletConteneurEspacePrive').position().left; // get left position var width = $('#voletConteneurEspacePrive').width(); // get width; var containerwidth=$(window).width(); var right = width + left - containerwidth; // add the two together if(right==0){ $('#voletConteneurEspacePrive').animate({ right: '-717px' }, 500); }else{ $('#voletConteneurEspacePrive').animate({ right: '0px' }, 500); } } // Safari setCookie() bug fix : cezSetCookie = function(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } textareaIze = function( t ){ var str=''; t.find('.infoboxy').each(function( ) { // This doesn't work because the .div_item children aren't populated? str = str + $(this).find('.libsearch').text().replace(/[\n\r]/g, '').replace(/ +/g, ' ') + '\n'; }); $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'yes', 'transitionIn' : 'none', 'transitionOut' : 'none', 'overlayColor':'#000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true, 'autoSize': false, 'width':'370', 'height':'240', 'scrolling' : 'no', content : "" //retire pour permettre la selection de ligne precise et non pas tout le contenu //onClick='this.focus();this.select()' }); } textareaIzeParole = function( t ){ var str=''; str = t.find('.infoParole').html().replace(//mg,"\n"); $.fancybox({ 'margin' :5, 'padding' :1, 'scrolling' :'yes', 'transitionIn' : 'none', 'transitionOut' : 'none', 'overlayColor':'#000', 'opacity' : '0.9', 'titleShow':false, 'overlayShow': true, 'autoSize': false, 'width':'370', 'height':'240', 'scrolling' : 'no', content : "" //retire pour permettre la selection de ligne precise et non pas tout le contenu //onClick='this.focus();this.select()' }); } check_video_info = function(id_video){ /**cette fonction verifie l'etat d'une video e intervalle regulier et recharge l'ecran de liste des videos si jamais celle-ci devient termine**/ $.ajax({ url: '/ajax/get_video_info.php?id_video=' + id_video, success: function(data) { if(data=="demande" || data=="en cours") { setTimeout("check_video_info(" + id_video + ")",5000); }else if($('#prive_liste_videos_body').is(':visible')){ xajax_charger_ecran("liste_videos"); } } }); } //appel via se_connecter check_video_edit = function(){ var iframe = $('#espaceprive'); IntervalCheckVideoEdit = setInterval(function() { const url = window.location.href; $('#btn_edition_video').hide(); if($('#voletConteneurEspacePrive').hasClass('openprivate') ){ if(iframe.contents().find('#lien_prive_liste_videos').hasClass('active')){ if(iframe.contents().find('#form_video_montage').length){ if($('#btn_edition_video').not(':visible')){ $('#btn_edition_video').show(); } } } } }, 3000); } get_rememberme = function(){ /** fonction qui quand elle est appelee, verifie dans les cookies si l'authentification est presente, et si c'est le cas : -recupere le login et le password -remplit les champs login et passwords -procede e l'identification **/ var chiffer=getCookie("rememberme"); if(chiffer!=""){ var decoded_arr = Base64.decode(chiffer).split("|"); $('#sesouvenirdemoi').attr("checked",true); $("#header-userlogin-login").val(decoded_arr[0]); $("#header-userlogin-password").val(decoded_arr[1]); xajax_se_connecter(decoded_arr[0], decoded_arr[1]); }else{ $('#sesouvenirdemoi').attr("checked",false); } } changeLangSelect = function(){ var selectBox = document.getElementById("langSelect"); var selectedValue = selectBox.options[selectBox.selectedIndex].value; window.location.href = selectedValue; } set_rememberme = function( ){ /** si val == false on efface le cookie d'identification si val == true on positionne le cookie d'identification **/ var val = $('input#sesouvenirdemoi:checked').val(); if(val=="1"){ var login = $("#header-userlogin-login").val(); var password = $("#header-userlogin-password").val(); if(login!="" && password!=""){ var chiffer = Base64.encode(login + "|" + password + "|endofcookie"); setCookie("rememberme",chiffer,1000); } }else{ /**effacer immediatement le cookie rememberme**/ setCookie("rememberme","",-1); } } /**ajuster la taille des tags**/ function ajusterTailleTags(idt){ //yohanndev V4 return true; /* var nb = $(idt).length; var size = 13; switch(nb){ case 0: case 1: case 2: soze = 15; break; case 3: size = 12 break; case 4: case 5: size = 11; break; case 6: case 7: case 8: size = 10; break; case 9: case 10: size = 9; break; } */ if($(idt).length>0){ var w = parseInt($(idt).parent().css('width').replace('px','')); var w2 = parseInt($('.text-wrap').css('width').replace('px','')); if(w+5 > w2){ /**reduire la marge de chaque mot**/ $(idt).each(function(i){ $(this).addClass('text-tag-nomargin'); }); }else{ $(idt).each(function(i){ $(this).removeClass('text-tag-nomargin'); }); //$(idt).vAlign(); } } } /**s'execute quand on clique sur un mot de premier niveau**/ clickRechercheGuideeNiveau1 = function(o,idcra,id_liste_critere,nom_liste_critere){ if(!o.hasClass('mot_sel') && !o.hasClass('mot_busy')){ spinnerStart(); newAdvSearchPrune(nom_liste_critere); newAdvSearchAdd(idcra,id_liste_critere,nom_liste_critere,'search_hidden_results'); /**EV 05/07/2022 : on ajoute les mots de la barre de recherche**/ var r = $(".text-tags .text-label").map( function(){return $(this).text();}).get().join(' '); xajax_check_multiple_words(r,xajax.getFormValues('search_hidden_results'),false,true); /////////////o.parent().find('.niveau2').show(); ///rentrerPoigneeRechercheGuidee();$('#poigneeRechercheGuidee').click(); o.addClass('mot_sel'); } } /**s'execute quand on clique sur un mot de second niveau**/ clickRechercheGuideeNiveau2 = function(o,idcra,id_liste_critere,nom_liste_critere){ if(!o.hasClass('mot_sel') && !o.hasClass('mot_busy')){ spinnerStart(); newAdvSearchPrune(nom_liste_critere); newAdvSearchAdd(idcra,id_liste_critere,nom_liste_critere,'search_hidden_results'); /**EV 05/07/2022 : on ajoute les mots de la barre de recherche**/ var r = $(".text-tags .text-label").map( function(){return $(this).text();}).get().join(' '); // xajax_check_multiple_words(r,xajax.getFormValues('search_hidden_results'),false,true); o.parent().find('.niveau3').show(); /* rentrerPoigneeRechercheGuidee(); */ /* $('#poigneeRechercheGuidee').click();*/ o.addClass('mot_sel'); } } /** SG 21/03/2024 : pour qu'au click sur mot clef dans liste des résultats ca l'ajoute à la recherche reviendre **/ clickKeyWord = function(el) { var idcra = el.getAttribute('data-idcra'); var id_liste_critere = el.getAttribute('data-idlistecritere'); var nom_liste_critere = el.getAttribute('data-nomlistecritere'); var r = $(".text-tags .text-label").map( function(){return $(this).text();}).get().join(' '); tagSearchAdd(idcra, id_liste_critere, nom_liste_critere, 'search_form'); xajax_check_and_add_keyword_from_tags_list(xajax.getFormValues('search_form'), r, id_liste_critere, nom_liste_critere); //SG 22/03/2024 : ici on remove les inputs concernant le mot qu'on vient d'ajouter sinon ca casse le fait de pouvoir retirer des mots de la recherche car au click sur le "-" doublon dans le formulaire var input_to_remove = document.getElementsByName('classif_'+idcra+'[]'); input_to_remove[0].remove(); } tagSearchAdd = function(id_critere,id_liste_critere,nom_liste_critere,nom_formulaire){ var hds=""; jQuery('#' + nom_formulaire ).append(hds); } newAdvSearchAdd = function(id_critere,id_liste_critere,nom_liste_critere,nom_formulaire){ var hds=""; jQuery('#' + nom_formulaire ).append(hds); } newAdvSearchPrune = function(nom_liste_critere){ var i=1; var zeopenButton = $('.inspirationselection button.selected'); if(zeopenButton.length>0){ var goodID = zeopenButton.attr('id').replace(/btninsp-/,''); $('#millery-container-'+goodID).find(".millery-breadcrumb:not(:last)").each(function(){ var zeword = $(this).text(); $('#search_hidden_results>input').each(function(){ var zeword2=$(this).attr('data-value'); if( zeword2!=null && zeword.replace(/\-/gi,' ') == zeword2.replace(/\-/gi,' ') ){ $(this).remove(); $(".text-tags .text-label").each(function(){ /**si le tag match avec zeword, on supprime le tag**/ if($(this).text() == zeword){ $(this).parent().remove(); } }); } }); i++; }); } } newAdvSearchClearWord = function(nom_liste_critere){ $('.millery-breadcrumbs').empty(); var zetag = jQuery('.millery-node').each( function(){ if($(this).text().trim() == nom_liste_critere.trim()){ $(this).removeClass('mot_sel').removeClass('millery-node-active'); var zid = $(this).attr('id'); /**rechercher le noeud dont data-id=zid**/ var ulequivalent = $( "a[data-id='" + zid + "']" ); if(ulequivalent.length>0){ var zpere = ulequivalent.parent().parent().parent(); if(zpere.is('li')){ var zpere = ulequivalent.parent().parent().parent().find("a"); if(zpere.length > 0){ var zperestr = zpere.html() jQuery('.millery-node').each( function(){ if($(this).text().trim() == zperestr.trim()){ $(this).removeClass('mot_sel').removeClass('millery-node-active'); } }); }else{ } }else{ } } } } ); /** /**dégriser le mot du parent**/ } advSearchAdd = function(id_critere,id_liste_critere,libelle) { var libreplace = libelle.replace(/'/,''); var str="" ; /**ajouter le mot à une liste existante si elle existe, sinon, la créer**/ if($("#advsearchitem"+id_liste_critere).size()==0) { /////////////////////$('#temp_terms').append(str); $('#header-search-query').textext()[0].tags().addTags([libreplace]); ajusterTailleTags('.text-tag'); $('#rechercheguidee').privateValign(); /**Appel de la fonction de recherche "affichage du nombre de résultats**/ var r = $(".text-tags .text-label").map( function(){return $(this).text();}).get().join(' '); xajax_check_multiple_words(r, xajax.getFormValues('search_form')); } } advSearchRemove = function(id_critere,id_liste_critere,libelle) { if(id_liste_critere==0) { return true; } var libreplace = libelle.replace(/'/,''); $('#advsearchitem'+id_liste_critere).remove(); /**décocher l'image !**/ if(libelle!=""){ /**retirer le mot**/ $(".text-label:contains('" + libreplace +"')").parent().find('.text-remove').click(); $('#searchitem' + id_liste_critere).remove(); } /**Appel de la fonction de recherche "affichage du nombre de résultats**/ var r = $(".text-tags .text-label").map( function(){return $(this).text();}).get().join(' '); xajax_check_multiple_words(r, xajax.getFormValues('search_form')); advcpt++; } /**clic sur une image de FILE**/ traiterClickImgFile = function(imagoz,id_critere,nom_critere,id_liste_critere,nom_liste_critere){ if(imagoz.attr('src').indexOf('off')==-1){ imagoz.attr('src','/themes/cezame/css/images/search-checkbox-off.gif'); advSearchRemove(id_critere, id_liste_critere,nom_liste_critere); }else{ ////////////$('.cocher_enfants').removeClass('cocher_enfants'); imagoz.attr('src','/themes/cezame/css/images/search-checkbox-on.gif'); advSearchAdd(id_critere,id_liste_critere,nom_liste_critere); } } /**clic sur une image de FOLDER**/ traiterClickImgFolder = function(imagoz,id_critere,nom_critere,id_liste_critere,nom_liste_critere){ if(imagoz.attr('src').indexOf('off')==-1){ imagoz.attr('src','/themes/cezame/css/images/search-checkbox-off.gif'); advSearchRemove(id_critere,id_liste_critere,0); $('#searchitem'+id_liste_critere).remove(); if($('#result > li').size()<1){ xajax_effacer_derniers_titres_session(); $('#allresults').hide(); }else{ } }else{ ////////////$('.cocher_enfants').removeClass('cocher_enfants'); imagoz.attr('src','/themes/cezame/css/images/search-checkbox-on.gif'); advSearchAdd(id_critere,id_liste_critere,nom_liste_critere,false); } } accentsTidy = function(s){ var r=s.toLowerCase(); r = r.replace(new RegExp(/\.(html|php)$/g),""); r = r.replace(new RegExp(/\s/g),""); r = r.replace(new RegExp(/[àáâãäå]/g),"a"); r = r.replace(new RegExp(/æ/g),"ae"); r = r.replace(new RegExp(/ç/g),"c"); r = r.replace(new RegExp(/[èéêë]/g),"e"); r = r.replace(new RegExp(/[ìíîï]/g),"i"); r = r.replace(new RegExp(/ñ/g),"n"); r = r.replace(new RegExp(/[òóôõö]/g),"o"); r = r.replace(new RegExp(/œ/g),"oe"); r = r.replace(new RegExp(/[ùúûü]/g),"u"); r = r.replace(new RegExp(/[ýÿ]/g),"y"); r = r.replace(new RegExp(/\W/g),""); r = r.replace(new RegExp(/[?&=]/g),"_"); return r; }; urlTidy = function(s){ var r=s.toLowerCase(); ////// r = r.replace(new RegExp(/[?&=]/g),"_"); r = r.replace(new RegExp(/[?]/g),"___"); r = r.replace(new RegExp(/[&]/g),"-_-"); r = r.replace(new RegExp(/[=]/g),"_-_"); r = r.replace("https://en.cezamemusic.com",""); return r; }; tidyUrl = function(s){ var r=s.toLowerCase(); ////// r = r.replace(new RegExp(/[?&=]/g),"_"); r = r.replace(new RegExp(/___/g),"?"); r = r.replace(new RegExp(/-_-/g),"&"); r = r.replace(new RegExp(/_-_/g),"="); r = "https://en.cezamemusic.com:443" + r; return r; }; function changeHauteur(H) { //document.getElementById('iframaz').style.height = H + "px"; if(H == '130'){ $('.scrollableZone').css('height','133px'); }else{ $('.scrollableZone').css('height','260px'); } $('#iframaz').css('height', H+"px"); } function open_window_txt(txt,titre){ var win = new Window({className: "dialog", width:640, height:480, zIndex: 100, resizable: true, title: titre, showEffect:Effect.BlindDown, hideEffect: Effect.SwitchOff, draggable:true, wiredDrag: true}) win.getContent().innerHTML= "
" + txt + "
" win.setStatusBar(" "); win.showCenter(); } function open_window_downloader(url,titre,w,h,center){ var features='resizable=0,toolbar=0,menubar=0,scrollbars=1'; if(center==""){ var wint = 0; var winl = 0; }else{ if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; }else{ winl = 0;wint =0; } if (winl < 0) winl = 0; if (wint < 0) wint = 0; } var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += features; win = window.open(url,titre,settings); try { //win.focus(); win.blur(); win.focus() }catch (e) { var obj = $.dialog({ title: '', content: 'Pop-up Blocker is enabled! Please disable your pop-up blocker (Address bar). Otherwise, use another browser. 
see more', animation: 'scale', }); } //raz pour les prochains download centerpopup="1"; return win; } function open_window_url(url,titre,w,h){ var features='toolbar=0,resizable=1,status=0,scrollbars=yes'; if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; }else{winl = 0;wint =0;} if (winl < 0) winl = 0; if (wint < 0) wint = 0; var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += features; win = window.open(url,'popupplayer',settings); win.window.focus(); return win; } function open_window_url_scroll(url,titre,w,h){ var features='location=1,toolbar=0,resizable=0,status=0,scrollbars=yes'; if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; }else{winl = 0;wint =0;} if (winl < 0) winl = 0; if (wint < 0) wint = 0; var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += features; var randomnumber=Math.floor(Math.random()*1001); var titre2="win"+randomnumber; win = window.open(url,titre2,settings); //win.window.focus(); //return win; } function open_window_url_dhtml(url,titre,w,h){ var win = new Window(Application.getNewId(), {className: "dialog", title: titre, width:w, height:h, resizable: true, url: url, showEffectOptions: {duration:1}, close:function(win) {alert("validate cancel panel"); return true;}}); win.showCenter(); return win; } function dialog_iframe(url,titre,w=800,h=600,dClass=''){ // Initialisation dans footer_v3 var dgIframe = jQuery('#dialog-iframe'); var dgCtnr = dgIframe.parent(); if(dClass != '' && dgCtnr.hasClass(dClass)){ dgIframe.dialog('close'); dgIframe.dialog({ title:titre, resize: 'auto', open: function(){this.setAttribute('src',url);} }); } else { dgIframe.dialog({ title:titre, width:w, height:h, modal:true, resize: 'auto', dialogClass:dClass, open: function(){this.setAttribute('src',url);this.width='100%';} }); } /** * EV :: 12/03/2020 :: dans jquery-ui : modif du code * this.element.show().css({width:"auto" * remplacé par * this.element.show().css({width:b.width **/ dgCtnr.css({'z-index' : 1000000}); dgIframe.dialog('open'); } function ajax_control(url, width,height){ Dialog.alert({url: url, options: {method: 'get'}}, {windowParameters: {className: "cesame", width:width,height:height}, okLabel: "close"}); return win; } var txt = "
Login

"; function mycallbackform(v,m,f){ $.prompt(v +' ' + f.alertName); } function modal_login(url,niveau){ /**$.prompt(txt,{ callback: mycallbackform, submit: function(){xajax_se_connecter_modal(document.getElementById("login_modal").value,document.getElementById("password_modal").value,niveau,url);}, buttons: { Connexion: 'Se connecter'} });**/ } function modal_login_incorrect(){ $('login_error_msg').innerHTML='Login or password incorrect'; $('login_error_msg').show(); Windows.focusedWindow.updateHeight(); new Effect.Shake(Windows.focusedWindow.getId()); return false; } var txtgetsearchtname = " "; function mycallbackform2(v,m,f){ //$.prompt(v +' ' + f.alertName); } function modal_get_search_name(){ if(document.getElementById("search_modal").value==''){ //rien }else{ xajax_memoriser_recherche(xajax.getFormValues('search_form'),document.getElementById("search_modal").value); } /* $.prompt(txtgetsearchtname,{ callback: function(){ }, submit: function(){if(document.getElementById("search_modal").value==''){}else{xajax_memoriser_recherche(xajax.getFormValues('search_form'), document.getElementById("search_modal").value);}}, buttons: { Memoriser: 'Choisir un nom de recherche'} }); */ } var svgResult=''; (function($){ jQuery.fn.idle = function(time) { var o = $(this); o.queue(function() { setTimeout(function() { o.dequeue(); }, time); }); }; })(jQuery); var lastpostip=""; function centerChildren(itemli){ if(itemli.length==0) return; //var offsetmoins = parseInt(itemli.parent().parent().css('height').replace(/px$/, "") / 2); var colonneParentH = parseInt(itemli.parent().parent().css('height')); //@Yohann : regarder par rapoport e la hauteur de la fenetre, et faire quelque chose. var ecranH = Math.floor($( document ).height() / 2); var colonneEnfantH = parseInt(itemli.css('height')); var htop = parseInt(ecranH-colonneEnfantH); if(colonneEnfantH > colonneParentH ){ var hauteurCalc = 0 - parseInt(itemli.css('height').replace(/px$/, "") / 2) + 80 ; }else{ var hauteurCalc = 0 - parseInt(itemli.css('height').replace(/px$/, "") / 2) ; } itemli.css('top',hauteurCalc + 'px'); } function isRecogSearchCartouche() { return (document.getElementById('recogdiv') != null); } function spinnerStart() { hide_bpm_key(); cezProgress.start(); } // When ajaxStop is fired, rmeove 'loading' from body class function spinnerStop() { if (!isRecogSearchCartouche()) { //show_bpm_key_zone(); } cezProgress.stop(); } function spinnerStartRG() { $.blockUI({ css: { top:'35%', backgroundColor: '', color: '#fff', border: 'none', }, overlayCSS: { backgroundColor: '#000', opacity: 0.00 }, message: "" }); } // When ajaxStop is fired, rmeove 'loading' from body class function spinnerStopRG() { $.unblockUI(); } //////// /////// PROGRESS BAR OBJECT - GA 03/2022 ////// ///// Loading bar growing randomly //// Check the options to adapt parameters /// Then call cezProgress.start() / cezProgress.stop() // const CP_STOPPED = 0; const CP_STARTED = 1; const CP_STOPPING = 2; var cezProgress = { started: false, status: CP_STOPPED, cancellable: false, animStep: 0, animInterval: null, startAnimTimeout: null, div_overlay: null, div_progressbar: null, btn_cancel: null, searchbtn_elem: null, options: { baseProgressTime: 2, /// (~secondes) temps approximatif de progression de la barre pour aller de 0 à progressStall baseGrowRandMin: 8, baseGrowRandMax: 56, growRandMin: 4, /// = (baseGrowRandMin / baseProgressTime) /// déterminé lors du start() à partir de baseProgressTime growRandMax: 28, /// = (baseGrowRandMax / baseProgressTime) /// déterminé lors du start() à partir de baseProgressTime growIntervalMs: 230, timeJQSlideAnim: 110, progressStall : 0, /// Plafond de progression en attendant le cezProgress.stop() }, getProgress: function() { if (cezProgress.started()) return cezProgress.div_progressbar.style.width.slice(0, -1); else return 0; }, setProgress: function(percent){ if (cezProgress.div_progressbar != null) cezProgress.div_progressbar.style.width = percent+'%'; else return false; }, create: function(cancellable=false) { cezProgress.div_overlay = document.createElement('div'); cezProgress.div_overlay.setAttribute('id', 'cez-loading-overlay'); cezProgress.div_overlay.innerHTML = '
'; document.body.appendChild(cezProgress.div_overlay); cezProgress.div_progressbar = document.getElementById('cez-progress-bar'); cezProgress.btn_cancel = document.getElementById('btn-cancel-progress'); }, //// STATUS started: function() { return cezProgress.status === CP_STARTED }, stopped: function() { return cezProgress.status === CP_STOPPED }, stopping: function() { return cezProgress.status === CP_STOPPING }, //// START PROGRESS BAR //// progress_time : 1 par défaut - temps de progression de la barre de 0 à progressStall start: function(progress_time=false, cancellable=false) { if (cezProgress.started()) return false; /// Init Growing Min & Max random values from baseProgressTime value if (progress_time == false) progress_time = cezProgress.options.baseProgressTime; cezProgress.options.growRandMin = cezProgress.options.baseGrowRandMin / progress_time; cezProgress.options.growRandMax = cezProgress.options.baseGrowRandMax / progress_time; cezProgress.status = CP_STARTED; cezProgress.options.progressStall = getRandomIntProgress(75,85); cezProgress.div_overlay = document.getElementById('cez-loading-overlay'); if (cezProgress.div_overlay == null || cezProgress.div_overlay == false) cezProgress.create(); else cezProgress.div_progressbar = document.getElementById('cez-progress-bar'); /// If cancellable : on affiche le bouton [ANNULER] à droite dans la barre de recherche cezProgress.cancellable = cancellable; if (cancellable) { // disableScrollY(); cezProgress.bindScrollRepositionBtnCancel(); // $(document.body).addClass('no-scroll'); $(cezProgress.div_overlay).addClass('progress-cancellable'); cezProgress.searchbtn_elem = document.getElementById('searchbtn'); cezProgress.setBtnCancelPos(); $(cezProgress.btn_cancel).fadeIn(cezProgress.options.growIntervalMs); /////16/04/2024 Eric / on ne le retire plus. : document.getElementById('btn_external_recommendation').style.display = 'none'; $('#header-search-query').addClass('header-search-disabled'); } /// Si la barre de progression n'est pas encore remise à 0 : délai var animStartDelay = 0; if (cezProgress.getProgress() > 0) { animStartDelay = cezProgress.options.growIntervalMs; cezProgress.setProgress(0); } cezProgress.startAnimTimeout = setTimeout(function(){ //// Init $(cezProgress.div_overlay).show(); $(cezProgress.div_overlay).removeClass('cez-progress-overlay-small'); cezProgress.animStep = 0; /// Progress animation cezProgress.animate(); }, animStartDelay); }, animate: function() { clearTimeout(cezProgress.startAnimTimeout); cezProgress.startAnimTimeout = null; ///// avancée random toutes les 0.3s (+ transition duration) jusqu'au plafond progressStall if (cezProgress.animInterval != null) return; cezProgress.animInterval = setInterval(function(){ cezProgress.growRand(); }, cezProgress.options.growIntervalMs); }, growRand: function() { /// Random grow var progress = 0.1 * Math.round(10 * cezProgress.getProgress()); if (progress >= cezProgress.options.progressStall) { cezProgress.stop(false); return; } var addProgress = cezProgress.options.growRandMin + Math.floor(Math.random() * cezProgress.options.growRandMax); if (cezProgress.animStep > 2 && progress > (cezProgress.animStep * 0.7 * cezProgress.options.growRandMax)) /// Si la progression est trop rapide addProgress = addProgress * 0.5; if (progress > (0.65 * cezProgress.options.progressStall)) { // Ralentissement 1 addProgress = addProgress * 0.6; if (Math.random() > 0.7) addProgress = 0; else if (progress > (0.8 * cezProgress.options.progressStall)) { // Ralentissement 2 if (Math.random() > 0.7) addProgress = 0; else addProgress = addProgress * 0.5; } } var newProgress = 0.1 * Math.round(10 * (progress + addProgress)); if (newProgress >= cezProgress.options.progressStall) newProgress = cezProgress.options.progressStall + 1; cezProgress.setProgress(newProgress); }, //// STOP PROGRESS BAR //// si finish===true alors on emmène la progressbar rapidement à 100% stop: function(finish=true, cancel=false) { if (cezProgress.stopped()) { cezProgress.setProgress(0); $(cezProgress.div_overlay).hide(); return false; } if (cezProgress.animInterval != null) { clearInterval(cezProgress.animInterval); cezProgress.animInterval = null; } if (finish===true) { if (cezProgress.startAnimTimeout != null) { clearTimeout(cezProgress.startAnimTimeout); cezProgress.startAnimTimeout = null; } cezProgress.setProgress(100); cezProgress.status = CP_STOPPING; $(cezProgress.div_overlay).addClass('cez-progress-overlay-small'); if (cezProgress.cancellable) { // enableScrollY(); cezProgress.unbindScrollRepositionBtnCancel(); document.getElementById('btn_external_recommendation').style.display = 'flex'; $('#header-search-query').removeClass('header-search-disabled'); // $(document.body).removeClass('no-scroll'); $(cezProgress.div_overlay).removeClass('progress-cancellable'); $(cezProgress.btn_cancel).fadeOut(cezProgress.options.timeJQSlideAnim); if (cancel) { $(cezProgress.div_overlay).fadeOut(cezProgress.options.timeJQSlideAnim, cezProgress.resetIfNotStarted); document.getElementById('header-search-query').value = ''; return; } } setTimeout(function(){ if (!cezProgress.started()) { $(cezProgress.div_overlay).slideUp(cezProgress.options.timeJQSlideAnim, cezProgress.resetIfNotStarted); // setTimeout(function(){ /// Le temps que la barre de chargement remonte // }, cezProgress.options.timeJQSlideAnim); } }, cezProgress.options.growIntervalMs); } }, /// Fonctions utilisées dans les autres fonctions seulement - après un timeout ou une anim jQuery resetIfNotStarted: function(){ if (!cezProgress.started()) { cezProgress.status = CP_STOPPED; cezProgress.setProgress(0); } }, setBtnCancelPos: function(){ var sbpos = cezProgress.searchbtn_elem.getBoundingClientRect(); cezProgress.btn_cancel.style = 'top:'+sbpos.top+'px;right:'+(sbpos.right + 30)+'px;'; /// /!\ +30px en dur car getBoundingClientRect() détecte la position 'right' à la bordure de l'élément suivant... }, bindScrollRepositionBtnCancel: function() { window.addEventListener('scroll', cezProgress.setBtnCancelPos); }, unbindScrollRepositionBtnCancel: function() { window.removeEventListener('scroll', cezProgress.setBtnCancelPos); }, }; function getRandomIntProgress(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; } /////// /////// JQUERY AJAX REQUEST HANDLER /////// /** GA 12/2021 * SERT A GERER DES REQUETES AJAX EN JQUERY : METHODES CANCEL, ADDCALLBACKS, et d'autres à l'avenir * USE OF jq_xhr : * Set the jq_xhr instance with the jQuery ajax request * Add callbacks on cancel if needed * Cancel or Reset **/ var jq_xhr = { instance: null, /// jq_xhr.instance = $.ajax(.....) cancel: function(){ /// pas touche if (this.instance != null) { this.instance.abort(); this.onCancelCallback(); } this.reset(); }, onCancelCallback: function(){}, /// pas touche addCancelCallback: function(addFunc){ /// jq_xhr.addCancelCallback( function(){alert('hello world')} ) this.onCancelCallback = function(){ this.onCancelCallback(); addFunc(); } }, reset: function(){ /// pas touche - reset automatiquement au jq_xhr.cancel() this.instance = null; this.onCancelCallback = function(){}; } } /////// SPINNER AJAX CANCELLABLE function spinnerStartCancellable() { cezProgress.start(45, true); } // When ajaxStop is fired, rmeove 'loading' from body class function spinnerStopCancellable() { jq_xhr.reset(); // $.unblockUI(); cezProgress.stop(true, true); } /// Triggered by click to cancel ajax and stop spinner function cancelSpinnerXHR() { jq_xhr.cancel(); spinnerStopCancellable(); } //// DISABLE SCROLL JS var fixScrollTop = 0; function disableScrollY() { fixScrollTop = window.pageYOffset || document.documentElement.scrollTop; window.addEventListener('scroll', stopScrollY); } function stopScrollY() { window.scrollTo(0, fixScrollTop); } function enableScrollY() { window.removeEventListener('scroll', stopScrollY); } var lasthtmldrag=""; /**derniere position connue du draggable**/ lastdragcontexte=''; lastdragid=''; function setLastPosDrag(jq,contexte,id){ lastdragcontexte=contexte; lastdragid=id; jq.addClass('dropilluminated'); } function byeLastposDrag(jq){ jq.removeClass('dropilluminated'); } function addDragDropMediaToFavorites(id_media){ xajax_add_basket(id_media,1) } function addDragDropMediaToProject(id_media,id_projet){ xajax_addMediaToProject(id_media,id_projet,'',1); } function downloadMedia(id_media){} function downloadMediaFormat(id_media){} getWidth = function() { if (self.innerWidth) { return self.innerWidth; } else if (document.documentElement && document.documentElement.clientHeight){ return document.documentElement.clientWidth; } else if (document.body) { return document.body.clientWidth; } return 0; } getWidthPos = function(){ return getWidth() - 720; } dropounet = function(ecran, param1){ if( param1=="" && ecran == "liste_projets"){ $("iframe#espaceprive").contents().find('#prive_' + ecran + '_content tbody tr').droppable({ drop: function(event, ui) { var draggableId = ui.draggable.attr("id_media"); var droppableId = $(this).data("id_projet"); xajax_tip_situation(draggableId,'liste_projets',droppableId); }, over: function(event, ui) { var idhover = $(this).data('id_projet'); $('#espaceprive').contents().find('.loginboxtable tbody tr').removeClass('highlighter_focus_in'); $('#espaceprive').contents().find('tr[data-id_projet="'+idhover+'"]').addClass('highlighter_focus_in'); } }); }else if(param1!="" && ecran == "liste_projets"){ $('#overlayspace').droppable({ over: function(event, ui) {}, drop: function(event, ui) { var draggableId = ui.draggable.attr("id_media"); xajax_tip_situation(draggableId,'liste_projets',param1); } }); }else if(ecran == "detail_panier"){ $('#overlayspace').droppable({ over: function(event, ui) {}, drop: function(event, ui) { var draggableId = ui.draggable.attr("id_media"); xajax_tip_situation(draggableId,ecran,param1); } }); } } dragounet =function(){ $( ".divTrack" ).draggable({ zIndex: 1000001, cursor:"grabbing", cursorAt: {left: -10, top: -10}, iframeFix: true, scroll : true, revert: true, revertDuration: 0, containment: "document", create: function(event,ui){ lastdragcontexte=''; lastdragid=''; }, start:function(event,ui){}, over:function(event,ui){}, drag:function(event,ui){ var last_man = $('#espaceprive').contents().find('#layer_prive_handle a.active'); var id_media = $(this).attr('id_media'); if(last_man.length>0){ var last_fonction = last_man.attr('id'); var last_fonction_param_1 = last_man.attr('data-param1'); if(last_fonction == "lien_prive_liste_projets" && last_fonction_param_1 == ""){ }else if(last_fonction=="lien_prive_liste_projets" || last_fonction=="lien_prive_detail_panier") { $('#overlayspace').show().css({'cursor':'grabbing'}); } } }, helper:function(event){ return "
" + $(this,"td:eq( 3 )").find('strong').text() + "
"; }, stop:function(event,ui){ $('#overlayspace').hide(); } }); } /**sortir et rentrer la recherche guidee**/ rentrerPoigneeRechercheGuidee = function(){ if(window.innerWidth > 1210){ var getwidthdynamique = $("#rechercheGuideeContainer nav").width(); } else { var getwidthdynamique = ($("#rechercheGuideeContainer nav").width() + 22); } getwidthdynamique = (Math.round(getwidthdynamique ) ); $('#rechercheGuideeContainer').animate({ left: '-'+getwidthdynamique+'px' }, 500); $('#vt_menu .navigation .niveau1').hide(); cezSetCookie("rechercheguidee","valid",1000); } sortirPoigneeRechercheGuidee = function(){ $('#rechercheGuideeContainer').animate({ left: '0px' }, 500); $("#nav-wrap").show(); $('#vt_menu .navigation .niveau1').show(); } openHddMaintenance = function(){ open_fancy("Cezame | Chargement...","/private/hddmaintenance/index.php", "800px", "800px"); } privateOpenHddMaintenance = function(){ parent.$('#poigneeVolet').click(); parent.open_fancy("Cezame | Chargement...","/private/hddmaintenance/index.php", "800px", "800px"); } goInfinite = function(loader) { jQuery.ias('destroy'); var iastl = jQuery.ias({ container: '#infinitetrackslist', item: '.listeResultat', pagination: '#pagination_tracks', next: '.next' }); if(loader != ""){ iastl.on('loaded', function(){ spinnerStop() setTimeout(function() { dragounet(); $('.btn-add-keywords').on("click", function(e){ e.preventDefault(); clickKeyWord(this); }); },250); }); iastl.on('load', function(){ spinnerStart(); }); } } /**prend une URL, un lien href et un rel unique, et puis ajaxify le tout**/ goLaunchAjaxify = function(url,tagtoclick,relinfo){ url = url.slice(0,2048); ajaxify.pronto(0, url); } goLaunchAjaxifyNA = function(url,tagtoclick,relinfo){ url = url.slice(0,2048); ajaxify.pronto(0, url); } goToSearch = function(){ } // scroll handler var scrollToAnchor = function( id ) { // grab the element to scroll to based on the name var elem = $("li[id_media='"+ id +"']"); // if that didn't work, look for an element with our ID if ( typeof( elem.offset() ) === "undefined" ) { elem = $("#"+id); } // if the destination element exists if ( typeof( elem.offset() ) !== "undefined" ) { // do the scroll if(elem.offset().top>500){ $('html, body').animate({ scrollTop: (elem.offset().top - 50) }, 1500 ); } } }; // scroll handler var scrollToFirstAnchor = function( ) { // grab the element to scroll to based on the name var elem = $("li#track_0"); // if that didn't work, look for an element with our ID if ( typeof( elem.offset() ) === "undefined" ) { elem = $("#"+id); } // if the destination element exists if ( typeof( elem.offset() ) !== "undefined" ) { // do the scroll $('html, body').animate({ scrollTop: (elem.offset().top - 50) }, 500 ); } }; TipNotConnected = function(){ Tip("",BGCOLOR,'#FFFFFF',FONTCOLOR,'#000000',BORDERWIDTH,1,BORDERCOLOR,'#CCCCCC',CLOSEBTN, true,CLOSEBTNCOLORS, ['#FFFFFF', '#000000', '#B6BBC1', '#9A9FA5'], CLOSEBTNTEXT, 'Close X',STICKY,true,OPACITY,90,PADDING,7,ABOVE,true,CENTERMOUSE,true, DURATION, -1000,OFFSETY,80,WIDTH,250); xajax_tip_not_connected( ); } // SG 14/11/2023 : message de présentation des fonctionnalités IA réservées aux users connectés TipNotConnectedPubAi = function (restraint) { var obj = $.dialog({ title: '', content: restraint ? `
Login or register to enjoy the latest "AI search" features:
More info ...
` : `
Login or register to enjoy the latest "AI search" features:
More info ...
  
`, animation: 'scale', onClose: function (e, ui) { if ( !restraint ) { var nopub = document.getElementById('remember-no-pub').checked; if ( nopub ) { var expiration = new Date(); expiration.setFullYear(expiration.getFullYear() + 1); document.cookie = "no_pub_ai="+nopub+"; expires=" + expiration.toUTCString() + ";"; } } } }); } /**fonction pour clamper tous les divs qui ont la classe clampable**/ goClamp = function(){ $(".clampable").clamp({ truncationChar:'', truncationLabel:'[...]', alwaysDisplay:false }); } /** * SG 22/11/2023 : * DEBUT BLOC TRAITEMENT FILTRE BPM/KEY **/ onChangeSelectKey = function(el){ var only_word_search = jQuery('#search_form').serialize().replace('search_external_recommendation_youtube=&search_external_recommendation_brief=', ''); const url_params = new URLSearchParams(window.location.search); const id_media_str = url_params.get('id_media_str'); jQuery.ajax({ url : '/ajax/ajax_search_filters.php?key='+jQuery(el).val() }).done(function(){ // if(jQuery('#search_form').serialize()!=''){ var tmp_url = ""; if ( id_media_str !== null ) { tmp_url = '/liste_resultats.php?id_media_str='+id_media_str+'&randkeybpm='+Math.random().toString(36).substring(7); }else if(only_word_search!=''){ tmp_url = '/liste_resultats.php?'+jQuery('#search_form').serialize()+'&randkeybpm='+Math.random().toString(36).substring(7); } goLaunchAjaxify(tmp_url,'#searchlink','search_' + Math.random().toString(36).substring(7)); }); } resetSelectKey = function(){ var only_word_search = jQuery('#search_form').serialize().replace('search_external_recommendation_youtube=&search_external_recommendation_brief=', ''); const url_params = new URLSearchParams(window.location.search); const id_media_str = url_params.get('id_media_str'); jQuery.ajax({ url : '/ajax/ajax_search_filters.php?reset=1' }).done(function(){ // if(jQuery('#search_form').serialize()!=''){ var tmp_url = ""; if ( id_media_str!==null ) { tmp_url = '/liste_resultats.php?id_media_str='+id_media_str+'&randkeybpm='+Math.random().toString(36).substring(7); }else if(only_word_search!=''){ tmp_url = '/liste_resultats.php?'+jQuery('#search_form').serialize()+'&randkeybpm='+Math.random().toString(36).substring(7); } goLaunchAjaxify(tmp_url,'#searchlink','search_' + Math.random().toString(36).substring(7)); }); jQuery('.slider-min').html('10'); jQuery('.slider-max').html('300'); jQuery('#slider').slider('destroy'); load_bpm_key_slider(); jQuery('#FilterKey').val(jQuery('#FilterKey option:first').val()); jQuery('#customFilterBpm').val(''); } onChangeInputBPM = function (el) { var only_word_search = jQuery('#search_form').serialize().replace('search_external_recommendation_youtube=&search_external_recommendation_brief=', ''); const url_params = new URLSearchParams(window.location.search); const id_media_str = url_params.get('id_media_str'); jQuery.ajax({ url : '/ajax/ajax_search_filters.php?bpm='+jQuery(el).val() }).done(function(){ var tmp_url = ""; if ( id_media_str !== null ) { tmp_url = '/liste_resultats.php?id_media_str='+id_media_str+'&randkeybpm='+Math.random().toString(36).substring(7); }else if(only_word_search!=''){ tmp_url = '/liste_resultats.php?'+jQuery('#search_form').serialize()+'&randkeybpm='+Math.random().toString(36).substring(7); } goLaunchAjaxify(tmp_url,'#searchlink','search_' + Math.random().toString(36).substring(7)); }); jQuery('.slider-min').html('10'); jQuery('.slider-max').html('300'); jQuery('#slider').slider('destroy'); load_bpm_key_slider(); } resetInputBPM = function () { var only_word_search = jQuery('#search_form').serialize().replace('search_external_recommendation_youtube=&search_external_recommendation_brief=', ''); const url_params = new URLSearchParams(window.location.search); const id_media_str = url_params.get('id_media_str'); jQuery.ajax({ url : '/ajax/ajax_search_filters.php?reset=1' }).done(function(){ var tmp_url = ""; if ( id_media_str !== null ) { tmp_url = '/liste_resultats.php?id_media_str='+id_media_str+'&randkeybpm='+Math.random().toString(36).substring(7); }else if(only_word_search!=''){ tmp_url = '/liste_resultats.php?'+jQuery('#search_form').serialize()+'&randkeybpm='+Math.random().toString(36).substring(7); } goLaunchAjaxify(tmp_url,'#searchlink','search_' + Math.random().toString(36).substring(7)); }); jQuery('.slider-min').html('10'); jQuery('.slider-max').html('300'); jQuery('#slider').slider('destroy'); load_bpm_key_slider(); jQuery('#FilterKey').val(jQuery('#FilterKey option:first').val()); jQuery('#customFilterBpm').val(''); } /** * FIN BLOC TRAITEMENT FILTRE BPM/KEY **/ --> xajax_get_track_infos"); }else{ getTitle(i); } } } function loadPlayer( ) { if(Pl_debug) { console.log("loadPlayer:"+ used++); } wPlayerLaunchPlayer( 0, false); } function PlayPauseUnTitreButton(liste_titres,id_liste_critere,i){ idm=0; tab_liste_titres=liste_titres.split(/,/); for(var j=0;j0){ if( (actif.attr('id')=="Pl_play") && actif.attr('data-wait-until')=="true"){ $("#Pl_play").trigger('click'); } if(actif.attr('id')=="Pl_pause"){ $("#Pl_pause").trigger('click'); $("#Pl_pause").removeClass('active'); $('#Pl_play').attr('data-wait-until','true'); } return false; } } hasRegionStartingWith = function(prefix= "") { const regionsList = myPlaylist.regions.list; if(prefix!= ""){ for (const key in regionsList) { if (regionsList.hasOwnProperty(key) && key.startsWith(prefix)) { return key; // Retourne la clé trouvée } } }else{ if (regionsList && typeof regionsList === 'object') { return Object.keys(regionsList); } } return null; } getUrlAlbumFromID = function(Vid_album){ } function millisToMinutesAndSeconds(millis) { var minutes = Math.floor(millis / 60000); var seconds = Math.floor( ((millis % 60000) / 1000)); return (seconds == 60 ? (minutes+1) + ":00" : minutes + ":" + (seconds < 10 ? "0" : "") + seconds); } wPlayerSendEvent = function(type,val){ var idm=myPlaylist.playlist[val].id_media; if(Pl_debug) { console.log("fct:wPlayerSendEvent "+type +" rang:"+ val+" id"+idm); } if(type=="SEEK"){ return void(0); } //23/05/24 a voir si on garde, regression possible $('#Pl_stop').removeClass('active'); if(type=="ITEM" || type=="REGION"){ //remove les actifs $(".boxcontroleplayer button.Tl_listening").hide(); $(".boxcontroleplayer button.Tl_play").show(); $(".boxcommand button").removeClass("active"); $(".boxcontroletracks button").removeClass("active"); $(".boxcontroleplayer button:not(.Tl_favorite)").removeClass('active'); //player $('#Pl_play').hide(); $('#Pl_pause').show().addClass("active"); $('#Pl_playcover').hide(); $('#Pl_pausecover').show(); //tl $("#boxcontrol_"+idm).find('.Tl_play').hide(); $("#boxcontrol_"+idm).find('.Tl_listening').show().addClass('active'); //Lts $(".boxcontroletracks").find('.Lts_play').hide(); $(".boxcontroletracks").find('.Lts_listening').show().addClass('active'); $('.TexteDescriptionTrackOver').removeClass('TexteDescriptionTrackOver').addClass('TexteDescriptionTrackVisited'); $(".TexteDescriptionTrack[id_media='"+ idm +"']").addClass('TexteDescriptionTrackOver'); $(".TexteDescriptionTrack[id_media='0"+ idm +"']").addClass('TexteDescriptionTrackOver'); if(from_last_click=="videoedit" || from_last_click=="videosharing"){ let typeframe; if(from_last_click == "videoedit"){ typeframe = frames['espaceprive'].document; }else{ typeframe = document; } $(".controllistprivate button.Ve_listening", typeframe).hide(); $(".controllistprivate button.Ve_play", typeframe).show(); $(".controllistprivate button", typeframe).removeClass('active'); $(".controllistprivate button", typeframe).removeClass('active'); $(".controllistprivate button.Ve_play", typeframe).hide(); $(".controllistprivate button.Ve_listening", typeframe).show().addClass('active'); } //private if(from_last_click=="private"){ /**YOHANN :: si la ligne n'existe pas, sauter d''un cran**/ if ($("tr[id_media='"+ idm +"']", frames['espaceprive'].document).length ==0 ){ if(parseInt(val) < parseInt(curIndex)){ //en arriere if(Number(val) == 0){ //debut de chaine on fait rien }else{ wPlayerSendEvent("ITEM",(Number(val)-1)); } }else{ //en avant if(val ==(myPlaylist.playlist.length - 1)){ //fin de chaine on fait rien }else{ wPlayerSendEvent("ITEM",(Number(val)+1)); } } return; } $(".controllistprivate button.Tl_listening").hide(); $(".controllistprivate button.Tl_play").show(); $(".controllistprivate button").removeClass('active'); $(".controllistprivate button", frames['espaceprive'].document).removeClass('active'); $("tr[id_media='"+ idm +"'] .Tl_play", frames['espaceprive'].document).hide(); $("tr[id_media='"+ idm +"'] .Tl_listening", frames['espaceprive'].document).show().addClass('active'); } if( from_last_click!="private" && ($(".divTrackAlt[id_media='" + idm + "']").is(':hidden') || $(".divTrackAlt[id_media='0" + idm + "']").is(':hidden')) ) { //est ce qu'on va en avant ou en arriere if(parseInt(val) < parseInt(curIndex)){ //en arriere if(Number(val) == 0){ clickPrevScrolledTrack(); }else{ wPlayerSendEvent("ITEM",(Number(val)-1)); } }else{ if(val ==(myPlaylist.playlist.length - 1)){ clickNextScrolledTrack(); }else{ wPlayerSendEvent("ITEM",(Number(val)+1)); } } return; } /**Revenir Ici***/ if(type != "REGION"){ setCurrentSong(val); } myPlaylist.on('ready', function() { if(from_last_click == "videoedit"){ //region.update /*region.update({ dragSelection: { slop: 5 } });*/ $( "#video-montage-loop",frames['espaceprive'].document ).on( "change", function(e) { region.update({ loop: $(this).is(':checked') }); }); } if(type !== "REGION"){ //pour type = item // permet de creer une pause dans une region //yohanndev region const regionKey = hasRegionStartingWith('video_'); if (regionKey) { const region = myPlaylist.regions.list[regionKey]; const start = region.start; const end = region.end; $("#espaceprive").contents().find('#video-montage-start').val(start); $("#espaceprive").contents().find('#video-montage-end').val(end); myPlaylist.play(start, end); } else { myPlaylist.play(); } } }); return; } if(type=="PLAY"){ //remove les actifs $(".boxcontroleplayer button.Tl_listening").hide(); $(".boxcontroleplayer button.Tl_play").show(); $(".boxcommand button").removeClass("active"); $(".boxcontroletracks button").removeClass("active"); $(".boxcontroleplayer button:not(.Tl_favorite)").removeClass('active'); //player $('#Pl_play').hide(); $('#Pl_pause').show().addClass("active"); $('#Pl_playcover').hide(); $('#Pl_pausecover').show(); //tl $("#boxcontrol_"+idm).find('.Tl_play').hide(); $("#boxcontrol_"+idm).find('.Tl_listening').show().addClass('active'); //lts cartouche $(".boxcontroletracks").find('.Lts_play').hide(); $(".boxcontroletracks").find('.Lts_listening').show().addClass('active'); $('.TexteDescriptionTrackOver').removeClass('TexteDescriptionTrackOver').addClass('TexteDescriptionTrackVisited'); $(".TexteDescriptionTrack[id_media='"+ idm +"']").addClass('TexteDescriptionTrackOver'); $(".TexteDescriptionTrack[id_media='0"+ idm +"']").addClass('TexteDescriptionTrackOver'); //Thumbs carousel if($('.item_wrap').length > 0){ $('.item_wrap ul.active').find('.Th_pausecover').show(); $('.item_wrap ul.active').find('.Th_playcover').hide(); } //private if(from_last_click=="private"){ $(".controllistprivate button.Tl_listening").hide(); $(".controllistprivate button.Tl_play").show(); $(".controllistprivate button").removeClass('active'); $(".controllistprivate button", frames['espaceprive'].document).removeClass('active'); $("tr[id_media='"+ idm +"'] .Tl_play", frames['espaceprive'].document).hide(); $("tr[id_media='"+ idm +"'] .Tl_listening", frames['espaceprive'].document).show().addClass('active'); } if(from_last_click=="videoedit" || from_last_click=="videosharing"){ let typeframe; if(from_last_click == "videoedit"){ typeframe = frames['espaceprive'].document; }else{ typeframe = document; } $(".controllistprivate button.Ve_listening", typeframe).hide(); $(".controllistprivate button.Ve_play", typeframe).show(); $(".controllistprivate button", typeframe).removeClass('active'); $(".controllistprivate button", typeframe).removeClass('active'); $(".controllistprivate button.Ve_play", typeframe).hide(); $(".controllistprivate button.Ve_listening", typeframe).show().addClass('active'); } //init //$('#current_id_media').val(val); } if(type=="LOAD"){ $(".boxcontroleplayer button:not(.Tl_favorite)").removeClass('active'); //player $('#Pl_play').show().addClass("active"); $('#Pl_pause').hide(); $('#Pl_playcover').show(); $('#Pl_pausecover').hide(); //tl $("#boxcontrol_"+idm).find('.Tl_play').show().addClass('active'); $("#boxcontrol_"+idm).find('.Tl_listening').hide(); //lts cartouche $(".boxcontroletracks").find('.Lts_play').show().addClass('active'); $(".boxcontroletracks").find('.Lts_listening').hide(); if(from_last_click=="videoedit" || from_last_click=="videosharing"){ let typeframe; if(from_last_click == "videoedit"){ typeframe = frames['espaceprive'].document; }else{ typeframe = document; } $(".controllistprivate button", typeframe).removeClass('active'); $(".controllistprivate button.Ve_listening", typeframe).hide(); $(".controllistprivate button.Ve_play", typeframe).show(); } setCurrentSong(val); return; } if(type=="PAUSE"){ //remove les actifs //on supprime pas ici les actifs car il permette de recuperer la currentpos $(".boxcontroleplayer button:not(.Tl_favorite)").removeClass('active'); //player $('#Pl_play').show().addClass("active"); $('#Pl_pause').hide(); $('#Pl_playcover').show(); $('#Pl_pausecover').hide(); //tl $("#boxcontrol_"+idm).find('.Tl_play').show().addClass('active'); $("#boxcontrol_"+idm).find('.Tl_listening').hide(); //lts cartouche $(".boxcontroletracks").find('.Lts_play').show().addClass('active'); $(".boxcontroletracks").find('.Lts_listening').hide(); //Thumbs carousel if($('.item_wrap').length > 0){ $('.item_wrap').find('.Th_playcover').show(); $('.item_wrap').find('.Th_pausecover').hide().removeClass('active'); } if(from_last_click=="private"){ $(".controllistprivate button").removeClass('active'); $("tr[id_media='"+ idm +"'] .Tl_listening", frames['espaceprive'].document).hide(); $("tr[id_media='"+ idm +"'] .Tl_play", frames['espaceprive'].document).show().addClass('active'); } if(from_last_click=="videoedit" || from_last_click=="videosharing"){ let typeframe; if(from_last_click == "videoedit"){ typeframe = frames['espaceprive'].document; }else{ typeframe = document; } $(".controllistprivate button", typeframe).removeClass('active'); $(".controllistprivate .Ve_listening", typeframe).hide().removeClass('active'); $(".controllistprivate .Ve_play", typeframe).show().addClass('active'); } } if(type=="STOP"){ //remove les actifs $(".boxcommand button").removeClass("active"); $(".boxcontroletracks button").removeClass("active"); $(".boxcontroleplayer button:not(.Tl_favorite)").removeClass('active'); $(".controllistprivate button").removeClass('active'); //player $('#Pl_stop').addClass("active"); $('#Pl_play').show(); $('#Pl_pause').hide(); $('#Pl_playcover').show(); $('#Pl_pausecover').hide(); //tl $(".boxcontroleplayer button.Tl_listening").hide(); $(".boxcontroleplayer button.Tl_play").show(); //lts cartouche $(".boxcontroletracks button.Lts_listening").hide(); $(".boxcontroletracks button.Lts_play").show(); $(".boxcontroletracks button.Lts_play").show(); //Thumbs carousel if($('.item_wrap').length > 0){ $('.item_wrap ul').removeClass('active'); $('.item_wrap').find('.Th_playcover').show(); $('.item_wrap').find('.Th_pausecover').hide().removeClass('active'); } //$('#current_id_media').val(val); if(from_last_click=="private"){ $("tr", frames['espaceprive'].document).removeClass('titrepriveplay'); $("tr[id_media='"+ idm +"'] .Tl_listening", frames['espaceprive'].document).hide().removeClass('active'); $("tr[id_media='"+ idm +"'] .Tl_play", frames['espaceprive'].document).show().removeClass('active'); } if(from_last_click=="videoedit" || from_last_click=="videosharing"){ let typeframe; if(from_last_click == "videoedit"){ typeframe = frames['espaceprive'].document; }else{ typeframe = document; } $(".controllistprivate button.Ve_listening", typeframe).hide(); $(".controllistprivate button.Ve_play", typeframe).show(); } pos= val; } if(type=="NEXT"){ //recupere l'ancien id joué et replace les boutons //tl $("#boxcontrol_"+idm).find('.Tl_play').show(); $("#boxcontrol_"+idm).find('.Tl_listening').hide(); $('.TexteDescriptionTrackOver').removeClass('TexteDescriptionTrackOver').addClass('TexteDescriptionTrackVisited'); $(".TexteDescriptionTrack[id_media='"+ idm +"']").addClass('TexteDescriptionTrackOver'); $(".TexteDescriptionTrack[id_media='0"+ idm +"']").addClass('TexteDescriptionTrackOver'); } if(type=="PREVIOUS"){ //recupere l'ancien id joué et replace les boutons //tl $("#boxcontrol_"+idm).find('.Tl_play').show(); $("#boxcontrol_"+idm).find('.Tl_listening').hide(); $('.TexteDescriptionTrackOver').removeClass('TexteDescriptionTrackOver').addClass('TexteDescriptionTrackVisited'); $(".TexteDescriptionTrack[id_media='"+ idm +"']").addClass('TexteDescriptionTrackOver'); $(".TexteDescriptionTrack[id_media='0"+ idm +"']").addClass('TexteDescriptionTrackOver'); } } wPlayerLaunch = function(start,loadItemOnly){ if(typeof loadItemOnly !== 'undefined' && loadItemOnly!= ""){ wPlayerSendEvent('LOAD',start); }else{ wPlayerSendEvent('ITEM',start); ///!\espaceprivé :: click sur la video } if(Pl_debug) { console.log("fct:wPlayerLaunch "+start); } } wPlayerGetCurrentItemNumber2 = function(){ //recupere la piste courante qui est joué selon les attributs html //var curItem = 0; //si le bouton hautparleur est bleu donc actif, la lecture est en cours var curItemPosPlaying = $('.Tl_listening.active:visible').closest("ul"); //si le bouton play est bleu, donc actif, la lecture est en pause var curItemPosPause = $('.Tl_play.active:visible').closest("ul"); //espace prive box // espace prive window if($('#espaceprive').length || $('#espaceprive', parent).length || window.location.pathname == "/privatewidget.php") { var curItemPosEP = $("tr.titreprive",frames['espaceprive'].document).hasClass('titrepriveplay'); } var curItemPosCF = $("ul.compo_musique_originale").hasClass('compo_listSelected'); if(curItemPosPlaying.length>0 && from_last_click=="public"){ curItem=curItemPosPlaying.attr('curposition'); }else if(curItemPosPause.length>0 && from_last_click=="public"){ curItem=curItemPosPause.attr('curposition'); }else{ //il existe deja un current index, si oui on le prend if(typeof curIndex != "undefined"){ var curItem = 0; }else{ curItem=0; } if(typeof pos != "undefined" && pos!=""){ curItem = pos; } } if(curItemPosEP==true && from_last_click=="private"){ curItem=$("tr.titrepriveplay",frames['espaceprive'].document).attr('curposition'); } if(curItemPosCF==true && from_last_click=="composers"){ curItem=$("ul.compo_listSelected").attr('curposition'); } if(Pl_debug) { console.log("fct:wPlayerGetCurrentItemNumber2 - curentitem:"+curItem); } return curItem; } function playRegion(resume,from){ const regionKey = hasRegionStartingWith('video_'); if(resume){ wPlayerSendEvent('REGION',0); if(regionKey){ myPlaylist.play(); }else{ window.parent.xajax_load_player_playlist($('#id_media',frames['espaceprive'].document).val(),'','0',from,'',$('#id_video',frames['espaceprive'].document).val()); } }else{ wPlayerSendEvent('REGION',0); if(regionKey){ myPlaylist.regions.list[regionKey].play(); }else{ window.parent.xajax_load_player_playlist($('#id_media',frames['espaceprive'].document).val(),'','0',from,'',$('#id_video',frames['espaceprive'].document).val()); } } } function fctclearRegions(){ const regionKey = hasRegionStartingWith(); //ne jamais clear les (climax[0-9]) //if(regionKey.some(item => item.startsWith('climax'))){ if(regionKey){ regionKey.forEach(key => { if (!key.startsWith('climax')) { // Si la clé ne commence pas par "climax", appeler remove() sur l'élément correspondant dans regionsList if (myPlaylist.regions.list.hasOwnProperty(key)) { myPlaylist.regions.list[key].remove(); } } }); }else{ //on efface tout myPlaylist.clearRegions(); } } function createRegion(regionStart, regionEnd, readOnly,loop,maxLength,id) { const maxDuration = 60; // Durée maximale en secondes provenant de la video ( plus tard!!) const duration = parseInt(myPlaylist.getDuration()); if(regionStart == 0 && regionEnd == 0){ const regionEnd = Math.min(regionStart + maxDuration, duration); } if(readOnly !== null && readOnly !== '' && readOnly == true){ defaultEdit = { drag: false, resize: false }; }else{ defaultEdit = { drag: true, resize: true }; } if(loop !== null && loop !== '' && loop == true){ defaultLoop = { loop: true }; }else{ defaultLoop = { loop: false }; } if (typeof maxLength !== 'undefined' && maxLength !== null) { defaultOptions = { id:id, start: regionStart, end: regionEnd, color: 'rgba(0, 123, 255, 0.3)' //maxLength: maxLength,//bug wavesurfer on drag }; } else { defaultOptions = { id:id, start: regionStart, end: regionEnd, color: 'rgba(0, 123, 255, 0.3)', }; } region = myPlaylist.addRegion({ ...defaultOptions, ...defaultEdit, ...defaultLoop }); } // Create a WaveSurfer instance wPlayerLaunchPlayer = function(position,autostartplayer){ if($("#Pl_waveform").length == 0){ if(Pl_debug) { console.log("not exist Pl_waveform : wPlayerLaunchPlayer"); } return false; } // Create a canvas gradient const ctx1 = document.createElement('canvas').getContext('2d') const gradient = ctx1.createLinearGradient(0, 0, 0, 150) gradient.addColorStop(0, 'rgb(35, 149, 255)') gradient.addColorStop(0.7, 'rgb(28, 111, 195)') gradient.addColorStop(1, 'rgb(0, 0, 0)') const ctx2 = document.createElement('canvas').getContext('2d') const gradientdefault = ctx2.createLinearGradient(0, 0, 0, 150) gradientdefault.addColorStop(0, 'rgb(193, 193, 193)') gradientdefault.addColorStop(0.7, 'rgb(124, 124, 124)') gradientdefault.addColorStop(1, 'rgb(0, 0, 0)') /*init*/ myPlaylist = WaveSurfer.create({ container: '#Pl_waveform', backend: 'MediaElement', mediaType:'audio', cursorColor:'#1daee0', reflection:false, closeAudioContext:true, plugins: [ WaveSurfer.regions.create({ dragSelection: {slop: 5} }), WaveSurfer.cursor.create({ showTime: true, hideOnBlur: true, opacity: 1, customShowTimeStyle: { 'background-color': '#1daee0', 'color': '#fff', 'padding': '2px', 'font-size': '10px', 'borderRightColor':'#1daee0' } }) ], //waveColor: '#c1c1c1', waveColor: gradientdefault, //progressColor: '#2395ff', progressColor:gradient, height: dimPeak, barWidth: 3, responsive:true, normalize: true }); if(playList.length == 0){ return false; } /**assignation de la playlist**/ myPlaylist.playlist = playList; myPlaylist.setVolume(volume); /*stop spinner*/ spinnerStop(); /*timer*/ myPlaylist.on('ready', function() { var totalTime = myPlaylist.getDuration(); $('#time-total').html(millisToMinutesAndSeconds(Math.round(totalTime * 1000))); spinnerStop(); /*sliderzoom.oninput = function () { var zoomLevel = Number(sliderzoom.value); myPlaylist.zoom(zoomLevel); };*/ /*myPlaylist.once('decode', () => { document.querySelector('input#zoom-range[type="range"]').oninput = (e) => { const minPxPerSec = Number(e.target.value) myPlaylist.zoom(minPxPerSec) } })*/ myPlaylist.on('region-updated', function(e){ const url = window.location.href; var iframe = $('#espaceprive'); var regionid=e.id; var regionsList = myPlaylist.regions.list; if(defaultEdit.drag == false && defaultEdit.resize== false){ //partage if (url.includes("lire_titres")) { const keys = Object.keys(regionsList); if (keys.length > 1 && typeof keys[1] !== 'undefined') { secondRegion = keys[1]; regionsList[secondRegion].remove() ; } }else{ fctclearRegions(); } }else{ //cad d'edition sur une fenetre ouverte espace video : detail video if($('#voletConteneurEspacePrive').hasClass('openprivate') ){ if(iframe.contents().find('#lien_prive_liste_videos').hasClass('active')){ if(iframe.contents().find('#form_video_montage').length){ let dureeRegion = (e.end - e.start); let dureeVideo = $("#espaceprive").contents().find('#videoDuration').val(); if(Number(dureeRegion) > Number(dureeVideo)){ e.end = (parseFloat(e.start) + Number(dureeVideo)); } for (const key in regionsList) { if (regionsList.hasOwnProperty(key) && key!=regionid) { regionsList[key].remove() } } } } }else{ fctclearRegions(); } } if($('#voletConteneurEspacePrive').hasClass('openprivate') ){ if(iframe.contents().find('#lien_prive_liste_videos').hasClass('active')){ if(iframe.contents().find('#form_video_montage').length){ $("#espaceprive").contents().find('#video-montage-start').val(e.start); $("#espaceprive").contents().find('#video-montage-end').val(e.end); $("#espaceprive").contents().find('video#video-montage').get(0).pause(); if($('#video-montage').length > 0 ){ document.getElementById('video-montage').pause(); } $("#Pl_stop").trigger('click'); } } } }); }); idm = myPlaylist.playlist[position].id_media; myPlaylist.on('audioprocess', function() { var totalTime = myPlaylist.getDuration(); $('#time-total').html(millisToMinutesAndSeconds(Math.round(totalTime * 1000))); if(myPlaylist.isPlaying()) { var currentTime = myPlaylist.getCurrentTime(); var remainingTime = totalTime - currentTime; currentMod = parseInt(parseInt(currentTime*1000) % 10000 ); if(currentMod < lastcurrentMod){ $.ajax({ url: '/ajax/ajax_stats.php', type:'POST', data:'id_media='+idm+"&stats="+millisToMinutesAndSeconds(Math.round(myPlaylist.getCurrentTime() * 1000)), }); }else{ } lastcurrentMod = currentMod; $('#time-current').html(millisToMinutesAndSeconds(Math.round(currentTime * 1000))); $('#time-remaining').html(millisToMinutesAndSeconds(Math.round(remainingTime * 1000))); } }); myPlaylist.on('destroy', function () { if(Pl_debug) { console.log('!!!!!!!!!!!!!! Wavesurfer destroy !!!!!!!!!!!!!!'); } }); if(position>0){ wPlayerSendEvent("ITEM",position) } if(autostartplayer){ wPlayerSendEvent("PLAY"); } $('#volume').on('input', function () { $(this).trigger('change'); myPlaylist.setVolume($(this).val()); }); $('#zoom').on('input', function () { $(this).trigger('change'); myPlaylist.zoom(Number(this.value)); }); $("#Pl_thumblink,#toggleplaycover").on('click', function(e) { //myPlaylist.playPause(); e.preventDefault(); }); $("#Pl_mute").on('click', function(e) { $(this).toggleClass("active"); myPlaylist.toggleMute(); e.preventDefault(); }); $("#Pl_download").on('click', function(e) { Tip('
',BGCOLOR,'#FFFFFF',FONTCOLOR,'#000000',BORDERWIDTH,1,BORDERCOLOR,'#CCCCCC',CLOSEBTN, false,STICKY,true,OPACITY,90,PADDING,7,ABOVE,true,CENTERMOUSE,true, DURATION, -1000,WIDTH,350); xajax_tip_download($('#current_id_media').val()); e.preventDefault(); }); $("#Pl_add").on('click', function(e){ Tip('
',BGCOLOR,'#FFFFFF',FONTCOLOR,'#000000',BORDERWIDTH,1,BORDERCOLOR,'#CCCCCC',CLOSEBTN, true,CLOSEBTNCOLORS, ['#FFFFFF', '#000000', '#B6BBC1', '#9A9FA5'], CLOSEBTNTEXT, 'Close X',STICKY,true,OPACITY,90,PADDING,7,ABOVE,true,CENTERMOUSE,true, DURATION, -1000,OFFSETY,80,WIDTH,'calc(300px + 20%)'); xajax_tip_basket($('#current_id_media').val()); e.preventDefault(); }); $("#Pl_similarto").on('click', function(e) { var t = $('#egale_id_media_' + $('#current_id_media').val() ); var ididid = $('#current_id_media').val(); var u = $('#Pl_waveform audio').attr('src').replace(/\?.*$/,''); launch_recommendation(u,ididid); e.preventDefault(); }); $("#Pl_pref").on('click', function(e) { xajax_tip_favorites($('#current_id_media').val(),'player'); e.preventDefault(); }); $("#Pl_share").on('click', function(e) { var urlSocialShare = getShareURL('','','',$('#current_id_media').val()); socialSharePopup(urlSocialShare); }); $("#Pl_copyright").on('click', function(e) { if(Pl_debug) { console.log("copyright"+'#infoBoxListePlayerPage_'+$('#current_id_media').val()); } //$('#infoBoxListePlayerPage_'+$('#current_id_media').val()).show(); $this = $(this); $.fancybox({ autoSize: true, href: '#infoBoxListePlayerPage_'+$('#current_id_media').val(), fitToView : true, minWidth : '70%', openEffect :'fade', openSpeed :300, title: this.title, helpers : { title: { type: 'outside'}, } }); return false; e.preventDefault(); }); $("#Pl_stop").on('click', function(e) { if( $('#voletConteneurEspacePrive').is(':visible') && $('#voletConteneurEspacePrive').hasClass('openprivate') ){ if(from_last_click!="" && from_last_click == "videoedit"){ from_last_click = 'videoedit'; }else{ from_last_click = 'private'; } }else if(window.location.pathname == "/privatewidget.php" ){ from_last_click = 'private'; }else{ if(from_last_click == ""){ from_last_click = 'public'; }else{ from_last_click = from_last_click; } } var pos=wPlayerGetCurrentItemNumber2(); wPlayerSendEvent('STOP',pos); myPlaylist.stop(); e.preventDefault(); }); $("#Pl_pause,#Pl_pausecover").on('click', function(e,current) { flag = false; if( $('#voletConteneurEspacePrive').is(':visible') && $('#voletConteneurEspacePrive').hasClass('openprivate') ){ if(from_last_click!="" && from_last_click== "videoedit"){ from_last_click = 'videoedit'; }else{ from_last_click = 'private'; } }else if(window.location.pathname == "/privatewidget.php" ){ from_last_click = 'private'; }else{ if(from_last_click == ""){ from_last_click = 'public'; }else{ from_last_click = from_last_click; } } //si current est passé en parametre, ca provient d'un trigger, d'une liste de lecture (tentative abordée, mais fontionnelle) if (current !== undefined) { var pos = current; flag = true; }else{ //si on presse pause, il y forcement un bouton lecture actif, sinon on fait rien var pos=wPlayerGetCurrentItemNumber2(); flag = true; } if(flag){ wPlayerSendEvent('PAUSE',pos); myPlaylist.pause(); } e.preventDefault(); }); $("#Pl_play,#Pl_playcover").on('click', function(e) { if( $('#voletConteneurEspacePrive').is(':visible') && $('#voletConteneurEspacePrive').hasClass('openprivate') ){ if(from_last_click!= "" && from_last_click=="videoedit"){ from_last_click = 'videoedit'; }else{ from_last_click = 'private'; } }else if(window.location.pathname == "/privatewidget.php" ){ from_last_click = 'private'; }else{ if(from_last_click == ""){ from_last_click = 'public'; }else{ from_last_click = from_last_click; } } var pos=wPlayerGetCurrentItemNumber2(); wPlayerSendEvent('PLAY',pos); myPlaylist.play(); e.preventDefault(); }); $("#Pl_next").on('click', function(e) { var pos=curIndex; wPlayerSendEvent('NEXT',pos); if(pos ==(myPlaylist.playlist.length - 1)){ clickNextScrolledTrack(); return; }else{ wPlayerSendEvent("ITEM",(Number(pos)+1)); } e.preventDefault(); }); $("#Pl_previous").on('click', function(e) { var pos=curIndex; wPlayerSendEvent('PREVIOUS',pos); if(Number(pos) == 0){ clickPrevScrolledTrack(); return; }else{ wPlayerSendEvent("ITEM",(Number(pos)-1)); } e.preventDefault(); }); $("#Pl_minimyseme").on('click', function(e) { if( $('.Pl_wrap').hasClass('minimizeme')){ setCookie("minimizeme",'false',1000); }else{ setCookie("minimizeme",'true',1000); } $('.Pl_wrap').toggleClass( 'minimizeme',800 ); myPlaylist.drawer.containerWidth = myPlaylist.drawer.container.clientWidth; myPlaylist.drawBuffer(); check_status_drawer('fromminimize'); e.preventDefault(); }); myPlaylist.on('play', function() { //pendant que le morceau joue }); myPlaylist.on('finish', function() { wPlayerSendEvent('NEXT',curIndex); if(curIndex == (myPlaylist.playlist.length - 1)){ clickNextScrolledTrack(); if(Pl_debug) { console.log("fct:clickNextScrolledTrack fin de liste pagination"); } return; }else{ wPlayerSendEvent("ITEM",(Number(curIndex)+1)); } }); myPlaylist.on('region-click', function(region, e) { //myPlaylist.play(region.start); //region.playLoop() //e.stopPropagation(); // Play on click, loop on shift click //e.shiftKey ? region.playLoop() : region.play(); }); } window.setCurrentSong = function(index) { if( typeof myPlaylist == 'undefined'){ return false; } var playlist = myPlaylist.playlist; previousTrack = curIndex; curIndex = index; info_media = playlist[index]; if(Pl_debug) { console.log(info_media); } $("#Pl_url").attr("href",info_media.linkalbum); $("#Pl_thumbs").attr("src",info_media.img); $("#Pl_thumbs").attr("alt",info_media.titre); $("#Pl_title").html(info_media.titre); $("#Pl_album").html(info_media.titre_album); $("#Pl_ref").html(info_media.ref); $("#Pl_position").html(info_media.position); if(Pl_debug) { console.log("fct:setCurrentSong index"+curIndex ); } $.ajax({ url: '/jsonfy.php', type:'POST', data:'id_media='+info_media.id_media+"&ref="+info_media.ref, success: function(result_waveform){ data_peaks = (result_waveform); }, async: false }); if(from_last_click=='public'){ //YOHANNDEV a l'ouverture de la page uniquement ( chargement du 1 titre) et sur le play d'un titre ?! $('.TexteDescriptionTrackOver').removeClass('TexteDescriptionTrackOver').addClass('TexteDescriptionTrackVisited'); $(".TexteDescriptionTrack[id_media='"+ tabTitlesPage[curIndex] +"']").addClass('TexteDescriptionTrackOver'); $(".TexteDescriptionTrack[id_media='0"+ tabTitlesPage[curIndex] +"']").addClass('TexteDescriptionTrackOver'); } if(from_last_click=='private'){ /**espace privé**/ //init $("tr.titreprive", frames['espaceprive'].document).removeClass('titrepriveplay'); $("tr.titreprive .Tl_play", frames['espaceprive'].document).show(); $("tr.titreprive .Tl_listening", frames['espaceprive'].document).hide().removeClass('active'); //Act $("tr[id_media='"+ tabTitlesPage[curIndex] +"']", frames['espaceprive'].document).addClass('titrepriveplay'); $("tr[id_media='"+ tabTitlesPage[curIndex] +"'] .Tl_play", frames['espaceprive'].document).hide(); $("tr[id_media='"+ tabTitlesPage[curIndex] +"'] .Tl_listening", frames['espaceprive'].document).addClass('active').show(); } /* if(from_last_click=='videoedit'){ //init //$(".controllistprivate .Ve_play", frames['espaceprive'].document).show(); //$(".controllistprivate .Ve_listening", frames['espaceprive'].document).hide().removeClass('active'); //Act //$(".controllistprivate .Ve_play", frames['espaceprive'].document).hide(); //$(".controllistprivate .Ve_listening", frames['espaceprive'].document).addClass('active').show(); } */ if(from_last_click=='composers'){ $(".compo_musique_originale").removeClass('compo_listSelected'); $(".compo_musique_originale img.button_compo_musique_originale").attr('src','/themes/cezame/assets_cezame/images/compo_mini_lectureBLACK.png'); $("#compo_musique_originale_" + tabTitlesPage[curIndex]).addClass('compo_listSelected'); $("#compo_musique_originale_" + tabTitlesPage[curIndex] +" img.button_compo_musique_originale").attr('src','/themes/cezame/assets_cezame/images/compo_mini_lectureBLUE.png'); } myPlaylist.song = info_media.mp3; myPlaylist.backend.peaks = data_peaks.data; myPlaylist.drawBuffer(); /**climax**/ myPlaylist.clearRegions(); myPlaylist.load(myPlaylist.song, myPlaylist.backend.peaks); if(info_media.climaxJson !== undefined && info_media.climaxJson !== 'false' && info_media.climaxJson !== '0' ){ var someDataFinal = []; var arrClimax = decodeURIComponent(info_media.climaxJson); var arrJsonClimax = JSON.parse(arrClimax); arrJsonClimax.forEach(function(objectcl,i) { var values = objectcl.timing.split(/'/); var kkeys = ["mtiming", "stiming"]; var ffinal = {}; for(var j = 0 ; j < values.length; j++){ ffinal[kkeys[j]] = parseInt(values[j].trim()); } var timing=((ffinal.mtiming*60) + ffinal.stiming); var str = {id:'climax'+i,start: timing, end: timing+1, color:'rgb(255, 255, 255, 0)', attributes: {label: '◆',title:objectcl.desc},title:objectcl.desc,drag:false, resize:false}; someDataFinal.push(str); }); setTimeout(function(){ for(var k = 0 ; k < someDataFinal.length; k++){ myPlaylist.addRegion(someDataFinal[k]); } }, 200); } itemMonitor(); if(Pl_debug) console.log("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); }; /**clavier**/ var in_search = false; /**définition des touches**/ KEY_DOWN = 40; KEY_UP = 38; KEY_LEFT = 37; KEY_RIGHT = 39; KEY_END = 35; KEY_BEGIN = 36; KEY_BACK_TAB = 8; KEY_TAB = 9; KEY_SH_TAB = 16; KEY_ENTER = 13; KEY_ESC = 27; KEY_SPACE = 32; KEY_DEL = 46; KEY_A = 65; KEY_B = 66; KEY_C = 67; KEY_D = 68; KEY_E = 69; KEY_F = 70; KEY_G = 71; KEY_H = 72; KEY_I = 73; KEY_J = 74; KEY_K = 75; KEY_L = 76; KEY_M = 77; KEY_N = 78; KEY_O = 79; KEY_P = 80; KEY_Q = 81; KEY_R = 82; KEY_S = 83; KEY_T = 84; KEY_U = 85; KEY_V = 86; KEY_W = 87; KEY_X = 88; KEY_Y = 89; KEY_Z = 90; KEY_PF1 = 112; KEY_PF2 = 113; KEY_PF3 = 114; KEY_PF4 = 115; KEY_PF5 = 116; KEY_PF6 = 117; KEY_PF7 = 118; KEY_PF8 = 119; REMAP_KEY_T = 5019; function checkEventObj ( _event_ ){ // --- IE explorer if ( window.event ) return window.event; // --- Netscape and other explorers else return _event_; } /**fonctions pour catcher les flèches gauches et droite, à appliquer sur la liste de **/ function applyKey (_event_){ if(in_search==true) { return; } // --- Retrieve event object from current web explorer var winObj = checkEventObj(_event_); var intKeyCode = winObj.keyCode; var intAltKey = winObj.altKey; var intCtrlKey = winObj.ctrlKey; // 1° --- Access with [ALT/CTRL+Key] if (intAltKey || intCtrlKey) { if ( intKeyCode == KEY_RIGHT || intKeyCode == KEY_LEFT ){ // --- Display Message if(intKeyCode == KEY_RIGHT){ getNextTitle(); } if(intKeyCode == KEY_LEFT){ getPrevTitle(); } sendEvent('ITEM',curIndex); // 3° --- Map the keyCode in another keyCode not used winObj.keyCode = intKeyCode = REMAP_KEY_T; winObj.returnValue = false; return false; } } // 2 ° --- Access without [ALT/CTRL+Key] else { if ( intKeyCode == KEY_RIGHT || intKeyCode == KEY_LEFT ){ // --- Display Message if(intKeyCode == KEY_RIGHT){ getNextTitle(); } if(intKeyCode == KEY_LEFT){ getPrevTitle(); } jPlayerSendEvent('ITEM',curIndex); // 3° --- Map the keyCode in another keyCode not used winObj.keyCode = intKeyCode = REMAP_KEY_T; winObj.returnValue = false; return false; } } } function clickFormeTiming(e,that, offset){ return; var x = e.clientX - offset - 8.5; var duration = parseInt(myPlaylist.getDuration()); var duration_finale; duration_finale=duration; w=(parseInt(duration_finale) / visual_width) * x; w=parseInt(w); wPlayerSendEvent('SEEK', w ); if(!myPlaylist.isPlaying() && myPlaylist.getCurrentTime()>0){ wPlayerSendEvent('PLAY',false); } } function clickForme(e,that){ return; var offset = that.offset(); var x = e.clientX - offset.left + 5; var duration = parseInt(myPlaylist.getDuration()); var duration_finale; duration_finale=duration; w=(parseInt(duration_finale) / visual_width) * x; w=parseInt(w); wPlayerSendEvent('SEEK', w ); if(!myPlaylist.isPlaying() && myPlaylist.getCurrentTime()>0){ wPlayerSendEvent('PLAY',false); } } --> fonction searchExternalRecommendation() mise dans l'element directement // $('#btn_search_external_recommendation_youtube').on('click', function() { // searchExternalRecommendation(document.getElementById('search_external_recommendation_youtube').value); // }); function searchExternalRecommendation(url) { var p = /^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/i; var p2 =/^(?:https?:\/\/open\.spotify\.com|spotify)/i; var p3 =/^(?:https?:\/\/.*soundcloud.com\/)/i; var p4 =/^(?:https?:\/\/.*disco.ac\/)/i; var tab_url = url.split('?'); url = tab_url[0]; var v_param = ""; if ( tab_url[1] ) { var params_get = tab_url[1].split('&'); for (let i = 0; i < params_get.length; i++) { var tmp_param = params_get[i].split('='); if ( tmp_param[0] == 'v' ) { v_param = tmp_param[1]; } } } url = url + (v_param != "" ? "?v=" + v_param : ""); let logged_in = false; jQuery.ajax({url: "/ajax/check_conn.php", type: "GET", async: false, success: function(JSONreponseFromAjax){ logged_in = JSONreponseFromAjax; }} ); if (1==1 || logged_in == "OK" ) { if((url.match(p) || url.match(p2) || url.match(p3) || url.match(p4)) && !launch_yt_progress){ if(url.match(p)){ var providerURL = "Youtube URL"; }else if(url.match(p2)){ var providerURL = "Spotify URL"; }else if(url.match(p3)){ var providerURL = "SoundCloud URL"; }else if(url.match(p4)){ var providerURL = "Disco URL"; }else{ var providerURL = "Youtube URL"; } var message = providerURL + " :
" + "The scan may take several minutes. Would you like to continue?"; var topito = jQuery('#header-search-query').offset(); $('#searchbtn').prop('disabled', true); jcConfirm( message, function(){ if(url.match(p)){ /**clean the url before sending it to alain**/ url=url.replace(/\?si=.*$/,''); } launch_yt_progress=true; ///////////$('progress').show(); $('progress').hide(); spinnerStartCancellable(); //////////randomBar( ); jq_xhr.reset(); jq_xhr.addCancelCallback(resetSearchExternalRecommendation); jq_xhr.instance = $.ajax({url: "https://cdn.cezamemusic.com/recog/upload.php", type: "GET", data: {url: url,lang:'en'}, success: function(JSONreponseFromAjax){ resetSearchExternalRecommendation(); $('#searchbtn').prop('disabled', false); if(JSONreponseFromAjax=="ERR"){ getAlert("An error has occured","header-search-query"); clearTimeout(mytimeoutrb); progress = document.getElementById('uploadprogress'); progress.value = progress.innerHTML = 0; ///////////$('progress').show(); $('progress').hide(); // $('.external_recommendationbox')[0].style.display = 'none'; }else if(JSONreponseFromAjax=="ERR_NOT_CONNECTED"){ //jQuery('#infoBoxListePage_connect').show(); TipNotConnected(); $('progress').hide(); // $('.external_recommendationbox')[0].style.display = 'none'; }else if(JSONreponseFromAjax.match(/^ERR_/)){ $('progress').hide(); // $('.external_recommendationbox')[0].style.display = 'none'; }else{ clearTimeout(mytimeoutrb); progress = document.getElementById('uploadprogress'); progress.value = progress.innerHTML = 0; ///////////$('progress').show(); $('progress').hide(); /** SG 20/10/2021 : ajout pour cacher la box après requête et vider le champs **/ // $('#search_external_recommendation_youtube').val(''); // $('.external_recommendationbox').hide(); reponses = JSON.parse(JSONreponseFromAjax); reponsesMots = reponses.mots; JSONreponse = JSONreponseFromAjax; suggestiontitres(url,'yt'); } }, error: function(res, textStatus, errorThrown){ resetSearchExternalRecommendation(); if (textStatus !== 'abort') { var text_alert = "An error occured, please try again later"; //if (errorThrown.search(/time[- ]?out/i) !== -1) // text_alert += ".
Error : Processing time limit exceeded"; getAlert(text_alert); } } }); }, function(){ jQuery('#header-search-query').val(''); }, "continue", "Cancel", {} ); } } else { TipNotConnectedPubAi(true); } } function searchExternalRecommendationFromBrief(brief) { let logged_in = false; spinnerStart(); jQuery.ajax({url: "/ajax/check_conn.php", type: "GET", async: true, success: function(JSONreponseFromAjax){ logged_in = JSONreponseFromAjax; }} ); /**pour les tests on rend la fonction accessible (demo) */ if ( 1==1 || logged_in == "OK" ) { jQuery.ajax({ url: "/ajax/get_keywords_from_brief.php", type: "POST", data: { brief : brief }, dataType: "html", async: true, success: function(JSONreponseFromAjax){ var parsedRes = JSON.parse(JSONreponseFromAjax); var div_error = document.getElementById('external_brief_errors'); if ( parsedRes.error !== undefined ) { var txt_error = "Error : "; if ( parsedRes.error == "brief_empty" ) { txt_error += "Your brief is empty"; } else if ( parsedRes.error == "brief_too_long" ) { txt_error += "Your brief is too long, it must be 1000 characters long maximum"; } div_error.innerHTML = txt_error; div_error.style.display = 'block'; spinnerStop(); } else { div_error.innerHTML = ''; div_error.style.display = 'none'; var responseJSON = parsedRes; var response = responseJSON; var url = "/liste_resultats.php?"; resetSearchExternalRecommendation(); var params = []; var tab_mots = []; //var nbi = 1; //for( var key in response ) { for( var valou of response ) { //if(nbi < 5){ //params.push("mot[]=" + encodeURI(response[key] + "@@@@" + response[key] + "@@@@" + response[key])); params.push("mot[]=" + encodeURI(valou + "@@@@" + valou + "@@@@" + valou)); //tab_mots.push(response[key]); tab_mots.push(valou); //} //nbi++; } if ( params.length == 0 ) { div_error.innerHTML = 'No results found, please try again later.'; div_error.style.display = 'block'; spinnerStop(); return; } url += params.join("&"); xajax_check_multiple_words(tab_mots.join(' '), [], false, true, false, brief); //window.location.href = url; } } } ); } else { TipNotConnectedPubAi(true); spinnerStop(); } } function resetSearchExternalRecommendation() { spinnerStopCancellable(); launch_yt_progress = false; $('#search_external_recommendation_youtube').val(''); $('.external_recommendationbox').hide(); } /** SG 20/10/2021 : RAJOUT POUR LE FILE AREA DE L'EXTERNAL RECOMMENDATION **/ $("#file_external_recommendation").on("change", function(e) { let logged_in = false; jQuery.ajax({url: "/ajax/check_conn.php", type: "GET", async: false, success: function(JSONreponseFromAjax){ logged_in = JSONreponseFromAjax; }} ); if (1==1 || logged_in == "OK" ) { spinnerStart(); var lbl_external = document.getElementById('file_external_recommendation_lbl'); var old_txt = lbl_external.innerHTML; lbl_external.innerHTML = e.target.files[0].name; if ( !e.target.files[0].name ) { return; } var fileExtension = e.target.files[0].name.split('.').pop(); if ( accepted_files.includes(fileExtension.toLowerCase())){ if ( accepted_files_music.includes(fileExtension.toLowerCase())){ readfiles(e.target.files); }else{ readfiles_image(e.target.files); } } else { spinnerStop(); $('#progress_external_recommendation_file').hide(); getAlertDanger("Only MP3, WAV, AIFF, JPG and PNG files are accepted"); lbl_external.innerHTML = old_txt; e.target.files = null; } } else { TipNotConnectedPubAi(true); } }); //--- //- FUNCTIONS!! //--- //--- //- autocomplete EXPLICATION : lance l'autocomplete sur la recherche quand un titre est directement renseigne, suggestion //--- var svg_header_search_query = ""; /////////jQuery('#header-search-query').val(); /**************EV 19/01/2021 : retiré de la recherche if($("#header-search-query").length > 0) $("#header-search-query").autocomplete({ source: "/ajax/searchv4.php", position: { my: "left+0 top+2" }, create: function(){ $(this).data('ui-autocomplete')._renderItem = function (ul, item) { svg_header_search_query = jQuery('#header-search-query').val(); item.label = item.label.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + $.ui.autocomplete.escapeRegex(this.term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); return $("
  • ") .addClass("ac-li_"+item.type) .data("item.autocomplete", item) .append("" + item.label + "") .appendTo(ul); }; }, focus: function( event, ui ) { if(ui.item.txt!='') { $("#header-search-query").val(ui.item.txt); //svg_header_search_query = jQuery('#header-search-query').val(); }else{ $("#header-search-query").val(svg_header_search_query); } return false; }, select: function( event, ui ) { if(ui.item.url!='' && ui.item.url!='#'){ document.location.href=ui.item.url; } return false; }, response: function( event, ui ) { if(ui.content!=null){ //launchSearch(); } } }).autocomplete( "widget" ).addClass( "autocomplete_search_page" ); ******/ //--- //- recog clickOnTag //--- clickOnTag = function(el){ //////empty_search_form(); spinnerStart(); var inz = el.find('input'); if(el.hasClass('recogbuttondisabled')) { /**ne rien faire, sortir de cette fonction, car le mot n'est pas sélectionnable**/ return null; }else if(el.hasClass('recogbuttonselected')){ inz.prop('disabled', true); el.removeClass('recogbuttonselected').addClass('recogbuttondefault'); }else if(el.hasClass('recogbuttondefault')){ inz.prop('disabled', false); el.removeClass('recogbuttondefault').addClass('recogbuttonselected'); } jQuery('.recogbutton').each(function(){jQuery(this).removeClass('recogbuttondisabled').addClass('recogbuttondefault');}); //xajax_get_recog_results_keywords(xajax.getFormValues('alain_search_form'),$('#recogtags').html(),JSONreponse); xajax_get_recog_results_keywords(xajax.getFormValues('alain_search_form'),'',JSONreponse); } //--- //- recog launch_recog_search //--- launch_recog_search = function(){ var zurl=""; var taburl = [ ]; taburl.push("last_item_played=" + global_last_item_played); taburl.push("type_suggestion=" + global_type_suggestion); jQuery('.recogbutton').each(function(){ /**verifier si disabled ou pas**/ if(jQuery(this).hasClass('recogbuttonselected')){ var zinput=jQuery(this).find('input'); taburl.push( zinput.attr('name') + "=" + zinput.val() ); } }); similartracks=JSON.parse(JSONreponse); similartracks=similartracks.similartracks; if(similartracks.length > 0){ tabids=new Array(); for(var i=0;i" + "" + lib + "" tagz.push(tag); } } strz+=""; $('#cartouche-similar_content').html(strz); //$('#search_form').append(strz); /*$('#recogtags').css('margin-top', (0 - ($('#recogtags').css('height')/2)) + 'px');*/ /**mémoriser le grid**/ //xajax_get_recog_results_keywords(xajax.getFormValues('search_form'),$('#recogtags').html(),JSONreponse); //xajax_get_recog_results_tracks(xajax.getFormValues('search_form'),$('#recogtags').html()); } //--- //- recog suggestionmots //--- suggestionmots = function(){ jQuery('#recogtags').show(); //jQuery('.recogbutton').each(function(){ //jQuery(this).removeClass("recogbuttonselected").addClass("recogbuttondefault"); //jQuery(this).find('input').removeAttr('disabled'); //}); //xajax_get_recog_results_keywords(xajax.getFormValues('search_form'),$('#recogtags').html(),JSONreponse); } var global_last_item_played; var global_type_suggestion; //--- //- recog suggestiontitres //--- suggestiontitres = function(last_item_played,type_suggestion){ /** last_item_played : le titre de réference sur une recommendation (signe égal) type_suggestion : (equal,yt,mp3) **/ global_last_item_played=last_item_played; global_type_suggestion=type_suggestion; //xajax_get_recog_results_tracks(xajax.getFormValues('alain_search_form'),$('#recogtags').html(),JSONreponse, last_item_played, type_suggestion); xajax_get_recog_results_tracks(xajax.getFormValues('alain_search_form'),'',JSONreponse, last_item_played, type_suggestion); } //--- //- recog previewfile //--- previewfile = function (file) { if (tests.filereader === true && acceptedTypes[file.type] === true) { var reader = new FileReader(); reader.onload = function (event) { }; reader.readAsDataURL(file); } else { holder.innerHTML += '

    Loading ' + file.name + ' ' + (file.size ? (file.size/1024|0) + 'K' : ''); fichier=file.name; } } //--- //- recog readfiles //--- readfiles = function(files) { var formData = tests.formdata ? new FormData() : null; for (var i = 0; i < files.length; i++) { if (tests.formdata) formData.append('file', files[i]); // previewfile(files[i]); en commentaire pcq nom du fichier pas important et pas beau } formData.set('lang','en'); // now post a new XHR request if (tests.formdata) { var xhr = new XMLHttpRequest(); xhr.open('POST', '/recog/upload.php'); xhr.onload = function() { progress.value = progress.innerHTML = 100; }; xhr.onloadend = function() { JSONreponse= xhr.responseText.trim(); if(JSONreponse=="ERR"){ spinnerStopCancellable(); $('#progress_external_recommendation_file').hide(); document.getElementById('file_external_recommendation').files = null; document.getElementById('file_external_recommendation_lbl').innerHTML = 'Choose file from your computer'; getAlertDanger("An error has occured, please try again with another file"); }else if(JSONreponse=="ERR_NOT_CONNECTED"){ //jQuery('#infoBoxListePage_connect').show(); TipNotConnected(); }else{ $('#fichiercharge').remove(); $('#chargementde').remove(); $('progress').hide(); spinnerStop(); reponses = JSON.parse(JSONreponse); reponsesMots = reponses.mots; suggestiontitres(files[0].name, 'mp3'); /** SG 21/10/2021 : POUR CACHER LA BOX QD RESULTAT AFFICHÉ **/ if($('.external_recommendationbox').length){ /** SG 22/10/2021 : POUR PROGRESS BAR EXTERNAL_RECOMMENDATION **/ $('#progress_external_recommendation_file').width('100%'); $('.external_recommendationbox').hide(); $('#progress_external_recommendation_file').width('0%'); $('#progress_external_recommendation_file').hide(); $('#file_external_recommendation').val(''); document.getElementById('file_external_recommendation_lbl').innerHTML = 'Drop your file here.'; } } }; if (tests.progress) { $('progress').show(); $('#progress_external_recommendation_file').show(); spinnerStart(); xhr.upload.onprogress = function (event) { if (event.lengthComputable) { var complete = (event.loaded / event.total * 100 | 0); if(complete!=100){ $('#recogdiv').each(function(){$(this).remove();}); } /** SG 22/10/2021 : PR PROGRESS BAR EXTERNAL_RECOMMENDATION **/ if($('#progress_external_recommendation_file').length){ $('#progress_external_recommendation_file').width((event.loaded/event.total*100)+'%'); } progress.value = progress.innerHTML = complete; } } } xhr.send(formData); } } //--- //- recog readfiles //--- readfiles_image = function(files) { var formData = tests.formdata ? new FormData() : null; for (var i = 0; i < files.length; i++) { if (tests.formdata) formData.append('file', files[i]); // previewfile(files[i]); en commentaire pcq nom du fichier pas important et pas beau } formData.set('lang','en'); // now post a new XHR request if (tests.formdata) { var xhr = new XMLHttpRequest(); xhr.open('POST', '/ajax/get_keywords_from_brief.php'); xhr.onload = function() { progress.value = progress.innerHTML = 100; }; xhr.onloadend = function() { JSONreponse= xhr.responseText.trim(); if(JSONreponse=="ERR"){ spinnerStopCancellable(); $('#progress_external_recommendation_file').hide(); document.getElementById('file_external_recommendation').files = null; document.getElementById('file_external_recommendation_lbl').innerHTML = 'Choose file from your computer'; getAlertDanger("XXXXXAn error has occured, please try again with another file"); }else if(JSONreponse=="ERR_NOT_CONNECTED"){ //jQuery('#infoBoxListePage_connect').show(); TipNotConnected(); }else{ $('#fichiercharge').remove(); $('#chargementde').remove(); $('progress').hide(); spinnerStop(); var parsedRes = JSON.parse(JSONreponse); var div_error = document.getElementById('external_brief_errors'); if ( parsedRes.error !== undefined ) { var txt_error = "Error : "; if ( parsedRes.error == "brief_empty" ) { txt_error += "Your brief is empty"; } else if ( parsedRes.error == "brief_too_long" ) { txt_error += "Your brief is too long, it must be 1000 characters long maximum"; } div_error.innerHTML = txt_error; div_error.style.display = 'block'; spinnerStop(); } else { div_error.innerHTML = ''; div_error.style.display = 'none'; var responseJSON = parsedRes; var response = responseJSON; var url = "/liste_resultats.php?"; var params = []; var tab_mots = []; for( var valou of response ) { params.push("mot[]=" + encodeURI(valou + "@@@@" + valou + "@@@@" + valou)); tab_mots.push(valou); } if ( params.length == 0 ) { div_error.innerHTML = 'No results found, please try again later.'; div_error.style.display = 'block'; spinnerStop(); return; } url += params.join("&"); xajax_check_multiple_words(tab_mots.join(' '), [], false, true, false, ''); //window.location.href = url; } } }; if (tests.progress) { $('progress').show(); $('#progress_external_recommendation_file').show(); spinnerStart(); xhr.upload.onprogress = function (event) { if (event.lengthComputable) { var complete = (event.loaded / event.total * 100 | 0); if(complete!=100){ $('#recogdiv').each(function(){$(this).remove();}); } /** SG 22/10/2021 : PR PROGRESS BAR EXTERNAL_RECOMMENDATION **/ if($('#progress_external_recommendation_file').length){ $('#progress_external_recommendation_file').width((event.loaded/event.total*100)+'%'); } progress.value = progress.innerHTML = complete; } } } xhr.send(formData); } } //--- //- afficherPanneauEntree //--- afficherPanneauEntree = function(){ var zeObj = $('#header-search-query'); if(zeObj.val()!=""){ $('#boiteAdviceRico').show(500); } } //--- //- jelancenoresult //--- jelancenoresult = function(){ in_search=false; $('#msgdbg').text($("#header-search-query").attr('value')); spinnerStart(); //xajax_check_multiple_words($("#header-search-query").attr('value'), xajax.getFormValues('search_form')); }; var mytimeoutrb; var randomPercent = 0 randomBar = function( ){ randomPercent = randomPercent + 5 if(randomPercent > 100) { randomPercent = 0 } progress = document.getElementById('uploadprogress'); progress.value = progress.innerHTML = randomPercent; mytimeoutrb = setTimeout( function(){randomBar( );} , 300); } todoOnKeyDown = function(zeObj,e){ $carousel_gallery_home.flickity('pausePlayer'); /** le moteur suggest est désactivé quand on tape une touche, cela empeche le masque "Entrée" de s'afficher, et lance le timeout de 3 secondes pour l'ouvrir **/ spinnerStop(); clearTimeout(timeoutAfficherPanneauEntree); in_search=true; timeoutAfficherPanneauEntree = setTimeout(function(){afficherPanneauEntree();},3000); //var kc=e.keyCode; var kc = e.key || e.code; if(kc=="Enter" || kc==13 || kc==37 || kc==38 || kc==39 || kc==40 || zeObj.value=='' || zeObj.value.indexOf('?+')!=-1){ spinnerStop(); } if($('#btn_external_recommendation').length > 0){ /** SG 21/20/2021 : POUR CACHER BOUTON external_recommendation QD QQUE CHOSE DE TAPER **/ if((zeObj.value).length>0){ /////16/04/2024 Eric / on ne le retire plus. : document.getElementById('btn_external_recommendation').style.display = 'none'; }else{ document.getElementById('btn_external_recommendation').style.display = 'flex'; } } if(( kc==13 || kc=='Enter') && zeObj.value!='' ){ var r = $(".text-tags .text-label").map( function(){return $(this).text();}).get().join(' '); if(r!=''){ var phrase=r + ' ' + zeObj.value; }else{ var phrase=zeObj.value; } $.ajax({ type: "POST", url: "/ajax/check_is_prompt.php", data: { phrase: phrase, langue: 'en' } }).done(function(reponse) { if (reponse === "OK") { /**vider le formulaire de recherche**/ empty_search_form(); /**appeler la fonction de recommandation par brief**/ searchExternalRecommendationFromBrief(phrase); } else { //bouton entrée tappé fct_menuzonehidden(); spinnerStart(); clearTimeout('jelancelenoresultdansxsecondes'); xajax_check_multiple_words(phrase, xajax.getFormValues('search_form')); } }); }else if(( kc==13 || kc=='Enter') && zeObj.value==''){ fct_menuzonehidden(); } } todoOnBlur = function(zeObj,e){ var v = zeObj.value; $carousel_gallery_home.flickity('pausePlayer'); spinnerStop(); clearTimeout(timeoutAfficherPanneauEntree); in_search=true; timeoutAfficherPanneauEntree = setTimeout(function(){afficherPanneauEntree();},3000); spinnerStop(); /** SG 24/10/2023 : POUR CACHER BOUTON external_recommendation QD QQUE CHOSE DE TAPER **/ if($('#btn_external_recommendation').length > 0){ if((zeObj.value).length>0){ /////16/04/2024 Eric / on ne le retire plus. : document.getElementById('btn_external_recommendation').style.display = 'none'; }else{ document.getElementById('btn_external_recommendation').style.display = 'flex'; } } if(v!=''){ fct_menuzonehidden(); spinnerStart(); clearTimeout('jelancelenoresultdansxsecondes'); zeObj.value = ''; var r = $(".text-tags .text-label").map( function(){return $(this).text();}).get().join(' '); var phrase = ''; if ( r!='' ) { phrase = r + ' ' + v; } else { phrase = v; } $.ajax({ type: "POST", url: "/ajax/check_is_prompt.php", data: { phrase: phrase, langue: 'en' } }).done(function(reponse) { if (reponse === "OK") { /**vider le formulaire de recherche**/ empty_search_form(); /**appeler la fonction de recommandation par brief**/ searchExternalRecommendationFromBrief(phrase); } else { //bouton entrée tappé fct_menuzonehidden(); spinnerStart(); clearTimeout('jelancelenoresultdansxsecondes'); xajax_check_multiple_words(phrase, xajax.getFormValues('search_form')); ////////show_bpm_key_zone("search"); } }); } else { //fct_menuzonehidden(); //remettre cette ligne si problème sur le onblur //SG 03/11/2023 : afin que la cartouche ne se ferme plus au onblur de l'input et que le bouton ai search se cache quand des mots sont présents dans l'input var r = $(".text-tags .text-label").map( function(){return $(this).text();}).get().join(' '); if ( r!="" ) { /////16/04/2024 Eric / on ne le retire plus. : $("#btn_external_recommendation").hide(); } else { if (document.getElementsByClassName('recogbutton').length == 0) { fct_menuzonehidden(); } } } } //Tooltip sur liste track search v4 pour les recommandations tooltip_menu_media = function(button,id_media,content){ $('.tooltip_menu_recommandation').removeClass('persistent').fadeOut(); //CONTENT:: id="tooltiprecommandation_70535" const $tooltip = $("#"+content+"_" + id_media); $tooltip.stop(true, true).fadeIn(); // Stop toute animation en cours et montre le tooltip $tooltip.addClass('persistent'); //on charge pour ce contenu le code pour la region if(content === "tooltiprecommandation"){ if (!myPlaylist || typeof myPlaylist.playlist !== 'object') { //console.error("myPlaylist.playlist n'est pas un objet valide."); return; } // Convertir en tableau //--si c'est la grosse playlist avec les alternates if (String(id_media).startsWith("0")) { //console.log("alt"); id_media_alt = String(id_media).slice(1); // Supprime le premier caractère pos = $('#boxcontrol_'+id_media_alt).attr('curposition'); //--sinon c'est la petite playlist celle au chargement de la page }else{ const playlistValues = Object.values(myPlaylist.playlist); // Rechercher l'index const index = myPlaylist.playlist.findIndex( item => String(item.id_media) === id_media ); if (index !== -1) { const currentItem = playlistValues[index]; pos = index; //console.log("Index trouvé :", index, "Données :", currentItem); } } //console.log("Index trouvé :", pos, "Données :", myPlaylist.playlist[pos]); from_last_click ="recommandationedit"; window.setCurrentSongLOAD(pos); //createRegion(regionStart, regionEnd, readOnly,loop,maxLength,id) //id=time-total recup le timing setTimeout(() => { let dureetrack = $("#time-total").html(); let [minutesDT, secondsDT] = dureetrack.split(':').map(Number); let newseconds = (minutesDT * 60) + secondsDT; console.log(newseconds); window.createRegion('0', newseconds, 'false', 'false', '', 'recommandation_' + id_media); }, 150); $tooltip.on("click", ".Ttr_validate", function (e) { let timingdebut = $tooltip.find('.Ttr_timingdebut').val(); let timingfin = $tooltip.find('.Ttr_timingfin').val(); console.log(timingdebut+" "+timingfin+" Suivant"); closeTooltip_media(id_media); }); } // Gestion des délais pour le masquage let hideTimeout; // Quand la souris quitte le bouton $(button).on("mouseout", function () { hideTimeout = setTimeout(() => { if (!$tooltip.is(":hover") && !$tooltip.hasClass("persistent")) { $tooltip.fadeOut(); } }, 200); }); // Quand la souris entre dans le tooltip $tooltip.on("mouseover", function () { clearTimeout(hideTimeout); // Annuler le délai de masquage si la souris entre dans le tooltip }); // Quand la souris quitte le tooltip $tooltip.on("mouseout", function () { hideTimeout = setTimeout(() => { if (!$tooltip.is(":hover") && !$tooltip.hasClass("persistent")) { $tooltip.fadeOut(); } }, 200); }); //$tooltip.fadeOut(); } function closeTooltip_media(id_media='') { let $tooltip; if(id_media!=''){ $tooltip = $("#tooltiprecommandation_"+id_media); }else{ $tooltip = $(this).closest(".tooltip_menu_recommandation"); } $tooltip.removeClass("persistent").fadeOut(); if(from_last_click === "recommandationedit"){ from_last_click = 'public'; fctclearRegions(); const $tooltip = $(this).closest(".tooltip_menu_recommandation"); $tooltip.find('.Ttr_timingdebut').val(''); $tooltip.find('.Ttr_timingfin').val(''); } } launch_recommendation = function(localurl,last_item_played){ let logged_in = false; jQuery.ajax({url: "/ajax/check_conn.php", type: "GET", async: false, success: function(JSONreponseFromAjax){ logged_in = JSONreponseFromAjax; }} ); var cookiepubai = document.cookie.match('(^|;) ?no_pub_ai=([^;]*)(;|$)'); var test_pubai = false; if ( cookiepubai !== null ) { test_pubai = cookiepubai[2]; } //SG 14/11/2023 : si pas connecté, on affiche la popup de pub pour les fonctionnalités complémentaires de l'IA // if ( logged_in != "OK" && !test_pubai ) { ///pour l'instant on met ça de côté ... TipNotConnectedPubAi(false); // } $('progress').hide(); spinnerStart(); /**on supprime le div de recog, vu que l'on va en charger un nouveau**/ jQuery('#recogdiv').remove(); if ( !$('body').hasClass('mobile') ) { randomBar( ); } jQuery.ajax({url: "/recog/upload.php", type: "POST", data : {localurl: localurl, id_media: last_item_played,lang:'en'}, success: function(JSONreponseFromAjax){ if(JSONreponseFromAjax=="ERR"){ $('progress').hide(); spinnerStop(); }else if(JSONreponseFromAjax=="ERR_NOT_CONNECTED"){ TipNotConnected(); $('progress').hide(); spinnerStop(); }else if(JSONreponseFromAjax.match(/^ERR_/) ){ $('progress').hide(); spinnerStop(); clearTimeout(mytimeoutrb); }else { clearTimeout(mytimeoutrb); if ( !$('body').hasClass('mobile') ) { progress = document.getElementById('uploadprogress'); progress.value = progress.innerHTML = 0; } jQuery('progress').hide(); spinnerStop(); reponses = JSON.parse(JSONreponseFromAjax); reponsesMots = reponses.mots; JSONreponse = JSONreponseFromAjax; suggestiontitres(last_item_played,'equal'); } } }); } //--- //- changeScrollHeight //--- changeScrollHeight = function() { var h = parseInt(window.prompt('Please type new scroll height (number in pixels):', jQuery.Autocompleter.defaults.scrollHeight)); if(h > 0) { $("#suggest1").setOptions({ scrollHeight: h }); } } //--- //- focus_header_search_query //--- focus_header_search_query = function(){ //$("#header-search-query").trigger("activate.autocomplete"); $("#header-search-query").click(); } //--- //- RemoveAccents //--- RemoveAccents = function(strAccents) { var strAccents = strAccents.split(''); var strAccentsOut = new Array(); var strAccentsLen = strAccents.length; var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž'; var accentsOut = "AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz"; for (var y = 0; y < strAccentsLen; y++) { if (accents.indexOf(strAccents[y]) != -1) { strAccentsOut[y] = accentsOut.substr(accents.indexOf(strAccents[y]), 1); } else strAccentsOut[y] = strAccents[y]; } strAccentsOut = strAccentsOut.join(''); //return strAccentsOut.replace(/ +/,"-"); strAccentsOut=strAccentsOut.replace(/'/g,"-").replace(/&+/g," ").replace(/ +/g,"-").replace(/\-+/,'-'); return strAccentsOut; } //--- //- addAlbumAndLaunch //--- addAlbumAndLaunch = function(id_album,e,f){ e.after(""); f.submit(); } //--- //- launchSearch //--- launchSearch = function(){ jQuery('.loupe').click(); } /**tout ce qui se rapoporte au filtrage par bpm et key**/ load_bpm_key_slider = function(){ jQuery('#slider').slider({ range: true, min: 10, max: 300, step: 1, values: [ 10, 300 ], slide: function( event, ui ) { jQuery('.slider-min').html(ui.values[ 0 ]); jQuery('.slider-max').html(ui.values[ 1 ]); }, change: function( event, ui ) { var min = ui.values[ 0 ]; var max = ui.values[ 1 ]; jQuery('#customFilterBpm').val(''); jQuery.ajax({ url: '/ajax/ajax_search_filters.php?minbpm='+min+'&maxbpm='+max} ).done(function(){ var only_word_search = jQuery('#search_form').serialize().replace('search_external_recommendation_youtube=&search_external_recommendation_brief=', ''); const url_params = new URLSearchParams(window.location.search); const id_media_str = url_params.get('id_media_str'); var tmp_url = ""; if ( id_media_str !== null ) { tmp_url = '/liste_resultats.php?id_media_str='+id_media_str+'&randkeybpm='+Math.random().toString(36).substring(7); }else if(only_word_search!=''){ tmp_url = '/liste_resultats.php?'+jQuery('#search_form').serialize()+'&randkeybpm='+Math.random().toString(36).substring(7); } goLaunchAjaxify(tmp_url,'#searchlink','search_' + Math.random().toString(36).substring(7)); }); } }); } -->