s4
changeset 911:fe6e6b72de17
Restrict ajax button activation to certain case
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 05 Jan 2021 13:29:54 +0900 |
parents | 043748271354 |
children | 4f19add6f877 |
files | s4-main.js |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/s4-main.js Tue Jan 05 13:14:26 2021 +0900 1.2 +++ b/s4-main.js Tue Jan 05 13:29:54 2021 +0900 1.3 @@ -613,7 +613,11 @@ 1.4 i.addEventListener("click", insertRedirect, false); 1.5 } 1.6 registInsertDirect(document.querySelectorAll("a[href]")); 1.7 - if (document.querySelector('td[class="repl"]')) 1.8 + if (myurl.match(/replyblog\+[0-9]/) 1.9 + && document.querySelector("td.repl")) { 1.10 + // There's no need to provide ajax posting when 1.11 + // no replies written to the blog. Therefore we 1.12 + // assign ajax post when td.repl exists. 1.13 for (i of document.querySelectorAll('input#c[value="送信"]')) { 1.14 let b = document.createElement("button"); 1.15 b.textContent = "送信!"; 1.16 @@ -626,8 +630,9 @@ 1.17 b.id = i.id; 1.18 i.remove(); 1.19 } 1.20 - i = document.getElementById("reload"); 1.21 - if (i) i.addEventListener("click", ajaxPost, false); 1.22 + i = document.getElementById("reload"); 1.23 + if (i) i.addEventListener("click", ajaxPost, false); 1.24 + } 1.25 for (i of document.querySelectorAll('input[type="file"]')) { 1.26 i.addEventListener('change', (e) => { 1.27 warnFileSize(document.forms[0]);