Skip to content

Commit

Permalink
button added
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro56565 committed Apr 3, 2024
1 parent 104308a commit 1128c00
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
17 changes: 17 additions & 0 deletions content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function addButton() {
const toolbarDiv = document.querySelector('div[data-testid="toolBar"]');
if (toolbarDiv && !toolbarDiv.hasAttribute('data-button-added')) {

const button = document.createElement('button');
button.textContent = 'Mahesh Tweets';

if (toolbarDiv.parentNode) {
toolbarDiv.parentNode.insertBefore(button, toolbarDiv);
console.log('Selected toolbar div:', toolbarDiv);
console.log("Button Added",button);
}
toolbarDiv.setAttribute('data-button-added', 'true');
}
setTimeout(addButton, 200); //delay added
}
addButton();
15 changes: 8 additions & 7 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
"name": "Mahesh Tweets",
"version": "1.0",
"permissions": [
"activeTab"
"activeTab"
],
"content_scripts": [
{
{
"matches": ["https://twitter.com/*"],
"js": ["content.js"]
}
}
],
"action": {
"default_popup": "popup.html",
"default_icon": {
"default_popup": "popup.html",
"default_icon": {
"128": "/images/icon.png"
}
}
},
"icons": {
"128": "/images/icon.png"
"128": "/images/icon.png"
}
}

0 comments on commit 1128c00

Please sign in to comment.