aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/utils.js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-12-13 01:56:04 +0100
committerMaximilian Hils <git@maximilianhils.com>2014-12-13 01:56:04 +0100
commit955c5c87a261ad4083e4b3f1579625a2b53eb912 (patch)
treec33ab7eb3be5865d1ea38768d3404db524f4413e /web/src/js/utils.js
parenta09eb2bef42e241c6ff1698606f4a0decbca174a (diff)
downloadmitmproxy-955c5c87a261ad4083e4b3f1579625a2b53eb912.tar.gz
mitmproxy-955c5c87a261ad4083e4b3f1579625a2b53eb912.tar.bz2
mitmproxy-955c5c87a261ad4083e4b3f1579625a2b53eb912.zip
web: filter/highlight ui, many fixes
Diffstat (limited to 'web/src/js/utils.js')
-rw-r--r--web/src/js/utils.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/web/src/js/utils.js b/web/src/js/utils.js
index 7541e98d..b96aed0b 100644
--- a/web/src/js/utils.js
+++ b/web/src/js/utils.js
@@ -3,8 +3,7 @@ var AutoScrollMixin = {
componentWillUpdate: function () {
var node = this.getDOMNode();
this._shouldScrollBottom = (
- node.scrollTop !== 0
- &&
+ node.scrollTop !== 0 &&
node.scrollTop + node.clientHeight === node.scrollHeight
);
},
@@ -28,9 +27,14 @@ var StickyHeadMixin = {
var Navigation = _.extend({}, ReactRouter.Navigation, {
- setQuery: function (k, v) {
+ setQuery: function (dict) {
var q = this.context.getCurrentQuery();
- q[k] = v;
+ for(var i in dict){
+ if(dict.hasOwnProperty(i)){
+ q[i] = dict[i] || undefined; //falsey values shall be removed.
+ }
+ }
+ q._ = "_"; // workaround for https://github.com/rackt/react-router/pull/599
this.replaceWith(this.context.getCurrentPath(), this.context.getCurrentParams(), q);
},
replaceWith: function(routeNameOrPath, params, query) {
@@ -46,6 +50,7 @@ var Navigation = _.extend({}, ReactRouter.Navigation, {
ReactRouter.Navigation.replaceWith.call(this, routeNameOrPath, params, query);
}
});
+_.extend(Navigation.contextTypes, ReactRouter.State.contextTypes);
var State = _.extend({}, ReactRouter.State, {
getInitialState: function () {
@@ -76,12 +81,15 @@ var Key = {
DOWN: 40,
PAGE_UP: 33,
PAGE_DOWN: 34,
+ HOME: 36,
+ END: 35,
LEFT: 37,
RIGHT: 39,
ENTER: 13,
ESC: 27,
TAB: 9,
SPACE: 32,
+ BACKSPACE: 8,
J: 74,
K: 75,
H: 72,