From 3f000203615d5e51bad135e4db209d93f634b1a2 Mon Sep 17 00:00:00 2001 From: Vansh Date: Sun, 23 Jun 2024 23:18:14 +0530 Subject: [PATCH] Added Web Annotation Extension --- Web Annotation Extension/annotation-old.js | 376 ++++++++++++++++++ Web Annotation Extension/annotation.js | 426 +++++++++++++++++++++ Web Annotation Extension/background.js | 29 ++ Web Annotation Extension/icons/icon128.png | Bin 0 -> 12500 bytes Web Annotation Extension/icons/icon16.png | Bin 0 -> 1716 bytes Web Annotation Extension/icons/icon32.png | Bin 0 -> 2499 bytes Web Annotation Extension/icons/icon48.png | Bin 0 -> 3709 bytes Web Annotation Extension/manifest.json | 36 ++ Web Annotation Extension/popup.css | 42 ++ Web Annotation Extension/popup.html | 15 + Web Annotation Extension/popup.js | 38 ++ 11 files changed, 962 insertions(+) create mode 100644 Web Annotation Extension/annotation-old.js create mode 100644 Web Annotation Extension/annotation.js create mode 100644 Web Annotation Extension/background.js create mode 100644 Web Annotation Extension/icons/icon128.png create mode 100644 Web Annotation Extension/icons/icon16.png create mode 100644 Web Annotation Extension/icons/icon32.png create mode 100644 Web Annotation Extension/icons/icon48.png create mode 100644 Web Annotation Extension/manifest.json create mode 100644 Web Annotation Extension/popup.css create mode 100644 Web Annotation Extension/popup.html create mode 100644 Web Annotation Extension/popup.js diff --git a/Web Annotation Extension/annotation-old.js b/Web Annotation Extension/annotation-old.js new file mode 100644 index 00000000..cedf12fe --- /dev/null +++ b/Web Annotation Extension/annotation-old.js @@ -0,0 +1,376 @@ +(function() { + if (document.getElementById('annotationSidebar')) return; + + // Add Sidebar + const sidebar = document.createElement('div'); + sidebar.id = 'annotationSidebar'; + sidebar.style.position = 'fixed'; + sidebar.style.top = '10px'; + sidebar.style.left = '10px'; + sidebar.style.width = '200px'; + sidebar.style.backgroundColor = 'white'; + sidebar.style.border = '1px solid #ccc'; + sidebar.style.zIndex = '10000'; + sidebar.style.padding = '10px'; + sidebar.style.boxShadow = '0 0 10px rgba(0,0,0,0.5)'; + sidebar.style.display = 'flex'; + sidebar.style.flexDirection = 'column'; + sidebar.style.display = 'none'; + document.body.appendChild(sidebar); + + sidebar.innerHTML = ` +
+ Tools + +
+ + + + + `; + + const startAnnotationButton = document.getElementById('startAnnotation'); + const stopAnnotationButton = document.getElementById('stopAnnotation'); + const screenshotButton = document.getElementById('screenshotButton'); + const clearButton = document.getElementById('clearButton'); + const closeSidebarButton = document.getElementById('closeSidebar'); + + // Annotation Canvas + const canvas = document.createElement('canvas'); + canvas.id = 'annotationCanvas'; + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + canvas.style.position = 'fixed'; + canvas.style.top = '0'; + canvas.style.left = '0'; + canvas.style.zIndex = '9999'; + canvas.style.display = 'none'; + document.body.appendChild(canvas); + + const ctx = canvas.getContext('2d'); + let drawing = false; + let penColor = '#000000'; + let penWidth = 2; + const paths = []; + let currentPath = []; + + const penWidthInput = document.createElement('input'); + penWidthInput.type = 'range'; + penWidthInput.min = 1; + penWidthInput.max = 20; + penWidthInput.value = 2; + penWidthInput.style.display = 'none'; + sidebar.appendChild(penWidthInput); + + const colorPickerInput = document.createElement('input'); + colorPickerInput.type = 'color'; + colorPickerInput.value = '#000000'; + colorPickerInput.style.display = 'none'; + sidebar.appendChild(colorPickerInput); + + const undoButton = document.createElement('button'); + undoButton.textContent = 'Undo'; + undoButton.style.display = 'none'; + sidebar.appendChild(undoButton); + + penWidthInput.addEventListener('input', (e) => { + penWidth = e.target.value; + }); + + colorPickerInput.addEventListener('input', (e) => { + penColor = e.target.value; + }); + + startAnnotationButton.addEventListener('click', () => { + canvas.style.display = 'block'; + canvas.style.cursor = 'crosshair'; + startAnnotationButton.style.display = 'none'; + stopAnnotationButton.style.display = 'inline'; + penWidthInput.style.display = 'block'; + colorPickerInput.style.display = 'block'; + undoButton.style.display = 'block'; + clearButton.style.display = 'block'; + }); + + stopAnnotationButton.addEventListener('click', () => { + canvas.style.display = 'none'; + canvas.style.cursor = 'default'; + startAnnotationButton.style.display = 'inline'; + stopAnnotationButton.style.display = 'none'; + penWidthInput.style.display = 'none'; + colorPickerInput.style.display = 'none'; + undoButton.style.display = 'none'; + clearButton.style.display = 'none'; + }); + + undoButton.addEventListener('click', () => { + paths.pop(); + redraw(); + }); + + closeSidebarButton.addEventListener('click', () => { + sidebar.style.display = 'none'; + }); + + clearButton.addEventListener('click', () => { + paths.length = 0; + redraw(); + }); + + canvas.addEventListener('mousedown', (e) => { + if (e.target.id === 'annotationCanvas') { + drawing = true; + currentPath = [{ x: e.clientX, y: e.clientY, color: penColor, width: penWidth }]; + ctx.beginPath(); + ctx.moveTo(e.clientX, e.clientY); + } + }); + + canvas.addEventListener('mousemove', (e) => { + if (drawing) { + currentPath.push({ x: e.clientX, y: e.clientY, color: penColor, width: penWidth }); + ctx.lineTo(e.clientX, e.clientY); + ctx.strokeStyle = penColor; + ctx.lineWidth = penWidth; + ctx.stroke(); + } + }); + + canvas.addEventListener('mouseup', () => { + if (drawing) { + paths.push(currentPath); + drawing = false; + ctx.closePath(); + } + }); + + canvas.addEventListener('mouseleave', () => { + if (drawing) { + paths.push(currentPath); + drawing = false; + ctx.closePath(); + } + }); + + function redraw() { + ctx.clearRect(0, 0, canvas.width, canvas.height); + paths.forEach(path => { + ctx.beginPath(); + path.forEach((point, index) => { + ctx.strokeStyle = point.color; + ctx.lineWidth = point.width; + if (index === 0) { + ctx.moveTo(point.x, point.y); + } else { + ctx.lineTo(point.x, point.y); + } + ctx.stroke(); + }); + ctx.closePath(); + }); + } + + screenshotButton.addEventListener('click', () => { + const link = document.createElement('a'); + link.href = canvas.toDataURL(); + link.download = 'screenshot.png'; + link.click(); + }); + + chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request.action === 'toggleSidebar') { + sidebar.style.display = (sidebar.style.display === 'none' || sidebar.style.display === '') ? 'flex' : 'none'; + } + }); + +})(); + + + +/* (function() { + if (document.getElementById('annotationSidebar')) return; + + // Add Sidebar + const sidebar = document.createElement('div'); + sidebar.id = 'annotationSidebar'; + sidebar.classList.add('collapsed'); + sidebar.style.position = 'fixed'; + sidebar.style.top = '10px'; + sidebar.style.left = '10px'; + sidebar.style.width = '150px'; + sidebar.style.backgroundColor = 'white'; + sidebar.style.border = '1px solid #ccc'; + sidebar.style.zIndex = '10000'; + sidebar.style.padding = '10px'; + sidebar.style.boxShadow = '0 0 10px rgba(0,0,0,0.5)'; + document.body.appendChild(sidebar); + + sidebar.innerHTML = ` +
+ + `; + + const dragHandle = document.getElementById('dragHandle'); + const toolsDiv = document.getElementById('tools'); + const startAnnotationButton = document.getElementById('startAnnotation'); + const stopAnnotationButton = document.getElementById('stopAnnotation'); + let isDragging = false; + let offsetX, offsetY; + + dragHandle.addEventListener('mousedown', (e) => { + isDragging = true; + dragHandle.style.cursor = 'grabbing'; + offsetX = e.clientX - sidebar.getBoundingClientRect().left; + offsetY = e.clientY - sidebar.getBoundingClientRect().top; + document.addEventListener('mousemove', onDrag); + document.addEventListener('mouseup', onStopDrag); + }); + + function onDrag(e) { + if (isDragging) { + sidebar.style.left = `${e.clientX - offsetX}px`; + sidebar.style.top = `${e.clientY - offsetY}px`; + } + } + + function onStopDrag() { + isDragging = false; + dragHandle.style.cursor = 'grab'; + document.removeEventListener('mousemove', onDrag); + document.removeEventListener('mouseup', onStopDrag); + } + + sidebar.addEventListener('click', (e) => { + e.stopPropagation(); + sidebar.classList.toggle('expanded'); + sidebar.classList.toggle('collapsed'); + if (sidebar.classList.contains('expanded')) { + toolsDiv.style.display = 'block'; + } else { + toolsDiv.style.display = 'none'; + } + }); + + document.addEventListener('click', (e) => { + if (sidebar.classList.contains('expanded') && !e.target.closest('#annotationSidebar')) { + sidebar.classList.remove('expanded'); + sidebar.classList.add('collapsed'); + toolsDiv.style.display = 'none'; + } + }); + + // Prevent annotation on the sidebar + sidebar.addEventListener('mousedown', (e) => e.stopPropagation()); + sidebar.addEventListener('mousemove', (e) => e.stopPropagation()); + sidebar.addEventListener('mouseup', (e) => e.stopPropagation()); + + // Annotation Canvas + const canvas = document.createElement('canvas'); + canvas.id = 'annotationCanvas'; + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + canvas.style.position = 'fixed'; + canvas.style.top = '0'; + canvas.style.left = '0'; + canvas.style.zIndex = '9999'; + canvas.style.display = 'none'; + document.body.appendChild(canvas); + + const ctx = canvas.getContext('2d'); + let drawing = false; + let penColor = '#000000'; + let penWidth = 2; + const paths = []; + let currentPath = []; + + const penWidthInput = document.getElementById('penWidth'); + const colorPickerInput = document.getElementById('colorPicker'); + const undoButton = document.getElementById('undoButton'); + + penWidthInput.addEventListener('input', (e) => { + penWidth = e.target.value; + }); + + colorPickerInput.addEventListener('input', (e) => { + penColor = e.target.value; + }); + + startAnnotationButton.addEventListener('click', () => { + canvas.style.display = 'block'; + startAnnotationButton.style.display = 'none'; + stopAnnotationButton.style.display = 'inline'; + }); + + stopAnnotationButton.addEventListener('click', () => { + canvas.style.display = 'none'; + startAnnotationButton.style.display = 'inline'; + stopAnnotationButton.style.display = 'none'; + }); + + undoButton.addEventListener('click', () => { + paths.pop(); + redraw(); + }); + + canvas.addEventListener('mousedown', (e) => { + if (e.target.id === 'annotationCanvas') { + drawing = true; + currentPath = [{ x: e.clientX, y: e.clientY, color: penColor, width: penWidth }]; + ctx.beginPath(); + ctx.moveTo(e.clientX, e.clientY); + } + }); + + canvas.addEventListener('mousemove', (e) => { + if (drawing) { + currentPath.push({ x: e.clientX, y: e.clientY, color: penColor, width: penWidth }); + ctx.lineTo(e.clientX, e.clientY); + ctx.strokeStyle = penColor; + ctx.lineWidth = penWidth; + ctx.stroke(); + } + }); + + canvas.addEventListener('mouseup', () => { + if (drawing) { + paths.push(currentPath); + drawing = false; + ctx.closePath(); + } + }); + + canvas.addEventListener('mouseleave', () => { + if (drawing) { + paths.push(currentPath); + drawing = false; + ctx.closePath(); + } + }); + + function redraw() { + ctx.clearRect(0, 0, canvas.width, canvas.height); + paths.forEach(path => { + ctx.beginPath(); + path.forEach((point, index) => { + ctx.strokeStyle = point.color; + ctx.lineWidth = point.width; + if (index === 0) { + ctx.moveTo(point.x, point.y); + } else { + ctx.lineTo(point.x, point.y); + } + ctx.stroke(); + }); + ctx.closePath(); + }); + } +})(); + */ \ No newline at end of file diff --git a/Web Annotation Extension/annotation.js b/Web Annotation Extension/annotation.js new file mode 100644 index 00000000..e12dee1d --- /dev/null +++ b/Web Annotation Extension/annotation.js @@ -0,0 +1,426 @@ +(function() { + if (document.getElementById('annotationSidebar')) return; + + // Add Sidebar + const sidebar = document.createElement('div'); + sidebar.id = 'annotationSidebar'; + sidebar.style.position = 'fixed'; + sidebar.style.top = '10px'; + sidebar.style.left = '10px'; + sidebar.style.width = '220px'; + sidebar.style.backgroundColor = 'white'; + sidebar.style.border = '1px solid #ccc'; + sidebar.style.zIndex = '10000'; + sidebar.style.padding = '10px'; + sidebar.style.boxShadow = '0 0 10px rgba(0,0,0,0.5)'; + sidebar.style.display = 'flex'; + sidebar.style.flexDirection = 'column'; + sidebar.style.display = 'none'; + sidebar.style.borderRadius = '8px'; + document.body.appendChild(sidebar); + + sidebar.innerHTML = ` +
+ ☰ Drag + +
+ + + + + + + + + + `; + + const startAnnotationButton = document.getElementById('startAnnotation'); + const stopAnnotationButton = document.getElementById('stopAnnotation'); + const screenshotButton = document.getElementById('screenshotButton'); + const clearButton = document.getElementById('clearButton'); + const closeSidebarButton = document.getElementById('closeSidebar'); + const dragHandle = document.getElementById('dragHandle'); + const penWidthInput = document.getElementById('penWidthInput'); + const colorPickerInput = document.getElementById('colorPickerInput'); + const undoButton = document.getElementById('undoButton'); + const penInputText = document.getElementById('penInputText'); + const colorInputText = document.getElementById('colorInputText'); + + + // Annotation Canvas + const canvas = document.createElement('canvas'); + canvas.id = 'annotationCanvas'; + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + canvas.style.position = 'fixed'; + canvas.style.top = '0'; + canvas.style.left = '0'; + canvas.style.zIndex = '9999'; + canvas.style.display = 'none'; + document.body.appendChild(canvas); + + const ctx = canvas.getContext('2d'); + let drawing = false; + let penColor = '#000000'; + let penWidth = 2; + const paths = []; + let currentPath = []; + +/* const penWidthInput = document.createElement('input'); + penWidthInput.type = 'range'; + penWidthInput.min = 1; + penWidthInput.max = 20; + penWidthInput.value = 2; + penWidthInput.style.display = 'none'; + penWidthInput.style.margin = '10px 0'; + sidebar.appendChild(penWidthInput); + + const colorPickerInput = document.createElement('input'); + colorPickerInput.type = 'color'; + colorPickerInput.value = '#000000'; + colorPickerInput.style.display = 'none'; + colorPickerInput.style.margin = '10px 0'; + sidebar.appendChild(colorPickerInput); */ + + /* const undoButton = document.createElement('button'); + undoButton.textContent = 'Undo'; + undoButton.style.display = 'none'; + undoButton.style.borderRadius = '8px'; + undoButton.style.margin = '10px 0'; + undoButton.style.padding = '10px'; + undoButton.style.background = '#6c757d'; + undoButton.style.color = 'white'; + undoButton.style.border = 'none'; + undoButton.style.cursor = 'pointer'; + sidebar.appendChild(undoButton); */ + + penWidthInput.addEventListener('input', (e) => { + penWidth = e.target.value; + }); + + colorPickerInput.addEventListener('input', (e) => { + penColor = e.target.value; + }); + + startAnnotationButton.addEventListener('click', () => { + canvas.style.display = 'block'; + canvas.style.cursor = 'crosshair'; + startAnnotationButton.style.display = 'none'; + stopAnnotationButton.style.display = 'inline'; + penWidthInput.style.display = 'block'; + colorPickerInput.style.display = 'block'; + undoButton.style.display = 'block'; + clearButton.style.display = 'block'; + penInputText.style.display = 'block'; + colorInputText.style.display = 'block'; + }); + + stopAnnotationButton.addEventListener('click', () => { + canvas.style.display = 'none'; + canvas.style.cursor = 'default'; + startAnnotationButton.style.display = 'inline'; + stopAnnotationButton.style.display = 'none'; + penWidthInput.style.display = 'none'; + colorPickerInput.style.display = 'none'; + undoButton.style.display = 'none'; + clearButton.style.display = 'none'; + penInputText.style.display = 'none'; + colorInputText.style.display = 'none'; + }); + + undoButton.addEventListener('click', () => { + paths.pop(); + redraw(); + }); + + closeSidebarButton.addEventListener('click', () => { + sidebar.style.display = 'none'; + }); + + clearButton.addEventListener('click', () => { + paths.length = 0; + redraw(); + }); + + let isDragging = false; + let offsetX, offsetY; + + dragHandle.addEventListener('mousedown', (e) => { + isDragging = true; + offsetX = e.clientX - sidebar.getBoundingClientRect().left; + offsetY = e.clientY - sidebar.getBoundingClientRect().top; + document.addEventListener('mousemove', onDrag); + document.addEventListener('mouseup', stopDrag); + }); + + function onDrag(e) { + if (isDragging) { + sidebar.style.left = `${e.clientX - offsetX}px`; + sidebar.style.top = `${e.clientY - offsetY}px`; + } + } + + function stopDrag() { + isDragging = false; + document.removeEventListener('mousemove', onDrag); + document.removeEventListener('mouseup', stopDrag); + } + + canvas.addEventListener('mousedown', (e) => { + if (e.target.id === 'annotationCanvas') { + drawing = true; + currentPath = [{ x: e.clientX, y: e.clientY, color: penColor, width: penWidth }]; + ctx.beginPath(); + ctx.moveTo(e.clientX, e.clientY); + } + }); + + canvas.addEventListener('mousemove', (e) => { + if (drawing) { + currentPath.push({ x: e.clientX, y: e.clientY, color: penColor, width: penWidth }); + ctx.lineTo(e.clientX, e.clientY); + ctx.strokeStyle = penColor; + ctx.lineWidth = penWidth; + ctx.stroke(); + } + }); + + canvas.addEventListener('mouseup', () => { + if (drawing) { + paths.push(currentPath); + drawing = false; + ctx.closePath(); + } + }); + + canvas.addEventListener('mouseleave', () => { + if (drawing) { + paths.push(currentPath); + drawing = false; + ctx.closePath(); + } + }); + + function redraw() { + ctx.clearRect(0, 0, canvas.width, canvas.height); + paths.forEach(path => { + ctx.beginPath(); + path.forEach((point, index) => { + ctx.strokeStyle = point.color; + ctx.lineWidth = point.width; + if (index === 0) { + ctx.moveTo(point.x, point.y); + } else { + ctx.lineTo(point.x, point.y); + } + ctx.stroke(); + }); + ctx.closePath(); + }); + } + + screenshotButton.addEventListener('click', () => { + const link = document.createElement('a'); + link.href = canvas.toDataURL(); + link.download = 'screenshot.png'; + link.click(); + }); + + chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request.action === 'toggleSidebar') { + sidebar.style.display = (sidebar.style.display === 'none' || sidebar.style.display === '') ? 'flex' : 'none'; + } + }); + +})(); + + + +/* (function() { + if (document.getElementById('annotationSidebar')) return; + + // Add Sidebar + const sidebar = document.createElement('div'); + sidebar.id = 'annotationSidebar'; + sidebar.classList.add('collapsed'); + sidebar.style.position = 'fixed'; + sidebar.style.top = '10px'; + sidebar.style.left = '10px'; + sidebar.style.width = '150px'; + sidebar.style.backgroundColor = 'white'; + sidebar.style.border = '1px solid #ccc'; + sidebar.style.zIndex = '10000'; + sidebar.style.padding = '10px'; + sidebar.style.boxShadow = '0 0 10px rgba(0,0,0,0.5)'; + document.body.appendChild(sidebar); + + sidebar.innerHTML = ` +
+ + `; + + const dragHandle = document.getElementById('dragHandle'); + const toolsDiv = document.getElementById('tools'); + const startAnnotationButton = document.getElementById('startAnnotation'); + const stopAnnotationButton = document.getElementById('stopAnnotation'); + let isDragging = false; + let offsetX, offsetY; + + dragHandle.addEventListener('mousedown', (e) => { + isDragging = true; + dragHandle.style.cursor = 'grabbing'; + offsetX = e.clientX - sidebar.getBoundingClientRect().left; + offsetY = e.clientY - sidebar.getBoundingClientRect().top; + document.addEventListener('mousemove', onDrag); + document.addEventListener('mouseup', onStopDrag); + }); + + function onDrag(e) { + if (isDragging) { + sidebar.style.left = `${e.clientX - offsetX}px`; + sidebar.style.top = `${e.clientY - offsetY}px`; + } + } + + function onStopDrag() { + isDragging = false; + dragHandle.style.cursor = 'grab'; + document.removeEventListener('mousemove', onDrag); + document.removeEventListener('mouseup', onStopDrag); + } + + sidebar.addEventListener('click', (e) => { + e.stopPropagation(); + sidebar.classList.toggle('expanded'); + sidebar.classList.toggle('collapsed'); + if (sidebar.classList.contains('expanded')) { + toolsDiv.style.display = 'block'; + } else { + toolsDiv.style.display = 'none'; + } + }); + + document.addEventListener('click', (e) => { + if (sidebar.classList.contains('expanded') && !e.target.closest('#annotationSidebar')) { + sidebar.classList.remove('expanded'); + sidebar.classList.add('collapsed'); + toolsDiv.style.display = 'none'; + } + }); + + // Prevent annotation on the sidebar + sidebar.addEventListener('mousedown', (e) => e.stopPropagation()); + sidebar.addEventListener('mousemove', (e) => e.stopPropagation()); + sidebar.addEventListener('mouseup', (e) => e.stopPropagation()); + + // Annotation Canvas + const canvas = document.createElement('canvas'); + canvas.id = 'annotationCanvas'; + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + canvas.style.position = 'fixed'; + canvas.style.top = '0'; + canvas.style.left = '0'; + canvas.style.zIndex = '9999'; + canvas.style.display = 'none'; + document.body.appendChild(canvas); + + const ctx = canvas.getContext('2d'); + let drawing = false; + let penColor = '#000000'; + let penWidth = 2; + const paths = []; + let currentPath = []; + + const penWidthInput = document.getElementById('penWidth'); + const colorPickerInput = document.getElementById('colorPicker'); + const undoButton = document.getElementById('undoButton'); + + penWidthInput.addEventListener('input', (e) => { + penWidth = e.target.value; + }); + + colorPickerInput.addEventListener('input', (e) => { + penColor = e.target.value; + }); + + startAnnotationButton.addEventListener('click', () => { + canvas.style.display = 'block'; + startAnnotationButton.style.display = 'none'; + stopAnnotationButton.style.display = 'inline'; + }); + + stopAnnotationButton.addEventListener('click', () => { + canvas.style.display = 'none'; + startAnnotationButton.style.display = 'inline'; + stopAnnotationButton.style.display = 'none'; + }); + + undoButton.addEventListener('click', () => { + paths.pop(); + redraw(); + }); + + canvas.addEventListener('mousedown', (e) => { + if (e.target.id === 'annotationCanvas') { + drawing = true; + currentPath = [{ x: e.clientX, y: e.clientY, color: penColor, width: penWidth }]; + ctx.beginPath(); + ctx.moveTo(e.clientX, e.clientY); + } + }); + + canvas.addEventListener('mousemove', (e) => { + if (drawing) { + currentPath.push({ x: e.clientX, y: e.clientY, color: penColor, width: penWidth }); + ctx.lineTo(e.clientX, e.clientY); + ctx.strokeStyle = penColor; + ctx.lineWidth = penWidth; + ctx.stroke(); + } + }); + + canvas.addEventListener('mouseup', () => { + if (drawing) { + paths.push(currentPath); + drawing = false; + ctx.closePath(); + } + }); + + canvas.addEventListener('mouseleave', () => { + if (drawing) { + paths.push(currentPath); + drawing = false; + ctx.closePath(); + } + }); + + function redraw() { + ctx.clearRect(0, 0, canvas.width, canvas.height); + paths.forEach(path => { + ctx.beginPath(); + path.forEach((point, index) => { + ctx.strokeStyle = point.color; + ctx.lineWidth = point.width; + if (index === 0) { + ctx.moveTo(point.x, point.y); + } else { + ctx.lineTo(point.x, point.y); + } + ctx.stroke(); + }); + ctx.closePath(); + }); + } +})(); + */ \ No newline at end of file diff --git a/Web Annotation Extension/background.js b/Web Annotation Extension/background.js new file mode 100644 index 00000000..886ed0f5 --- /dev/null +++ b/Web Annotation Extension/background.js @@ -0,0 +1,29 @@ +chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request.action === 'captureScreenshot') { + chrome.tabs.query({active: true, currentWindow: true}, (tabs) => { + chrome.tabs.captureVisibleTab(null, { format: 'png' }, (dataUrl) => { + sendResponse({ screenshotUrl: dataUrl }); + }); + }); + return true; // Required to use sendResponse asynchronously. + } +}); + +chrome.runtime.onInstalled.addListener(() => { + chrome.contextMenus.create({ + id: "startAnnotation", + title: "Start Annotation", + contexts: ["all"] + }); +}); + +chrome.contextMenus.onClicked.addListener((info, tab) => { + if (info.menuItemId === "startAnnotation") { + chrome.scripting.executeScript({ + target: { tabId: tab.id }, + files: ['annotation.js'] + }, () => { + chrome.tabs.sendMessage(tab.id, { action: "toggleSidebar" }); + }); + } +}); diff --git a/Web Annotation Extension/icons/icon128.png b/Web Annotation Extension/icons/icon128.png new file mode 100644 index 0000000000000000000000000000000000000000..7555650c24c21596d05b3c10195baa7a2ef608a0 GIT binary patch literal 12500 zcmZ{K1yEaU6lL(>Qi{7ni&LCpL4p$~?m-I0-5nYzQna{hfl_GE;!r41thl?oJM8;+ zXLn|IW`_yM%zIy6-u>=9=iGB&l!lrDE*1qA2n51~Dnekud+>iRFf#C8#po&v1VRGY z%F1fk!r>qgSqj|DOuQ3>`WhVvr^$y|PWngj0mOEQA1uDCrY6nKMe>SEp$@ zJMR58&5zj5B}F8xD7*Mll`zz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m6KPOl$e6|WWG;`O9_6F zuO%UqF+&=PNVzEs=6w+3$nYde)gp1-6rFsNX>HO$)FpmM%rM5U z;2JhE>^h0*F7hT(!c*qsNXgEn-+jDAQarL>PSV<*AA~U|-pfuE}SH2@fjSSOJYS03e{VzV>5JDXZ{>5r#?>G?EUIlsfP4zOI`u~j9ay7 za!BUt=$@N{Bd=n4)kv{!xaeK?5SS{Lf_dmnN=-<4Z{xG9#>AppG~n|=f2p)2bigM` zZqy6qkQn(#+gWk;X6$opICXg*u2fJ(SmB$qw077*HHWCdxL95V#IQQ%wN=j;Qru}_ zbAL4^4wyGm#wlACo($;yTBeRzPRDeLA-C=f9`9`Lswp}d-pyx4cy!! zeOTCrCU_^O>qaC?kPTzdG&bk#-aAAf?&VEY` z#JYuX-E6)fwYBEaL?+>G)+t~eG=clW>(7iIkud8O4DzED~yWe``gWyB#H>XcZ=JaM-*I)fDguzUZa4 zrb*WLGr3HoC}LNpeoR2(3zgoESU!X8N@KME-ExE0(;+EfwM6l?z)@oiHkMWN#i`NHfe?zNbYLx=YfPuWVZ0`Zw~pfsg5%Bub~vb*i_AS zj6gXPLIZPPGsx%-tkrLJkOW%KI~7vk6rP5K(C!?3k78i%Kn-*JEJ7DEGut>RW6NK< zVK9DPU>_Vvk%mV+r0)C}#6|m0;q9Z$1@O!?v%8$0yQR6il_=cR3U~wY@$d<7@(6PB z@oMu3iwX#cz7cuF!z0SW6ZP;j<^NjX;AClQ?eqU%aFdV24lH2%KUZ+Kb+B@CH+OLU zf7iSLzW#q*BpVMm2v|e&-x}Zvcu}~MvyZE-&3ku{f|HXC@N7KP5za-&$HOaFiOnwz poJst@&$P61gS*-~yW2WBg4|#VGR>deFo5GAsGJ()n~YiL{{ViT*L45@ literal 0 HcmV?d00001 diff --git a/Web Annotation Extension/icons/icon16.png b/Web Annotation Extension/icons/icon16.png new file mode 100644 index 0000000000000000000000000000000000000000..48acfb7cb213ed1950a21757b2c37216aa7a2eb4 GIT binary patch literal 1716 zcmZ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ltg? z*duVJ$8zwYXcqcFpm1t_kLVTzl~optFd`^F@Dh3iFdi`M&C%oyDbZbj#&hBD7bd0={bTt=c@PrqEMJF|jnji%gD@eFc1y2o`W_l$C9>l8v3rQscjtQA8>sg+!r|$VmVd=jF=1 SKvk6K0Ur-P_dBlPr~d(-NMhFj literal 0 HcmV?d00001 diff --git a/Web Annotation Extension/icons/icon48.png b/Web Annotation Extension/icons/icon48.png new file mode 100644 index 0000000000000000000000000000000000000000..f065117e71e8ad64bdf3c3d405bceb1fcbb92cff GIT binary patch literal 3709 zcmZ`+2{aU5xF6ZZR%0I$Gi8~{HiKkKj9q0J3R%Knh%qC?SR+KnR%0hiMpV`qTQQ>P zkC0+)86+wDl2XK*|9j`XbKX1W-FxnG?!CWz@Atdk_uYF_Y^=-#cqMrO0DypnxiOkm zBK}RlW2}6_J@7pMzy|O$GP3c*U;qGcHpbmuuN%Oj#Kq6wMwBx#T({yC%(CTOJpl&C zf%t_Urt*Oa?4?if_;n;7Pa@klx_PcK!xVXOZ02?au`T3`vCBU+Q&|Z5n1Y)xVfe6se02w7%7<$^C zc1-3>&j0WM4Axi1y3eI~xq~`sG@7UYA5bdL4$v`J43z($DMw}Pvr08k1)s) zyvueMdRGEa$+&p2Pwa4oMF|9Bj=ll_M92dGcM<@AKdh!Z-vEG67HP}w0Dw*&03c2% zYPZ#6b#QrJGBXAo{ToYPJ$cAt@#Q>77jE6OfUMi0urXci8N zAYc6f%F0JL2OZnV+j|u`PYX})=DdC_z?f{gks=m;x!1dT-^U^%Za-p}Z)Rux6nXUe zq(-j7YaLa>NpbeHB+0t*iwA7>X1dA#C8Ms_O|s~DHH|ZR+kJ=b%n3YmkoQ^Gn7T41 z-=RX<{=3C$|8hpP(837jOG&?xm6hZnTe4dxmK`ScudcG;Z&}&14VQ-%006wb7RHA5 zjy=VWt^rp~q)YPEgNNF1@JvqE2k}+5cI?0)J3r%^lxwMD+$|G0;E0B3N5i=-!`|HN zG~2E2(r%DIS<<;O@yCYxB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pi_&Jd4DxfXJ7D=}4PSJud+lQgqG`2O_p{qa&0wl`@lqiZ)G zl=<0-yc5mxsFc|ZX*lB-pJB|e6#C+!#xg9_pkC$aki9kPj8>C1CQwISKtM3s4Aq_)%+2ZtSeRHD*P`6x{{!HE$4LMH literal 0 HcmV?d00001 diff --git a/Web Annotation Extension/manifest.json b/Web Annotation Extension/manifest.json new file mode 100644 index 00000000..05f00c48 --- /dev/null +++ b/Web Annotation Extension/manifest.json @@ -0,0 +1,36 @@ +{ + "manifest_version": 3, + "name": "Web Annotation Tool", + "version": "1.0", + "description": "Annotate webpages and save them as screenshots", + "permissions": [ + "activeTab", + "storage", + "scripting", + "tabs", + "contextMenus" + ], + "background": { + "service_worker": "background.js" + }, + "action": { + "default_popup": "popup.html", + "default_icon": { + "16": "icons/icon16.png", + "48": "icons/icon48.png", + "128": "icons/icon128.png" + } + }, + "content_scripts": [ + { + "matches": ["http://*/*", "https://*/*"], + "js": ["annotation.js"], + "run_at": "document_idle" + } + ], + "icons": { + "16": "icons/icon16.png", + "48": "icons/icon48.png", + "128": "icons/icon128.png" + } +} \ No newline at end of file diff --git a/Web Annotation Extension/popup.css b/Web Annotation Extension/popup.css new file mode 100644 index 00000000..090a842c --- /dev/null +++ b/Web Annotation Extension/popup.css @@ -0,0 +1,42 @@ +body { + font-family: Arial, sans-serif; + width: 200px; + margin: 0; +} + +.container { + text-align: center; + padding: 20px; +} + +button { + width: 100%; + padding: 10px; + margin: 10px 0; + cursor: pointer; + border: none; + background-color: #007bff; + color: white; + border-radius: 5px; + outline: none; + transition: background-color 0.3s ease; +} + +button:hover { + background-color: #0056b3; +} + +#penWidth, #colorPicker, #undoButton { + margin: 5px 0; +} + +#undoButton:hover, #clearButton:hover { + background-color: #c82333; +} + +canvas { + position: fixed; + top: 0; + left: 0; + z-index: 9999; +} diff --git a/Web Annotation Extension/popup.html b/Web Annotation Extension/popup.html new file mode 100644 index 00000000..7105a534 --- /dev/null +++ b/Web Annotation Extension/popup.html @@ -0,0 +1,15 @@ + + + + Web Annotation Tool + + + + +
+

Annotation Tool

+ + +
+ + \ No newline at end of file diff --git a/Web Annotation Extension/popup.js b/Web Annotation Extension/popup.js new file mode 100644 index 00000000..16cb7c7d --- /dev/null +++ b/Web Annotation Extension/popup.js @@ -0,0 +1,38 @@ +document.addEventListener("DOMContentLoaded", function(){ + document.getElementById('enableAnnotation').addEventListener('click', () => { + chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { + const tab = tabs[0]; + if ((tab.url.startsWith('http://') || tab.url.startsWith('https://')) && (tab && tab.id)) { + chrome.scripting.executeScript({ + target: { tabId: tab.id }, + files: ['annotation.js'] + }).then(() => { + console.log("Annotation script executed."); + chrome.tabs.sendMessage(tab.id, {action: "toggleSidebar"}); + }).catch((err) => { + console.error("Script execution failed: ", err); + }); + } else { + console.error("Cannot run script on this URL."); + alert("Cannot run script on this URL."); + } + }); + }); + + document.getElementById('saveScreenshot').addEventListener('click', () => { + chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { + const tab = tabs[0]; + if (tab.url.startsWith('http://') || tab.url.startsWith('https://')) { + chrome.tabs.captureVisibleTab(tabs[0].windowId, {}, function(image) { + const link = document.createElement('a'); + link.href = image; + link.download = 'screenshot.png'; + link.click(); + }); + } else { + console.error("Cannot capture screenshot on this URL."); + alert("Cannot capture screenshot on this URL."); + } + }); + }); +}); \ No newline at end of file