From 55bd396e4b75fc8c796fec1a21437457752f05c5 Mon Sep 17 00:00:00 2001 From: tao Date: Fri, 12 Nov 2021 19:28:18 +0200 Subject: [PATCH 1/5] add several meanings result --- background/background.js | 29 ++++++++++++++++++----------- content_scripts/dictionary.js | 16 +++++++++++++++- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/background/background.js b/background/background.js index f50f220..41a7d6b 100644 --- a/background/background.js +++ b/background/background.js @@ -33,17 +33,24 @@ function extractMeaning (document, context) { if (!document.querySelector("[data-dobid='hdw']")) { return null; } var word = document.querySelector("[data-dobid='hdw']").textContent, - definitionDiv = document.querySelector("div[data-dobid='dfn']"), - meaning = ""; - - if (definitionDiv) { - definitionDiv.querySelectorAll("span").forEach(function(span){ - if(!span.querySelector("sup")) - meaning = meaning + span.textContent; - }); + definitionDivNodeList = document.querySelectorAll("div[data-dobid='dfn']"), + meaningArray = []; + + if(definitionDivNodeList) { + definitionDivNodeList.forEach((definitionDiv) => { + if (definitionDiv) { + definitionDiv.querySelectorAll("span").forEach( function(span) { + if(!span.querySelector("sup")) { + meaningArray.push(span.textContent); + } + }); + } + }); + } + + for(var i = 0; i < meaningArray.length; i++) { + meaningArray[i] = meaningArray[i][0].toUpperCase() + meaningArray[i].substring(1); } - - meaning = meaning[0].toUpperCase() + meaning.substring(1); var audio = document.querySelector("audio[jsname='QInZvb']"), source = document.querySelector("audio[jsname='QInZvb'] source"), @@ -67,7 +74,7 @@ function extractMeaning (document, context) { audioSrc = `${GOOGLE_SPEECH_URI}?${queryString}`; } - return { word: word, meaning: meaning, audioSrc: audioSrc }; + return { word: word, meaningArray: meaningArray, audioSrc: audioSrc }; }; function saveWord (content) { diff --git a/content_scripts/dictionary.js b/content_scripts/dictionary.js index fbb2595..6cfcbe2 100644 --- a/content_scripts/dictionary.js +++ b/content_scripts/dictionary.js @@ -148,13 +148,27 @@ return oRect; } + function meaningArrayToParagraphList(meaningArray) { + var meaningList = document.createElement("ul"); + meaningList.style = "margin-top: 0px; margin-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; padding-bottom: 0px;"; + meaningArray.forEach(function(meaning) { + var meaningItem = document.createElement("li"); + meaningItem.style = "margin-block-start: 0px; margin-block-end: 0px; display: list-item;"; + meaningItem.textContent = meaning; + meaningList.appendChild(meaningItem); + }); + return meaningList; + } + + function appendToDiv(createdDiv, content){ var hostDiv = createdDiv.heading.getRootNode().host; var popupDiv = createdDiv.heading.getRootNode().querySelectorAll("div")[1]; var heightBefore = popupDiv.clientHeight; createdDiv.heading.textContent = content.word; - createdDiv.meaning.textContent = content.meaning; + createdDiv.meaning.textContent = ""; + createdDiv.meaning.appendChild(meaningArrayToParagraphList(content.meaningArray)); createdDiv.moreInfo.textContent = "More »"; var heightAfter = popupDiv.clientHeight; From 572aed3bb32ab0cdefcc26fc7bf46034df319e25 Mon Sep 17 00:00:00 2001 From: Diulgher Artiom <42372666+GeneralTao2@users.noreply.github.com> Date: Fri, 12 Nov 2021 19:59:39 +0200 Subject: [PATCH 2/5] fix mistake with `meaning` building --- background/background.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/background/background.js b/background/background.js index 41a7d6b..ac6e364 100644 --- a/background/background.js +++ b/background/background.js @@ -39,13 +39,15 @@ function extractMeaning (document, context) { if(definitionDivNodeList) { definitionDivNodeList.forEach((definitionDiv) => { if (definitionDiv) { + var meaning = "" definitionDiv.querySelectorAll("span").forEach( function(span) { if(!span.querySelector("sup")) { - meaningArray.push(span.textContent); + meaning = meaning + span.textContent; } }); + meaningArray.push(meaning); } - }); + }); } for(var i = 0; i < meaningArray.length; i++) { @@ -91,4 +93,4 @@ function saveWord (content) { definitions }); }) -} \ No newline at end of file +} From 000a4670763a9e9b33cd33f15bde9da2facff468 Mon Sep 17 00:00:00 2001 From: tao Date: Sat, 13 Nov 2021 20:01:09 +0200 Subject: [PATCH 3/5] fix broken `saveWord` --- background/background.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/background/background.js b/background/background.js index ac6e364..b56d796 100644 --- a/background/background.js +++ b/background/background.js @@ -81,14 +81,14 @@ function extractMeaning (document, context) { function saveWord (content) { let word = content.word, - meaning = content.meaning, + meaningArray = content.meaningArray, storageItem = browser.storage.local.get('definitions'); storageItem.then((results) => { let definitions = results.definitions || {}; - definitions[word] = meaning; + definitions[word] = meaningArray.join(' '); browser.storage.local.set({ definitions }); From 0cc5d0b61ff2bc61db9e7666f0578babab511f0c Mon Sep 17 00:00:00 2001 From: tao Date: Sat, 13 Nov 2021 20:45:34 +0200 Subject: [PATCH 4/5] fix broken code style --- et HEAD~ | 236 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 et HEAD~ diff --git a/et HEAD~ b/et HEAD~ new file mode 100644 index 0000000..0373865 --- /dev/null +++ b/et HEAD~ @@ -0,0 +1,236 @@ +commit d8649f931cb52c82f43d1aaf3f4a55f42161b116 (HEAD -> master) +Author: tao +Date: Sat Nov 13 20:01:09 2021 +0200 + + fix broken `saveWord` + +commit 572aed3bb32ab0cdefcc26fc7bf46034df319e25 +Author: Diulgher Artiom <42372666+GeneralTao2@users.noreply.github.com> +Date: Fri Nov 12 19:59:39 2021 +0200 + + fix mistake with `meaning` building + +commit 55bd396e4b75fc8c796fec1a21437457752f05c5 +Author: tao +Date: Fri Nov 12 19:28:18 2021 +0200 + + add several meanings result + +commit 50ad68b1da6a772a1cf41beda4f1ea181ddc5cc3 +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Tue Aug 17 23:13:48 2021 +0530 + + Update README.md + +commit 81be174b8a5ee2697cc880b91b60842da5ef1685 +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Tue Aug 17 23:12:09 2021 +0530 + + Update README.md + +commit 0c416734505ec025cfb003352acd80b062afbe9a +Author: Suraj Jain +Date: Mon Dec 21 01:39:56 2020 +0530 + + Updated Extension to v1.1.0 + +commit 19f517473b6070b011804f00ef505e7904f91e23 +Author: Suraj Jain +Date: Mon Dec 21 01:39:37 2020 +0530 + + Allowed user to choose Ctrl/Command keys as trigger key. Extension will detect user Operating System to show him relevant trigger keys. + +commit c9bf04ec1680df369436144d1504d653c4007734 (tag: v1.0.10) +Author: Suraj Jain +Date: Fri Dec 4 23:17:29 2020 +0530 + + Updated Extension to v1.0.10 + +commit f1a5fb0029bc7bff8b28558eaddd4f770ffa246d +Author: Suraj Jain +Date: Fri Dec 4 23:15:40 2020 +0530 + + Fixed incorrect setting of zIndex property on hostDiv + +commit 6437fe52352d019d02c83566dcc071f44f8d9a25 +Author: Suraj Jain +Date: Fri Dec 4 23:01:46 2020 +0530 + + Updated Extension to v1.0.9 + +commit fadec8335851c3edb01fa10fef27dc9400c0841c +Merge: b48205a 650de40 +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Thu Nov 26 11:01:28 2020 +0530 + + Merge pull request #33 from AxelDavid45/master + + Added ZIndex property to fix div hidden + +commit b48205a57a5cbcaa02dccea2c0a61ed70bead259 +Author: Suraj Jain +Date: Wed Nov 25 09:08:54 2020 +0530 + + Updated Extension to v1.0.8 + +commit 94a2d956b6bd39c80c621bf016ec4e09bd4f82f9 +Author: Suraj Jain +Date: Wed Nov 25 09:06:56 2020 +0530 + + Fixed issue where definitions of word was not being parsed properly because google sends localized meaning, using gl (geolocation) query param to go around that + +commit 650de40eefe8dc7b3537a0651a8b5d82f5f03104 +Author: Axel David Espinosa Meneses +Date: Sun Oct 11 12:21:28 2020 -0500 + + ZIndex updated + + I updated the zindex value to keep it for sure always on top + +commit 8dddb0f9da901a5fad684e83cf4e11506c10fead +Author: Axel David Espinosa Meneses +Date: Sat Oct 3 13:19:52 2020 -0500 + + Added ZIndex property to fix div hidden + + I added a Z-Index property to fix a problem in some websites where the div that contains the word information is hidden. + For example, in the Google Assistant Documentation, the div that contains the word information is under the information because of the z-index. + +commit 2f7f32a7bf780d783ad70ff4f0e6b147749b07a9 +Author: Suraj Jain +Date: Sat Sep 5 01:28:53 2020 +0530 + + Updated extension v1.0.7 + +commit 8097b3c80b95bf775114a221705fa0fb1b380f23 +Author: Suraj Jain +Date: Sat Sep 5 01:28:15 2020 +0530 + + Fixed history setting + +commit dcf2f559aa5719055d05b762da058f90610eba3a +Author: meetDeveloper +Date: Sat Jul 18 00:57:15 2020 +0530 + + Updated extension v1.0.6 + +commit e8400aad2ba923bba216b70bd70bf006e8e944ad +Merge: b17bf48 6cd03a7 +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Sat Jul 18 00:50:16 2020 +0530 + + Merge pull request #21 from slay2k/bugfix_undefined_URI + + Bugfix to move 'GOOGLE_SPEECH_URI' definition + +commit 6cd03a786d41c78b42b117620c849cedcc5b9624 +Author: Romy Maxwell +Date: Fri Jul 17 14:50:34 2020 -0400 + + Typo + +commit 7395697205c5b874f2925364e74bb8edfb0a1ddf +Author: Romy Maxwell +Date: Fri Jul 17 14:49:19 2020 -0400 + + Adding const + +commit 5694c18ab9c037f541c512559d93f6debaf2a1ea +Author: Romy Maxwell +Date: Fri Jul 17 13:27:39 2020 -0400 + + Bugfix to move 'GOOGLE_SPEECH_URI' definition + +commit b17bf488b1f029070cdf765eeb4479fa6a6b46ad +Author: meetDeveloper +Date: Fri Jul 10 22:48:07 2020 +0530 + + Updated extension to v1.0.5 + +commit e1aea5229423dcd4b1e6a44c131ef7c622bb87d6 +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Fri Jul 3 23:10:19 2020 +0530 + + Create FUNDING.yml + +commit 798c664175b75b366e59e8ec2ea88de0c1291aee +Author: meetDeveloper +Date: Mon Jun 22 13:38:58 2020 +0530 + + Updated extension to v1.0.4 + +commit e53e9b37f6f713f9b3d142047cc209cb621dc382 +Author: meetDeveloper +Date: Mon Jun 22 13:37:31 2020 +0530 + + Placed 128*128 px icon in icons folder and modified the manifest file to reflect the same + +commit 642bb59ccdf7fe006305ece021c8562bc833440f +Merge: d994bf6 f85ced4 +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Mon Jun 22 13:34:58 2020 +0530 + + Merge pull request #16 from chuaweijie/master + + Added Icon for Chrome Web Store Listing + +commit d994bf6ca4e5e7d873af68a74eb53ea734772fb0 +Author: meetDeveloper +Date: Wed Jun 17 15:24:40 2020 +0530 + + Updated extension to v1.0.3 + +commit dc7ffb5e90e544e91abcb0e29d02b2745168c7ce +Author: meetDeveloper +Date: Wed Jun 17 15:24:24 2020 +0530 + + Omitting credentials so that browser does not send or recieve cookies from other domain in case of cross-origin requests + +commit f85ced44f198e487e881d6fbee6562dd3c5e32f9 +Author: Chua Wei Jie +Date: Fri May 15 09:41:23 2020 +0700 + + Added Icon for Chrome Webstore Listing + + I've added icon_128.png at the root which is needed for the icon on Chrome Webstore. I've also updated the manifest.json to reflect this change. + +commit ec39e05dc67e45249da8f87a981242f954b44af5 +Author: meetDeveloper +Date: Thu Apr 9 07:56:53 2020 +0530 + + Added browser polyfill to support chrome based extension that instead of sending promise uses callback based approach + +commit f55fa9599ad8a3390cbd0c67654f2600e1c43df4 +Author: meetDeveloper +Date: Thu Apr 9 07:56:09 2020 +0530 + + Added background script to preform cross site requests + +commit f2841e7dbc585cc080ad77194b8138a0a28fcabb +Author: meetDeveloper +Date: Sat Dec 14 12:40:49 2019 +0530 + + 1. Added German, Spanish and French Languages. + 2. Added support for storing words and meanings you have searched for and ability to retrieve them in a text file. + 3. Added ability to add modifier key, so that modifier key + double click results in dictionary popup. + +commit 445773ce9b2688d7869c65956706ed27778ede4f +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Mon Dec 10 00:49:36 2018 +0530 + + Update README.md + +commit 895b7625fe5fd09a3e4729153d276761c2e0d737 +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Mon Oct 8 23:05:57 2018 +0530 + + Updated Version... + +commit 3efff688e24a0cf6804d95fde2c7e30ceacd3a59 +Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> +Date: Mon Oct 8 23:05:08 2018 +0530 + + Added More Info Feature and Fixed Bugs. + + New Features: + A link has b \ No newline at end of file From d659edf5c259a15092f5ff7cf8c17feb63836e1e Mon Sep 17 00:00:00 2001 From: tao Date: Wed, 17 Nov 2021 18:08:45 +0200 Subject: [PATCH 5/5] add romanian language and move options page to popup [not ready] --- .web-extension-id | 3 + background/background.js | 62 +++++- common/dictionary-links.js | 15 ++ content_scripts/dictionary.js | 375 ++++++++++++++++---------------- et HEAD~ | 236 -------------------- icons/Dictionary-32.png | Bin 0 -> 1446 bytes manifest.json | 26 ++- {options => popup}/options.css | 2 +- {options => popup}/options.html | 1 + {options => popup}/options.js | 1 + 10 files changed, 285 insertions(+), 436 deletions(-) create mode 100644 .web-extension-id create mode 100644 common/dictionary-links.js delete mode 100644 et HEAD~ create mode 100644 icons/Dictionary-32.png rename {options => popup}/options.css (99%) rename {options => popup}/options.html (98%) rename {options => popup}/options.js (98%) diff --git a/.web-extension-id b/.web-extension-id new file mode 100644 index 0000000..5b950aa --- /dev/null +++ b/.web-extension-id @@ -0,0 +1,3 @@ +# This file was created by https://github.com/mozilla/web-ext +# Your auto-generated extension ID for addons.mozilla.org is: +dictionary_anywrere_fork@tao.com \ No newline at end of file diff --git a/background/background.js b/background/background.js index b56d796..5724812 100644 --- a/background/background.js +++ b/background/background.js @@ -4,14 +4,32 @@ const GOOGLE_SPEECH_URI = 'https://www.google.com/speech-api/v1/synthesize', enabled: true }; +function getContentOfSiteCrossOrigin (url) { + return new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.onload = () => { + if (xhr.status === 200) { + resolve(xhr.responseText); + } else { + reject(xhr.statusText); + } + }; + xhr.onerror = () => { + reject(xhr.statusText); + }; + xhr.send(); + }); +} + browser.runtime.onMessage.addListener((request, sender, sendResponse) => { const { word, lang } = request, - url = `https://www.google.com/search?hl=${lang}&q=define+${word}&gl=US`; - + url = makeLink(word, lang); + fetch(url, { - method: 'GET', - credentials: 'omit' - }) + method: 'GET', + credentials: 'omit' + }) .then((response) => response.text()) .then((text) => { const document = new DOMParser().parseFromString(text, 'text/html'), @@ -29,7 +47,7 @@ browser.runtime.onMessage.addListener((request, sender, sendResponse) => { return true; }); -function extractMeaning (document, context) { +function extractMeaningFromGoogle (document) { if (!document.querySelector("[data-dobid='hdw']")) { return null; } var word = document.querySelector("[data-dobid='hdw']").textContent, @@ -39,7 +57,7 @@ function extractMeaning (document, context) { if(definitionDivNodeList) { definitionDivNodeList.forEach((definitionDiv) => { if (definitionDiv) { - var meaning = "" + var meaning = ""; definitionDiv.querySelectorAll("span").forEach( function(span) { if(!span.querySelector("sup")) { meaning = meaning + span.textContent; @@ -53,6 +71,36 @@ function extractMeaning (document, context) { for(var i = 0; i < meaningArray.length; i++) { meaningArray[i] = meaningArray[i][0].toUpperCase() + meaningArray[i].substring(1); } + return { word: word, meaningArray: meaningArray }; +} + +function extractMeaningFromDoxonline (document) { + var targetSpan = document.querySelector(".def"); + if (!targetSpan) { return null; } + + var word = targetSpan.querySelector("b").textContent.slice(0,-1), + meaningArray = [targetSpan.innerHTML]; + + if(meaningArray[0].length > 1000) { + meaningArray[0] = meaningArray[0].substr(0, 1000) + "..."; + } + + return { word: word, meaningArray: meaningArray }; +} + + +function extractMeaning (document, context) { + var word, + meaningArray, + wordAndMeaningArray; + + if (context.lang === 'ro') { + wordAndMeaningArray = extractMeaningFromDoxonline(document); + } else { + wordAndMeaningArray = extractMeaningFromGoogle(document); + } + word = wordAndMeaningArray.word; + meaningArray = wordAndMeaningArray.meaningArray; var audio = document.querySelector("audio[jsname='QInZvb']"), source = document.querySelector("audio[jsname='QInZvb'] source"), diff --git a/common/dictionary-links.js b/common/dictionary-links.js new file mode 100644 index 0000000..cb8bb28 --- /dev/null +++ b/common/dictionary-links.js @@ -0,0 +1,15 @@ +function makeDexonlineLink(word) { + return `https://dexonline.ro/definitie/${word}`; +} + +function makeGoogleLink(word, language) { + return `https://www.google.com/search?hl=${language}&q=define+${word}`; +} + +function makeLink(word, language) { + if(language === 'ro') { + return makeDexonlineLink(word); + } else { + return makeGoogleLink(word, language); + } +} \ No newline at end of file diff --git a/content_scripts/dictionary.js b/content_scripts/dictionary.js index 6cfcbe2..10fa3cf 100644 --- a/content_scripts/dictionary.js +++ b/content_scripts/dictionary.js @@ -1,230 +1,239 @@ - var DEFAULT_LANGUAGE = 'en', - DEFAULT_TRIGGER_KEY = 'none', +var DEFAULT_LANGUAGE = 'en', + DEFAULT_TRIGGER_KEY = 'none', - LANGUAGE, - TRIGGER_KEY; + LANGUAGE, + TRIGGER_KEY; - function showMeaning (event){ - var createdDiv, - info = getSelectionInfo(event); +function showMeaning (event){ + var createdDiv, + info = getSelectionInfo(event); - if (!info) { return; } + if (!info) { return; } - retrieveMeaning(info) - .then((response) => { - if (!response.content) { return noMeaningFound(createdDiv); } + retrieveMeaning(info) + .then((response) => { + if (!response.content) { return noMeaningFound(createdDiv); } - appendToDiv(createdDiv, response.content); - }); - - // Creating this div while we are fetching meaning to make extension more fast. - createdDiv = createDiv(info); - } - - - function getSelectionInfo(event) { - var word; - var boundingRect; + appendToDiv(createdDiv, response.content); + }); - if (window.getSelection().toString().length > 1) { - word = window.getSelection().toString(); - boundingRect = getSelectionCoords(window.getSelection()); - } else { - return null; - } + // Creating this div while we are fetching meaning to make extension more fast. + createdDiv = createDiv(info); +} - var top = boundingRect.top + window.scrollY, - bottom = boundingRect.bottom + window.scrollY, - left = boundingRect.left + window.scrollX; - if (boundingRect.height == 0) { - top = event.pageY; - bottom = event.pageY; - left = event.pageX; - } +function getSelectionInfo(event) { + var word; + var boundingRect; - return { - top: top, - bottom: bottom, - left: left, - word: word, - clientY: event.clientY, - height: boundingRect.height - }; + if (window.getSelection().toString().length > 1) { + word = window.getSelection().toString(); + boundingRect = getSelectionCoords(window.getSelection()); + } else { + return null; } - function retrieveMeaning(info){ - return browser.runtime.sendMessage({ word: info.word, lang: LANGUAGE, time: Date.now() }); - } + var top = boundingRect.top + window.scrollY, + bottom = boundingRect.bottom + window.scrollY, + left = boundingRect.left + window.scrollX; - function createDiv(info) { - var hostDiv = document.createElement("div"); + if (boundingRect.height == 0) { + top = event.pageY; + bottom = event.pageY; + left = event.pageX; + } - hostDiv.className = "dictionaryDiv"; - hostDiv.style.left = info.left -10 + "px"; - hostDiv.style.position = "absolute"; - hostDiv.style.zIndex = "1000000" - hostDiv.attachShadow({mode: 'open'}); + return { + top: top, + bottom: bottom, + left: left, + word: word, + clientY: event.clientY, + height: boundingRect.height + }; +} - var shadow = hostDiv.shadowRoot; - var style = document.createElement("style"); - //style.textContent = "*{ all: initial}"; - style.textContent = ".mwe-popups{background:#fff;position:absolute;z-index:110;-webkit-box-shadow:0 30px 90px -20px rgba(0,0,0,0.3),0 0 1px #a2a9b1;box-shadow:0 30px 90px -20px rgba(0,0,0,0.3),0 0 1px #a2a9b1;padding:0;font-size:14px;min-width:300px;border-radius:2px}.mwe-popups.mwe-popups-is-not-tall{width:320px}.mwe-popups .mwe-popups-container{color:#222;margin-top:-9px;padding-top:9px;text-decoration:none}.mwe-popups.mwe-popups-is-not-tall .mwe-popups-extract{min-height:40px;max-height:140px;overflow:hidden;margin-bottom:47px;padding-bottom:0}.mwe-popups .mwe-popups-extract{margin:16px;display:block;color:#222;text-decoration:none;position:relative} .mwe-popups.flipped_y:before{content:'';position:absolute;border:8px solid transparent;border-bottom:0;border-top: 8px solid #a2a9b1;bottom:-8px;left:10px}.mwe-popups.flipped_y:after{content:'';position:absolute;border:11px solid transparent;border-bottom:0;border-top:11px solid #fff;bottom:-7px;left:7px} .mwe-popups.mwe-popups-no-image-tri:before{content:'';position:absolute;border:8px solid transparent;border-top:0;border-bottom: 8px solid #a2a9b1;top:-8px;left:10px}.mwe-popups.mwe-popups-no-image-tri:after{content:'';position:absolute;border:11px solid transparent;border-top:0;border-bottom:11px solid #fff;top:-7px;left:7px} .audio{background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAcUlEQVQ4y2P4//8/AyUYQhAH3gNxA7IAIQPmo/H3g/QA8XkgFiBkwHyoYnRQABVfj88AmGZcTuuHyjlgMwBZM7IE3NlQGhQe65EN+I8Dw8MLGgYoFpFqADK/YUAMwOsFigORatFIlYRElaRMWmaiBAMAp0n+3U0kqkAAAAAASUVORK5CYII=);background-position: center;background-repeat: no-repeat;cursor:pointer;margin-left: 8px;opacity: 0.5; width: 16px; display: inline-block;} .audio:hover {opacity: 1;}"; - shadow.appendChild(style); +function retrieveMeaning(info){ + return browser.runtime.sendMessage({ word: info.word, lang: LANGUAGE, time: Date.now() }); +} - var encapsulateDiv = document.createElement("div"); - encapsulateDiv.style = "all: initial; text-shadow: transparent 0px 0px 0px, rgba(0,0,0,1) 0px 0px 0px !important;"; - shadow.appendChild(encapsulateDiv); +function createDiv(info) { + var hostDiv = document.createElement("div"); + hostDiv.className = "dictionaryDiv"; + hostDiv.style.left = info.left -10 + "px"; + hostDiv.style.position = "absolute"; + hostDiv.style.zIndex = "1000000" + hostDiv.attachShadow({mode: 'open'}); - var popupDiv = document.createElement("div"); - popupDiv.style = "font-family: arial,sans-serif; border-radius: 12px; border: 1px solid #a2a9b1; box-shadow: 0 0 17px rgba(0,0,0,0.5)"; - encapsulateDiv.appendChild(popupDiv); + var shadow = hostDiv.shadowRoot; + var style = document.createElement("style"); + //style.textContent = "*{ all: initial}"; + style.textContent = ".mwe-popups{background:#fff;position:absolute;z-index:110;-webkit-box-shadow:0 30px 90px -20px rgba(0,0,0,0.3),0 0 1px #a2a9b1;box-shadow:0 30px 90px -20px rgba(0,0,0,0.3),0 0 1px #a2a9b1;padding:0;font-size:14px;min-width:400px;border-radius:2px}.mwe-popups.mwe-popups-is-not-tall{width:420px}.mwe-popups .mwe-popups-container{color:#222;margin-top:-9px;padding-top:9px;text-decoration:none}.mwe-popups.mwe-popups-is-not-tall .mwe-popups-extract{min-height:40px;max-height:140px;overflow:hidden;margin-bottom:47px;padding-bottom:0}.mwe-popups .mwe-popups-extract{margin:16px;display:block;color:#222;text-decoration:none;position:relative} .mwe-popups.flipped_y:before{content:'';position:absolute;border:8px solid transparent;border-bottom:0;border-top: 8px solid #a2a9b1;bottom:-8px;left:10px}.mwe-popups.flipped_y:after{content:'';position:absolute;border:11px solid transparent;border-bottom:0;border-top:11px solid #fff;bottom:-7px;left:7px} .mwe-popups.mwe-popups-no-image-tri:before{content:'';position:absolute;border:8px solid transparent;border-top:0;border-bottom: 8px solid #a2a9b1;top:-8px;left:10px}.mwe-popups.mwe-popups-no-image-tri:after{content:'';position:absolute;border:11px solid transparent;border-top:0;border-bottom:11px solid #fff;top:-7px;left:7px} .audio{background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAcUlEQVQ4y2P4//8/AyUYQhAH3gNxA7IAIQPmo/H3g/QA8XkgFiBkwHyoYnRQABVfj88AmGZcTuuHyjlgMwBZM7IE3NlQGhQe65EN+I8Dw8MLGgYoFpFqADK/YUAMwOsFigORatFIlYRElaRMWmaiBAMAp0n+3U0kqkAAAAAASUVORK5CYII=);background-position: center;background-repeat: no-repeat;cursor:pointer;margin-left: 8px;opacity: 0.5; width: 16px; display: inline-block;} .audio:hover {opacity: 1;}"; + shadow.appendChild(style); + var encapsulateDiv = document.createElement("div"); + encapsulateDiv.style = "all: initial; text-shadow: transparent 0px 0px 0px, rgba(0,0,0,1) 0px 0px 0px !important;"; + shadow.appendChild(encapsulateDiv); - var contentContainer = document.createElement("div"); - contentContainer.className = "mwe-popups-container"; - popupDiv.appendChild(contentContainer); + var popupDiv = document.createElement("div"); + popupDiv.style = "font-family: arial,sans-serif; border-radius: 12px; border: 1px solid #a2a9b1; box-shadow: 0 0 17px rgba(0,0,0,0.5)"; + encapsulateDiv.appendChild(popupDiv); - var content = document.createElement("div"); - content.className = "mwe-popups-extract"; - content.style = "line-height: 1.4; margin-top: 0px; margin-bottom: 11px; max-height: none"; - contentContainer.appendChild(content); + var contentContainer = document.createElement("div"); + contentContainer.className = "mwe-popups-container"; + popupDiv.appendChild(contentContainer); - var heading = document.createElement("h3"); - heading.style = "margin-block-end: 0px; display:inline-block;"; - heading.textContent = "Searching"; - var meaning = document.createElement("p"); - meaning.style = "margin-top: 10px"; - meaning.textContent = "Please Wait..."; + var content = document.createElement("div"); + content.className = "mwe-popups-extract"; + content.style = "line-height: 1.4; margin-top: 0px; margin-bottom: 11px; max-height: none"; + contentContainer.appendChild(content); - var audio = document.createElement("div"); - audio.className = "audio"; - audio.innerHTML = " "; - audio.style.display = "none"; - var moreInfo =document.createElement("a"); - moreInfo.href = `https://www.google.com/search?hl=${LANGUAGE}&q=define+${info.word}`; - moreInfo.style = "float: right; text-decoration: none;" - moreInfo.target = "_blank"; + var heading = document.createElement("h3"); + heading.style = "margin-block-end: 0px; display:inline-block;"; + heading.textContent = "Searching"; - content.appendChild(heading); - content.appendChild(audio); - content.appendChild(meaning); - content.appendChild(moreInfo); - document.body.appendChild(hostDiv); + var meaning = document.createElement("p"); + meaning.style = "margin-top: 10px"; + meaning.textContent = "Please Wait..."; - if(info.clientY < window.innerHeight/2){ - popupDiv.className = "mwe-popups mwe-popups-no-image-tri mwe-popups-is-not-tall"; - hostDiv.style.top = info.bottom + 10 + "px"; - if(info.height == 0){ - hostDiv.style.top = parseInt(hostDiv.style.top) + 8 + "px"; - } - } else { - popupDiv.className = "mwe-popups flipped_y mwe-popups-is-not-tall"; - hostDiv.style.top = info.top - 10 - popupDiv.clientHeight + "px"; + var audio = document.createElement("div"); + audio.className = "audio"; + audio.innerHTML = " "; + audio.style.display = "none"; - if(info.height == 0){ - hostDiv.style.top = parseInt(hostDiv.style.top) - 8 + "px"; - } + var moreInfo =document.createElement("a"); + if(LANGUAGE == "ro") { + moreInfo.href = `https://dexonline.ro/definitie/${info.word}`; + } else { + moreInfo.href = makeLink(info.word, LANGUAGE); + } + moreInfo.style = "float: right; text-decoration: none;" + moreInfo.target = "_blank"; + + content.appendChild(heading); + content.appendChild(audio); + content.appendChild(meaning); + content.appendChild(moreInfo); + document.body.appendChild(hostDiv); + + if(info.clientY < window.innerHeight/2){ + popupDiv.className = "mwe-popups mwe-popups-no-image-tri mwe-popups-is-not-tall"; + hostDiv.style.top = info.bottom + 10 + "px"; + if(info.height == 0){ + hostDiv.style.top = parseInt(hostDiv.style.top) + 8 + "px"; } + } else { + popupDiv.className = "mwe-popups flipped_y mwe-popups-is-not-tall"; + hostDiv.style.top = info.top - 10 - popupDiv.clientHeight + "px"; - return { - heading, - meaning, - moreInfo, - audio - }; - + if(info.height == 0){ + hostDiv.style.top = parseInt(hostDiv.style.top) - 8 + "px"; + } } - function getSelectionCoords(selection) { - var oRange = selection.getRangeAt(0); //get the text range - var oRect = oRange.getBoundingClientRect(); - return oRect; + return { + heading, + meaning, + moreInfo, + audio + }; + +} + +function getSelectionCoords(selection) { + var oRange = selection.getRangeAt(0); //get the text range + var oRect = oRange.getBoundingClientRect(); + return oRect; +} + +function meaningArrayToParagraphList(meaningArray) { + var meaningList = document.createElement("ul"); + meaningList.style = "margin-top: 0px; margin-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; padding-bottom: 0px;"; + meaningArray.forEach(function(meaning) { + var meaningItem = document.createElement("li"); + meaningItem.style = "margin-block-start: 0px; margin-block-end: 0px; display: list-item;"; + meaningItem.innerHTML = meaning; + meaningList.appendChild(meaningItem); + }); + return meaningList; +} + + +function appendToDiv(createdDiv, content){ + var hostDiv = createdDiv.heading.getRootNode().host; + var popupDiv = createdDiv.heading.getRootNode().querySelectorAll("div")[1]; + + var heightBefore = popupDiv.clientHeight; + createdDiv.heading.textContent = content.word; + createdDiv.meaning.textContent = ""; + createdDiv.meaning.appendChild(meaningArrayToParagraphList(content.meaningArray)); + createdDiv.moreInfo.textContent = "More »"; + + var heightAfter = popupDiv.clientHeight; + var difference = heightAfter - heightBefore; + + + if(popupDiv.classList.contains("flipped_y")){ + hostDiv.style.top = parseInt(hostDiv.style.top) - difference + 1 + "px"; } - function meaningArrayToParagraphList(meaningArray) { - var meaningList = document.createElement("ul"); - meaningList.style = "margin-top: 0px; margin-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; padding-bottom: 0px;"; - meaningArray.forEach(function(meaning) { - var meaningItem = document.createElement("li"); - meaningItem.style = "margin-block-start: 0px; margin-block-end: 0px; display: list-item;"; - meaningItem.textContent = meaning; - meaningList.appendChild(meaningItem); - }); - return meaningList; + if(content.audioSrc){ + var sound = document.createElement("audio"); + sound.src = content.audioSrc; + createdDiv.audio.style.display = "inline-block"; + createdDiv.audio.addEventListener("click", function(){ + sound.play(); + }); } - - - function appendToDiv(createdDiv, content){ - var hostDiv = createdDiv.heading.getRootNode().host; - var popupDiv = createdDiv.heading.getRootNode().querySelectorAll("div")[1]; - - var heightBefore = popupDiv.clientHeight; - createdDiv.heading.textContent = content.word; - createdDiv.meaning.textContent = ""; - createdDiv.meaning.appendChild(meaningArrayToParagraphList(content.meaningArray)); - createdDiv.moreInfo.textContent = "More »"; - - var heightAfter = popupDiv.clientHeight; - var difference = heightAfter - heightBefore; - - - if(popupDiv.classList.contains("flipped_y")){ - hostDiv.style.top = parseInt(hostDiv.style.top) - difference + 1 + "px"; - } - - if(content.audioSrc){ - var sound = document.createElement("audio"); - sound.src = content.audioSrc; - createdDiv.audio.style.display = "inline-block"; - createdDiv.audio.addEventListener("click", function(){ - sound.play(); - }); - } +} + +function noMeaningFound (createdDiv){ + createdDiv.heading.textContent = "Sorry"; + createdDiv.meaning.textContent = "No definition found."; +} + +function removeMeaning(event){ + var element = event.target; + if(!element.classList.contains("dictionaryDiv")){ + document.querySelectorAll(".dictionaryDiv").forEach(function(Node){ + Node.remove(); + }); } +} - function noMeaningFound (createdDiv){ - createdDiv.heading.textContent = "Sorry"; - createdDiv.meaning.textContent = "No definition found."; +document.addEventListener('dblclick', ((e) => { + updateLanguageAndTriggerKey(); + if (TRIGGER_KEY === 'none') { + return showMeaning(e); } - function removeMeaning(event){ - var element = event.target; - if(!element.classList.contains("dictionaryDiv")){ - document.querySelectorAll(".dictionaryDiv").forEach(function(Node){ - Node.remove(); - }); - } + //e has property altKey, shiftKey, cmdKey representing they key being pressed while double clicking. + if(e[`${TRIGGER_KEY}Key`]) { + return showMeaning(e); } - document.addEventListener('dblclick', ((e) => { - if (TRIGGER_KEY === 'none') { - return showMeaning(e); - } + return; +})); - //e has property altKey, shiftKey, cmdKey representing they key being pressed while double clicking. - if(e[`${TRIGGER_KEY}Key`]) { - return showMeaning(e); - } +document.addEventListener('click', removeMeaning); - return; - })); +function updateLanguageAndTriggerKey() { + let storageItem = browser.storage.local.get(); - document.addEventListener('click', removeMeaning); + storageItem.then((results) => { + let interaction = results.interaction || { dblClick: { key: DEFAULT_TRIGGER_KEY }}; + LANGUAGE = results.language || DEFAULT_LANGUAGE; + console.log("++++++++++++"+LANGUAGE); + TRIGGER_KEY = interaction.dblClick.key; + }); +} - (function () { - let storageItem = browser.storage.local.get(); - - storageItem.then((results) => { - let interaction = results.interaction || { dblClick: { key: DEFAULT_TRIGGER_KEY }}; - - LANGUAGE = results.language || DEFAULT_LANGUAGE; - TRIGGER_KEY = interaction.dblClick.key; - }); - })(); +(function () { + updateLanguageAndTriggerKey(); +})(); diff --git a/et HEAD~ b/et HEAD~ deleted file mode 100644 index 0373865..0000000 --- a/et HEAD~ +++ /dev/null @@ -1,236 +0,0 @@ -commit d8649f931cb52c82f43d1aaf3f4a55f42161b116 (HEAD -> master) -Author: tao -Date: Sat Nov 13 20:01:09 2021 +0200 - - fix broken `saveWord` - -commit 572aed3bb32ab0cdefcc26fc7bf46034df319e25 -Author: Diulgher Artiom <42372666+GeneralTao2@users.noreply.github.com> -Date: Fri Nov 12 19:59:39 2021 +0200 - - fix mistake with `meaning` building - -commit 55bd396e4b75fc8c796fec1a21437457752f05c5 -Author: tao -Date: Fri Nov 12 19:28:18 2021 +0200 - - add several meanings result - -commit 50ad68b1da6a772a1cf41beda4f1ea181ddc5cc3 -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Tue Aug 17 23:13:48 2021 +0530 - - Update README.md - -commit 81be174b8a5ee2697cc880b91b60842da5ef1685 -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Tue Aug 17 23:12:09 2021 +0530 - - Update README.md - -commit 0c416734505ec025cfb003352acd80b062afbe9a -Author: Suraj Jain -Date: Mon Dec 21 01:39:56 2020 +0530 - - Updated Extension to v1.1.0 - -commit 19f517473b6070b011804f00ef505e7904f91e23 -Author: Suraj Jain -Date: Mon Dec 21 01:39:37 2020 +0530 - - Allowed user to choose Ctrl/Command keys as trigger key. Extension will detect user Operating System to show him relevant trigger keys. - -commit c9bf04ec1680df369436144d1504d653c4007734 (tag: v1.0.10) -Author: Suraj Jain -Date: Fri Dec 4 23:17:29 2020 +0530 - - Updated Extension to v1.0.10 - -commit f1a5fb0029bc7bff8b28558eaddd4f770ffa246d -Author: Suraj Jain -Date: Fri Dec 4 23:15:40 2020 +0530 - - Fixed incorrect setting of zIndex property on hostDiv - -commit 6437fe52352d019d02c83566dcc071f44f8d9a25 -Author: Suraj Jain -Date: Fri Dec 4 23:01:46 2020 +0530 - - Updated Extension to v1.0.9 - -commit fadec8335851c3edb01fa10fef27dc9400c0841c -Merge: b48205a 650de40 -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Thu Nov 26 11:01:28 2020 +0530 - - Merge pull request #33 from AxelDavid45/master - - Added ZIndex property to fix div hidden - -commit b48205a57a5cbcaa02dccea2c0a61ed70bead259 -Author: Suraj Jain -Date: Wed Nov 25 09:08:54 2020 +0530 - - Updated Extension to v1.0.8 - -commit 94a2d956b6bd39c80c621bf016ec4e09bd4f82f9 -Author: Suraj Jain -Date: Wed Nov 25 09:06:56 2020 +0530 - - Fixed issue where definitions of word was not being parsed properly because google sends localized meaning, using gl (geolocation) query param to go around that - -commit 650de40eefe8dc7b3537a0651a8b5d82f5f03104 -Author: Axel David Espinosa Meneses -Date: Sun Oct 11 12:21:28 2020 -0500 - - ZIndex updated - - I updated the zindex value to keep it for sure always on top - -commit 8dddb0f9da901a5fad684e83cf4e11506c10fead -Author: Axel David Espinosa Meneses -Date: Sat Oct 3 13:19:52 2020 -0500 - - Added ZIndex property to fix div hidden - - I added a Z-Index property to fix a problem in some websites where the div that contains the word information is hidden. - For example, in the Google Assistant Documentation, the div that contains the word information is under the information because of the z-index. - -commit 2f7f32a7bf780d783ad70ff4f0e6b147749b07a9 -Author: Suraj Jain -Date: Sat Sep 5 01:28:53 2020 +0530 - - Updated extension v1.0.7 - -commit 8097b3c80b95bf775114a221705fa0fb1b380f23 -Author: Suraj Jain -Date: Sat Sep 5 01:28:15 2020 +0530 - - Fixed history setting - -commit dcf2f559aa5719055d05b762da058f90610eba3a -Author: meetDeveloper -Date: Sat Jul 18 00:57:15 2020 +0530 - - Updated extension v1.0.6 - -commit e8400aad2ba923bba216b70bd70bf006e8e944ad -Merge: b17bf48 6cd03a7 -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Sat Jul 18 00:50:16 2020 +0530 - - Merge pull request #21 from slay2k/bugfix_undefined_URI - - Bugfix to move 'GOOGLE_SPEECH_URI' definition - -commit 6cd03a786d41c78b42b117620c849cedcc5b9624 -Author: Romy Maxwell -Date: Fri Jul 17 14:50:34 2020 -0400 - - Typo - -commit 7395697205c5b874f2925364e74bb8edfb0a1ddf -Author: Romy Maxwell -Date: Fri Jul 17 14:49:19 2020 -0400 - - Adding const - -commit 5694c18ab9c037f541c512559d93f6debaf2a1ea -Author: Romy Maxwell -Date: Fri Jul 17 13:27:39 2020 -0400 - - Bugfix to move 'GOOGLE_SPEECH_URI' definition - -commit b17bf488b1f029070cdf765eeb4479fa6a6b46ad -Author: meetDeveloper -Date: Fri Jul 10 22:48:07 2020 +0530 - - Updated extension to v1.0.5 - -commit e1aea5229423dcd4b1e6a44c131ef7c622bb87d6 -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Fri Jul 3 23:10:19 2020 +0530 - - Create FUNDING.yml - -commit 798c664175b75b366e59e8ec2ea88de0c1291aee -Author: meetDeveloper -Date: Mon Jun 22 13:38:58 2020 +0530 - - Updated extension to v1.0.4 - -commit e53e9b37f6f713f9b3d142047cc209cb621dc382 -Author: meetDeveloper -Date: Mon Jun 22 13:37:31 2020 +0530 - - Placed 128*128 px icon in icons folder and modified the manifest file to reflect the same - -commit 642bb59ccdf7fe006305ece021c8562bc833440f -Merge: d994bf6 f85ced4 -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Mon Jun 22 13:34:58 2020 +0530 - - Merge pull request #16 from chuaweijie/master - - Added Icon for Chrome Web Store Listing - -commit d994bf6ca4e5e7d873af68a74eb53ea734772fb0 -Author: meetDeveloper -Date: Wed Jun 17 15:24:40 2020 +0530 - - Updated extension to v1.0.3 - -commit dc7ffb5e90e544e91abcb0e29d02b2745168c7ce -Author: meetDeveloper -Date: Wed Jun 17 15:24:24 2020 +0530 - - Omitting credentials so that browser does not send or recieve cookies from other domain in case of cross-origin requests - -commit f85ced44f198e487e881d6fbee6562dd3c5e32f9 -Author: Chua Wei Jie -Date: Fri May 15 09:41:23 2020 +0700 - - Added Icon for Chrome Webstore Listing - - I've added icon_128.png at the root which is needed for the icon on Chrome Webstore. I've also updated the manifest.json to reflect this change. - -commit ec39e05dc67e45249da8f87a981242f954b44af5 -Author: meetDeveloper -Date: Thu Apr 9 07:56:53 2020 +0530 - - Added browser polyfill to support chrome based extension that instead of sending promise uses callback based approach - -commit f55fa9599ad8a3390cbd0c67654f2600e1c43df4 -Author: meetDeveloper -Date: Thu Apr 9 07:56:09 2020 +0530 - - Added background script to preform cross site requests - -commit f2841e7dbc585cc080ad77194b8138a0a28fcabb -Author: meetDeveloper -Date: Sat Dec 14 12:40:49 2019 +0530 - - 1. Added German, Spanish and French Languages. - 2. Added support for storing words and meanings you have searched for and ability to retrieve them in a text file. - 3. Added ability to add modifier key, so that modifier key + double click results in dictionary popup. - -commit 445773ce9b2688d7869c65956706ed27778ede4f -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Mon Dec 10 00:49:36 2018 +0530 - - Update README.md - -commit 895b7625fe5fd09a3e4729153d276761c2e0d737 -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Mon Oct 8 23:05:57 2018 +0530 - - Updated Version... - -commit 3efff688e24a0cf6804d95fde2c7e30ceacd3a59 -Author: meetDeveloper <32453612+meetDeveloper@users.noreply.github.com> -Date: Mon Oct 8 23:05:08 2018 +0530 - - Added More Info Feature and Fixed Bugs. - - New Features: - A link has b \ No newline at end of file diff --git a/icons/Dictionary-32.png b/icons/Dictionary-32.png new file mode 100644 index 0000000000000000000000000000000000000000..4851f5481851eeed2ebbd498b8dbace4a5109c60 GIT binary patch literal 1446 zcmV;X1zGxuP)1VIr*Z2SYh8VT#2BoGmuW%hoYnRA&r1HQPSn@;^8m<88P#G;|ux%p7z z3jx{)(!*$4cdV)8WQu>s=N)yb-VUf<|L^;A1eP+64s}h!Bf4d~!sEj6Ro7CyB^=cA z=_TPq;fO5<6uwfrR^eyGxeC84wo{1-@Ts1m+z-}%u%5R~;eO$;X%zM9dDKl>GKHC> z)GnFbI3$P>C4@$iWei*fq!uKzzkP#c-!v=Y(dBQkhAoa9dGSU>ElSsn)U4B&V?t(YI?__yF2B;Ow%d zX}fT~37rpC+D?}xzf4~?3$LfpItLv$(7aH|s=Cg}J*3v z2v{%x000SaNLh0L01FZT01FZU(%pXi000BsNkla& z5i2dlPKa9zc4_SFEUov!&*o1LAx zo88F+2WHPa?%Z?EcfRvjqW^pdm;U+r`5?=(xm-%`db&-wA|i!_eAW)7NVHmX?B0C} zE?y$ab0Q%~COfqKXp!;{@5l=xIURYcmzO?f)$fDqgHES2gJ%!pIKG)mNo`8hnJJ30-xeIqD0DPpKn~fdu8eUW?5&=fPTM! zEsCNAR%932i#;X3#3%Z*;$(MsBvA;IQmGc!lk_njy(}BxRS^L6@E2YU^y71b{+?3D zNFOY4nr~o)>ftI?%G=KJcx(uYZHi6wR@efN@|N~xMG9>huQe~U68j54GTbDPDWX?3 zpoRc1U>J*&uNV)$*AZ|^y~Hfw_k-{i-{7spW#9MxNf5B!8$|bufQ}-M#~Z zQm~Ixc=X}qKqU>C!aB{IrP%YJJyWRrBKf(YL=cE<^&71%K2V+?2!up&2#ORv8WNI1 z1KRwhS_p#&<|Q1CzkQM(3J)VtK;Y_pheJY+F^I`VxQo_*V-~*809)36+U_V&- zjx?>$Fv>0YWgBZ-xabSp0_rSiga9{(8N^y@rx;INGR10~;svM0F(9IG1VHdTQ<+?6tikBoq(?)5S zM(iy*dWi&Yl4LRi_ClaAf}4oxwM_An)Z>e-ew7);RS%sAjH~;s?{w%F_|~b=q`@=} zft`xc^YkR9@9R>NurxuB^l4uR*wSK~OjV9Uu>8JpCA1tECryPIo>N_hxx%GWywOm~ zsZknQ9fK?DHi+Jl~(@rUp-&jSgs=AYS9#i;VcZe0Day`nbBDUs#ZZ7 zFbx5fpSF5mH?zDukpab`!9dqQ*@&f_C{7>#0l2{ODwBvK1ONa407*qoM6N<$f)k*b Ai~s-t literal 0 HcmV?d00001 diff --git a/manifest.json b/manifest.json index afb3465..b7d9a21 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "manifest_version": 2, "name": "Dictionary Anywhere", - "version": "1.1.0", + "version": "1.1.2", "description": "View definitions easily as you browse the web. Double-click any word to view its definition in a small pop-up bubble.", @@ -14,16 +14,11 @@ "128": "icons/Dictionary-128.png" }, - "options_ui": { - "page": "options/options.html", - "browser_style": true, - "chrome_style": true - }, - "content_scripts": [ { "matches": [""], "js": [ + "common/dictionary-links.js", "common/browser-polyfill.js", "content_scripts/dictionary.js" ] @@ -32,14 +27,27 @@ "background": { "scripts": [ + "common/dictionary-links.js", "common/browser-polyfill.js", "background/background.js" ], "persistent": false }, + "browser_action": { + "default_icon": "icons/Dictionary-32.png", + "default_title": "Dictionary Anywhere", + "default_popup": "popup/options.html" + }, + "permissions": [ "storage", - "https://www.google.com/" - ] + "https://www.google.com/", + "https://dexonline.ro/" + ], + "browser_specific_settings": { + "gecko": { + "id": "dictionary_anywrere_fork@tao.com" + } + } } diff --git a/options/options.css b/popup/options.css similarity index 99% rename from options/options.css rename to popup/options.css index 0cdb728..71df3c7 100644 --- a/options/options.css +++ b/popup/options.css @@ -8,7 +8,7 @@ body { border-radius: 3px; margin: 40px auto 0; padding: 20px 40px 30px; - width: 650px + width: 500px } #title { diff --git a/options/options.html b/popup/options.html similarity index 98% rename from options/options.html rename to popup/options.html index d1ff023..8b90ec2 100644 --- a/options/options.html +++ b/popup/options.html @@ -20,6 +20,7 @@ + diff --git a/options/options.js b/popup/options.js similarity index 98% rename from options/options.js rename to popup/options.js index d8750ba..ee248d4 100644 --- a/options/options.js +++ b/popup/options.js @@ -18,6 +18,7 @@ const DEFAULT_LANGUAGE = 'en', function saveOptions(e) { + console.log(document.querySelector("#language-selector").value) browser.storage.local.set({ language: document.querySelector("#language-selector").value, interaction: {