diff s4-main.js @ 1002:47b3e770372d draft

Auth-ON/OFF button available in all modes
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 04 Dec 2022 16:59:59 +0859
parents bbd5a0c50d5b
children 5bd1b5125049
line wrap: on
line diff
--- a/s4-main.js	Sun Dec 04 10:36:33 2022 +0859
+++ b/s4-main.js	Sun Dec 04 16:59:59 2022 +0859
@@ -803,21 +803,23 @@
 	}
 	return elem;
     }
-    var quizwarnVisible = false;
+    var authVisible = false;
     function toggleAuthorVisibility(e) {
-	// In QUIZ mode, click to quizwarn line toggles visibility of author
+	// Click to hideauth button toggles visibility of author columns
 	e.stopPropagation();
-	if (quizwarnVisible) {
+	let b = document.getElementById("hideauth");
+	if (authVisible) {
 	    for (let i of document.querySelectorAll("td.repatt")) {
 		i.classList.remove("hideauthor");
 	    }
-	    quizwarnVisible = false;
+	    authVisible = false;
 	} else {
 	    for (let i of document.querySelectorAll("td.repatt")) {
 		i.classList.add("hideauthor");
 	    }
-	    quizwarnVisible = true;
+	    authVisible = true;
 	}
+	b.textContent = b.textContent.replace(/OFF|ON/, authVisible ? "ON" : "OFF");
     }
     function downloadFile(filename, content, BOM) {
         let bom = new Uint8Array([0xEF, 0xBB, 0xBF]);
@@ -926,7 +928,9 @@
 		let btn = document.createElement("button");
 		btn.innerText = "CSVget";
 		btn.type = "button";
-		btn.title = `見えている書き込みをCSVで取得します
+		btn.accessKey = "g";
+		btn.title = `Shortcut: G
+見えている書き込みをCSVで取得します
 全件表示されていることを確認してから利用して下さい。
 Excelで利用する場合は Ctrl を押しながらクリックして下さい。
 Get seen TEXT content as CSV.`;
@@ -949,7 +953,7 @@
 		warnFileSize(document.forms[0]);
 	    }, false)
 	}
-	if (i=document.getElementById("quizwarn")) {
+	if (i=document.getElementById("hideauth")) {
 	    i.addEventListener('click', toggleAuthorVisibility, false);
 	}
 	// Hack article_m links

yatex.org