Permalink
Browse files

use hash frag to maintain state of wikipedia/namespace settings w/ bbq

  • Loading branch information...
1 parent 17191d6 commit 6a4f3dabf1b76cee6b1e7124b7ee0744c9ed6f3c @edsu committed Nov 16, 2012
Showing with 40 additions and 0 deletions.
  1. +21 −0 public/js/app.js
  2. +18 −0 public/js/jquery.ba-bbq.min.js
  3. +1 −0 views/layout.jade
View
@@ -27,6 +27,7 @@ function init() {
// update the stream
addUpdate(msg);
removeOld();
+
});
}
@@ -158,6 +159,7 @@ function setupControls() {
$('select[name="wikis"]').change(function() {
wikipediaLimit = ($('select[name="wikis"]').val());
+ $.bbq.pushState({wiki: wikipediaLimit.replace("#", "")});
});
/* don't display changing backgrounds on mobile devices */
@@ -178,13 +180,32 @@ function setupControls() {
} else if (name == "background") {
showBackground = checked;
}
+ if (checked) {
+ var state = {};
+ state[name] = checked;
+ $.bbq.pushState(state, checked)
+ } else {
+ $.bbq.removeState(name);
+ }
});
$('select[name="namespace"]').change(function() {
namespaceLimit = ($('select[name="namespace"]').val());
+ $.bbq.pushState({namespace: $('select[name="namespace"]').val()});
});
$(document).bind('keyup', 'p', togglePause);
$(document).bind('keyup', 'pause', togglePause);
+ // see if hash frag determines some of the control settings
+ if ($.bbq.getState("wiki")) {
+ $('select[name="wikis"]')
+ .val("#" + $.bbq.getState("wiki"))
+ .change();
+ }
+ if ($.bbq.getState("namespace")) {
+ $('select[name="namespace"]')
+ .val($.bbq.getState("namespace"))
+ .change();
+ }
}
function wikipediaFilter(msg) {

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -15,6 +15,7 @@ html
script(src='/js/jquery.blockUI.js')
script(src='/js/jquery-ui.js')
script(src='/js/jquery.backstretch.js')
+ script(src='/js/jquery.ba-bbq.min.js')
- if (trends)
script(src="/js/trends.js")

0 comments on commit 6a4f3da

Please sign in to comment.