comparison 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
comparison
equal deleted inserted replaced
1001:bbd5a0c50d5b 1002:47b3e770372d
801 i.classList.add("atall"); 801 i.classList.add("atall");
802 } 802 }
803 } 803 }
804 return elem; 804 return elem;
805 } 805 }
806 var quizwarnVisible = false; 806 var authVisible = false;
807 function toggleAuthorVisibility(e) { 807 function toggleAuthorVisibility(e) {
808 // In QUIZ mode, click to quizwarn line toggles visibility of author 808 // Click to hideauth button toggles visibility of author columns
809 e.stopPropagation(); 809 e.stopPropagation();
810 if (quizwarnVisible) { 810 let b = document.getElementById("hideauth");
811 if (authVisible) {
811 for (let i of document.querySelectorAll("td.repatt")) { 812 for (let i of document.querySelectorAll("td.repatt")) {
812 i.classList.remove("hideauthor"); 813 i.classList.remove("hideauthor");
813 } 814 }
814 quizwarnVisible = false; 815 authVisible = false;
815 } else { 816 } else {
816 for (let i of document.querySelectorAll("td.repatt")) { 817 for (let i of document.querySelectorAll("td.repatt")) {
817 i.classList.add("hideauthor"); 818 i.classList.add("hideauthor");
818 } 819 }
819 quizwarnVisible = true; 820 authVisible = true;
820 } 821 }
822 b.textContent = b.textContent.replace(/OFF|ON/, authVisible ? "ON" : "OFF");
821 } 823 }
822 function downloadFile(filename, content, BOM) { 824 function downloadFile(filename, content, BOM) {
823 let bom = new Uint8Array([0xEF, 0xBB, 0xBF]); 825 let bom = new Uint8Array([0xEF, 0xBB, 0xBF]);
824 let str = new Blob(BOM ? [bom, content] : [content], 826 let str = new Blob(BOM ? [bom, content] : [content],
825 {type: "text/csv"}); 827 {type: "text/csv"});
924 let td = document.querySelector("table.bloghead tr td"); 926 let td = document.querySelector("table.bloghead tr td");
925 if (td) { 927 if (td) {
926 let btn = document.createElement("button"); 928 let btn = document.createElement("button");
927 btn.innerText = "CSVget"; 929 btn.innerText = "CSVget";
928 btn.type = "button"; 930 btn.type = "button";
929 btn.title = `見えている書き込みをCSVで取得します 931 btn.accessKey = "g";
932 btn.title = `Shortcut: G
933 見えている書き込みをCSVで取得します
930 全件表示されていることを確認してから利用して下さい。 934 全件表示されていることを確認してから利用して下さい。
931 Excelで利用する場合は Ctrl を押しながらクリックして下さい。 935 Excelで利用する場合は Ctrl を押しながらクリックして下さい。
932 Get seen TEXT content as CSV.`; 936 Get seen TEXT content as CSV.`;
933 btn.addEventListener("click", getTextContentCSV, false); 937 btn.addEventListener("click", getTextContentCSV, false);
934 let artlink = td.querySelector('a[accesskey="f"]'); 938 let artlink = td.querySelector('a[accesskey="f"]');
947 for (i of document.querySelectorAll('input[type="file"]')) { 951 for (i of document.querySelectorAll('input[type="file"]')) {
948 i.addEventListener('change', (e) => { 952 i.addEventListener('change', (e) => {
949 warnFileSize(document.forms[0]); 953 warnFileSize(document.forms[0]);
950 }, false) 954 }, false)
951 } 955 }
952 if (i=document.getElementById("quizwarn")) { 956 if (i=document.getElementById("hideauth")) {
953 i.addEventListener('click', toggleAuthorVisibility, false); 957 i.addEventListener('click', toggleAuthorVisibility, false);
954 } 958 }
955 // Hack article_m links 959 // Hack article_m links
956 registPjaxViewers(document.querySelectorAll("a[href]")); 960 registPjaxViewers(document.querySelectorAll("a[href]"));
957 atMarkView(document); 961 atMarkView(document);

yatex.org