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(){
@@ -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(){
@@ -5,8 +5,8 @@ base theme: classy
core: 8.x
libraries:
- core/normalize
- edlptheme/global-css
- edlptheme/history-js
- edlptheme/global-css
- edlptheme/global-js
# stylesheets-remove:
@@ -1,21 +1,22 @@
global-css:
version: VERSION
css:
base:
theme:
assets/dist/styles/app.min.css: {}
history-js:
version: VERSION
header: true
js:
assets/dist/scripts/history.min.js: { weight:-998, scope: header }
assets/dist/scripts/history.min.js: { weight:-998, preprocess: false, minified: true }
global-js:
version: VERSION
js:
# assets/dist/bower/jquery.hotkeys.js: { scope: footer }
assets/dist/bower/imagesloaded.pkgd.min.js: { scope: footer }
assets/dist/bower/masonry.pkgd.min.js: { scope: footer }
assets/dist/scripts/main.min.js: { scope: footer }
assets/dist/bower/imagesloaded.pkgd.min.js: { minified: true }
assets/dist/bower/masonry.pkgd.min.js: { minified: true }
assets/dist/scripts/main.min.js: { minified: true }
dependencies:
- core/drupal
# - core/drupal.ajax