Add files via upload
This commit is contained in:
parent
aa4952cc0a
commit
fc332a57ca
2 changed files with 39 additions and 0 deletions
26
dofusbook.atelier.copy.js
Normal file
26
dofusbook.atelier.copy.js
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
function waitResources() {
|
||||||
|
const itemCells = document.getElementsByClassName('cell');
|
||||||
|
|
||||||
|
if(itemCells.length > 0){
|
||||||
|
for(const itemCell of itemCells) {
|
||||||
|
const itemWrapper = itemCell.getElementsByClassName('wrapper').item(0);
|
||||||
|
const itemName = itemWrapper.getElementsByClassName('label').item(0).innerHTML.slice(1, -1);
|
||||||
|
|
||||||
|
let itemCopyButton = document.createElement("button");
|
||||||
|
itemCopyButton.innerHTML = "copy";
|
||||||
|
itemCopyButton.onclick = function(){
|
||||||
|
navigator.clipboard.writeText(itemName).then(() => {
|
||||||
|
console.info(`${itemName} copied !`);
|
||||||
|
}, () => {
|
||||||
|
console.error(`ERROR ${itemName} not copied !`);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
itemWrapper.appendChild(itemCopyButton);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setTimeout(waitResources, 250); // try again in 300 milliseconds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
waitResources();
|
||||||
13
manifest.json
Normal file
13
manifest.json
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "DofusBook Atelier Bouton Copier",
|
||||||
|
"description": "Ajout d'un bouton pour chaque nom de ressource dans l'atelier de DofusBook",
|
||||||
|
"version": "1.0",
|
||||||
|
"manifest_version": 3,
|
||||||
|
"content_scripts": [
|
||||||
|
{
|
||||||
|
"matches": ["https://www.dofusbook.net/fr/outils/atelier"],
|
||||||
|
"js": ["dofusbook.atelier.copy.js"],
|
||||||
|
"run_at": "document_end"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue