I need to update a textare value with the chrome plugin. When I type directly into the console, the value is updated without any problems, but I cannot update the taxtarea value on some sites. I am able to access the textarea but cannot update the value with .value. Thank you very much to everyone who helped.
window.onload = () => {
var div = document.createElement('div');
div.innerHTML = `<div class="plg">
<input type="number" id="sureee" placeholder="Süre">
<input type="file" id="plugingo">
<label class="chkbx" id="clcc">
<input type="checkbox" id="inpinp">
<span class="x"></span>
</label>
</div>
<style>
input[type="file"] {
cursor: pointer !important;
font: 300 14px sans-serif;
color: #fff;
margin-bottom:20px;
}
input[type="file"]::-webkit-file-upload-button {
background: #212121;
border: 0;
padding: 12px 25px;
cursor: pointer;
color: #fff;
text-transform: uppercase;
}
input[type="file"]::-ms-browse {
background: #212121;
border: 0;
padding: 12px 25px;
cursor: pointer;
color: #fff;
text-transform: uppercase;
}
.plg{
position:fixed;
z-index: 999;
left: 0;
bottom: 0;
background-color: #000;
width: 300px;
height: auto;
padding:20px ;
}
#sureee{
padding:8px;
font-size:18px;
outline:none;
border:1px solid #fff;
width:100%;
margin-bottom:20px;
}
.chkbx input[type="checkbox"] {
display: none;
}
.chkbx {
position: relative;
cursor: pointer;
}
.chkbx .x {
display: block;
width: 60px;
height: 34px;
border: 2px solid #d3d3be;
border-radius: 60px;
transition: 0.5s;
}
.chkbx .x:before {
content: "";
position: absolute;
width: 25px;
height: 25px;
top: 5px;
left: 5px;
box-sizing: border-box;
background: #d3d3be;
border: 2px solid #d3d3be;
border-radius: 40px;
transition: 0.5s;
}
.chkbx :checked~.x:before {
background: #fe7f2d;
border-color: #fe7f2d;
transform: translatex(25px);
}
.chkbx :checked~.x {
border-color: #fe7f2d;
}
.chkbx {
display: block;
}
</style>`;
document.body.appendChild(div);
var index = 0;
var cl;
function gg(comment) {
var sure = Number(document.getElementById('sureee').value) * 1000;
if (index <= comment.length - 1) {
console.log(comment[index])
cl = setTimeout(function () {
var gonder = document.querySelector(".send-msg-btn");
if (document.getElementById('inpinp').checked == true) {
document.querySelector('textarea.chat-panel-input').value=comment[index];
gonder.click();
index++;
}
gg(comment)
}, sure);
}
}
function clcz() {
let fileReader = new FileReader();
fileReader.onload = function () {
let parsedJSON = fileReader.result
var comment = parsedJSON.split('\n');
gg(comment)
}
fileReader.readAsText(document.getElementById('plugingo').files[0]);
}
document.getElementById('plugingo').addEventListener('change', () => {
index = 0;
document.getElementById('inpinp').click();
clcz();
})
}