mirror of
https://github.com/openwrt/luci.git
synced 2025-01-18 23:02:09 +00:00
ae8bbb814f
* HTML Cleanup: Meta tags. * Converted charset to shorthand. * Removed meta tags with `Content-Script-Type` attribute. (Invalid in HTML5 spec.) * HTML Cleanup: CSS tags. * Removed `type` attribute with CSS files from link tags. (HTML5 spec recommends omitting it.) * Removed `type` attribute from style tags. (Deprecated in HTML5 spec.) https://html.spec.whatwg.org/#attr-link-type https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style * HTML Cleanup: Convert from XHTML to HTML5 * Removed XML declaration. * Removed XML namespace. * Changed doctype to HTML5. * HTML Cleanup: CDATA tags. * CDATA sections should not be used within HTML they are considered as comments and not displayed. https://developer.mozilla.org/en-US/docs/Web/API/CDATASection * HTML Cleanup: Script tags. * Removed `language` attribute from script tags. (No longer valid in HTML5) * Removed `type` attribute with JavaScript MIME type from script tags. (HTML5 spec recommends omitting it.) https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type https://mimesniff.spec.whatwg.org/#javascript-mime-type Signed-off-by: Mustafa Can Elmacı <mustafacan@elmaci.net>
31 lines
1.0 KiB
HTML
31 lines
1.0 KiB
HTML
<div style="display: inline-block;">
|
|
<input type="button"" class="btn cbi-button cbi-button-add" id="btnload" name="load" value="<%:Load%>" />
|
|
<input type="file" id="file_load" style="visibility:hidden; position: absolute;top: 0px; left: 0px;" accept="application/x-tar" />
|
|
</div>
|
|
<script>
|
|
let btnLoad = document.getElementById('btnload')
|
|
btnLoad.onclick = function (e) {
|
|
document.getElementById("file_load").click()
|
|
e.preventDefault()
|
|
}
|
|
|
|
let fileLoad = document.getElementById('file_load')
|
|
fileLoad.onchange = function(e){
|
|
let fileLoad = document.getElementById('file_load')
|
|
if (!fileLoad.value) {
|
|
return
|
|
}
|
|
let fileName = fileLoad.files[0].name
|
|
let formData = new FormData()
|
|
formData.append('upload-filename', fileName)
|
|
formData.append('upload-archive', fileLoad.files[0])
|
|
let xhr = new XMLHttpRequest()
|
|
uci_confirm_docker()
|
|
xhr.open("POST", '<%=luci.dispatcher.build_url("admin/docker/images_load")%>', true)
|
|
xhr.onload = function() {
|
|
location.reload()
|
|
}
|
|
xhr.send(formData)
|
|
}
|
|
</script>
|