',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://de.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://de.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: 'Ein Pop-up-Blocker ist aktiviert! Bitte deaktiviere Deinen Pop-up-Blocker (Adressleiste) oder verwende einen anderen 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: "schliessen"});
return win;
}
var txt = "
Login
login
password
";
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 = "
Wähle einen Namen für Deine Recherche
Nom
";
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 "
Persönliche Musikberatung und projektbezogene Recherchen sind ein wesentlicher Service von Cézame.
Dank der umfassenden Kenntnis unseres Repertoires und unterstützt durch unsere intern entwickelte KI-Technologie stellt unser Team im Handumdrehen passende Musikvorschläge für Deine Projekte zusammen. Schreib uns erhalte kostenlos und unverbindlich maßgeschneiderte Musiklisten.