const extensionCode = `
{
"manifest_version": 2,
"name": "SmartTab",
"version": "1.0",
"description": "Organize and manage your browser tabs efficiently.",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"permissions": [
"tabs"
],
"background": {
"scripts": ["background.js"],
"persistent": false
},
"browser_action": {
"default_icon": {
"16": "icons/icon16.png",
"48": "icons/icon48.png"
},
"default_popup": "popup.html"
}
}
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.query({}, function(tabs) {
chrome.windows.create({ focused: true }, function(window) {
tabs.forEach(function(tab) {
chrome.tabs.move(tab.id, { windowId: window.id, index: -1 });
});
});
});
});
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="popup.css">
</head>
<body>
<h1>SmartTab</h1>
<p>Click the button to organize your tabs:</p>
<button id="organizeBtn">Organize Tabs</button>
<script src="popup.js"></script>
</body>
</html>
`;
// Create the necessary files
const files = [
{ name: 'manifest.json', content: extensionCode },
{ name: 'background.js', content: '' },
{ name: 'popup.html', content: '' },
{ name: 'popup.css', content: '' },
{ name: 'popup.js', content: '' }
];
// Download the files
files.forEach(file => {
const element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(file.content));
element.setAttribute('download', file.name);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
});
Comments