js cleaning

This commit is contained in:
Bachir Soussi Chiadmi
2018-04-11 17:57:17 +02:00
parent 1ae73c1c12
commit ac821854ce
4 changed files with 24 additions and 68 deletions
@@ -1,4 +1,3 @@
console.log('EDLP THEME MAIN.js');
(function($, Drupal, drupalSettings) {
EdlpTheme = function(){
@@ -32,10 +31,6 @@ console.log('EDLP THEME MAIN.js');
_audioPlayer = new AudioPlayer();
_compoPlayer = new CompoPlayer();
// if (_$body.is('.path-productions')) initProductions();
// if(_$body.is('.path-frontpage')) initHome();
// initScrollbars();
};
// ___ _
@@ -148,7 +143,6 @@ console.log('EDLP THEME MAIN.js');
}
return state;
};
// function ajaxLoadContent(url, sys_path, ajax_path, selector){
function ajaxLoadContent(state){
console.log('ajaxLoadContent : url', state.url);
_$body.addClass('ajax-loading');
@@ -167,7 +161,6 @@ console.log('EDLP THEME MAIN.js');
$('.ajax-loading').removeClass('ajax-loading');
_$body.removeClass('ajax-loading');
};
// function onAjaxLoaded(data, url, ajax_path, sys_path, selector){
function onAjaxLoaded(data, state){
console.log('ajax loaded url:'+state.url+' ajax_path:'+state.ajax_path+' sys_path:'+state.sys_path);
@@ -467,7 +460,6 @@ console.log('EDLP THEME MAIN.js');
_$body.attr('corpus-map', 'ready');
}
function openEntree(tid){
if(tid){
closeAllModals();
@@ -1082,7 +1074,7 @@ console.log('EDLP THEME MAIN.js');
// assume we are going back to front page
$('body').removeClass().addClass('path-frontpage');
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
// TODO: close entrees
// close entrees
_$corpus_canvas.trigger({'type':'close-all-entree'});
}
@@ -1161,16 +1153,16 @@ console.log('EDLP THEME MAIN.js');
// |_|
// https://plainjs.com/javascript/utilities/set-cookie-get-cookie-and-delete-cookie-5/
function getCookie(name) {
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
return v ? v[2] : null;
}
function setCookie(name, value, days) {
var d = new Date;
d.setTime(d.getTime() + 24*60*60*1000*days);
document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
}
function deleteCookie(name) { setCookie(name, '', -1); }
// function getCookie(name) {
// var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
// return v ? v[2] : null;
// }
// function setCookie(name, value, days) {
// var d = new Date;
// d.setTime(d.getTime() + 24*60*60*1000*days);
// document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
// }
// function deleteCookie(name) { setCookie(name, '', -1); }
init();
} // end EdlpTheme()
@@ -1179,5 +1171,4 @@ console.log('EDLP THEME MAIN.js');
var edlptheme = new EdlpTheme();
});
})(jQuery, Drupal, drupalSettings);
@@ -1,4 +1,3 @@
console.log('EDLP THEME MAIN.js');
(function($, Drupal, drupalSettings) {
EdlpTheme = function(){
@@ -32,10 +31,6 @@ console.log('EDLP THEME MAIN.js');
_audioPlayer = new AudioPlayer();
_compoPlayer = new CompoPlayer();
// if (_$body.is('.path-productions')) initProductions();
// if(_$body.is('.path-frontpage')) initHome();
// initScrollbars();
};
// ___ _
@@ -148,7 +143,6 @@ console.log('EDLP THEME MAIN.js');
}
return state;
};
// function ajaxLoadContent(url, sys_path, ajax_path, selector){
function ajaxLoadContent(state){
console.log('ajaxLoadContent : url', state.url);
_$body.addClass('ajax-loading');
@@ -167,7 +161,6 @@ console.log('EDLP THEME MAIN.js');
$('.ajax-loading').removeClass('ajax-loading');
_$body.removeClass('ajax-loading');
};
// function onAjaxLoaded(data, url, ajax_path, sys_path, selector){
function onAjaxLoaded(data, state){
console.log('ajax loaded url:'+state.url+' ajax_path:'+state.ajax_path+' sys_path:'+state.sys_path);
@@ -467,7 +460,6 @@ console.log('EDLP THEME MAIN.js');
_$body.attr('corpus-map', 'ready');
}
function openEntree(tid){
if(tid){
closeAllModals();
@@ -1082,7 +1074,7 @@ console.log('EDLP THEME MAIN.js');
// assume we are going back to front page
$('body').removeClass().addClass('path-frontpage');
$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');
// TODO: close entrees
// close entrees
_$corpus_canvas.trigger({'type':'close-all-entree'});
}
@@ -1161,16 +1153,16 @@ console.log('EDLP THEME MAIN.js');
// |_|
// https://plainjs.com/javascript/utilities/set-cookie-get-cookie-and-delete-cookie-5/
function getCookie(name) {
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
return v ? v[2] : null;
}
function setCookie(name, value, days) {
var d = new Date;
d.setTime(d.getTime() + 24*60*60*1000*days);
document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
}
function deleteCookie(name) { setCookie(name, '', -1); }
// function getCookie(name) {
// var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
// return v ? v[2] : null;
// }
// function setCookie(name, value, days) {
// var d = new Date;
// d.setTime(d.getTime() + 24*60*60*1000*days);
// document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
// }
// function deleteCookie(name) { setCookie(name, '', -1); }
init();
} // end EdlpTheme()
@@ -1179,5 +1171,4 @@ console.log('EDLP THEME MAIN.js');
var edlptheme = new EdlpTheme();
});
})(jQuery, Drupal, drupalSettings);