summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthewsotoudeh <matthewsot@outlook.com>2015-02-19 17:04:56 -0800
committermatthewsotoudeh <matthewsot@outlook.com>2015-02-19 17:04:56 -0800
commit41e3cc18b0c0d3335441fd27fecee77b2307d890 (patch)
tree7504a14669a4acb831720eb334336f42f4b64798
parent3ab14bda7057093a11188ca72003e339ffcb3f17 (diff)
A basic location bar
-rw-r--r--foopy.js33
-rw-r--r--index.html2
-rw-r--r--style.css9
3 files changed, 44 insertions, 0 deletions
diff --git a/foopy.js b/foopy.js
index 0181fd5..1bbf7ec 100644
--- a/foopy.js
+++ b/foopy.js
@@ -42,6 +42,38 @@
return curr;
}
+ function updateLocation(choice) {
+ $('#location').html('');
+
+ var pastStack = '#!/';
+ for (var i = 0; i < stack.length; i++) {
+ var l10nId = $('[next-group="' + stack[i] + '"]').first().children('span').first().attr('data-l10n-id');
+
+ pastStack += stack[i] + '/';
+
+ var newLink = $('<a></a>').attr('href', pastStack).click(function () {
+ window.location.href = $(this).attr('href');
+ window.location.reload(true);
+ });
+
+ if (stack[i] === 'progornoprog') {
+ newLink.text('~');
+ } else {
+ if (document.webL10n.getReadyState() === 'complete') {
+ //L10n has already loaded, so we'll just set the text
+ newLink.text(document.webL10n.get(l10nId));
+ } else {
+ //If it hasn't loaded, we'll se the data-l10n-id attribute and wait for L10n to load it
+ newLink.attr('data-l10n-id', l10nId);
+ }
+ }
+
+ $('#location').append(newLink).append(' / ');
+ }
+
+ $('#location').append($('<span></span>').text($(choice).text().split('\n')[0].trim()));
+ }
+
function updateCurrentChoice(lastIndex) {
var lastChoice = $('.choices li', groupNode)[choices[choices.length - 1][lastIndex]];
var choice = $('.choices li', groupNode)[choices[choices.length - 1][choiceIndex[choiceIndex.length - 1]]];
@@ -63,6 +95,7 @@
button.addEventListener('click', trackExternalLink);
}
setLocationHashSuffix(getUIDAttribute(choice));
+ updateLocation(choice);
}
function nextChoice(ev) {
diff --git a/index.html b/index.html
index 30f7ea8..d1f5858 100644
--- a/index.html
+++ b/index.html
@@ -30,6 +30,8 @@
</head>
<body>
+ <div id="location"></div>
+
<a href="http://www.mozilla.org/" id="tabzilla">mozilla</a>
<div id="lang">
<span id="lang-selection" data-l10n-id="lang-selection">Language:</span>
diff --git a/style.css b/style.css
index f3d8dfa..c8c3699 100644
--- a/style.css
+++ b/style.css
@@ -17,6 +17,15 @@ html {
background-image: url("./bg.png");
}
+#location {
+ float: left;
+ margin-left: 100px;
+ margin-top: 10px;
+}
+ #location a {
+ color: #487dc3;
+ }
+
#tabzilla {
margin-right: 100px;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback