blob: ebbc71f3aa13a478d049aefe3cb32e1d1783ef40 [file] [log] [blame]
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -07001<html>
2<!--
3 Copyright 2011 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file.
6-->
7<head>
Brad Fitzpatrickf4349f72011-05-31 13:16:51 -07008<script src="gopher.js"></script>
9<script>
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070010
11function focusinput() {
Brad Fitzpatrickf4349f72011-05-31 13:16:51 -070012 document.getElementById("inputbox").focus();
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070013}
14
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070015function navigate() {
Brad Fitzpatrickf4349f72011-05-31 13:16:51 -070016 var box = document.getElementById("inputbox");
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070017 box.focus();
Brad Fitzpatrickf4349f72011-05-31 13:16:51 -070018
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070019 var t = box.value;
20 if (t == "") {
21 return false;
22 }
23
Brad Fitzpatrickf4349f72011-05-31 13:16:51 -070024 var success = function(url) {
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070025 console.log("matched " + t + " to: " + url)
26 box.value = "";
27 openURL(url);
28 return false; // cancel form submission
Brad Fitzpatrickf4349f72011-05-31 13:16:51 -070029 };
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070030
Brad Fitzpatrickf4349f72011-05-31 13:16:51 -070031 var url = urlForInput(t);
32 if (url) {
33 return success(url);
34 }
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070035
Brad Fitzpatrickf4349f72011-05-31 13:16:51 -070036 console.log("no match for text: " + t)
37 return false;
Brad Fitzpatrick09dd5bf2011-05-23 14:05:18 -070038}
39
40function openURL(url) {
41 chrome.tabs.create({ "url": url })
42}
43
44</script>
45</head>
46<body onload="focusinput()" style='margin: 0.5em; font-family: sans;'>
47<small><a href="#" onclick="openURL('http://code.google.com/p/go/issues/list')">issue</a>,
48<a href="#" onclick="openURL('http://codereview.appspot.com/')">codereview</a>,
49<a href="#" onclick="openURL('http://code.google.com/p/go/source/list')">commit</a>, or
50<a href="#" onclick="openURL('http://golang.org/pkg/')">pkg</a> id/name:</small>
51<form style='margin: 0' onsubmit="return navigate();"><nobr><input id="inputbox" size=10 /><input type="submit" value="go" /></nobr></form>
52<small>Also: <a href="#" onclick="openURL('http://godashboard.appspot.com/')">buildbots</small>
53</body>
54</html>