#317 disabled toot button when offline

This commit is contained in:
cutls 2020-10-18 18:04:31 +09:00
parent 99c2f0fc8d
commit bdfeae20f2
4 changed files with 14 additions and 3 deletions

View File

@ -215,4 +215,14 @@ if(pwa) {
} }
} }
} }
} }
const connection = function (event) {
console.log(navigator.onLine, 'network state')
if(!navigator.onLine) {
$('#toot-post-btn').addClass('disabled')
} else {
$('#toot-post-btn').removeClass('disabled')
}
}
window.onoffline = connection
window.ononline = connection

View File

@ -101,7 +101,7 @@ if (location.search) {
$('.mini-btn').text('expand_less') $('.mini-btn').text('expand_less')
} }
} }
window.onload = initPostbox window.onload = function () { initPostbox(); connection() }
function initPostbox() { function initPostbox() {
$('#posttgl').click(function (e) { $('#posttgl').click(function (e) {
if (!$('#post-box').hasClass('appear')) { if (!$('#post-box').hasClass('appear')) {

View File

@ -1085,7 +1085,7 @@
<!--TLのTL--> <!--TLのTL-->
<div id="timeline-container"> <div id="timeline-container">
<div id="something-wrong"> <div id="something-wrong">
<img src="../../img/desk.svg" style="width:150px;margin:5px;display:none;" draggable="false" /> <img src="../../img/thinking.svg" style="width:150px;margin:5px;display:none;" draggable="false" />
<div class="stw" style="display: none">@@helloTheDesk@@</div> <div class="stw" style="display: none">@@helloTheDesk@@</div>
</div> </div>
</div> </div>

View File

@ -43,6 +43,7 @@
<script src="../../@@node_base@@/vue/dist/vue.min.js"></script> <script src="../../@@node_base@@/vue/dist/vue.min.js"></script>
<script type="text/javascript" src="setting.vue.js"></script> <script type="text/javascript" src="setting.vue.js"></script>
<script type="text/javascript" src="../../@@node_base@@/sweetalert2/dist/sweetalert2.all.min.js"></script> <script type="text/javascript" src="../../@@node_base@@/sweetalert2/dist/sweetalert2.all.min.js"></script>
<script>function renderMem() {return false; }</script>
<h4>@@setting@@</h4> <h4>@@setting@@</h4>
<ul class="collapsible" data-collapsible="accordion"> <ul class="collapsible" data-collapsible="accordion">