diff --git a/misc/chrome/gophertool/popup.html b/misc/chrome/gophertool/popup.html index aec10048a3..8bb7795fac 100644 --- a/misc/chrome/gophertool/popup.html +++ b/misc/chrome/gophertool/popup.html @@ -9,11 +9,11 @@ -issue, -codereview, -commit, or -pkg id/name: +issue, +codereview, +commit, or +pkg id/name: -Also: buildbots +Also: buildbots diff --git a/misc/chrome/gophertool/popup.js b/misc/chrome/gophertool/popup.js index 717fc169cd..410d65120e 100644 --- a/misc/chrome/gophertool/popup.js +++ b/misc/chrome/gophertool/popup.js @@ -2,7 +2,19 @@ function openURL(url) { chrome.tabs.create({ "url": url }) } +function addLinks() { + var links = document.getElementsByTagName("a"); + for (var i = 0; i < links.length; i++) { + var url = links[i].getAttribute("url"); + if (url) + links[i].addEventListener("click", function () { + openURL(this.getAttribute("url")); + }); + } +} + window.addEventListener("load", function () { + addLinks(); console.log("hacking gopher pop-up loaded."); document.getElementById("inputbox").focus(); }); @@ -32,7 +44,3 @@ window.addEventListener("submit", function () { console.log("no match for text: " + t) return false; }); - -window.addEventListener("click", function () { - openURL("http://build.golang.org/"); -});