diff --git a/LICENSE b/LICENSE
index 710abe3f..261eeb9e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright [2020] [Ascensio System SIA]
+ Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/config.json b/config.json
index 6dc567c6..23487083 100644
--- a/config.json
+++ b/config.json
@@ -7,7 +7,7 @@
"de": "Thesaurus"
},
"guid": "asc.{BE5CBF95-C0AD-4842-B157-AC40FEDD9840}",
- "version": "1.0",
+ "version": "1.0.0",
"variations": [
{
diff --git a/index.html b/index.html
index 576344b8..f24ace1d 100644
--- a/index.html
+++ b/index.html
@@ -29,13 +29,13 @@
-
+
Lookup
ApiKey
diff --git a/resources/css/plugin_style.css b/resources/css/plugin_style.css
index 0fc5b58b..8c517936 100644
--- a/resources/css/plugin_style.css
+++ b/resources/css/plugin_style.css
@@ -23,28 +23,29 @@ html, body {
div::selection {
background: #a8d1ff;
}
-.button {
- color: #fff;
+button {
+ /* color: #fff;
background-color: #7d858c;
border: 1px solid #cfcfcf;
border-radius: 2px;
outline: none;
font-size: 11px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
- height: 22px;
- cursor: pointer;
+ cursor: pointer; */
+ height: 22px !important;
}
.input-synonim {
outline-color: #7d858c;
width: calc(100% - 10px);
border: 1px solid #cfcfcf;
}
-.input-white::selection {
+input::selection {
background: #D8DADC; /* WebKit/Blink Browsers */
-
+ color: #444444;
}
-.input-white::-moz-selection {
+input::-moz-selection {
background: #D8DADC; /* Gecko Browsers */
+ color: #444444;
}
.input-field {
display: flex;
@@ -53,7 +54,12 @@ div::selection {
.not-found {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
padding-left: 5px;
+ color: red;
}
+.h3-caption {
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ padding-left: 5px;
+ }
.div-words {
width: 100%;
display: flex;
@@ -65,8 +71,7 @@ div::selection {
.label-words {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
- margin-left: 10px;
- margin-top: 10px;
+ padding: 5px 5px;
cursor: pointer;
}
.global {
diff --git a/scripts/synonim.js b/scripts/synonim.js
index 8ec7221a..72050441 100644
--- a/scripts/synonim.js
+++ b/scripts/synonim.js
@@ -15,9 +15,8 @@
* limitations under the License.
*
*/
-(function(window, undefined){
- window.oncontextmenu = function(e)
- {
+(function(window, undefined) {
+ window.oncontextmenu = function(e) {
if (e.preventDefault)
e.preventDefault();
if (e.stopPropagation)
@@ -34,7 +33,7 @@
isInitp = false,
predata = "";
- $(document).ready(function () {
+ $(document).ready(function() {
//event mouseout label
$('body').on('mouseout', '.label-words', function() {
$(this).removeClass('label-selected');
@@ -45,17 +44,19 @@
});
//event click label
$('body').on('click', '.label-words', function() {
- var _htmlPaste = "" + $(this).text() +" "+ " ";
window.Asc.plugin.executeMethod("PasteText", [$(this).text() +" "]);
});
//event button click
- button = document.getElementById("btn_search");
- button.onclick = function() {
- synonim_data = inputSerch.value;
- if ((null!=synonim_data) && (predata != synonim_data))
- {
+ btn_search = document.getElementById("btn_search");
+ btn_search.onclick = function() {
+ synonim_data = inputSerch.value.trim();
+ if ('' !== synonim_data && null !== synonim_data) {
+ if (predata !== synonim_data) {
+ $('#global').empty(); // cleared global div
+ synonim();
+ }
+ } else {
$('#global').empty(); // cleared global div
- synonim();
}
};
inputApiKey = document.getElementById("inp_ApiKey");
@@ -79,8 +80,7 @@
});
function synonim() {
- if (!isInit)
- {
+ if (!isInit) {
var container = document.getElementById('scrollable-container-id');
Ps = new PerfectScrollbar('#' + container.id, {});
updateScroll();
@@ -97,76 +97,61 @@
_url += SynonimFormat;
xhr.open('GET', _url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xhr.onreadystatechange = function()
- {
- if (this.readyState == 4 && this.status == 404)
- {
- $('#global').append("This word not found "); //if synonym not found
- updateScroll();
- updateScroll();
- }
- if (this.readyState == 4 && this.status == 500) {
- $('#global').append(""+this.statusText+" "); //if synonym not found
- updateScroll();
- updateScroll();
- }
- if (this.readyState == 4 && this.status == 200 && !closed)
- {
- try
- {
- var _obj = JSON.parse(this.responseText);
- if (_obj.noun) //if noun exist
- {
- drawWords(_obj.noun,"Noun");
- }
- if(_obj.adjective) //if andjective exist
- {
- drawWords(_obj.adjective,"Adjective")
- }
- if(_obj.verb) //if verb exist
- {
- drawWords(_obj.verb,"Verb")
- }
- updateScroll();
- updateScroll();
+ xhr.onreadystatechange = function() {
+ if (this.readyState === 4) {
+ switch (this.status) {
+ case 401:
+ case 403:
+ synonim();
+ break;
+ case 404:
+ $('#global').append("" + window.Asc.plugin.tr("This word not found") + " "); //if synonym not found
+ break;
+ case 500:
+ $('#global').append(""+this.statusText+" "); //if synonym not found
+ break;
+ case 200:
+ if (!closed) {
+ try {
+ var _obj = JSON.parse(this.responseText);
+ if (_obj.noun) //if noun exist
+ drawWords(_obj.noun,"Noun");
+
+ if(_obj.adjective) //if andjective exist
+ drawWords(_obj.adjective,"Adjective")
+
+ if(_obj.verb) //if verb exist
+ drawWords(_obj.verb,"Verb")
+ }
+ catch (err){}
+ }
}
- catch (err)
- {}
- }else if (401 == this.readyState || 403 == this.status)
- synonim();
+ updateScroll();
+ updateScroll();
+ }
};
xhr.send(null);
};
window.Asc.plugin.init = function(text) {
- if (!isInitp)
- {
+ synonim_data = text.trim();
+ if (!isInitp) {
inputSerch = document.getElementById("inp_search");
- inputSerch.value = text;
- synonim_data = text;
- if (null != synonim_data && synonim_data != "")
- synonim();
- }else{
- inputSerch.value = text;
- synonim_data = text;
- if (predata == synonim_data)
- {
- return;
- }else {
- $('#global').empty(); // cleared global div
- if (synonim_data == "")
- {
- predata = "";
- return;
- }
- synonim();
- }
+ isInitp = true;
}
- isInitp = true;
+ $('#global').empty(); // cleared global div
+ window.Asc.plugin.executeMethod("GetSelectedText", [{Numbering:false, Math: false, TableCellSeparator: '\n', ParaSeparator: '\n', TabSymbol: String.fromCharCode(160)}], function(data) {
+ var val = (data === undefined) ? "" : (data.trim() == '') ? synonim_data : data.replace(/\r/g, ' ').trim();
+ inputSerch.value = val;
+ synonim_data = val;
+ if (synonim_data && synonim_data !== "" && predata !== synonim_data)
+ synonim();
+
+ predata = val;
+ });
};
- window.Asc.plugin.button = function(id)
- {
+ window.Asc.plugin.button = function() {
this.executeCommand("close", "");
};
@@ -185,30 +170,26 @@
//draws the structure of the plugin
function drawWords(response, type) {
- $('#global').append("" + type + " ");
+ $('#global').append("" + window.Asc.plugin.tr(type) + " ");
$('#global').append("
");
- if (response.syn && response.syn.length)
- {
+ if (response.syn && response.syn.length) {
$("#"+type).append("
");
- for (let i=0; i"+ response.syn[i] +"");
}
- if(response.ant && response.ant.length)
- {
- $("#"+type).append("Antonyms ");
+ if (response.ant && response.ant.length) {
+ $("#"+type).append("" + window.Asc.plugin.tr("Antonyms") + " ");
$("#"+type).append("
");
for (let i=0; i"+ response.ant[i] +"");
}
};
- function updateScroll()
- {
+ function updateScroll() {
Ps && Ps.update();
};
- window.Asc.plugin.onTranslate = function()
- {
+ window.Asc.plugin.onTranslate = function() {
var btn_search = document.getElementById("btn_search");
if (btn_search)
btn_search.innerHTML = window.Asc.plugin.tr("Lookup");
@@ -221,19 +202,8 @@
};
- window.Asc.plugin.onThemeChanged = function(theme)
- {
+ window.Asc.plugin.onThemeChanged = function(theme) {
window.Asc.plugin.onThemeChangedBase(theme);
- if (theme.name !== "theme-light")
- {
- document.getElementById("inp_search").classList.remove("input-white");
- document.getElementById("inp_ApiKey").classList.remove("input-white");
- }
- else
- {
- document.getElementById("inp_search").classList.add("input-white");
- document.getElementById("inp_ApiKey").classList.add("input-white");
- }
};
})(window, undefined);
\ No newline at end of file
diff --git a/translations/cs-CS.json b/translations/cs-CS.json
new file mode 100644
index 00000000..93d04189
--- /dev/null
+++ b/translations/cs-CS.json
@@ -0,0 +1,11 @@
+{
+ "Synonym" : "Stejný význam",
+ "Lookup" : "Hledat",
+ "Search" : "Hledat",
+ "Title" : "Zadejte svůj ApiKey",
+ "This word not found" : "Toto slovo nenalezeno",
+ "Noun" : "Podstatné jméno",
+ "Adjective" : "Přídavné jméno",
+ "Verb" : "Sloveso",
+ "Antonyms" : "Opačný význam"
+}
diff --git a/translations/cs-CZ.json b/translations/cs-CZ.json
deleted file mode 100644
index 8611f823..00000000
--- a/translations/cs-CZ.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "Synonym": "Stejný význam",
- "Lookup": "Hledat",
- "Title" : "Zadejte svůj ApiKey",
- "This word not found": "Toto slovo nenalezeno",
- "Noun": "Podstatné jméno",
- "Adjective": "Přídavné jméno",
- "Verb": "Sloveso",
- "Antonyms": "Opačný význam"
-}
diff --git a/translations/de-DE.json b/translations/de-DE.json
index 99bef251..cb4bb03d 100644
--- a/translations/de-DE.json
+++ b/translations/de-DE.json
@@ -1,10 +1,11 @@
{
- "Synonym": "Synonym",
- "Lookup": "Suche",
+ "Synonym" : "Synonym",
+ "Lookup" : "Suche",
+ "Search" : "Suche",
"Title" : "Geben Sie Ihren ApiKey ein",
- "This word not found": "Dieses Wort wurde nicht gefunden",
- "Noun": "Nomen",
- "Adjective": "Adjektiv",
- "Verb": "Verb",
- "Antonyms": "Antonyme"
+ "This word not found" : "Dieses Wort wurde nicht gefunden",
+ "Noun" : "Nomen",
+ "Adjective" : "Adjektiv",
+ "Verb" : "Verb",
+ "Antonyms" : "Antonyme"
}
\ No newline at end of file
diff --git a/translations/es-ES.json b/translations/es-ES.json
index 29263d30..9bb7f466 100644
--- a/translations/es-ES.json
+++ b/translations/es-ES.json
@@ -1,10 +1,11 @@
{
- "Synonym": "Sinónimo",
- "Lookup": "Búsqueda",
+ "Synonym" : "Sinónimo",
+ "Lookup" : "Búsqueda",
+ "Search" : "Búsqueda",
"Title" : "Introduzca su ApiKey",
- "This word not found": "Esta palabra no se encuentra",
- "Noun": "Sustantivo",
- "Adjective": "Adjetivo",
- "Verb": "Verbo",
- "Antonyms": "Antónimos"
+ "This word not found" : "Esta palabra no se encuentra",
+ "Noun" : "Sustantivo",
+ "Adjective" : "Adjetivo",
+ "Verb" : "Verbo",
+ "Antonyms" : "Antónimos"
}
\ No newline at end of file
diff --git a/translations/fr-FR.json b/translations/fr-FR.json
index 1d95157c..01f499f9 100644
--- a/translations/fr-FR.json
+++ b/translations/fr-FR.json
@@ -1,10 +1,11 @@
{
- "Synonym": "Synonyme",
- "Lookup": "Recherche",
+ "Synonym" : "Synonyme",
+ "Lookup" : "Recherche",
+ "Search" : "Recherche",
"Title" : "Entrez votre ApiKey",
- "This word not found": "Ce mot n'est pas trouvé",
- "Noun": "Nom",
- "Adjective": "Adjectif",
- "Verb": "Verbe",
- "Antonyms": "Antonymes"
+ "This word not found" : "Ce mot n'est pas trouvé",
+ "Noun" : "Nom",
+ "Adjective" : "Adjectif",
+ "Verb" : "Verbe",
+ "Antonyms" : "Antonymes"
}
\ No newline at end of file
diff --git a/translations/langs.json b/translations/langs.json
new file mode 100644
index 00000000..7e069ca0
--- /dev/null
+++ b/translations/langs.json
@@ -0,0 +1,7 @@
+[
+ "cs-CZ",
+ "de-DE",
+ "es-ES",
+ "fr-FR",
+ "ru-RU"
+]
\ No newline at end of file
diff --git a/translations/ru-RU.json b/translations/ru-RU.json
index 2bd4dd8d..fc25d8f1 100644
--- a/translations/ru-RU.json
+++ b/translations/ru-RU.json
@@ -1,10 +1,11 @@
{
- "Synonym": "Синоним",
- "Lookup": "Поиск",
+ "Synonym" : "Синоним",
+ "Lookup" : "Поиск",
+ "Search" : "Поиск",
"Title" : "Введите свой ApiKey",
- "This word not found": "Это слово не найдено",
- "Noun": "Имя существительное",
- "Adjective": "Имя прилагательное",
- "Verb": "Глагол",
- "Antonyms": "Антонимы"
+ "This word not found" : "Это слово не найдено",
+ "Noun" : "Имя существительное",
+ "Adjective" : "Имя прилагательное",
+ "Verb" : "Глагол",
+ "Antonyms" : "Антонимы"
}
\ No newline at end of file