Fix non existent ID error (JS)

This commit is contained in:
Dan 2025-03-26 18:56:59 +07:00
commit 1412698c8d
4 changed files with 7 additions and 47 deletions

View file

@ -226,6 +226,7 @@ $( function() {
</div>
</details>
<br>
<script>if(localStorage.getItem("custom-fields-state")==="open"){document.getElementById("custom-fields").setAttribute("open","")}document.getElementById("custom-fields-click").addEventListener("click",()=>{if(document.getElementById("custom-fields").open){localStorage.setItem("custom-fields-state",'close')}else{localStorage.setItem("custom-fields-state",'open')}})</script>
<?php endif;?>
<input type="submit" name="publish" class="btn btn-primary submit" value="<?php echo i18n('Publish');?>"/> <input type="submit" name="draft" class="btn btn-primary draft" value="<?php echo i18n('Save_as_draft');?>"/>
<br>
@ -416,17 +417,6 @@ $('.img-container').on("click", ".the-img", function(e) {
document.getElementById("preview-col").style.display = '';
localStorage.setItem("preview-state", 'open');
}
})
if (localStorage.getItem("custom-fields-state") === "open") {
document.getElementById("custom-fields").setAttribute("open", "");
}
document.getElementById("custom-fields-click").addEventListener("click", () => {
if (document.getElementById("custom-fields").open) {
localStorage.setItem("custom-fields-state", 'close');
} else {
localStorage.setItem("custom-fields-state", 'open');
}
})
})
</script>

View file

@ -94,6 +94,7 @@ if ($type == 'is_page') {
</div>
</details>
<br>
<script>if(localStorage.getItem("custom-fields-state")==="open"){document.getElementById("custom-fields").setAttribute("open","")}document.getElementById("custom-fields-click").addEventListener("click",()=>{if(document.getElementById("custom-fields").open){localStorage.setItem("custom-fields-state",'close')}else{localStorage.setItem("custom-fields-state",'open')}})</script>
<?php endif;?>
<input type="hidden" id="pType" name="posttype" value="<?php echo $type; ?>">
<input id="oldfile" type="hidden" name="oldfile" class="text"/>
@ -248,16 +249,5 @@ $('.img-container').on("click", ".the-img", function(e) {
document.getElementById("preview-col").style.display = '';
localStorage.setItem("preview-state", 'open');
}
})
if (localStorage.getItem("custom-fields-state") === "open") {
document.getElementById("custom-fields").setAttribute("open", "");
}
document.getElementById("custom-fields-click").addEventListener("click", () => {
if (document.getElementById("custom-fields").open) {
localStorage.setItem("custom-fields-state", 'close');
} else {
localStorage.setItem("custom-fields-state", 'open');
}
})
</script>

View file

@ -275,6 +275,7 @@ $( function() {
</div>
</details>
<br>
<script>if(localStorage.getItem("custom-fields-state")==="open"){document.getElementById("custom-fields").setAttribute("open","")}document.getElementById("custom-fields-click").addEventListener("click",()=>{if(document.getElementById("custom-fields").open){localStorage.setItem("custom-fields-state",'close')}else{localStorage.setItem("custom-fields-state",'open')}})</script>
<?php endif;?>
<?php if ($isdraft[4] == 'draft') { ?>
@ -471,16 +472,5 @@ $('.img-container').on("click", ".the-img", function(e) {
document.getElementById("preview-col").style.display = '';
localStorage.setItem("preview-state", 'open');
}
})
if (localStorage.getItem("custom-fields-state") === "open") {
document.getElementById("custom-fields").setAttribute("open", "");
}
document.getElementById("custom-fields-click").addEventListener("click", () => {
if (document.getElementById("custom-fields").open) {
localStorage.setItem("custom-fields-state", 'close');
} else {
localStorage.setItem("custom-fields-state", 'open');
}
})
})
</script>

View file

@ -206,6 +206,7 @@ if ($type == 'is_page' || $type == 'is_frontpage') {
</div>
</details>
<br>
<script>if(localStorage.getItem("custom-fields-state")==="open"){document.getElementById("custom-fields").setAttribute("open","")}document.getElementById("custom-fields-click").addEventListener("click",()=>{if(document.getElementById("custom-fields").open){localStorage.setItem("custom-fields-state",'close')}else{localStorage.setItem("custom-fields-state",'open')}})</script>
<?php endif;?>
<input type="hidden" id="pType" name="posttype" value="<?php echo $type; ?>">
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
@ -416,16 +417,5 @@ $('.img-container').on("click", ".the-img", function(e) {
document.getElementById("preview-col").style.display = '';
localStorage.setItem("preview-state", 'open');
}
})
if (localStorage.getItem("custom-fields-state") === "open") {
document.getElementById("custom-fields").setAttribute("open", "");
}
document.getElementById("custom-fields-click").addEventListener("click", () => {
if (document.getElementById("custom-fields").open) {
localStorage.setItem("custom-fields-state", 'close');
} else {
localStorage.setItem("custom-fields-state", 'open');
}
})
})
</script>