summaryrefslogtreecommitdiff
path: root/misc/chrome/gophertool/popup.html
blob: ebbc71f3aa13a478d049aefe3cb32e1d1783ef40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<html>
<!--
 Copyright 2011 The Go Authors. All rights reserved.
 Use of this source code is governed by a BSD-style
 license that can be found in the LICENSE file.
-->
<head>
<script src="gopher.js"></script>
<script>
    
function focusinput() {
  document.getElementById("inputbox").focus();
}

function navigate() {
  var box = document.getElementById("inputbox");
  box.focus();

  var t = box.value;
  if (t == "") {
    return false;
  }

  var success = function(url) {
    console.log("matched " + t + " to: " + url)
    box.value = "";
    openURL(url);
    return false;  // cancel form submission
  };

  var url = urlForInput(t);
  if (url) {
    return success(url);
  }

  console.log("no match for text: " + t)
  return false;
}

function openURL(url) {
  chrome.tabs.create({ "url": url })
}

</script>
</head>
<body onload="focusinput()" style='margin: 0.5em; font-family: sans;'>
<small><a href="#" onclick="openURL('http://code.google.com/p/go/issues/list')">issue</a>,
<a href="#" onclick="openURL('http://codereview.appspot.com/')">codereview</a>,
<a href="#" onclick="openURL('http://code.google.com/p/go/source/list')">commit</a>, or
<a href="#" onclick="openURL('http://golang.org/pkg/')">pkg</a> id/name:</small>
<form style='margin: 0' onsubmit="return navigate();"><nobr><input id="inputbox" size=10 /><input type="submit" value="go" /></nobr></form>
<small>Also: <a href="#" onclick="openURL('http://godashboard.appspot.com/')">buildbots</small>
</body>
</html>