definitly fix the history bug due to aggregation by loading history in head

This commit is contained in:
Bachir Soussi Chiadmi
2018-04-04 16:08:22 +02:00
parent 52f5a24742
commit cf1ea6aea7
6 changed files with 11 additions and 34 deletions
@@ -1,24 +1,11 @@
console.log('history');
// https://plainjs.com/javascript/utilities/set-cookie-get-cookie-and-delete-cookie-5/
// 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();
// }
console.log('EDLP THEME HISTORY.js');
// var edlp is provided by edlp_ajax.module file
if(edlp.redirect){
console.log('history redirect');
document.body.style.visibility = 'hidden';
// record current (will be origin) sys_path in cookie
// var cookiename = "edlp_origin_path";
// var cookie_value = edlp.sys_path.replace(/^\//, '') + '~~' + window.location.pathname;
// setCookie(cookiename, cookie_value, 1);
window.localStorage.setItem('edlp_origin_path', edlp.sys_path.replace(/^\//, ''));
window.localStorage.setItem('edlp_origin_url', window.location.pathname);
// redirect to home
window.location.replace(window.location.origin);
}else{
console.log('history do not redirect');
document.body.style.visibility = 'visible';
}
@@ -1,3 +1,4 @@
console.log('EDLP THEME MAIN.js');
(function($, Drupal, drupalSettings) {
EdlpTheme = function(){