Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: log DOM elements directly #93

Open
Lucretiel opened this issue Mar 19, 2019 · 1 comment
Open

Feature Request: log DOM elements directly #93

Lucretiel opened this issue Mar 19, 2019 · 1 comment

Comments

@Lucretiel
Copy link

Check-My-Links/functions.js

Lines 156 to 190 in 122928e

function updateDisplay(link, warnings, linkStatus) {
if (!isNaN(linkStatus) && 200 <= linkStatus && linkStatus < 300 && warnings.length === 0) {
link.classList.add("CMY_Valid");
passed += 1;
rbPass.innerHTML = "Valid links: " + passed;
} else if (!isNaN(linkStatus) && 300 <= linkStatus && linkStatus < 400 && warnings.length === 0) {
link.classList.add("CMY_Redirect");
link.classList.add("CMY_Valid");
redirected += 1;
rbRedirect.innerHTML = "Valid redirecting links: " + redirected;
} else if (!isNaN(linkStatus) && 200 <= linkStatus && linkStatus < 400 && warnings.length > 0) {
var response;
response = "Response " + linkStatus + ": " + link.href + " Warning: ";
for (var i = 0; i < warnings.length; i++) {
response += warnings[i];
if (i < warnings.length - 1) {
response += ",";
}
}
link.classList.add("CMY_Warning");
link.innerHTML += " <span class=\"CMY_Response\">" + linkStatus + "</span>";
warning += 1;
rbWarning.innerHTML = "Warnings: " + warning;
console.log(response);
} else {
console.log("Response " + linkStatus + ": " + link.href);
link.classList.add("CMY_Invalid");
link.innerHTML += " <span class=\"CMY_Response\">" + linkStatus + "</span>";
invalid += 1;
rbFail.innerHTML = "Invalid links: " + invalid;
}
queued -= 1;
checked += 1;
rbQueue.innerHTML = "Queue: " + queued;
}

It would be really convenient if, when CML logs errors to console.log, it called console.log directly on the relevent DOM elements. Chrome's rich console means that you can use that to navigate directly to the faulty DOM element.

@chasers
Copy link
Collaborator

chasers commented Nov 20, 2019

I like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants