Project import generated by Copybara.

GitOrigin-RevId: d9e9e3fb4e31372ec1fb43b178994ca78fa8fe70
diff --git a/templates/tracker/issue-list-js.ezt b/templates/tracker/issue-list-js.ezt
new file mode 100644
index 0000000..1eb1aad
--- /dev/null
+++ b/templates/tracker/issue-list-js.ezt
@@ -0,0 +1,110 @@
+<script type="text/javascript" nonce="[nonce]">
+runOnLoad(function() {
+
+  [# Pass the list of column names from HTML to JS ]
+  window._allColumnNames = [
+    [for column_values]'[column_values.column_name]'[if-index column_values last][else], [end][end]
+    ];
+
+  [# Update the issue link hrefs on-load and whenever the column-spec changes.]
+  _ctxCan = [can];
+  _ctxQuery = "[format "js"][query][end]";
+  _ctxSortspec = "[format "js"][sortspec][end]";
+  _ctxGroupBy = "[format "js"][groupby][end]";
+  _ctxDefaultColspec = "[format "js"][default_colspec][end]";
+  _ctxStart = [start];
+  _ctxNum = [num];
+  _ctxResultsPerPage = [default_results_per_page];
+  _ctxHotlistID = "[hotlist_id]";
+  _ctxArgs = _formatContextQueryArgs();
+
+  function _goIssue(issueIndex, newWindow) {
+    var url = _makeIssueLink(issueRefs[[]issueIndex]);
+    _go(url, newWindow);
+  }
+  // Added to enable calling from TKR_openArtifactAtCursor
+  window._goIssue = _goIssue;
+
+  window.issueRefs = [[]
+   [for table_data]
+     {project_name: "[format "js"][table_data.project_name][end]",
+      id: [table_data.local_id]}[if-index table_data last][else],[end][end]
+   ];
+
+  function _handleResultsClick(event) {
+    var target = event.target;
+    if (event.button >= 3)
+      return;
+    if (target.classList.contains("label"))
+      return;
+    if (target.classList.contains("rowwidgets") || target.parentNode.classList.contains("rowwidgets"))
+      return;
+    while (target && target.tagName != "TR") target = target.parentNode;
+    if ('[is_hotlist]') {
+       if (!target.attributes[[]"issue-context-url"]) return;
+       _go(target.attributes[[]"issue-context-url"].value, (event.metaKey || event.ctrlKey || event.button == 1));
+       }
+    else {
+       if (!target.attributes[[]"data-idx"]) return;
+       _goIssue(target.attributes[[]"data-idx"].value,
+       (event.metaKey || event.ctrlKey || event.button == 1));
+         }
+  };
+  [if-any table_data]
+    _addClickListener($("resultstable"), _handleResultsClick);
+  [end]
+
+  var issueCheckboxes = document.getElementsByClassName("checkRangeSelect");
+  for (var i = 0; i < issueCheckboxes.length; ++i) {
+    var el = issueCheckboxes[[]i];
+    el.addEventListener("click", function (event) {
+        _checkRangeSelect(event, event.target);
+        _highlightRow(event.target);
+    });
+  }
+
+  function _handleHeaderClick(event) {
+    var target = event.target;
+    while (target && target.tagName != "TH") target = target.parentNode;
+    var colIndex = target.getAttribute("data-col-index");
+    if (colIndex) {
+      _showBelow("pop_" + colIndex, target);
+    }
+    event.preventDefault();
+  }
+  var resultsTableHead = $("resultstablehead");
+  if (resultsTableHead) {
+    resultsTableHead.addEventListener("click", _handleHeaderClick);
+  }
+
+  if (typeof(ClientLogger) == "function") {
+    let cl = new ClientLogger("issues");
+    if (cl.started("issue-search")) {
+      cl.logPause("issue-search", "computer-time");
+      cl.logResume("issue-search", "user-time");
+
+      // Now we want to listen for clicks on any issue search result.
+      let logResultClick = function() {
+        cl.logPause("issue-search", "user-time");
+        cl.logResume("issue-search", "computer-time");
+      }
+
+      let links = document.querySelectorAll("#resultstable tbody .id a");
+      for (let i = 0; i < links.length; i++) {
+        links[[]i].addEventListener("click", logResultClick);
+      }
+    }
+  }
+});
+</script>
+
+<script type="text/javascript" defer src="/static/third_party/js/keys.js?version=[app_version]" nonce="[nonce]"></script>
+<script type="text/javascript" defer src="/static/third_party/js/skipper.js?version=[app_version]" nonce="[nonce]"></script>
+<script type="text/javascript" nonce="[nonce]">
+runOnLoad(function() {
+  _setupKibblesOnListPage(
+    [is arg0 "issuelist"]'[project_home_url]/issues/list'[else]'[currentPageURLEncoded]'[end],
+    '[project_home_url]/issues/entry',
+    '[projectname]', [is arg0 "issuelist"]1[else]5[end], 0);
+});
+</script>