Skip to content

Commit

Permalink
[from now] 2022/01/03 19:36:29
Browse files Browse the repository at this point in the history
diff --git a/scripts/prepare.ts b/scripts/prepare.ts
index 5c78c0c..edce3e7 100644
--- a/scripts/prepare.ts
+++ b/scripts/prepare.ts
@@ -9,7 +9,6 @@ import { r, port, isDev, log } from './utils'
  */
 async function stubIndexHtml() {
   const views = [
-    'options',
     'popup',
     'background',
   ]
diff --git a/src/background/main.ts b/src/background/main.ts
index 5691cbd..a25cf11 100644
--- a/src/background/main.ts
+++ b/src/background/main.ts
@@ -9,7 +9,6 @@ if (import.meta.hot) {
   import('./contentScriptHMR')
 }

-// タイトルの重複する削除した履歴を返す
 const removeDuplicates = (histories: History.HistoryItem[]) => {
   return Array.from(
     histories
@@ -21,7 +20,7 @@ const removeDuplicates = (histories: History.HistoryItem[]) => {
   )
 }

-const addHost = (histories: History.HistoryItem[]) => {
+const addHostname = (histories: History.HistoryItem[]) => {
   return histories.map((item) => {
     const url = new URL(item.url!)
     return {
@@ -44,7 +43,7 @@ browser.commands.onCommand.addListener(async() => {

   await sendMessage(
     'history-search',
-    { result: JSON.stringify(addHost(removeDuplicates(result))) },
+    { result: JSON.stringify(addHostname(removeDuplicates(result))) },
     {
       context: 'content-script',
       tabId: tab.id!,
diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue
index e666f57..1ecee06 100644
--- a/src/contentScripts/views/App.vue
+++ b/src/contentScripts/views/App.vue
@@ -2,7 +2,7 @@
   <div v-if="showModal" class="fixed z-99999 inset-0 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
     <div class="position relative min-h-screen">
       <div class="fixed inset-0 bg-black bg-opacity-60 transition-opacity" aria-hidden="true" @click="onCloseModal"></div>
-      <div class="absolute align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all -translate-x-1/2 left-1/2 top-10vh w-500px max-w-screen-80vw">
+      <div class="absolute align-bottom bg-white rounded-5px text-left overflow-hidden shadow-xl transform transition-all -translate-x-1/2 left-1/2 top-10vh w-500px max-w-screen-80vw">
         <div class="relative text-gray-600 focus-within:text-gray-400">
           <div class="p-20px pb-0">
             <svg
@@ -18,7 +18,7 @@
               id="username"
               ref="searchInput"
               v-model="searchWord"
-              class="shadow appearance-none border border-gray-400 rounded w-full py-12px px-12px text-gray-700 leading-tight focus:outline-none focus:shadow-outline box-border bg-white pl-43px"
+              class="shadow appearance-none border border-gray-400 rounded-5px w-full py-12px px-12px text-gray-700 leading-tight focus:outline-none focus:shadow-outline box-border bg-white pl-43px"
               type="search"
               placeholder="Search histories.."
               autofocus
@@ -38,7 +38,7 @@
                     :key="i"
                     :ref="el => { if (el) searchResultRefs[i] = el }"
                     :aria-selected="i === selectedNumber"
-                    class="block rounded"
+                    class="block rounded-5px"
                     :class="{ 'bg-blue-200': i === selectedNumber }"
                     role="option"
                   >
@@ -53,7 +53,7 @@
                     <li
                       :ref="el => { if (el) searchResultRefs[0] = el }"
                       :aria-selected="true"
-                      class="block rounded"
+                      class="block rounded-5px"
                       :class="{ 'bg-blue-200': true }"
                       role="option"
                     >
@@ -65,7 +65,7 @@
                 <template v-else>
                   <div class="flex min-h-15vh w-full justify-center items-center flex-row">
                     <Logo width="50" height="50" class="opacity-40 mr-15px" />
-                    <p class="text-16px text-gray-400 font-bold">
+                    <p class="text-16px text-gray-400 font-bold leading-26px">
                       Fussy<br />History Search
                     </p>
                   </div>
@@ -75,7 +75,7 @@
           </div>
           <div class="flex border border-gray-200 h-40px justify-between px-20px border-solid items-center text-11px text-gray-500">
             <p class="m-0">
-              <span class="bg-gray-200 rounded inline-block">↑</span><span class="bg-gray-200 rounded inline-block">↓</span>Navigate, <span class="bg-gray-200 rounded inline-block ml-10px">Enter</span>Open,<span class="ml-10px p-3px bg-gray-200 rounded inline-block">Ctrl + Enter</span>Open in new tab
+              <span class="bg-gray-200 rounded-3px pa-5px inline-block">↑</span><span class="bg-gray-200 rounded-3px pa-5px inline-block">↓</span>Navigate, <span class="bg-gray-200 rounded-3px pa-5px inline-block ml-10px">Enter</span>Open,<span class="ml-10px p-3px bg-gray-200 rounded-3px pa-5px inline-block">Ctrl + Enter</span>Open in new tab
             </p>
             <p class="m-0 grid items-center grid-flow-col gap-10px">
               <span>Fussy history search</span>
diff --git a/src/logic/storage.ts b/src/logic/storage.ts
index 8892d8b..37349cf 100644
--- a/src/logic/storage.ts
+++ b/src/logic/storage.ts
@@ -1,3 +1,4 @@
-import { useLocalStorage } from '@vueuse/core'
-
-export const isDarkMode = useLocalStorage('isDarkMode', false, { listenToStorageChanges: true })
+// TODO enable dark mode
+// import { useLocalStorage } from '@vueuse/core'
+//
+// export const isDarkMode = useLocalStorage('isDarkMode', false, { listenToStorageChanges: true })
diff --git a/src/manifest.ts b/src/manifest.ts
index 670646c..8031528 100644
--- a/src/manifest.ts
+++ b/src/manifest.ts
@@ -19,11 +19,6 @@ export async function getManifest() {
       default_icon: './assets/icon-512.png',
       default_popup: './dist/popup/index.html',
     },
-    options_ui: {
-      page: './dist/options/index.html',
-      open_in_tab: true,
-      chrome_style: false,
-    },
     background: {
       page: './dist/background/index.html',
       persistent: false,
@@ -44,9 +39,6 @@ export async function getManifest() {
       128: './assets/icon-512.png',
     },
     permissions: [
-      'tabs',
-      'storage',
-      'activeTab',
       'http://*/',
       'https://*/',
       'history',
diff --git a/src/options/Options.vue b/src/options/Options.vue
deleted file mode 100644
index 5c2a110..0000000
--- a/src/options/Options.vue
+++ /dev/null
@@ -1,19 +0,0 @@
-<template>
-  <main class="px-4 py-10 text-center text-gray-700 dark:text-gray-200">
-    <pixelarticons-sliders class="icon-btn mx-2 text-2xl" />
-    <div>Options</div>
-    <p class="mt-2 opacity-50">
-      This is the options page
-    </p>
-
-    <input v-model="storageDemo" class="border border-gray-400 rounded px-2 py-1 mt-2" />
-
-    <div class="mt-4">
-      Powered by Vite <pixelarticons-zap class="align-middle" />
-    </div>
-  </main>
-</template>
-
-<script setup lang="ts">
-import { storageDemo } from '~/logic/storage'
-</script>
diff --git a/src/options/index.html b/src/options/index.html
deleted file mode 100644
index dbd67cb..0000000
--- a/src/options/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-  <meta charset="UTF-8">
-  <base target="_blank">
-  <title>Options</title>
-</head>
-<body>
-  <div id="app"></div>
-  <script type="module" src="./main.ts"></script>
-</body>
-</html>
diff --git a/src/options/main.ts b/src/options/main.ts
deleted file mode 100644
index 1a911d5..0000000
--- a/src/options/main.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createApp } from 'vue'
-import App from './Options.vue'
-import '../styles'
-
-const app = createApp(App)
-app.mount('#app')
diff --git a/src/popup/Popup.vue b/src/popup/Popup.vue
index c867c46..5ab1398 100644
--- a/src/popup/Popup.vue
+++ b/src/popup/Popup.vue
@@ -1,5 +1,5 @@
 <template>
-  <main class="w-[200px] px-4 py-5 text-center text-gray-800 dark:bg-gray-700 dark:text-white">
+  <main class="w-[180px] px-4 py-5 text-center text-gray-800 dark:bg-gray-700 dark:text-white">
     <Logo width="40" height="40" class="inline-block" :dark="isDark" />
     <p class="mt-2 opacity-50">
       Fussy history search
diff --git a/vite.config.ts b/vite.config.ts
index d278cd3..428a892 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -92,7 +92,6 @@ export default defineConfig(({ command }) => ({
     rollupOptions: {
       input: {
         background: r('src/background/index.html'),
-        options: r('src/options/index.html'),
         popup: r('src/popup/index.html'),
       },
     },
  • Loading branch information
kawamataryo committed Jan 3, 2022
1 parent 34d4710 commit d7b98a7
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 60 deletions.
1 change: 0 additions & 1 deletion scripts/prepare.ts
Expand Up @@ -9,7 +9,6 @@ import { r, port, isDev, log } from './utils'
*/
async function stubIndexHtml() {
const views = [
'options',
'popup',
'background',
]
Expand Down
5 changes: 2 additions & 3 deletions src/background/main.ts
Expand Up @@ -9,7 +9,6 @@ if (import.meta.hot) {
import('./contentScriptHMR')
}

// タイトルの重複する削除した履歴を返す
const removeDuplicates = (histories: History.HistoryItem[]) => {
return Array.from(
histories
Expand All @@ -21,7 +20,7 @@ const removeDuplicates = (histories: History.HistoryItem[]) => {
)
}

const addHost = (histories: History.HistoryItem[]) => {
const addHostname = (histories: History.HistoryItem[]) => {
return histories.map((item) => {
const url = new URL(item.url!)
return {
Expand All @@ -44,7 +43,7 @@ browser.commands.onCommand.addListener(async() => {

await sendMessage(
'history-search',
{ result: JSON.stringify(addHost(removeDuplicates(result))) },
{ result: JSON.stringify(addHostname(removeDuplicates(result))) },
{
context: 'content-script',
tabId: tab.id!,
Expand Down
12 changes: 6 additions & 6 deletions src/contentScripts/views/App.vue
Expand Up @@ -2,7 +2,7 @@
<div v-if="showModal" class="fixed z-99999 inset-0 overflow-y-auto" aria-labelledby="modal-title" role="dialog" aria-modal="true">
<div class="position relative min-h-screen">
<div class="fixed inset-0 bg-black bg-opacity-60 transition-opacity" aria-hidden="true" @click="onCloseModal"></div>
<div class="absolute align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all -translate-x-1/2 left-1/2 top-10vh w-500px max-w-screen-80vw">
<div class="absolute align-bottom bg-white rounded-5px text-left overflow-hidden shadow-xl transform transition-all -translate-x-1/2 left-1/2 top-10vh w-500px max-w-screen-80vw">
<div class="relative text-gray-600 focus-within:text-gray-400">
<div class="p-20px pb-0">
<svg
Expand All @@ -18,7 +18,7 @@
id="username"
ref="searchInput"
v-model="searchWord"
class="shadow appearance-none border border-gray-400 rounded w-full py-12px px-12px text-gray-700 leading-tight focus:outline-none focus:shadow-outline box-border bg-white pl-43px"
class="shadow appearance-none border border-gray-400 rounded-5px w-full py-12px px-12px text-gray-700 leading-tight focus:outline-none focus:shadow-outline box-border bg-white pl-43px"
type="search"
placeholder="Search histories.."
autofocus
Expand All @@ -38,7 +38,7 @@
:key="i"
:ref="el => { if (el) searchResultRefs[i] = el }"
:aria-selected="i === selectedNumber"
class="block rounded"
class="block rounded-5px"
:class="{ 'bg-blue-200': i === selectedNumber }"
role="option"
>
Expand All @@ -53,7 +53,7 @@
<li
:ref="el => { if (el) searchResultRefs[0] = el }"
:aria-selected="true"
class="block rounded"
class="block rounded-5px"
:class="{ 'bg-blue-200': true }"
role="option"
>
Expand All @@ -65,7 +65,7 @@
<template v-else>
<div class="flex min-h-15vh w-full justify-center items-center flex-row">
<Logo width="50" height="50" class="opacity-40 mr-15px" />
<p class="text-16px text-gray-400 font-bold">
<p class="text-16px text-gray-400 font-bold leading-26px">
Fussy<br />History Search
</p>
</div>
Expand All @@ -75,7 +75,7 @@
</div>
<div class="flex border border-gray-200 h-40px justify-between px-20px border-solid items-center text-11px text-gray-500">
<p class="m-0">
<span class="bg-gray-200 rounded inline-block">↑</span><span class="bg-gray-200 rounded inline-block">↓</span>Navigate, <span class="bg-gray-200 rounded inline-block ml-10px">Enter</span>Open,<span class="ml-10px p-3px bg-gray-200 rounded inline-block">Ctrl + Enter</span>Open in new tab
<span class="bg-gray-200 rounded-3px pa-5px inline-block">↑</span><span class="bg-gray-200 rounded-3px pa-5px inline-block">↓</span>Navigate, <span class="bg-gray-200 rounded-3px pa-5px inline-block ml-10px">Enter</span>Open,<span class="ml-10px p-3px bg-gray-200 rounded-3px pa-5px inline-block">Ctrl + Enter</span>Open in new tab
</p>
<p class="m-0 grid items-center grid-flow-col gap-10px">
<span>Fussy history search</span>
Expand Down
7 changes: 4 additions & 3 deletions src/logic/storage.ts
@@ -1,3 +1,4 @@
import { useLocalStorage } from '@vueuse/core'

export const isDarkMode = useLocalStorage('isDarkMode', false, { listenToStorageChanges: true })
// TODO enable dark mode
// import { useLocalStorage } from '@vueuse/core'
//
// export const isDarkMode = useLocalStorage('isDarkMode', false, { listenToStorageChanges: true })
8 changes: 0 additions & 8 deletions src/manifest.ts
Expand Up @@ -19,11 +19,6 @@ export async function getManifest() {
default_icon: './assets/icon-512.png',
default_popup: './dist/popup/index.html',
},
options_ui: {
page: './dist/options/index.html',
open_in_tab: true,
chrome_style: false,
},
background: {
page: './dist/background/index.html',
persistent: false,
Expand All @@ -44,9 +39,6 @@ export async function getManifest() {
128: './assets/icon-512.png',
},
permissions: [
'tabs',
'storage',
'activeTab',
'http://*/',
'https://*/',
'history',
Expand Down
19 changes: 0 additions & 19 deletions src/options/Options.vue

This file was deleted.

12 changes: 0 additions & 12 deletions src/options/index.html

This file was deleted.

6 changes: 0 additions & 6 deletions src/options/main.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/popup/Popup.vue
@@ -1,5 +1,5 @@
<template>
<main class="w-[200px] px-4 py-5 text-center text-gray-800 dark:bg-gray-700 dark:text-white">
<main class="w-[180px] px-4 py-5 text-center text-gray-800 dark:bg-gray-700 dark:text-white">
<Logo width="40" height="40" class="inline-block" :dark="isDark" />
<p class="mt-2 opacity-50">
Fussy history search
Expand Down
1 change: 0 additions & 1 deletion vite.config.ts
Expand Up @@ -92,7 +92,6 @@ export default defineConfig(({ command }) => ({
rollupOptions: {
input: {
background: r('src/background/index.html'),
options: r('src/options/index.html'),
popup: r('src/popup/index.html'),
},
},
Expand Down

0 comments on commit d7b98a7

Please sign in to comment.