Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Mar 23, 2024
1 parent 8cd5069 commit 5f395ea
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
7 changes: 7 additions & 0 deletions entrypoints/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ export default defineBackground(() => {
});
});

// browser.browserAction.setTitle({ title: 'Usewiki2' });
// browser.browserAction.setBadgeText({ text: 'Usewiki2' });

// chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
// chrome.action.setBadgeText({ text: 'on' });
// });

/* chrome.runtime.onInstalled.addListener(function () {
chrome.contextMenus.create({
id: 'tiddlywiki',
Expand Down
21 changes: 17 additions & 4 deletions entrypoints/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ export default defineContentScript({
main() {
function getDoc() {
const documentClone = document.cloneNode(true) as Document;
// const readerable = isProbablyReaderable(documentClone);
// if (!readerable) {
// return readerable;
// }
const reader = new Readability(documentClone);
const article = reader.parse();
console.log(article);
return article;
}

Expand All @@ -21,6 +18,22 @@ export default defineContentScript({
}
});

// chrome.declarativeContent.onPageChanged.removeRules(undefined, () => {
// chrome.declarativeContent.onPageChanged.addRules([
// {
// conditions: [
// new chrome.declarativeContent.PageStateMatcher({
// // pageUrl: { schemes: ['https//'] },
// pageUrl: {
// hostEquals: 'www.tiddlywiki.com',
// },
// }),
// ],
// actions: [new chrome.declarativeContent.ShowPageAction()],
// },
// ]);
// });

// or use execsripting
// scripting
// window.addEventListener(
Expand Down
6 changes: 1 addition & 5 deletions entrypoints/popup/Popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tab.id, {
info: 'get-doc', message: '获取文章'
}, async function (response: IArticle) {
// if (!response) {
// html.value = '不支持当前页面'
// } else {
// }
html.value = response.content
md.value = await html2md(html.value);
title.value = response.title
Expand Down Expand Up @@ -216,7 +212,7 @@ const save2TiddlyWiki = async (title: string, text: string, port: string, url: s
</ElTabPane>

<!-- info -->
<ElTabPane>
<ElTabPane v-if="status.tiddlywiki_version">
<template #label>
<MaterialSymbolsInfoOutline />
</template>
Expand Down
2 changes: 1 addition & 1 deletion entrypoints/popup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Default Popup Title</title>
<title> Usewiki2 </title>
<meta name="manifest.type" content="browser_action" />
<link href="~/assets/tailwind.css" rel="stylesheet" />
</head>
Expand Down
1 change: 1 addition & 0 deletions wxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default defineConfig({

browser_action: {
default_popup: 'popup.html',
// default_title: 'hi',
},
},
});

0 comments on commit 5f395ea

Please sign in to comment.