From 3e63107e9473e3ec6676c047171a5d23c79b7dcd Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 26 Dec 2014 03:10:24 +0100 Subject: web: integrate filter docs --- web/src/js/components/header.jsx.js | 54 +++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 8 deletions(-) (limited to 'web/src/js') diff --git a/web/src/js/components/header.jsx.js b/web/src/js/components/header.jsx.js index ba63f12e..6470aec5 100644 --- a/web/src/js/components/header.jsx.js +++ b/web/src/js/components/header.jsx.js @@ -1,3 +1,45 @@ +var FilterDocs = React.createClass({ + statics: { + xhr: false, + doc: false + }, + componentWillMount: function () { + if (!FilterDocs.doc) { + FilterDocs.xhr = $.getJSON("/filter-help").done(function (doc) { + FilterDocs.doc = doc; + FilterDocs.xhr = false; + }); + } + if (FilterDocs.xhr) { + FilterDocs.xhr.done(function () { + this.forceUpdate(); + }.bind(this)); + } + }, + render: function () { + if (!FilterDocs.doc) { + return ; + } else { + var commands = FilterDocs.doc.commands.map(function (c) { + return + {c[0].replace(" ", '\u00a0')} + {c[1]} + ; + }); + commands.push( + + + +   mitmproxy docs + + ); + return + {commands} +
; + } + } +}); var FilterInput = React.createClass({ getInitialState: function () { // Consider both focus and mouseover for showing/hiding the tooltip, @@ -41,10 +83,7 @@ var FilterInput = React.createClass({ return desc; } else { return ( - - - Filter Documentation - + ); } }, @@ -134,28 +173,27 @@ var MainMenu = React.createClass({ return (
-
+
- - - +
+
); } -- cgit v1.2.3