Skip to content

Commit 5143be0

Browse files
authored
updated to s_code3 with shortbread (#2068)
* updated to s_code3 with shortbread * rolled back some changes in conf.py
1 parent a2bf7cf commit 5143be0

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

_static/aws-ux-shortbread/index.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_static/aws-ux-shortbread/init.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(function (w) {
2+
w.URLSearchParams = w.URLSearchParams || function (searchString) {
3+
var self = this;
4+
self.searchString = searchString;
5+
self.get = function (name) {
6+
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(self.searchString);
7+
if (results === null) {
8+
return null;
9+
}
10+
else {
11+
return decodeURI(results[1]) || 0;
12+
}
13+
};
14+
}
15+
})(window);
16+
17+
const queryString = window.location.search;
18+
const urlParams = new URLSearchParams(queryString);
19+
const lang = urlParams.get('lang')
20+
window.onload = function () {
21+
var domainName = window.location.hostname;
22+
23+
// remove an instance of shortbread if already exists
24+
var existingShortbreadEl = document.getElementById("awsccc-sb-ux-c");
25+
existingShortbreadEl && existingShortbreadEl.remove();
26+
27+
var shortbread = AWSCShortbread({
28+
domain: domainName,
29+
language: lang,
30+
// TODO add geolocator
31+
queryGeolocation: function (geolocatedIn) { geolocatedIn("EU") },
32+
});
33+
34+
shortbread.checkForCookieConsent();
35+
}

conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@
6060
html_static_path = ['_static']
6161

6262
# For Adobe Analytics
63-
html_js_files = ["https://a0.awsstatic.com/s_code/js/3.0/awshome_s_code.js", "js/analytics.js"]
63+
html_js_files = [
64+
"https://a0.awsstatic.com/s_code/js/3.0/awshome_s_code.js",
65+
"aws-ux-shortbread/index.js",
66+
"aws-ux-shortbread/init.js"
67+
]

0 commit comments

Comments
 (0)