<!DOCTYPE HTML>
<html>
<head>
<title>global HTML page</title>
<script type="text/javascript">
console.log('global loaded');
safari.application.addEventListener("command", handleCommandEvent, false);
safari.application.addEventListener("validate", handleValidationEvent, false);

function handleCommandEvent(event) {
  // Add to dash here (find the button and click?)
}

function handleValidationEvent(event) {
  // Get the page URL. This is undefined if we're not on a site listed in
  // the Info.plist
  pageUrl = safari.application.activeBrowserWindow.activeTab.url;

  if (pageUrl !== undefined &&
      (pageUrl.match(/godoc/) ||
       pageUrl.match(/rubygems/) ||
       pageUrl.match(/cocoapods/))) {
        // We process this page.
  } else {
    // Ignore this page
    event.target.disabled = true;
    event.preventDefault();
  }
}
</script>
</head>
<body>
</body>
</html>

<!DOCTYPE HTML>
<html>
<head>
<title>global HTML page</title>
<script type="text/javascript">
console.log('global loaded');
safari.application.addEventListener("command", handleCommandEvent, false);
safari.application.addEventListener("validate", handleValidationEvent, false);

function handleCommandEvent(event) {
  // TODO: Add to dash here (find the button and click?)
}

function handleValidationEvent(event) {
  // Get the page URL. This is undefined if we're not on a site listed in
  // the Info.plist
  pageUrl = safari.application.activeBrowserWindow.activeTab.url;

  if (pageUrl !== undefined &&
      (pageUrl.match(/godoc/) ||
       pageUrl.match(/rubygems/) ||
       pageUrl.match(/cocoapods/))) {
        // We process this page, allow the menu.
        // TODO: Look for the button first?
  } else {
    // Ignore this page
    event.target.disabled = true;
    event.preventDefault();
  }
}
</script>
</head>
<body>
</body>
</html>

Add a few TODO notes
Add a few TODO notes
