Skip to content

Commit

Permalink
Merge pull request #285 from satyam8932/master
Browse files Browse the repository at this point in the history
Feature : Full Page Screenshot for Chrome Extension
  • Loading branch information
Sulagna-Dutta-Roy authored May 18, 2024
2 parents af32ed0 + 4d16cd2 commit ff0bced
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Full Page Screenshot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Full Page Screenshot</title>
<link rel="stylesheet" href="src/popup.css">
</head>
<body>
<button id="capture">Capture Screenshot</button>
<script src="scripts/popup.js"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions Full Page Screenshot/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"manifest_version": 3,
"name": "Full Page Screenshot",
"version": "1.0",
"description": "A Chrome extension to capture full-page screenshots.",
"permissions": ["activeTab"],
"background": {
"service_worker": "background.js"
},
"icons": {
"16": "src/icon.jpg",
"48": "src/icon.jpg",
"128": "src/icon.jpg"
},
"browser_action": {
"default_popup": "popup.html",
"default_icon": "icon.png"
}
}
8 changes: 8 additions & 0 deletions Full Page Screenshot/scripts/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.captureVisibleTab(null, { format: 'png', quality: 100 }, function(dataUrl) {
var link = document.createElement('a');
link.href = dataUrl;
link.download = 'full-page-screenshot.png';
link.click();
});
});
3 changes: 3 additions & 0 deletions Full Page Screenshot/scripts/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
document.getElementById('capture').addEventListener('click', function() {
chrome.runtime.sendMessage({ action: 'captureScreenshot' });
});
Binary file added Full Page Screenshot/src/icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions Full Page Screenshot/src/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 0;
padding: 20px;
}

button {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
border-radius: 5px;
font-size: 16px;
}

0 comments on commit ff0bced

Please sign in to comment.