fix capture
This commit is contained in:
@@ -115,7 +115,7 @@ async function captureFullPage(msg) {
|
||||
const windowId = msg.windowId;
|
||||
if (tabId == null) throw new Error('No active tab');
|
||||
|
||||
const dims = await browser.tabs.sendMessage(tabId, { kind: 'get_viewport' });
|
||||
const dims = await browser.tabs.sendMessage(tabId, { kind: 'get_viewport' }, { frameId: 0 });
|
||||
const vw = dims.viewportWidth || 1;
|
||||
const vh = dims.viewportHeight || 1;
|
||||
const ph = dims.pageHeight || vh;
|
||||
@@ -129,13 +129,13 @@ async function captureFullPage(msg) {
|
||||
const parts = [];
|
||||
for (let i = 0; i < sliceCount; i++) {
|
||||
const y = Math.max(0, Math.min(i * vh, ph - vh));
|
||||
await browser.tabs.sendMessage(tabId, { kind: 'scroll_to', y: y });
|
||||
await browser.tabs.sendMessage(tabId, { kind: 'scroll_to', y: y }, { frameId: 0 });
|
||||
await sleep(250);
|
||||
const dataUrl = await browser.tabs.captureVisibleTab(windowId, { format: 'png' });
|
||||
parts.push({ dataUrl: dataUrl, y: y });
|
||||
}
|
||||
|
||||
await browser.tabs.sendMessage(tabId, { kind: 'scroll_to', y: dims.scrollY || 0 }).catch(() => {});
|
||||
await browser.tabs.sendMessage(tabId, { kind: 'scroll_to', y: dims.scrollY || 0 }, { frameId: 0 }).catch(() => {});
|
||||
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = Math.round(vw * dpr);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "quickSnote",
|
||||
"name": "QUICKsnote",
|
||||
"version": "1.0.6",
|
||||
"description": "Quick-capture a note to snotes from any page, with the selected text and page link ready to use",
|
||||
"description": "QUICKsnote captures a note to snotes from any page, with the selected text and page link ready to use",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"activeTab"
|
||||
@@ -31,7 +31,7 @@
|
||||
"js": [
|
||||
"content.js"
|
||||
],
|
||||
"all_frames": true,
|
||||
"all_frames": false,
|
||||
"run_at": "document_idle"
|
||||
}
|
||||
],
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
"default_title": "quickSnote",
|
||||
"default_title": "QUICKsnote",
|
||||
"default_popup": "popup.html",
|
||||
"default_icon": {
|
||||
"48": "icons/icon-48.png",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>quickSnote Options</title>
|
||||
<title>QUICKsnote Options</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
@@ -26,7 +26,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>quickSnote</h1>
|
||||
<h1>QUICKsnote</h1>
|
||||
|
||||
<div class="field">
|
||||
<label for="serverUrl">snotes server URL</label>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
try {
|
||||
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
|
||||
if (!tabs.length || tabs[0].id == null) return;
|
||||
const ctx = await browser.tabs.sendMessage(tabs[0].id, { kind: 'get_context' });
|
||||
const ctx = await browser.tabs.sendMessage(tabs[0].id, { kind: 'get_context' }, { frameId: 0 });
|
||||
if (ctx && ctx.selection && !noteEl.value) {
|
||||
noteEl.value = ctx.selection;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ function header() {
|
||||
el("select", { id: "user-select", class: "user-select", onchange: onUserChange }),
|
||||
el("button", { class: "btn primary", text: "+ New note", onclick: () => openNote(null) }),
|
||||
el("button", { class: "btn ghost", text: "Help", onclick: showHelp }),
|
||||
el("button", { class: "btn ghost", text: "quickSnote", onclick: showTools }),
|
||||
el("button", { class: "btn ghost", text: "QUICKsnote", onclick: showTools }),
|
||||
themeSelector(),
|
||||
]);
|
||||
const burger = el("button", { class: "menu-toggle", title: "Menu", "aria-label": "Menu", onclick: () => menu.classList.toggle("open") }, [
|
||||
@@ -218,7 +218,10 @@ function showHelp() {
|
||||
const wrap = el("div", { class: "editor-wrap" }, [
|
||||
el("div", { class: "editor-topbar" }, [back]),
|
||||
el("div", { class: "help-card" }, [
|
||||
el("h1", { text: "Help" }),
|
||||
el("div", { class: "tools-head" }, [
|
||||
el("img", { src: "/static/snotes-logo.png", class: "tools-logo", alt: "snotes" }),
|
||||
el("h1", { text: "Help" }),
|
||||
]),
|
||||
|
||||
el("h2", { text: "Keyboard shortcuts" }),
|
||||
el("table", { class: "help-table" }, [
|
||||
@@ -263,10 +266,10 @@ function showTools() {
|
||||
|
||||
const card = el("div", { class: "help-card" }, [
|
||||
el("div", { class: "tools-head" }, [
|
||||
el("img", { src: "/static/snotes-logo.png", class: "tools-logo", alt: "quickSnote" }),
|
||||
el("h1", { text: "Quick capture" }),
|
||||
el("img", { src: "/static/snotes-logo.png", class: "tools-logo", alt: "QUICKsnote" }),
|
||||
el("h1", { text: "QUICKsnote" }),
|
||||
]),
|
||||
el("p", { html: 'The <b>quickSnote</b> browser extension lets you jot a note from any page. It prefills the note with the text you\'ve selected, and a <b>Page</b> button inserts the current page\'s title and link.' }),
|
||||
el("p", { html: 'The <b>QUICKsnote</b> browser extension lets you jot a note from any page. It prefills the note with the text you\'ve selected, and a <b>Page</b> button inserts the current page\'s title and link.' }),
|
||||
|
||||
el("h2", { text: "Firefox" }),
|
||||
el("div", { class: "tools-row" }, [installBtn, extStatus]),
|
||||
@@ -327,7 +330,7 @@ function showTools() {
|
||||
|
||||
installBtn.addEventListener("click", () => {
|
||||
if (detected) return;
|
||||
if (window.InstallTrigger) InstallTrigger.install({ "quickSnote": xpiUrl });
|
||||
if (window.InstallTrigger) InstallTrigger.install({ "QUICKsnote": xpiUrl });
|
||||
else window.location.href = xpiUrl;
|
||||
extStatus.textContent = "Installing… check toolbar for prompt";
|
||||
stopPing();
|
||||
|
||||
Reference in New Issue
Block a user