mirror of
https://github.com/NohamR/N_m3u8DL-RE_Command_Generator.git
synced 2025-05-24 14:31:57 +00:00
fix insert undefined
This commit is contained in:
parent
867adbe231
commit
0e473f54c3
15
generator.js
15
generator.js
@ -1,19 +1,4 @@
|
|||||||
|
|
||||||
function insert(pos, id, placeholder) {
|
|
||||||
let input = document.createElement('input')
|
|
||||||
input.type = 'text'
|
|
||||||
input.id = id
|
|
||||||
input.placeholder = placeholder
|
|
||||||
input.oninput = () => { generate('generator_body') }
|
|
||||||
document.querySelector(pos).appendChild(input)
|
|
||||||
}
|
|
||||||
function removeLast(pos) {
|
|
||||||
console.log(document.querySelector(pos).lastChild.tagName);
|
|
||||||
if (document.querySelector(pos).lastChild.tagName != 'INPUT') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
document.querySelector(pos).removeChild(document.querySelector(pos).lastChild)
|
|
||||||
}
|
|
||||||
function generate(params) {
|
function generate(params) {
|
||||||
let form = document.getElementById(params)
|
let form = document.getElementById(params)
|
||||||
// console.log(form)
|
// console.log(form)
|
||||||
|
17
index.html
17
index.html
@ -13,6 +13,23 @@
|
|||||||
</head>
|
</head>
|
||||||
<script type="module" src="generator.js"></script>
|
<script type="module" src="generator.js"></script>
|
||||||
<script type="module" src="darkmode.js"></script>
|
<script type="module" src="darkmode.js"></script>
|
||||||
|
<script>
|
||||||
|
function insert(pos, id, placeholder) {
|
||||||
|
let input = document.createElement('input')
|
||||||
|
input.type = 'text'
|
||||||
|
input.id = id
|
||||||
|
input.placeholder = placeholder
|
||||||
|
input.oninput = () => { generate('generator_body') }
|
||||||
|
document.querySelector(pos).appendChild(input)
|
||||||
|
}
|
||||||
|
function removeLast(pos) {
|
||||||
|
console.log(document.querySelector(pos).lastChild.tagName);
|
||||||
|
if (document.querySelector(pos).lastChild.tagName != 'INPUT') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
document.querySelector(pos).removeChild(document.querySelector(pos).lastChild)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<body class="dark">
|
<body class="dark">
|
||||||
<div id="DarkMode">
|
<div id="DarkMode">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user