Complete Refactor - Changed to Django

This commit is contained in:
2025-11-11 08:14:04 +00:00
commit 24b0422864
197 changed files with 62230 additions and 0 deletions

52
static/unfold/js/app.js Normal file
View File

@@ -0,0 +1,52 @@
window.addEventListener('load', e => {
submitSearch()
fileInputUpdatePath()
})
/*************************************************************
* File upload path
*************************************************************/
const fileInputUpdatePath = () => {
const updateFilePath = () => {
Array.from(document.querySelectorAll('input[type=file]')).forEach(input => {
input.addEventListener('change', e => {
const parts = e.target.value.split('\\')
const placeholder = input.parentNode.parentNode.querySelector('input[type=text]')
placeholder.setAttribute('value', parts[parts.length - 1])
})
})
}
updateFilePath()
document.addEventListener('DOMNodeInserted', e => {
updateFilePath()
})
}
/*************************************************************
* Search form on changelist view
*************************************************************/
const submitSearch = () => {
const searchbar = document.getElementById('searchbar')
const searchbarSubmit = document.getElementById('searchbar-submit')
if (searchbar !== null) {
searchbar.addEventListener('keypress', e => {
if (e.key === 'Enter') {
window.location = `?q=${e.target.value}`
e.preventDefault()
} else {
}
})
}
if (searchbarSubmit !== null && searchbar !== null) {
searchbarSubmit.addEventListener('click', e => {
e.preventDefault()
window.location = `?q=${searchbar.value}`
})
}
}