This repository has been archived by the owner on Jan 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ga event for language changes (#294)
* added ga event for language changes. * remove instagram link, made cordova links all https because they were broken * fixed a few more http links to be https
- Loading branch information
1 parent
6e36caa
commit 45a0f77
Showing
12 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
function getBaseUrl(urlString) { | ||
return urlString.replace(/https?:\/\//i, '').split('/')[0]; | ||
return urlString.replace(/https?:\/\//i, '').split('/')[0]; | ||
} | ||
|
||
|
||
document.addEventListener('DOMContentLoaded', function(event) { | ||
var toggleButton = Sizzle('.mobile-docs-toggle')[0]; | ||
var sidebar = Sizzle ('aside.sidebar')[0]; | ||
var body = Sizzle ('body')[0]; | ||
document.addEventListener('DOMContentLoaded', function (event) { | ||
var toggleButton = Sizzle('.mobile-docs-toggle')[0]; | ||
var sidebar = Sizzle('aside.sidebar')[0]; | ||
var body = Sizzle('body')[0]; | ||
|
||
toggleButton.addEventListener("click", function(e){ | ||
sidebar.classList.toggle('open'); | ||
body.classList.toggle('menu-open'); | ||
}); | ||
toggleButton.addEventListener("click", function (e) { | ||
sidebar.classList.toggle('open'); | ||
body.classList.toggle('menu-open'); | ||
}); | ||
|
||
var languageSelect = Sizzle('#language-select')[0]; | ||
var currentUrl = window.location.href; | ||
var urlArray = currentUrl.replace(/https?:\/\//i, '').split('/'); | ||
for (i = 0; i < languageSelect.children.length; i++) { | ||
var option = languageSelect.children[i]; | ||
if (getBaseUrl(currentUrl) === getBaseUrl(option.value)) { | ||
languageSelect.selectedIndex = i; | ||
var languageSelect = Sizzle('#language-select')[0]; | ||
var currentUrl = window.location.href; | ||
var urlArray = currentUrl.replace(/https?:\/\//i, '').split('/'); | ||
for (i = 0; i < languageSelect.children.length; i++) { | ||
var option = languageSelect.children[i]; | ||
if (getBaseUrl(currentUrl) === getBaseUrl(option.value)) { | ||
languageSelect.selectedIndex = i; | ||
} | ||
} | ||
} | ||
|
||
languageSelect.addEventListener("change", function(e){ | ||
urlArray.shift(); | ||
var newUrl = e.target.value + urlArray.join('/'); | ||
window.location = newUrl; | ||
}); | ||
/*function resize() { | ||
if (window.innerWidth>=820 && sidebar.classList.contains('open')) | ||
sidebar.classList.toggle('open'); | ||
} | ||
window.addEventListener("resize", resize);*/ | ||
languageSelect.addEventListener("change", function (e) { | ||
ga('send','event','languageChange',e.target.value,languageSelect.options[languageSelect.selectedIndex].text); | ||
urlArray.shift(); | ||
var newUrl = e.target.value + urlArray.join('/'); | ||
window.location = newUrl; | ||
}); | ||
/*function resize() { | ||
if (window.innerWidth>=820 && sidebar.classList.contains('open')) | ||
sidebar.classList.toggle('open'); | ||
} | ||
window.addEventListener("resize", resize);*/ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters