From 167e3bf27b8c22f316c854d68b76b3c5203482c6 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Thu, 28 May 2026 10:51:52 -0700 Subject: [PATCH] Switch links from `` to `` The links in the developer.html were spans with an onclick handler that called `prompt` with a URL. This meant to use the link you had to manaully copy and paste it. Switching to `` means you can just click the link. You can still copy the link by right clicking and picking copy link or long pressing on mobile. The link should still update to the correct value. --- .../resources/debug-runner/debug-runner.js | 28 +++++++++++-------- .../resources/debug-runner/motionmark.css | 7 ++++- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/MotionMark/resources/debug-runner/debug-runner.js b/MotionMark/resources/debug-runner/debug-runner.js index 049f92a..91f5fbf 100644 --- a/MotionMark/resources/debug-runner/debug-runner.js +++ b/MotionMark/resources/debug-runner/debug-runner.js @@ -356,25 +356,29 @@ window.suitesManager = new class SuitesManager { span.appendChild(document.createTextNode(" " + test.name + " ")); testElement.appendChild(document.createTextNode(" ")); - var link = Utilities.createElement("span", {}, testElement); + var link = Utilities.createElement("a", {}, testElement); link.classList.add("link"); link.textContent = "link"; link.suiteName = Utilities.stripUnwantedCharactersForURL(suiteCheckbox.suite.name); link.testName = test.name; - link.onclick = function(event) { - var element = event.target; - var title = "Link to run “" + element.testName + "” with current options:"; - var url = location.href.split(/[?#]/)[0]; + + function updateLinkHref() { var options = optionsManager.updateLocalStorageFromUI(); Utilities.extendObject(options, { - "suite-name": element.suiteName, - "test-name": Utilities.stripUnwantedCharactersForURL(element.testName) + "suite-name": link.suiteName, + "test-name": Utilities.stripUnwantedCharactersForURL(link.testName) }); - var complexity = suitesManager._editElement(element.parentNode).value; - if (complexity) - options.complexity = complexity; - prompt(title, url + Utilities.convertObjectToQueryString(options)); - }; + var complexityInput = link.parentNode.querySelector("input[type='number']"); + if (complexityInput && complexityInput.value) + options.complexity = complexityInput.value; + + var url = location.href.split(/[?#]/)[0]; + link.href = url + Utilities.convertObjectToQueryString(options); + } + + link.addEventListener("mouseenter", updateLinkHref); + link.addEventListener("focus", updateLinkHref); + link.addEventListener("click", updateLinkHref); var complexity = Utilities.createElement("input", { type: "number" }, testElement); complexity.relatedCheckbox = testCheckbox; diff --git a/MotionMark/resources/debug-runner/motionmark.css b/MotionMark/resources/debug-runner/motionmark.css index fa83391..8f862d6 100644 --- a/MotionMark/resources/debug-runner/motionmark.css +++ b/MotionMark/resources/debug-runner/motionmark.css @@ -168,11 +168,16 @@ label.tree-label { .tree .link { cursor: pointer; - color: #999; font-style: italic; margin-left: 2em; + text-decoration: none; } +#intro .tree .link { + color: #999; +} + + @media screen and (max-device-width: 414px), screen and (max-device-height: 414px) and (orientation: landscape) { .tree {