From 3d00648dc1b08873f7e779d5a842641795ec42ad Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Mon, 22 Oct 2012 01:05:21 +0800 Subject: [PATCH] gophertool: fix links R=bradfitz CC=golang-dev https://golang.org/cl/6713043 --- misc/chrome/gophertool/popup.html | 10 +++++----- misc/chrome/gophertool/popup.js | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/misc/chrome/gophertool/popup.html b/misc/chrome/gophertool/popup.html index aec10048a30..8bb7795faca 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 717fc169cd6..410d65120e6 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/"); -});