diff --git a/duplicate-tabs-closer-master/README.md b/duplicate-tabs-closer-master/README.md index 73d429a..2b0690e 100644 --- a/duplicate-tabs-closer-master/README.md +++ b/duplicate-tabs-closer-master/README.md @@ -26,22 +26,15 @@ List of urls to not close automatically. Duplicate tabs skipped will be notified Wildcards and RegExp are supported. -### Priority: -(Used with option *Close tab automatically* and *Close all duplicate tabs* button) -* **Keep older tab** *(default)*: Keep the already existing tab. -* **Keep newer tab**: Keep the newer tab. -* **Keep tab with https** *(default on)*: Ignore the scheme part during comparison and keep the tab with the https scheme. -* **Keep pinned tab** *(default on)*: Keep the pinned tab. - - -### matchingRules: - -* **Ignore case in URL** *(default on)* -* **Ignore 'www' in URL domain name** *(default on)* -* **Ignore hash part in URL** *(default off)* -* **Ignore search part in URL** *(default off)* -* **Ignore path part in URL** *(default off)* -* **Compare with tab title** *(default off)* +### Duplicate resolution behavior +(Used with option *Close tab automatically* and the *Close all duplicate tabs* button) +The extension always keeps pinned tabs, prefers the HTTPS version of a page, and retains the older tab when deciding which duplicate to close. These rules are now built-in and no longer configurable. + + +### matchingRules: + +URL comparisons always normalize links by forcing HTTPS, ignoring a leading `www`, comparing in lowercase, and keeping the full path, search, and hash segments. The remaining optional rule is: +* **Compare with tab title** *(default off)* ### Scope: diff --git a/duplicate-tabs-closer-master/_locales/en/messages.json b/duplicate-tabs-closer-master/_locales/en/messages.json index 0a23e5d..60fd06c 100644 --- a/duplicate-tabs-closer-master/_locales/en/messages.json +++ b/duplicate-tabs-closer-master/_locales/en/messages.json @@ -19,30 +19,10 @@ "message": "Show panel", "description": "Show panel" }, - "tabPriority": { - "message": "Priority", - "description": "Priority" - }, - "keepNewerTab": { - "message": "Keep newer tab", - "description": "Keep newer tab" - }, - "keepOlderTab": { - "message": "Keep older tab", - "description": "Keep older tab" - }, "keepTabWithHistory": { "message": "Keep tab with history", "description": "Keep tab with history" }, - "keeptabwithHttps": { - "message": "Keep tab with https", - "description": "Keep tab with https" - }, - "keepPinnedTab": { - "message": "Keep pinned tab", - "description": "Keep pinned tab" - }, "onRemainingTab": { "message": "On remaining tab", "description": "On remaining tab" @@ -59,26 +39,6 @@ "message": "Matching rules", "description": "Matching rules" }, - "ignoreHashPart": { - "message": "Ignore hash part in URL", - "description": "Ignore hash part in URL" - }, - "ignoreSearchPart": { - "message": "Ignore search part in URL", - "description": "Ignore search part in URL" - }, - "ignorePathPart": { - "message": "Ignore path part in URL", - "description": "Ignore path part in URL" - }, - "ignore3w": { - "message": "Ignore 'www' in URL domain name", - "description": "Ignore 'www' in URL domain name" - }, - "caseInsensitive": { - "message": "Ignore case in URL", - "description": "Ignore case in URL" - }, "compareWithTitle": { "message": "Compare with title", "description": "Compare with title" diff --git a/duplicate-tabs-closer-master/_locales/fr/messages.json b/duplicate-tabs-closer-master/_locales/fr/messages.json index 100ed48..ae5d3fc 100644 --- a/duplicate-tabs-closer-master/_locales/fr/messages.json +++ b/duplicate-tabs-closer-master/_locales/fr/messages.json @@ -19,30 +19,10 @@ "message": "Afficher le panneau", "description": "Show panel" }, - "tabPriority": { - "message": "Priorité", - "description": "Priority" - }, - "keepNewerTab": { - "message": "Conserver le nouvel onglet", - "description": "Keep newer tab" - }, - "keepOlderTab": { - "message": "Conserver l'ancien onglet", - "description": "Keep older tab" - }, "keepTabWithHistory": { "message": "Conserver l'onglet ayant un historique", "description": "Keep tab with history" }, - "keeptabwithHttps": { - "message": "Conserver l'onglet avec https", - "description": "Keep tab with https" - }, - "keepPinnedTab": { - "message": "Conserver l'onglet épinglé", - "description": "Keep pinned tab" - }, "onRemainingTab": { "message": "Sur l'onglet restant", "description": "On remaining tab" @@ -59,26 +39,6 @@ "message": "Règle de correspondance", "description": "Règle de correspondance" }, - "ignoreHashPart": { - "message": "Ignorer la partie « hachage » de l'URL", - "description": "Ignore hash part in URL" - }, - "ignoreSearchPart": { - "message": "Ignorer la partie « recherche » de l'URL", - "description": "Ignore search part in URL" - }, - "ignorePathPart": { - "message": "Ignorer la partie « chemin » de l'URL", - "description": "Ignore path part in URL" - }, - "ignore3w": { - "message": "Ignorer 'www' dans le nom de domaine de l'URL", - "description": "Ignorer 'www' dans le nom de domaine de l'URL" - }, - "caseInsensitive": { - "message": "Ignorer la casse de l'URL", - "description": "Ignorer la casse de l'URL" - }, "compareWithTitle": { "message": "Comparer avec le titre", "description": "Compare with title" diff --git a/duplicate-tabs-closer-master/_locales/ja/messages.json b/duplicate-tabs-closer-master/_locales/ja/messages.json index aa4d5d5..806fc44 100644 --- a/duplicate-tabs-closer-master/_locales/ja/messages.json +++ b/duplicate-tabs-closer-master/_locales/ja/messages.json @@ -19,30 +19,10 @@ "message": "パネルを表示する", "description": "Show panel" }, - "tabPriority": { - "message": "優先順位", - "description": "Priority" - }, - "keepNewerTab": { - "message": "新しい方のタブを残す", - "description": "Keep newer tab" - }, - "keepOlderTab": { - "message": "古い方のタブを残す", - "description": "Keep older tab" - }, "keepTabWithHistory": { "message": "タブの履歴を維持する", "description": "Keep tab with history" }, - "keeptabwithHttps": { - "message": "HTTPSのタブを残す", - "description": "Keep tab with https" - }, - "keepPinnedTab": { - "message": "ピン留めされたタブを残す", - "description": "Keep pinned tab" - }, "onRemainingTab": { "message": "残されたタブがある場合", "description": "On remaining tab" @@ -59,26 +39,6 @@ "message": "Matching rules", "description": "Matching rules" }, - "ignoreHashPart": { - "message": "URLのハッシュ部分(#~)を無視する", - "description": "Ignore hash part in URL" - }, - "ignoreSearchPart": { - "message": "URLのクエリー部分(?~)を無視する", - "description": "Ignore search part in URL" - }, - "ignorePathPart": { - "message": "URLのパス部分を無視する", - "description": "Ignore path part in URL" - }, - "ignore3w": { - "message": "Ignore 'www' in URL domain name", - "description": "Ignore 'www' in URL domain name" - }, - "caseInsensitive": { - "message": "Ignore case in URL", - "description": "Ignore case in URL" - }, "compareWithTitle": { "message": "タブのタイトルを比較する", "description": "Compare with title" diff --git a/duplicate-tabs-closer-master/_locales/ru/messages.json b/duplicate-tabs-closer-master/_locales/ru/messages.json index bc3c231..3220189 100644 --- a/duplicate-tabs-closer-master/_locales/ru/messages.json +++ b/duplicate-tabs-closer-master/_locales/ru/messages.json @@ -19,30 +19,10 @@ "message": "Показать панель", "description": "Show panel" }, - "tabPriority": { - "message": "Приоритет", - "description": "Priority" - }, - "keepNewerTab": { - "message": "Сохранить новейшую вкладку", - "description": "Keep newer tab" - }, - "keepOlderTab": { - "message": "Сохранить старейшую вкладку", - "description": "Keep older tab" - }, "keepTabWithHistory": { "message": "Сохранить вкладку с историей", "description": "Keep tab with history" }, - "keeptabwithHttps": { - "message": "Сохранить вкладку с https", - "description": "Keep tab with https" - }, - "keepPinnedTab": { - "message": "Сохранить закрепленную вкладку", - "description": "Keep pinned tab" - }, "onRemainingTab": { "message": "Оставшуюся вкладку...", "description": "On remaining tab" @@ -59,26 +39,6 @@ "message": "Matching rules", "description": "Matching rules" }, - "ignoreHashPart": { - "message": "Игнорировать хэш-часть в URL вкладки", - "description": "Ignore hash part in URL" - }, - "ignoreSearchPart": { - "message": "Игнорировать часть поиска в URL вкладки", - "description": "Ignore search part in URL" - }, - "ignorePathPart": { - "message": "Игнорировать часть пути в URL вкладки", - "description": "Ignore path part in URL" - }, - "ignore3w": { - "message": "Ignore 'www' in URL domain name", - "description": "Ignore 'www' in URL domain name" - }, - "caseInsensitive": { - "message": "Ignore case in URL", - "description": "Ignore case in URL" - }, "compareWithTitle": { "message": "Сравнить заголовки вкладок", "description": "Compare with title" diff --git a/duplicate-tabs-closer-master/_locales/uk/messages.json b/duplicate-tabs-closer-master/_locales/uk/messages.json index 6c79e8e..1840687 100644 --- a/duplicate-tabs-closer-master/_locales/uk/messages.json +++ b/duplicate-tabs-closer-master/_locales/uk/messages.json @@ -19,30 +19,10 @@ "message": "Показати панель", "description": "Show panel" }, - "tabPriority": { - "message": "Пріоритет", - "description": "Priority" - }, - "keepNewerTab": { - "message": "Зберегти новішу вкладку", - "description": "Keep newer tab" - }, - "keepOlderTab": { - "message": "Зберегти старішу вкладку", - "description": "Keep older tab" - }, "keepTabWithHistory": { "message": "Зберегти вкладку з історією", "description": "Keep tab with history" }, - "keeptabwithHttps": { - "message": "Зберегти вкладку з https", - "description": "Keep tab with https" - }, - "keepPinnedTab": { - "message": "Зберегти закріплену вкладку", - "description": "Keep pinned tab" - }, "onRemainingTab": { "message": "Вкладку, що залишилася...", "description": "On remaining tab" @@ -59,26 +39,6 @@ "message": "Matching rules", "description": "Matching rules" }, - "ignoreHashPart": { - "message": "Ігнорувати хеш-частину в URL вкладки", - "description": "Ignore hash part in URL" - }, - "ignoreSearchPart": { - "message": "Ігнорувати частину пошуку в URL вкладки", - "description": "Ignore search part in URL" - }, - "ignorePathPart": { - "message": "Ігнорувати частину шляху в URL вкладки", - "description": "Ignore path part in URL" - }, - "ignore3w": { - "message": "Ignore 'www' in URL domain name", - "description": "Ignore 'www' in URL domain name" - }, - "caseInsensitive": { - "message": "Ignore case in URL", - "description": "Ignore case in URL" - }, "compareWithTitle": { "message": "Порівняти заголовки вкладок", "description": "Compare with title" diff --git a/duplicate-tabs-closer-master/_locales/zh_CN/messages.json b/duplicate-tabs-closer-master/_locales/zh_CN/messages.json index 055a3a4..5e33875 100644 --- a/duplicate-tabs-closer-master/_locales/zh_CN/messages.json +++ b/duplicate-tabs-closer-master/_locales/zh_CN/messages.json @@ -24,36 +24,11 @@ "description": "Show panel", "hash": "3519be2a903e741db8c653b0e7e341e8" }, - "tabPriority": { - "message": "优先级", - "description": "Priority", - "hash": "a47af5c8632e36b75d0299167f2b38e0" - }, - "keepNewerTab": { - "message": "保留新的标签页", - "description": "Keep newer tab", - "hash": "a3aa6ddd27496953c1d39e89d344f609" - }, - "keepOlderTab": { - "message": "保留旧的标签页", - "description": "Keep older tab", - "hash": "17c1cecef3fb5c4c822c709e32428724" - }, "keepTabWithHistory": { "message": "保留有历史记录的标签页", "description": "Keep tab with history", "hash": "23668f9ee2e1380d81db5eedce7e778b" }, - "keeptabwithHttps": { - "message": "保留 https 的标签页", - "description": "Keep tab with https", - "hash": "158afd64eff0d0d42ec5fcdc69456b39" - }, - "keepPinnedTab": { - "message": "保留固定的标签页", - "description": "Keep pinned tab", - "hash": "eeded9a172a2db461ba5b29f7a4c9fce" - }, "onRemainingTab": { "message": "剩余标签页", "description": "On remaining tab", @@ -74,29 +49,6 @@ "description": "MatchingRules", "hash": "e86eed212e60224faadd11386632e100" }, - "ignoreHashPart": { - "message": "忽略标签页 URL 中的井字部分", - "description": "Ignore hash part in URL", - "hash": "bbeeddb75b5f0c1d72685cf06108c3e3" - }, - "ignoreSearchPart": { - "message": "忽略标签页 URL 中的问号部分", - "description": "Ignore search part in URL", - "hash": "719a708f82ce50153de4e90a4b697a84" - }, - "ignorePathPart": { - "message": "忽略标签页 URL 中的路径部分", - "description": "Ignore path part in URL", - "hash": "c05dc772b761f094ec2b99f692c26148" - }, - "ignore3w": { - "message": "Ignore 'www' in URL domain name", - "description": "Ignore 'www' in URL domain name" - }, - "caseInsensitive": { - "message": "Ignore case in URL", - "description": "Ignore case in URL" - }, "compareWithTitle": { "message": "比较依据标签页标题", "description": "Compare with title", diff --git a/duplicate-tabs-closer-master/background.js b/duplicate-tabs-closer-master/background.js index 32464ec..e2a3173 100644 --- a/duplicate-tabs-closer-master/background.js +++ b/duplicate-tabs-closer-master/background.js @@ -97,45 +97,18 @@ const defaultOptions = { onRemainingTab: { value: "A" }, - keepTabBasedOnAge: { - value: "O" // "O" (older) or "N" (newer) - }, - keepTabWithHttps: { - value: true - }, - keepPinnedTab: { - value: true - }, keepTabWithHistory: { value: false }, scope: { value: "C" }, - ignoreHashPart: { - value: false - }, - ignoreSearchPart: { - value: false - }, - ignorePathPart: { - value: false - }, - ignore3w: { - value: true - }, - caseInsensitive: { - value: true - }, compareWithTitle: { value: false }, onDuplicateTabDetectedPinned: { value: true }, - tabPriorityPinned: { - value: true - }, matchingRulesPinned: { value: true }, @@ -229,15 +202,7 @@ const setOptions = (storedOptions) => { options.autoCloseTab = storedOptions.onDuplicateTabDetected.value === "A"; options.defaultTabBehavior = storedOptions.onRemainingTab.value === "B"; options.activateKeptTab = storedOptions.onRemainingTab.value === "A"; - options.keepNewerTab = storedOptions.keepTabBasedOnAge.value === "N"; - options.keepTabWithHttps = storedOptions.keepTabWithHttps.value; - options.keepPinnedTab = storedOptions.keepPinnedTab.value; - options.ignoreHashPart = storedOptions.ignoreHashPart.value; - options.ignoreSearchPart = storedOptions.ignoreSearchPart.value; - options.ignorePathPart = storedOptions.ignorePathPart.value; - options.compareWithTitle = storedOptions.compareWithTitle.value; - options.ignore3w = storedOptions.ignore3w.value; - options.caseInsensitive = storedOptions.caseInsensitive.value; + options.compareWithTitle = storedOptions.compareWithTitle.value; options.searchInAllWindows = storedOptions.scope.value === "A" || storedOptions.scope.value === "CA"; options.searchPerContainer = storedOptions.scope.value === "CC" || storedOptions.scope.value === "CA"; options.whiteList = whiteListToPattern(storedOptions.whiteList.value); @@ -314,49 +279,27 @@ const isHttps = (url) => { // eslint-disable-next-line no-unused-vars const getMatchingURL = (url) => { if (!isValidURL(url)) return url; - let matchingURL = url; - if (options.ignorePathPart) { - const uri = new URL(matchingURL); - matchingURL = uri.origin; - } - else if (options.ignoreSearchPart) { - matchingURL = matchingURL.split("?")[0]; - } - else if (options.ignoreHashPart) { - matchingURL = matchingURL.split("#")[0]; - } - if (options.keepTabWithHttps) { - matchingURL = matchingURL.replace(/^http:\/\//i, "https://"); - } - if (options.ignore3w) { - matchingURL = matchingURL.replace("://www.", "://"); - } - if (options.caseInsensitive) { - matchingURL = matchingURL.toLowerCase(); - } - matchingURL = matchingURL.replace(/\/$/, ""); - return matchingURL; -}; - -// eslint-disable-next-line no-unused-vars -const getMatchPatternURL = (url) => { - let urlPattern = null; - if (isValidURL(url)) { - const uri = new URL(url); - urlPattern = `*://${uri.hostname}`; - if (options.ignorePathPart) { - urlPattern += "/*"; - } - else { - urlPattern += uri.pathname; - if (uri.search || uri.hash) { - urlPattern += "*"; - } - } - } - else if (isBrowserURL(url)) { - urlPattern = `${url}*`; - } + let matchingURL = url; + matchingURL = matchingURL.replace(/^http:\/\//i, "https://"); + matchingURL = matchingURL.toLowerCase(); + matchingURL = matchingURL.replace("://www.", "://"); + matchingURL = matchingURL.replace(/\/$/, ""); + return matchingURL; +}; + +// eslint-disable-next-line no-unused-vars +const getMatchPatternURL = (url) => { + let urlPattern = null; + if (isValidURL(url)) { + const uri = new URL(url); + urlPattern = `*://${uri.hostname}${uri.pathname}`; + if (uri.search || uri.hash) { + urlPattern += "*"; + } + } + else if (isBrowserURL(url)) { + urlPattern = `${url}*`; + } return urlPattern; };"use strict"; @@ -430,44 +373,32 @@ const matchTitle = (tab1, tab2) => { return false; }; -const getHttpsTabId = (observedTab, observedTabUrl, openedTab) => { - if (options.keepTabWithHttps) { - const regex = /^https:\/\//i; - const match1 = regex.test(observedTabUrl); - const match2 = regex.test(openedTab.url); - if (match1) { - return match2 ? null : observedTab.id; - } else { - return match2 ? openedTab.id : null; - } - } - return null; -}; - -const getPinnedTabId = (tab1, tab2) => { - if (options.keepPinnedTab) { - if (tab1.pinned) { - return tab2.pinned ? null : tab1.id; - } else { - return tab2.pinned ? tab2.id : null; - } - } - return null; -}; - -const getLastUpdatedTabId = (observedTab, openedTab) => { - const observedTabLastUpdate = tabsInfo.getLastComplete(observedTab.id); - const openedTabLastUpdate = tabsInfo.getLastComplete(openedTab.id); - if (options.keepNewerTab) { - if (observedTabLastUpdate === null) return observedTab.id; - if (openedTabLastUpdate === null) return openedTab.id; - return (observedTabLastUpdate > openedTabLastUpdate) ? observedTab.id : openedTab.id; - } else { - if (observedTabLastUpdate === null) return openedTab.id; - if (openedTabLastUpdate === null) return observedTab.id; - return (observedTabLastUpdate < openedTabLastUpdate) ? observedTab.id : openedTab.id; - } -}; +const getHttpsTabId = (observedTab, observedTabUrl, openedTab) => { + const regex = /^https:\/\//i; + const match1 = regex.test(observedTabUrl); + const match2 = regex.test(openedTab.url); + if (match1) { + return match2 ? null : observedTab.id; + } else { + return match2 ? openedTab.id : null; + } +}; + +const getPinnedTabId = (tab1, tab2) => { + if (tab1.pinned) { + return tab2.pinned ? null : tab1.id; + } else { + return tab2.pinned ? tab2.id : null; + } +}; + +const getLastUpdatedTabId = (observedTab, openedTab) => { + const observedTabLastUpdate = tabsInfo.getLastComplete(observedTab.id); + const openedTabLastUpdate = tabsInfo.getLastComplete(openedTab.id); + if (observedTabLastUpdate === null) return openedTab.id; + if (openedTabLastUpdate === null) return observedTab.id; + return (observedTabLastUpdate < openedTabLastUpdate) ? observedTab.id : openedTab.id; +}; const getFocusedTab = (observedTab, openedTab, activeWindowId, retainedTabId) => { if (retainedTabId === observedTab.id) { diff --git a/duplicate-tabs-closer-master/optionPage/optionPage.html b/duplicate-tabs-closer-master/optionPage/optionPage.html index 7bceb1a..93b66e8 100644 --- a/duplicate-tabs-closer-master/optionPage/optionPage.html +++ b/duplicate-tabs-closer-master/optionPage/optionPage.html @@ -49,78 +49,20 @@ -
  • - - - -
  • -
  • -
    - -
    -
    - -
    -
    - -
    -
    -
  • -
  • - - - -
  • -
  • -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - +
  • + + + +
  • +
  • +
    +
    +
  • diff --git a/duplicate-tabs-closer-master/popup/popup.html b/duplicate-tabs-closer-master/popup/popup.html index c9d1d4b..079c854 100644 --- a/duplicate-tabs-closer-master/popup/popup.html +++ b/duplicate-tabs-closer-master/popup/popup.html @@ -53,81 +53,21 @@ -
    -
  • - - -
  • + + +
  • -
  • -
    - -
    -
    - -
    -
    - -
    -
    -
  • -
    -
    -
  • - - - -
  • -
  • -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - +
  • +
    +
    +