From c01ef254580bc55bbebab4d9a655a06c436216eb Mon Sep 17 00:00:00 2001 From: Smile4ever Date: Thu, 12 Jul 2018 20:34:40 +0200 Subject: [PATCH] Move Neat URL to separate repo --- Neat URL-webext/CHANGELOG.md => CHANGELOG.md | 3 + .../_locales/zh_CN/messages.json | 90 ------- Neat URL-webext/.gitignore | 1 - Neat URL-webext/README.md => README.md | 12 +- Scrollkey-webext/_locales/zh_CN/messages.json | 54 ---- Neat URL-webext/TODO.md => TODO.md | 0 .../_locales => _locales}/en/messages.json | 0 .../_locales => _locales}/nl/messages.json | 0 .../_locales => _locales}/ru/messages.json | 0 .../_locales => _locales}/uk/messages.json | 0 .../_locales => _locales}/zh_CN/messages.json | 0 .../background.js => background.js | 242 ++++++++++++++++++ Neat URL-webext/build.sh => build.sh | 4 + .../css => css}/options.chrome.css | 0 {Neat URL-webext/css => css}/options.css | 0 .../css => css}/options.firefox.css | 0 .../icons => icons}/dark/neaturl-48.png | Bin .../dark/neaturl-96-state-1.png | Bin .../dark/neaturl-96-state0.png | Bin .../dark/neaturl-96-state0_disabled.png | Bin .../dark/neaturl-96-state1.png | Bin .../dark/neaturl-96-state2.png | Bin .../dark/neaturl-96-state3.png | Bin .../icons => icons}/light/neaturl-48.png | Bin .../light/neaturl-96-state-1.png | Bin .../light/neaturl-96-state0.png | Bin .../light/neaturl-96-state0_disabled.png | Bin .../light/neaturl-96-state1.png | Bin .../light/neaturl-96-state2.png | Bin .../light/neaturl-96-state3.png | Bin icons/neaturl-48.png | Bin 0 -> 555 bytes icons/neaturl-96-state-1.png | Bin 0 -> 1055 bytes icons/neaturl-96-state0.png | Bin 0 -> 1075 bytes icons/neaturl-96-state0_disabled.png | Bin 0 -> 1006 bytes icons/neaturl-96-state1.png | Bin 0 -> 1070 bytes icons/neaturl-96-state2.png | Bin 0 -> 1075 bytes icons/neaturl-96-state3.png | Bin 0 -> 1082 bytes .../Neat URL 4.1.4 in Chrome.png | Bin .../manifest.json => manifest.json | 21 ++ Neat URL-webext/options.html => options.html | 143 +++++++++++ Neat URL-webext/options.js => options.js | 69 +++++ ...suffix-ccSLD.txt => publicsuffix-ccSLD.txt | 0 .../toolbaricon.js => toolbaricon.js | 0 .../neat_url-1.0.0.zip | Bin .../neat_url-1.0.1.zip | Bin .../neat_url-1.1.0.zip | Bin .../neat_url-1.2.0.zip | Bin .../neat_url-2.0.0.zip | Bin .../neat_url-2.0.1.zip | Bin .../neat_url-2.0.2.zip | Bin .../neat_url-2.0.3.zip | Bin .../neat_url-2.0.4.zip | Bin .../neat_url-2.0.5.zip | Bin .../neat_url-2.1.0.zip | Bin .../neat_url-2.1.1.zip | Bin .../neat_url-2.1.2.zip | Bin .../neat_url-3.0.0.zip | Bin .../neat_url-3.1.0.zip | Bin .../neat_url-3.1.1.zip | Bin .../neat_url-3.2.0.zip | Bin .../neat_url-4.0.0.zip | Bin .../neat_url-4.0.1.zip | Bin .../neat_url-4.1.0.zip | Bin .../neat_url-4.1.1.zip | Bin .../neat_url-4.1.2.zip | Bin .../neat_url-4.1.3.zip | Bin .../neat_url-4.1.4.chrome.zip | Bin .../neat_url-4.1.4.firefox.zip | Bin .../neat_url-4.1.5.chrome.zip | Bin .../neat_url-4.1.5.firefox.zip | Bin 70 files changed, 493 insertions(+), 146 deletions(-) rename Neat URL-webext/CHANGELOG.md => CHANGELOG.md (98%) delete mode 100644 GetArchive-webext/_locales/zh_CN/messages.json delete mode 100644 Neat URL-webext/.gitignore rename Neat URL-webext/README.md => README.md (91%) delete mode 100644 Scrollkey-webext/_locales/zh_CN/messages.json rename Neat URL-webext/TODO.md => TODO.md (100%) rename {Neat URL-webext/_locales => _locales}/en/messages.json (100%) rename {Neat URL-webext/_locales => _locales}/nl/messages.json (100%) rename {Neat URL-webext/_locales => _locales}/ru/messages.json (100%) rename {Neat URL-webext/_locales => _locales}/uk/messages.json (100%) rename {Neat URL-webext/_locales => _locales}/zh_CN/messages.json (100%) rename Neat URL-webext/background.js => background.js (74%) rename Neat URL-webext/build.sh => build.sh (93%) mode change 100755 => 100644 rename {Neat URL-webext/css => css}/options.chrome.css (100%) rename {Neat URL-webext/css => css}/options.css (100%) rename {Neat URL-webext/css => css}/options.firefox.css (100%) rename {Neat URL-webext/icons => icons}/dark/neaturl-48.png (100%) rename {Neat URL-webext/icons => icons}/dark/neaturl-96-state-1.png (100%) rename {Neat URL-webext/icons => icons}/dark/neaturl-96-state0.png (100%) rename {Neat URL-webext/icons => icons}/dark/neaturl-96-state0_disabled.png (100%) rename {Neat URL-webext/icons => icons}/dark/neaturl-96-state1.png (100%) rename {Neat URL-webext/icons => icons}/dark/neaturl-96-state2.png (100%) rename {Neat URL-webext/icons => icons}/dark/neaturl-96-state3.png (100%) rename {Neat URL-webext/icons => icons}/light/neaturl-48.png (100%) rename {Neat URL-webext/icons => icons}/light/neaturl-96-state-1.png (100%) rename {Neat URL-webext/icons => icons}/light/neaturl-96-state0.png (100%) rename {Neat URL-webext/icons => icons}/light/neaturl-96-state0_disabled.png (100%) rename {Neat URL-webext/icons => icons}/light/neaturl-96-state1.png (100%) rename {Neat URL-webext/icons => icons}/light/neaturl-96-state2.png (100%) rename {Neat URL-webext/icons => icons}/light/neaturl-96-state3.png (100%) create mode 100644 icons/neaturl-48.png create mode 100644 icons/neaturl-96-state-1.png create mode 100644 icons/neaturl-96-state0.png create mode 100644 icons/neaturl-96-state0_disabled.png create mode 100644 icons/neaturl-96-state1.png create mode 100644 icons/neaturl-96-state2.png create mode 100644 icons/neaturl-96-state3.png rename {Neat URL-webext/images => images}/Neat URL 4.1.4 in Chrome.png (100%) rename Neat URL-webext/manifest.json => manifest.json (55%) rename Neat URL-webext/options.html => options.html (65%) rename Neat URL-webext/options.js => options.js (73%) rename Neat URL-webext/publicsuffix-ccSLD.txt => publicsuffix-ccSLD.txt (100%) rename Neat URL-webext/toolbaricon.js => toolbaricon.js (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-1.0.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-1.0.1.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-1.1.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-1.2.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.0.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.0.1.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.0.2.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.0.3.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.0.4.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.0.5.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.1.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.1.1.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-2.1.2.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-3.0.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-3.1.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-3.1.1.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-3.2.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.0.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.0.1.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.1.0.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.1.1.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.1.2.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.1.3.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.1.4.chrome.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.1.4.firefox.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.1.5.chrome.zip (100%) rename {Neat URL-webext/web-ext-artifacts => web-ext-artifacts}/neat_url-4.1.5.firefox.zip (100%) diff --git a/Neat URL-webext/CHANGELOG.md b/CHANGELOG.md similarity index 98% rename from Neat URL-webext/CHANGELOG.md rename to CHANGELOG.md index aed95db..9ea4c01 100644 --- a/Neat URL-webext/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +<<<<<<< HEAD 4.1.5 ===== * Fix for item@jd.com @@ -150,6 +151,8 @@ ===== - Added utm_userid as default parameter +======= +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: 1.0.0 ===== - Fork of Lean URL, with features from Pure URL diff --git a/GetArchive-webext/_locales/zh_CN/messages.json b/GetArchive-webext/_locales/zh_CN/messages.json deleted file mode 100644 index ad8e399..0000000 --- a/GetArchive-webext/_locales/zh_CN/messages.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "extensionDescription": { - "message": "使用 archive.org 或 archive.is 获取一个网页从前的版本。", - "description": "" - }, - "search_engine": { - "message": "搜索引擎", - "description": "" - }, - "search_engine_descr": { - "message": "按 g 键使用搜索引擎", - "description": "" - }, - "ctrl_c": { - "message": "CTRL+C", - "description": "" - }, - "ctrl_c_descr": { - "message": "如果没有选中文本,CTRL+C 将复制网址", - "description": "" - }, - "ctrl_c_enable": { - "message": "启用 CTRL+C", - "description": "" - }, - "ctrl_c_require_focus": { - "message": "CTRL+C 仅在焦点于网页元素时生效", - "description": "" - }, - "prefer_long_link": { - "message": "偏好使用 archive.is 的短链接访问长链接", - "description": "" - }, - "default_archive_service": { - "message": "默认存档服务", - "description": "n" - }, - "default_archive_service_descr": { - "message": "工具栏按钮所使用的默认存档服务", - "description": "" - }, - "show_contextmenu_item_archiveorg": { - "message": "显示菜单项:Archive.org", - "description": "" - }, - "show_contextmenu_item_archiveis": { - "message": "显示菜单项:Archive.is", - "description": "" - }, - "show_contextmenu_item_webcitation": { - "message": "显示菜单项:WebCitation", - "description": "" - }, - "show_contextmenu_item_googlecache": { - "message": "显示菜单项:Google Cache", - "description": "" - }, - "automatic_forward": { - "message": "自动选择最佳链接(自动转向)", - "description": "" - }, - "related_tabs": { - "message": "在当前标签页旁打开新标签页", - "description": "" - }, - "related_tabs_descr": { - "message": "将新的标签页在当前标签页的旁边打开,以彰显便利和相关性", - "description": "" - }, - "keyboard_shortcut": { - "message": "键盘快捷键:", - "description": "" - }, - "automatic_retrieval": { - "message": "自动在载入出错时检索", - "description": "" - }, - "automatic_retrieval_descr": { - "message": "当“页面载入出错”页面显示时,自动使用默认的存档服务检索", - "description": "" - }, - "options_for": { - "message": "选项 - ", - "description": "" - }, - "save_preferences": { - "message": "保存设置", - "description": "" - } -} \ No newline at end of file diff --git a/Neat URL-webext/.gitignore b/Neat URL-webext/.gitignore deleted file mode 100644 index b31d62c..0000000 --- a/Neat URL-webext/.gitignore +++ /dev/null @@ -1 +0,0 @@ -browser-polyfill.min.js \ No newline at end of file diff --git a/Neat URL-webext/README.md b/README.md similarity index 91% rename from Neat URL-webext/README.md rename to README.md index b370996..61ad1ad 100644 --- a/Neat URL-webext/README.md +++ b/README.md @@ -4,7 +4,11 @@ Neat URL cleans URLs, removing parameters such as Google Analytics' utm paramete ## Blocked Parameters +<<<<<<< HEAD utm_source, utm_medium, utm_term, utm_content, utm_campaign, utm_reader, utm_place, utm_userid, utm_cid, utm_name, utm_pubreferrer, utm_swu, utm_viz_id, ga_source, ga_medium, ga_term, ga_content, ga_campaign, ga_place, yclid, _openstat, fb_action_ids, fb_action_types, fb_ref, fb_source, action_object_map, action_type_map, action_ref_map, gs_l, pd_rd_r@amazon.*, pd_rd_w@amazon.*, pd_rd_wg@amazon.*, _encoding@amazon.*, psc@amazon.*, ved@google.*, ei@google.*, sei@google.*, gws_rd@google.*, cvid@bing.com, form@bing.com, sk@bing.com, sp@bing.com, sc@bing.com, qs@bing.com, pq@bing.com, feature@youtube.com, gclid@youtube.com, kw@youtube.com, $/ref@amazon.&ast, _hsenc, mkt_tok, hmb_campaign, hmb_source, hmb_medium; +======= +utm_source, utm_medium, utm_term, utm_content, utm_campaign, utm_reader, utm_place, ga_source, ga_medium, ga_term, ga_content, ga_campaign, ga_place, yclid, _openstat, fb_action_ids, fb_action_types, fb_ref, fb_source, action_object_map, action_type_map, action_ref_map +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: ## Example @@ -22,6 +26,7 @@ Do you want to see neater URLs? Neat URL is just what you're looking for! +<<<<<<< HEAD ## Parameter rules A parameter is something that starts with ?. You can add your own parameter in the options of Neat URL. The ? is ommitted in the options, so a ?ved parameter becomes "ved". There are a few exceptions to this rule (see below) @@ -87,6 +92,8 @@ tt_medium, tt_content Other parameters you can consider: _hsmi, algo_expid, algo_pvid, aqs, bav, bih, biw, btsid, bvm, cn, cp, csi, dpr, dq, ech, forward, gs_gbg, gs_mss, gs_rn, iact, icid, iid, ijn, mc_cid, mc_eid, ncid, ndsp, nid, nr_email_referer, oq, pbx, pf, pf_rd_i, pf_rd_m, pf_rd_p, pf_rd_r, pf_rd_s, pf_rd_t, pq, prmd, psi, ref_, refsrc, sa, sclient, scroll, sr_share, stick, tbnid, vero_conv, vero_id, vet, ws_ab_test, yv +======= +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: ## History Neat URL is based on [Lean URL](https://github.com/xmikro/lean-url/). @@ -95,5 +102,8 @@ Neat URL contains a few improvements: * fixed for recent Firefox versions * a nice animation in the toolbar (can be changed or disabled) * domain-specific blocked parameters (to reach feature parity with Pure URL) +<<<<<<< HEAD * wildcard domain-specific blocked parameters -* wildcard at the end of blocked parameters (general or domain-specific) \ No newline at end of file +* wildcard at the end of blocked parameters (general or domain-specific) +======= +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: diff --git a/Scrollkey-webext/_locales/zh_CN/messages.json b/Scrollkey-webext/_locales/zh_CN/messages.json deleted file mode 100644 index baf8a91..0000000 --- a/Scrollkey-webext/_locales/zh_CN/messages.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "extensionDescription": { - "message": "以 VIM 式 j 和 k 键滚动页面。", - "description": "Description of the extension." - }, - "scrollvalue": { - "message": "滚动值", - "description": "" - }, - "scrollvalueshift": { - "message": "滚动值 (按住 Shift)", - "description": "" - }, - "scrollvaluealt": { - "message": "滚动值 (按住 Alt)", - "description": "" - }, - "pixels": { - "message": "像素", - "description": "" - }, - "pagedownpageup": { - "message": "PageDown 和 PageUp 键的滚动也采用上述值", - "description": "" - }, - "horizontalscroll": { - "message": "使用 J/K 键操控水平滚动", - "description": "" - }, - "horizontalscrollshift": { - "message": "使用 Shift+J/Shift+K 键操控水平滚动", - "description": "" - }, - "horizontalscrollalt": { - "message": "使用 Alt+J/Alt+K 键操控水平滚动", - "description": "" - }, - "savepreferences": { - "message": "保存设置", - "description": "" - }, - "notify_preferences_saved": { - "message": "设置已保存", - "description": "" - }, - "notify_tip_horizontal": { - "message": "此页面无法水平滚动。将首选项更改为垂直滚动或尝试配置其他快捷键。", - "description": "" - }, - "notify_tip_vertical": { - "message": "此页面无法垂直滚动。将首选项更改为垂直滚动或尝试配置其他快捷键。", - "description": "" - } -} \ No newline at end of file diff --git a/Neat URL-webext/TODO.md b/TODO.md similarity index 100% rename from Neat URL-webext/TODO.md rename to TODO.md diff --git a/Neat URL-webext/_locales/en/messages.json b/_locales/en/messages.json similarity index 100% rename from Neat URL-webext/_locales/en/messages.json rename to _locales/en/messages.json diff --git a/Neat URL-webext/_locales/nl/messages.json b/_locales/nl/messages.json similarity index 100% rename from Neat URL-webext/_locales/nl/messages.json rename to _locales/nl/messages.json diff --git a/Neat URL-webext/_locales/ru/messages.json b/_locales/ru/messages.json similarity index 100% rename from Neat URL-webext/_locales/ru/messages.json rename to _locales/ru/messages.json diff --git a/Neat URL-webext/_locales/uk/messages.json b/_locales/uk/messages.json similarity index 100% rename from Neat URL-webext/_locales/uk/messages.json rename to _locales/uk/messages.json diff --git a/Neat URL-webext/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json similarity index 100% rename from Neat URL-webext/_locales/zh_CN/messages.json rename to _locales/zh_CN/messages.json diff --git a/Neat URL-webext/background.js b/background.js similarity index 74% rename from Neat URL-webext/background.js rename to background.js index 0149588..d848c88 100644 --- a/Neat URL-webext/background.js +++ b/background.js @@ -1,3 +1,4 @@ +<<<<<<< HEAD // Sources: // * First version from Pure URL // * https://cheeky4n6monkey.blogspot.nl/2014/10/google-eid.html @@ -39,19 +40,37 @@ let neat_url_version; // previous version when upgrading, after upgrading the cu function init(){ let valueOrDefault = function(value, defaultValue){ +======= +/// Static variables +var defaultGlobalBlockedParams = "utm_source, utm_medium, utm_term, utm_content, utm_campaign, utm_reader, utm_place, ga_source, ga_medium, ga_term, ga_content, ga_campaign, ga_place, yclid, _openstat, fb_action_ids, fb_action_types, fb_ref, fb_source, action_object_map, action_type_map, action_ref_map"; // From Pure URL +var enabled = true; + +/// Preferences +var neat_url_blocked_params; // this is an array! +var neat_url_icon_animation; // none, missing_underscore, rotate or surprise_me + +function init(){ + var valueOrDefault = function(value, defaultValue){ +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: if(value == undefined) return defaultValue; return value; } +<<<<<<< HEAD let valueOrDefaultArray = function(value, defaultValue){ let calcValue = valueOrDefault(value, defaultValue); if(calcValue == "") return []; +======= + var valueOrDefaultArray = function(value, defaultValue){ + var calcValue = valueOrDefault(value, defaultValue); +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: return calcValue.split(" ").join("").split(","); } browser.storage.local.get([ "neat_url_blocked_params", +<<<<<<< HEAD "neat_url_icon_animation", "neat_url_icon_theme", "neat_url_show_counter", @@ -117,6 +136,17 @@ function init(){ suffixList = text.split("\n"); }); +======= + "neat_url_icon_animation" + ]).then((result) => { + //console.log("background.js neat_url_blocked_params " + result.neat_url_blocked_params); + neat_url_blocked_params = valueOrDefaultArray(result.neat_url_blocked_params, defaultGlobalBlockedParams); + //console.log("background.js neat_url_icon_animation " + result.neat_url_icon_animation); + neat_url_icon_animation = valueOrDefault(result.neat_url_icon_animation, "missing_underscore"); + }).catch(console.error); + + initBrowserAction(); +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: initContextMenus(); } init(); @@ -136,6 +166,7 @@ browser.runtime.onMessage.addListener(function(message) { } }); +<<<<<<< HEAD /// Browser action /// Neat URL code function initBrowserAction(){ @@ -153,15 +184,51 @@ function initBrowserAction(){ browser.browserAction.setIcon({path: resolveIconURL("neaturl-96-state0_disabled.png")}); browser.browserAction.setTitle({title: "Neat URL " + version + " - disabled"}); } +======= +// See also https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/Tabs/sendMessage +/*function sendMessage(action, data, errorCallback){ + function logTabs(tabs) { + for (tab of tabs) { + browser.tabs.sendMessage(tab.id, {"action": action, "data": data}).catch(function(){ + onError("failed to execute " + action + "with data " + data); + if(errorCallback) errorCallback(data); + }); + } + } + + browser.tabs.query({currentWindow: true, active: true}).then(logTabs, onError); +}*/ + +/// Browser action +/// Neat URL code +function initBrowserAction(){ + var version = browser.runtime.getManifest().version; + browser.browserAction.setTitle({title: "Neat URL " + version}); + + browser.browserAction.onClicked.addListener((tab) => { + if(enabled){ + browser.browserAction.setIcon({path: "icons/neaturl-96-state0_disabled.png"}); + browser.browserAction.setTitle({title: "Neat URL " + version + " - disabled"}); + } + else{ + browser.browserAction.setIcon({path: "icons/neaturl-96-state0.png"}); + browser.browserAction.setTitle({title: "Neat URL " + version + " - enabled"}); + } + + enabled = !enabled; +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: }); } /// Context menus /// Translate Now / Neat URL code function initContextMenus(){ +<<<<<<< HEAD browser.contextMenus.onClicked.removeListener(listener); browser.contextMenus.removeAll().catch(null); +======= +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: createContextMenu("neaturl-tb-preferences", "Preferences", ["browser_action"]); browser.contextMenus.onClicked.addListener(listener); } @@ -175,23 +242,42 @@ function createContextMenu(id, title, contexts){ }, onCreated); function onCreated(n) { +<<<<<<< HEAD //console.log(`[Neat URL]: Error: ${browser.runtime.lastError}`); +======= + if (browser.runtime.lastError) { + //console.log(`Error: ${browser.runtime.lastError}`); + } +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: } } /// Get Archive code function openPreferences(){ +<<<<<<< HEAD browser.runtime.openOptionsPage(); +======= + function onOpened() { + //console.log(`Options page opened`); + } + + browser.runtime.openOptionsPage().then(onOpened, onError); +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: } /// Translate Now / Lean URL code function listener(info,tab){ if(info.menuItemId == "neaturl-tb-preferences"){ +<<<<<<< HEAD +======= + // Open Preferences +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: openPreferences(); return; } } +<<<<<<< HEAD /// Neat URL code function upgradeParametersIfNeeded(){ let oldVersion = neat_url_version; @@ -450,11 +536,57 @@ function getRootDomain(domain) { } return domain; +======= +/// Lean URL code +function getParams(URL) { + var splitURL = URL.split("?"); + if ( splitURL.length == 1 ) { + return null; + } + + var params = {}; + rawParams = URL.split("?")[1].split("&"); + + for ( var i = 0; i < rawParams.length; i++ ) { + var rawParam = rawParams[i].split('='); + params[rawParam[0]] = rawParam[1]; + } + + return params; +} + +/// Lean URL code +function buildURL(baseURL, params) { + if ( Object.keys(params).length == 0 ) { + return baseURL; + } + + var newURL = baseURL + "?"; + + for ( var key in params ) { + newURL += key + "=" + params[key] + "&"; + } + newURL = newURL.slice(0, newURL.length-1); + + return newURL; +} + +/// Neat URL code +function getDomain(url) { + var arr = url.split("/")[2].split("."); + + if ( arr.length > 1 ) { + return arr[arr.length - 2] + "." + arr[arr.length - 1]; + } + + return null; +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: } /// Lean URL / Neat URL code function cleanURL(details) { if(!enabled) return; +<<<<<<< HEAD let url = new URL(details.url); let domain = url.hostname; @@ -587,20 +719,130 @@ function cleanURL(details) { } return { redirectUrl: leanURL.href }; +======= + + var baseURL = details.url.split("?")[0]; + + var params = getParams(details.url); + if ( params == null ) { + return; + } + + var domain = getDomain(details.url); + if ( domain == null ) { + return; + } + + var blockedParams = []; + for (let gbp of neat_url_blocked_params) { + if (gbp.indexOf("@") == -1) { + blockedParams.push(gbp); + continue; + } + + var keyValue = gbp.split("@")[0]; + var keyDomain = gbp.split("@")[1]; + + if( domain == keyDomain ) { + blockedParams.push(keyValue); + } + } + + var reducedParams = {}; + for ( var key in params ) { + if ( !blockedParams.includes(key) ) { + reducedParams[key] = params[key]; + } + } + + if ( Object.keys(reducedParams).length == Object.keys(params).length ) { + return; + } + + // Animate the toolbar icon + animateToolbarIcon(); + + leanURL = buildURL(baseURL, reducedParams); + return { redirectUrl: leanURL }; +} + +/// Lean URL / Neat URL code +browser.webRequest.onBeforeRequest.addListener( + cleanURL, + {urls: [""]}, + ["blocking"] +); + +/// Neat URL code +function animateToolbarIcon(){ + if(neat_url_icon_animation == "none") return; + + var defaultState = "icons/neaturl-96-state0.png"; + var images = []; + var imagesMissingUnderscore = ["icons/neaturl-96-state-1.png", defaultState, "icons/neaturl-96-state-1.png"]; + var imagesRotate = ["icons/neaturl-96-state1.png", "icons/neaturl-96-state2.png", "icons/neaturl-96-state3.png"]; + + if(neat_url_icon_animation == "missing_underscore") + images = imagesMissingUnderscore + if(neat_url_icon_animation == "rotate") + images = imagesRotate + + if(images.length == 0 && neat_url_icon_animation == "surprise_me"){ + // https://stackoverflow.com/questions/4959975/generate-random-number-between-two-numbers-in-javascript + var zeroOrOne = Math.floor(Math.random() * 2); + + if(zeroOrOne == 0) + images = imagesMissingUnderscore + if(zeroOrOne == 1) + images = imagesRotate + } + + var time = 350 * images.length; + + // Set first state + browser.browserAction.setIcon({path: images[0]}); + + if(images.length > 1){ + setTimeout(function(){ + browser.browserAction.setIcon({path: images[1]}); + }, 1 * time); + } + + if(images.length > 2){ + setTimeout(function(){ + browser.browserAction.setIcon({path: images[2]}); + }, 2 * time); + } + + // Reset to default state + setTimeout(function(){ + browser.browserAction.setIcon({path: defaultState}); + }, 3 * time); +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: } /// Translate Now code function notify(message){ +<<<<<<< HEAD browser.notifications.create(message.substring(0, 20), { type: "basic", iconUrl: browser.extension.getURL(resolveIconUrlNotif("neaturl-96-state0.png")), +======= + browser.notifications.create(message.substring(0, 20).replace(" ", ""), + { + type: "basic", + iconUrl: browser.extension.getURL("icons/neaturl-96-state0.png"), +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: title: "Neat URL", message: message }); } +<<<<<<< HEAD String.prototype.replaceAll = function(search, replacement) { let target = this; return target.replace(new RegExp(search, 'g'), replacement); }; +======= +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: diff --git a/Neat URL-webext/build.sh b/build.sh old mode 100755 new mode 100644 similarity index 93% rename from Neat URL-webext/build.sh rename to build.sh index 505a274..21d9421 --- a/Neat URL-webext/build.sh +++ b/build.sh @@ -1,4 +1,5 @@ #!/bin/bash +<<<<<<< HEAD NEATURLVERSION=$(jq -r '.version' manifest.json) echo "Building Neat URL $NEATURLVERSION" echo "Requirements:" @@ -68,3 +69,6 @@ rm -rf build echo "" echo "Done building Neat URL $NEATURLVERSION:" find web-ext-artifacts -mmin -1 -type f -print +======= +web-ext build --ignore-files build.sh images *.md +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: diff --git a/Neat URL-webext/css/options.chrome.css b/css/options.chrome.css similarity index 100% rename from Neat URL-webext/css/options.chrome.css rename to css/options.chrome.css diff --git a/Neat URL-webext/css/options.css b/css/options.css similarity index 100% rename from Neat URL-webext/css/options.css rename to css/options.css diff --git a/Neat URL-webext/css/options.firefox.css b/css/options.firefox.css similarity index 100% rename from Neat URL-webext/css/options.firefox.css rename to css/options.firefox.css diff --git a/Neat URL-webext/icons/dark/neaturl-48.png b/icons/dark/neaturl-48.png similarity index 100% rename from Neat URL-webext/icons/dark/neaturl-48.png rename to icons/dark/neaturl-48.png diff --git a/Neat URL-webext/icons/dark/neaturl-96-state-1.png b/icons/dark/neaturl-96-state-1.png similarity index 100% rename from Neat URL-webext/icons/dark/neaturl-96-state-1.png rename to icons/dark/neaturl-96-state-1.png diff --git a/Neat URL-webext/icons/dark/neaturl-96-state0.png b/icons/dark/neaturl-96-state0.png similarity index 100% rename from Neat URL-webext/icons/dark/neaturl-96-state0.png rename to icons/dark/neaturl-96-state0.png diff --git a/Neat URL-webext/icons/dark/neaturl-96-state0_disabled.png b/icons/dark/neaturl-96-state0_disabled.png similarity index 100% rename from Neat URL-webext/icons/dark/neaturl-96-state0_disabled.png rename to icons/dark/neaturl-96-state0_disabled.png diff --git a/Neat URL-webext/icons/dark/neaturl-96-state1.png b/icons/dark/neaturl-96-state1.png similarity index 100% rename from Neat URL-webext/icons/dark/neaturl-96-state1.png rename to icons/dark/neaturl-96-state1.png diff --git a/Neat URL-webext/icons/dark/neaturl-96-state2.png b/icons/dark/neaturl-96-state2.png similarity index 100% rename from Neat URL-webext/icons/dark/neaturl-96-state2.png rename to icons/dark/neaturl-96-state2.png diff --git a/Neat URL-webext/icons/dark/neaturl-96-state3.png b/icons/dark/neaturl-96-state3.png similarity index 100% rename from Neat URL-webext/icons/dark/neaturl-96-state3.png rename to icons/dark/neaturl-96-state3.png diff --git a/Neat URL-webext/icons/light/neaturl-48.png b/icons/light/neaturl-48.png similarity index 100% rename from Neat URL-webext/icons/light/neaturl-48.png rename to icons/light/neaturl-48.png diff --git a/Neat URL-webext/icons/light/neaturl-96-state-1.png b/icons/light/neaturl-96-state-1.png similarity index 100% rename from Neat URL-webext/icons/light/neaturl-96-state-1.png rename to icons/light/neaturl-96-state-1.png diff --git a/Neat URL-webext/icons/light/neaturl-96-state0.png b/icons/light/neaturl-96-state0.png similarity index 100% rename from Neat URL-webext/icons/light/neaturl-96-state0.png rename to icons/light/neaturl-96-state0.png diff --git a/Neat URL-webext/icons/light/neaturl-96-state0_disabled.png b/icons/light/neaturl-96-state0_disabled.png similarity index 100% rename from Neat URL-webext/icons/light/neaturl-96-state0_disabled.png rename to icons/light/neaturl-96-state0_disabled.png diff --git a/Neat URL-webext/icons/light/neaturl-96-state1.png b/icons/light/neaturl-96-state1.png similarity index 100% rename from Neat URL-webext/icons/light/neaturl-96-state1.png rename to icons/light/neaturl-96-state1.png diff --git a/Neat URL-webext/icons/light/neaturl-96-state2.png b/icons/light/neaturl-96-state2.png similarity index 100% rename from Neat URL-webext/icons/light/neaturl-96-state2.png rename to icons/light/neaturl-96-state2.png diff --git a/Neat URL-webext/icons/light/neaturl-96-state3.png b/icons/light/neaturl-96-state3.png similarity index 100% rename from Neat URL-webext/icons/light/neaturl-96-state3.png rename to icons/light/neaturl-96-state3.png diff --git a/icons/neaturl-48.png b/icons/neaturl-48.png new file mode 100644 index 0000000000000000000000000000000000000000..da51bacb3bf53306fe858928fecd02d02d7ac1a6 GIT binary patch literal 555 zcmV+`0@VG9P)Ep!_a zxDag9CTNo=xYyOxI{X8ywF|)_C0vbBZG;dkm53m5n$zYjE|(b}GmP`@m3!dAdG{SI zzwf^DIQJfz88KUl$SnaRfCP{L62RF5NGeIXFR3bNThb3n$CAEFdM9Z{(#1ju%qnrF=b#j6Yj?K zg#d5^*vUk#0R5-LKJ&iBXecRk8F=CDdW*QL9>7$u07^MO_%Ab?H?w+9+yU^%nHq|! z4oJEV3^-HYVk>0N9lrs545kj`C%y($f(HO@0$)7w8^E=o zDsc<(Bfw8j{1R}X*W%j-00ew;gx7(`MF{T{V9eY3r$vg-Eo4pXq2qrBmSeln3_Jds znf;3mV9@cu#(1TaRCwC$oKJ{VRUF4Z=lT3ISxQL;1Gz*v9<7z?lfV*wUm zEWiSc1(ce4svCz8767jS13>>>*IeKl@OyTh1%`p6l18c~AQX8f9731{tOnlAg71{0 zz;;OoETFUCrvaOQEx;oM^y?(BO41J&5D$Mb@XZ+i$LDba*d%GE1+)%-74Ri6Jz*c; zlC;|b?hk)$7JeryseiJolZXFp;1x;7Ea1QJ-vK^vqx3i6Yv2IzD=-2Gm=8P-JOiu; z7Dn!K26$RhqjUx&b#wtkS%`VpIpB4m*2ev&03Wt-&kddSbuwII5%3_ew?#+|;1l41 zG2HjPh=5}jaBpBA0Hb#WGzzR3S7+dOj(`U6SlI;B#xZs60A2+yW#O!rv~Qd<;un$E zCX4+l;$8{EA%rEsbCUKK(4W{!r{4nZmoSp8Zi?Viq``+{|{h|q?J_( zzgr_<2k=Iu<|HsE=@%+SNcpjj>{a!N$VfXx^C0Is6(sc(v?cOy>;;xqHTfxsr@Ip@8kCKjHk_woY({|9&rx);WPTP4$pI$&; zPTOTi-=&>!3mT5Tw*rg>lz$`Emm~PEvYv2F7y-spkOdeEumEEL7GPSF^h`MWEBYat zzX1}>v)?^c__@hM*obWgJ_4rxujy}Ko1~8&e_ z)s(A1zoeUf2p7u$?R~OlHt>{JLB;b#2enUHK=J(CL2c!aCR02EX43o?+>A)+ZD6jX zs~!ObBI!o9{EV@+>fxtchEB3-C_Zcm!C0u>cD&7GMF!0xZB-fCZSu Z{0qcD0a~3jw$T6p002ovPDHLkV1jqB&eQ+^ literal 0 HcmV?d00001 diff --git a/icons/neaturl-96-state0.png b/icons/neaturl-96-state0.png new file mode 100644 index 0000000000000000000000000000000000000000..9eeccebdfd28c0a81bedaa9e560f0120c461a5fd GIT binary patch literal 1075 zcmV-31kC%1P)^3cY-8L@2EKf3$OrV0Ty5^zygc~Sb(tr3osU70mcF> zz*v9<7z-#h^;9PgA>0Ez1q=a$*BtYJi@-10aU2*04oDiSnt)K`o^S|Z4zLSHW8Q36cn+3EEe-*F=n31rL zD<$o+fE&YqDGR@onbhCe(aFvKD)5A)gBI{#_^$vTwNd&bumji+d=HEP0`3MD01pB$ z0}CVPIR-o+sZlxuk~%toku1c#;}ozAsI_svX~3IpoO4~LeVq!&L(H%b`GW;aD}F48{7PeaoZ3;0(HNK0&t|Jef4 zvL>gk0UWY`R7>&@9tVbVO1_nJ(E`$hKLmUlDf^&|&w^@w5dQLP0d{*%+0ktEZ2<)a zUk@Q{0`>v3b4o7(YbA}BQ9!*%;olEz10IT$UICU%IzmaQ^&tFpG`AdM;r{_VCux)t zQ}1H%1Hgxosph|Y2fQHZC?%)frSNA0Ujj?pDE|a_wTx5Fo(w@Dgc`7`jqra1)<{}W zmGHZD1#AYMjno_lh9#Y)VuX|*>&PBeABtRQU(nphxkLp?Jp^rx{Ea=p(^U;W=@k${ zxC8hpXP7$%JR<1|6(;2s@L1#?^Lo|8Pc7iloVJsazQQCGa92*-=Z-$TfVnwsryYHI z0RuU0=N)~QR>Cc4IQrfSFcwh$h1fuj;6KZ{!__wejE5i#Fcx3|#sVzBv?l4EaP}+u z5t{D+iRRw#?kc=)(hm!Hll`3wT%3JB~k*fb0_n+aqObC2h5Uf(3*SX3*RV zj(s)d0x&4)ci)7IWr+4ZS#v9}*t4MGxwnJb`z)Y%&U8>)`K`$m_kdeyehY49r1UB< zPtpZn0Rpv8n3er<{gP%ch|tElTzRBi@ur|8njy@FK7zTL~WlwoBUWC0G{( znBL5Sj0H>`>QlM%A%yufKcUud{Lt>3-&6V?5JLD2c%~1#wp7yB9)f%iFcx3|#sa(& tHogKZz*v9<7z?lfV*wUmEWiQ`z&}i^3s$zpahCu9002ovPDHLkV1n@4(mwzI literal 0 HcmV?d00001 diff --git a/icons/neaturl-96-state0_disabled.png b/icons/neaturl-96-state0_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..26be2b704c6bd0927f20433dbc90f6c690f4cd4c GIT binary patch literal 1006 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 literal 0 HcmV?d00001 diff --git a/icons/neaturl-96-state3.png b/icons/neaturl-96-state3.png new file mode 100644 index 0000000000000000000000000000000000000000..3cfb917da8ca8d6ac4734255b474589500de6432 GIT binary patch literal 1082 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGooCO|{#S9GG!XV7ZFl&wk0|WCL zPZ!6Kid%2zcxT9kO0><_?_ImibZr-hnCR{mYdf5}GaOgMhOF(7);Ha%#U|qDurT6#-Q|eufvX3O9$@&u{XzJ{)+P7Pn=o#k#H^IWXux8_u;zSbrSO69 z1E&w@dDcfd7*DNd{=ijml_&2uJCEnBY{t2v|H2;dCM2Fsy!UoenKkG2)qj3BZqE+0 zI}r3>a>tINx(Uyw?w9((7IDd8$K(TFCw<$=8j`+b;VE_t=^LVg&!Zf+uCF)VuQPVM(`z7%?(=t0l}vxF^A_8puO{!Dz5ly!q>16SX1?|1h(WOR4@mnf*5 z{Ql0{#V^G+EL@Niaj9EX{&3y{H-&sR8-^aYBSGbkH*?Nd)=N~ZOX{}a$kE=BB5NQf zm>zlHf8^xif2E$n#xKO|ndWKkc#@W&^7r{6HFkk+<)m5{9@isn9TC^EEguB<-QT;? zZOuQE=^Cdr*Tgu*Uy$ToaKG8YVv`(2RY6YR3Zy=X}1cv}ipe z=j2KASk|Rx`TGgiZ>v$~6**P0nU~R*-#L8Q!UVDHUca_H?7ZBX`SOv~1EB{t3BR7a zS$3sW^r$4;Jl#nunXl)_x2er!FKR1nZ#-ID8mOaN-{W8XT=>8@zqX5;tpvT}FDD=H zwmhouQI)iA-D#I2O3Tdn*Rbtl|K|N`@zwNg3JDArOmpT3+RRilNuCil$zW2Qc7(@k z=6k&zj^VZ5x(ZvHS~DxAZx_#C+TnbuJ&*CN%D2l0_Gad4bbs7(>80L^wFf4BW9Cow znWffHt@8K5tNhCHElVbldCN`wPgG1+G(sRoXrQ0PwLx! lYq!FI5=C|_S>*rIeCI9e7c>>>>>> 2729b1a... Neat URL-webext 1.0.0: }, "applications": { "gecko": { @@ -18,13 +31,21 @@ "strict_min_version": "48.0" } }, +<<<<<<< HEAD "permissions": ["storage", "notifications", "contextMenus", "webRequest", "webRequestBlocking", "tabs", ""], +======= + "permissions": ["storage", "notifications", "contextMenus", "webRequest", "webRequestBlocking", ""], +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: "options_ui": { "page": "options.html", "browser_style": true }, "browser_action": { +<<<<<<< HEAD "default_icon": "icons/dark/neaturl-96-state0.png", +======= + "default_icon": "icons/neaturl-96-state0.png", +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: "browser_style": true } } diff --git a/Neat URL-webext/options.html b/options.html similarity index 65% rename from Neat URL-webext/options.html rename to options.html index 53a04f9..44ae778 100644 --- a/Neat URL-webext/options.html +++ b/options.html @@ -1,3 +1,4 @@ +<<<<<<< HEAD @@ -151,4 +152,146 @@

Advanced

+======= + + + + + + + + +
+ Refresh this page (F5) to see the options of Neat URL +
+ + + + + + +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: \ No newline at end of file diff --git a/Neat URL-webext/options.js b/options.js similarity index 73% rename from Neat URL-webext/options.js rename to options.js index c2aa2b9..ab6b0cb 100644 --- a/Neat URL-webext/options.js +++ b/options.js @@ -1,3 +1,4 @@ +<<<<<<< HEAD const PREFS = { "neat_url_blocked_params": { "type": "value", @@ -189,3 +190,71 @@ function useCorrectStylesheet(){ window.addEventListener("DOMContentLoaded", init, { passive: true }); document.querySelector("form").addEventListener("submit", (e) => { e.preventDefault(); saveOptions(); }, { passive: false }); window.addEventListener("resize", render); +======= +const PREFS = { + "neat_url_blocked_params": { + "type": "value", + "default": "utm_source, utm_medium, utm_term, utm_content, utm_campaign, utm_reader, utm_place, ga_source, ga_medium, ga_term, ga_content, ga_campaign, ga_place, yclid, _openstat, fb_action_ids, fb_action_types, fb_ref, fb_source, action_object_map, action_type_map, action_ref_map" + }, + "neat_url_icon_animation": { + "type": "value", + "default": "missing_underscore" + } +}; + +function saveOptions() { + browser.runtime.sendMessage({action: "notify", data: "Saved preferences"}); + + const values = {}; + for(let p in PREFS) { + values[p] = document.getElementById(p)[PREFS[p].type]; + } + + browser.storage.local.set(values).then(() => browser.runtime.sendMessage({action: "refresh-options"})); +} + +function restoreOptions() { + browser.storage.local.get(Object.keys(PREFS)).then((result) => { + let val; + for(let p in PREFS) { + if(p in result) { + val = result[p]; + } + else { + val = PREFS[p].default; + } + document.getElementById(p)[PREFS[p].type] = val; + console.log("options.js val restored is " + val); + } + }).catch(console.error); +} + +function init(){ + render(); + restoreOptions(); + document.querySelector("form").style.display = "block"; + document.querySelector(".refreshOptions").style.display = "none"; +} + +function render(){ + var sheet = document.styleSheets[0]; + + // https://stackoverflow.com/questions/29927992/remove-css-rules-by-javascript + if (sheet.cssRules) { + for (var i = 0; i < sheet.cssRules.length; i++) { + if (sheet.cssRules[i].selectorText === '.labelbox') { + sheet.deleteRule(i); + } + } + } + + var width = document.documentElement.clientWidth; + var cssRule = ".labelbox{ min-width: " + width / 3 + "px;}"; + + sheet.insertRule(cssRule, 1); +} + +window.addEventListener("DOMContentLoaded", init, { passive: true }); +document.querySelector("form").addEventListener("submit", (e) => { e.preventDefault(); saveOptions(); }, { passive: false }); +window.addEventListener("resize", render); +>>>>>>> 2729b1a... Neat URL-webext 1.0.0: diff --git a/Neat URL-webext/publicsuffix-ccSLD.txt b/publicsuffix-ccSLD.txt similarity index 100% rename from Neat URL-webext/publicsuffix-ccSLD.txt rename to publicsuffix-ccSLD.txt diff --git a/Neat URL-webext/toolbaricon.js b/toolbaricon.js similarity index 100% rename from Neat URL-webext/toolbaricon.js rename to toolbaricon.js diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-1.0.0.zip b/web-ext-artifacts/neat_url-1.0.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-1.0.0.zip rename to web-ext-artifacts/neat_url-1.0.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-1.0.1.zip b/web-ext-artifacts/neat_url-1.0.1.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-1.0.1.zip rename to web-ext-artifacts/neat_url-1.0.1.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-1.1.0.zip b/web-ext-artifacts/neat_url-1.1.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-1.1.0.zip rename to web-ext-artifacts/neat_url-1.1.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-1.2.0.zip b/web-ext-artifacts/neat_url-1.2.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-1.2.0.zip rename to web-ext-artifacts/neat_url-1.2.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.0.0.zip b/web-ext-artifacts/neat_url-2.0.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.0.0.zip rename to web-ext-artifacts/neat_url-2.0.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.0.1.zip b/web-ext-artifacts/neat_url-2.0.1.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.0.1.zip rename to web-ext-artifacts/neat_url-2.0.1.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.0.2.zip b/web-ext-artifacts/neat_url-2.0.2.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.0.2.zip rename to web-ext-artifacts/neat_url-2.0.2.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.0.3.zip b/web-ext-artifacts/neat_url-2.0.3.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.0.3.zip rename to web-ext-artifacts/neat_url-2.0.3.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.0.4.zip b/web-ext-artifacts/neat_url-2.0.4.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.0.4.zip rename to web-ext-artifacts/neat_url-2.0.4.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.0.5.zip b/web-ext-artifacts/neat_url-2.0.5.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.0.5.zip rename to web-ext-artifacts/neat_url-2.0.5.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.1.0.zip b/web-ext-artifacts/neat_url-2.1.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.1.0.zip rename to web-ext-artifacts/neat_url-2.1.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.1.1.zip b/web-ext-artifacts/neat_url-2.1.1.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.1.1.zip rename to web-ext-artifacts/neat_url-2.1.1.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-2.1.2.zip b/web-ext-artifacts/neat_url-2.1.2.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-2.1.2.zip rename to web-ext-artifacts/neat_url-2.1.2.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-3.0.0.zip b/web-ext-artifacts/neat_url-3.0.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-3.0.0.zip rename to web-ext-artifacts/neat_url-3.0.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-3.1.0.zip b/web-ext-artifacts/neat_url-3.1.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-3.1.0.zip rename to web-ext-artifacts/neat_url-3.1.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-3.1.1.zip b/web-ext-artifacts/neat_url-3.1.1.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-3.1.1.zip rename to web-ext-artifacts/neat_url-3.1.1.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-3.2.0.zip b/web-ext-artifacts/neat_url-3.2.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-3.2.0.zip rename to web-ext-artifacts/neat_url-3.2.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.0.0.zip b/web-ext-artifacts/neat_url-4.0.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.0.0.zip rename to web-ext-artifacts/neat_url-4.0.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.0.1.zip b/web-ext-artifacts/neat_url-4.0.1.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.0.1.zip rename to web-ext-artifacts/neat_url-4.0.1.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.1.0.zip b/web-ext-artifacts/neat_url-4.1.0.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.1.0.zip rename to web-ext-artifacts/neat_url-4.1.0.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.1.1.zip b/web-ext-artifacts/neat_url-4.1.1.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.1.1.zip rename to web-ext-artifacts/neat_url-4.1.1.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.1.2.zip b/web-ext-artifacts/neat_url-4.1.2.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.1.2.zip rename to web-ext-artifacts/neat_url-4.1.2.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.1.3.zip b/web-ext-artifacts/neat_url-4.1.3.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.1.3.zip rename to web-ext-artifacts/neat_url-4.1.3.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.1.4.chrome.zip b/web-ext-artifacts/neat_url-4.1.4.chrome.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.1.4.chrome.zip rename to web-ext-artifacts/neat_url-4.1.4.chrome.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.1.4.firefox.zip b/web-ext-artifacts/neat_url-4.1.4.firefox.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.1.4.firefox.zip rename to web-ext-artifacts/neat_url-4.1.4.firefox.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.1.5.chrome.zip b/web-ext-artifacts/neat_url-4.1.5.chrome.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.1.5.chrome.zip rename to web-ext-artifacts/neat_url-4.1.5.chrome.zip diff --git a/Neat URL-webext/web-ext-artifacts/neat_url-4.1.5.firefox.zip b/web-ext-artifacts/neat_url-4.1.5.firefox.zip similarity index 100% rename from Neat URL-webext/web-ext-artifacts/neat_url-4.1.5.firefox.zip rename to web-ext-artifacts/neat_url-4.1.5.firefox.zip