Mercurial > hgrepos > hgweb.cgi > s4
comparison s4-main.js @ 969:b327b5691b59 draft
Add author-hide/show button in quiz mode
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 15 May 2022 14:38:40 +0900 |
parents | 759070ee3d20 |
children | 8781f341d93a |
comparison
equal
deleted
inserted
replaced
968:edd96c59c8a2 | 969:b327b5691b59 |
---|---|
791 i.innerHTML = ii; | 791 i.innerHTML = ii; |
792 } | 792 } |
793 } | 793 } |
794 return elem; | 794 return elem; |
795 } | 795 } |
796 var quizwarnVisible = false; | |
797 function toggleAuthorVisibility(e) { | |
798 // In QUIZ mode, click to quizwarn line toggles visibility of author | |
799 e.stopPropagation(); | |
800 if (quizwarnVisible) { | |
801 for (let i of document.querySelectorAll("td.repatt")) { | |
802 i.classList.remove("hideauthor"); | |
803 } | |
804 quizwarnVisible = false; | |
805 } else { | |
806 for (let i of document.querySelectorAll("td.repatt")) { | |
807 i.classList.add("hideauthor"); | |
808 } | |
809 quizwarnVisible = true; | |
810 } | |
811 } | |
796 function initBlogs() { | 812 function initBlogs() { |
797 // Auto-complete #xxxx | 813 // Auto-complete #xxxx |
798 let i, check = collectElementsByAttr("input", "name", "notifyto"); | 814 let i, check = collectElementsByAttr("input", "name", "notifyto"); |
799 if (check) | 815 if (check) |
800 for (i of check) { | 816 for (i of check) { |
826 } | 842 } |
827 for (i of document.querySelectorAll('input[type="file"]')) { | 843 for (i of document.querySelectorAll('input[type="file"]')) { |
828 i.addEventListener('change', (e) => { | 844 i.addEventListener('change', (e) => { |
829 warnFileSize(document.forms[0]); | 845 warnFileSize(document.forms[0]); |
830 }, false) | 846 }, false) |
847 } | |
848 if (i=document.getElementById("quizwarn")) { | |
849 i.addEventListener('click', toggleAuthorVisibility, false); | |
831 } | 850 } |
832 // Hack article_m links | 851 // Hack article_m links |
833 registPjaxViewers(document.querySelectorAll("a[href]")); | 852 registPjaxViewers(document.querySelectorAll("a[href]")); |
834 atMarkView(document); | 853 atMarkView(document); |
835 } | 854 } |