Place a button to check fairness
This commit is contained in:
parent
bc810fb9d0
commit
afac80c54a
|
|
@ -2,6 +2,12 @@
|
||||||
// Content script to be run on pages
|
// Content script to be run on pages
|
||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
|
|
||||||
|
function checkTextarea(textarea) {
|
||||||
|
console.log("click " + textarea.id + " -> " + textarea.value);
|
||||||
|
|
||||||
|
// TODO make queries to the fairlanguage server
|
||||||
|
}
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
// Only run this script once
|
// Only run this script once
|
||||||
if (window.hasRun) {
|
if (window.hasRun) {
|
||||||
|
|
@ -11,9 +17,21 @@
|
||||||
|
|
||||||
// Search for all text areas
|
// Search for all text areas
|
||||||
document.querySelectorAll("textarea").forEach(function(textarea) {
|
document.querySelectorAll("textarea").forEach(function(textarea) {
|
||||||
// Do something with it...
|
// for testing: highlight textarea with red border
|
||||||
console.log(textarea);
|
// TODO
|
||||||
textarea.style.border = "2px solid red";
|
textarea.style.border = "2px solid red";
|
||||||
|
|
||||||
|
// Create a "Check fairness" button which is placed next to the textarea
|
||||||
|
// TODO image button integrated into the textarea...
|
||||||
|
var buttonCheck = document.createElement("button");
|
||||||
|
buttonCheck.textContent = "Check fairness!";
|
||||||
|
|
||||||
|
// Add click event listener
|
||||||
|
buttonCheck.addEventListener("click", (e) => {
|
||||||
|
checkTextarea(textarea);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Append button to the textarea
|
||||||
|
textarea.after(buttonCheck);
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue