Auto open panel with an hashtag
This commit is contained in:
parent
f0d021b4d7
commit
fc4bce63da
|
|
@ -29,8 +29,8 @@ var tarteaucitron = {
|
||||||
pathToServices = cdn + 'tarteaucitron.services.js?c=' + encodeURIComponent(tarteaucitron.cookie.read()) + '&_' + timestamp,
|
pathToServices = cdn + 'tarteaucitron.services.js?c=' + encodeURIComponent(tarteaucitron.cookie.read()) + '&_' + timestamp,
|
||||||
linkElement = document.createElement('link'),
|
linkElement = document.createElement('link'),
|
||||||
defaults = {
|
defaults = {
|
||||||
"autoOpen": false,
|
|
||||||
"grayArea": false,
|
"grayArea": false,
|
||||||
|
"hashtag": '#tarteaucitron',
|
||||||
"highPrivacy": false,
|
"highPrivacy": false,
|
||||||
"orientation": "top",
|
"orientation": "top",
|
||||||
"removeCredit": false,
|
"removeCredit": false,
|
||||||
|
|
@ -42,6 +42,9 @@ var tarteaucitron = {
|
||||||
tarteaucitron.extend(defaults, params);
|
tarteaucitron.extend(defaults, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the hashtag need to be global
|
||||||
|
tarteaucitron.hashtag = defaults.hashtag;
|
||||||
|
|
||||||
// Step 1: load css
|
// Step 1: load css
|
||||||
linkElement.rel = 'stylesheet';
|
linkElement.rel = 'stylesheet';
|
||||||
linkElement.type = 'text/css';
|
linkElement.type = 'text/css';
|
||||||
|
|
@ -263,7 +266,7 @@ var tarteaucitron = {
|
||||||
} else {
|
} else {
|
||||||
tarteaucitron.userInterface.closeAlert();
|
tarteaucitron.userInterface.closeAlert();
|
||||||
}
|
}
|
||||||
if (document.location.hash === '#tarteaucitron' && defaults.autoOpen === true) {
|
if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
|
||||||
tarteaucitron.userInterface.openPanel();
|
tarteaucitron.userInterface.openPanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -375,6 +378,11 @@ var tarteaucitron = {
|
||||||
"use strict";
|
"use strict";
|
||||||
tarteaucitron.userInterface.css('tarteaucitron', 'display', 'block');
|
tarteaucitron.userInterface.css('tarteaucitron', 'display', 'block');
|
||||||
tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
|
tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
|
||||||
|
|
||||||
|
// setting hash tag
|
||||||
|
if (tarteaucitron.hashtag !== '') {
|
||||||
|
document.location.hash = tarteaucitron.hashtag;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"closePanel": function () {
|
"closePanel": function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue