Merge pull request #3 from ONLYOFFICE/master

update master
This commit is contained in:
Alexey Matveev
2024-05-02 13:30:23 +03:00
committed by GitHub
22 changed files with 283 additions and 37 deletions

View File

@ -2,4 +2,8 @@
## 1.0.0
* Initial release.
* Initial release.
## 1.0.1
* Add default key if user don't have their own key.

View File

@ -1,7 +1,7 @@
{
"name": "Pixabay",
"guid": "asc.{1f6b80f3-8b3c-41c7-96a1-4b4386a6bd4c}",
"version": "1.0.0",
"version": "1.0.1",
"variations": [
{

View File

@ -187,7 +187,7 @@
</div>
</div>
<div id="main-container-id" >
<div id="api" style="margin-bottom: 16px;">
<div id="api" style="margin-bottom: 16px; display: none;">
<div style="margin: 12px"><span class="i18n">To use Pixabay, create Pixabay account, then copy the API key and insert it in the specified field.</span> <a id="link-readme" class="i18n" target="_blank" href="https://github.com/ONLYOFFICE/onlyoffice.github.io/tree/master/sdkjs-plugins/content/pixabay#configuration">Learn more here.</a></div>
<div style="margin: 16px 0 4px 0; font-weight: normal !important;">
<label class="i18n" style="margin-left:12px;">API key</label>
@ -195,7 +195,7 @@
<input type="text" id="api-value" class="form-control i18n" data-id="pixabay-api-key" placeholder="Enter your Pixabay API key" style="width: calc(100% - 24px); margin: 0 12px 0 12px; text-align: left;">
<button id="save" class="btn-text-default i18n">Save</button>
</div>
<div id="main-search-container-id" style="display:none;">
<div id="main-search-container-id" style="display:block;">
<input type="text" id="search-phrase" class="form-control i18n" placeholder="Enter search phrase" data-id="search-phrase-id" style="width: calc(100% - 24px); margin: 16px 12px 0 12px; text-align: left;">
<button id="button-search-id" class="btn-text-default i18n">Search</button>
<div id="hide_show_reconf">

View File

@ -22,6 +22,7 @@ let Ps1, Ps2;
const displayNoneClass = "display-none";
const borderColor = '#cbcbcb';
const OOKey = '52-50-56-53-54-54-48-53-45-50-55-48-50-102-49-49-52-49-97-52-50-101-55-101-50-54-98-48-100-48-53-49-53-98';
function showLoader(show) {
switchClass(elements.loader, displayNoneClass, !show);
@ -353,7 +354,7 @@ let Ps1, Ps2;
$('#save').on('click', function() {
const apikey = elements.api_input.value.trim();
if (apikey !== '') {
if (true || apikey !== '') {
loadClipArtPage(1, sLastQuery);
} else {
$('#preview-images-container-id').empty();
@ -382,6 +383,7 @@ let Ps1, Ps2;
});
$('#reconf').on('click', function() {
showLoader(false);
saved_key = localStorage.getItem($('#api-value').attr('data-id'));
localStorage.removeItem ($('#api-value').attr('data-id'));
if (saved_key !== null)
@ -398,7 +400,7 @@ let Ps1, Ps2;
});
updateScroll();
if (elements.api_input.value.trim() !== '')
if (true || elements.api_input.value.trim() !== '')
loadClipArtPage(1, sLastQuery);
};
@ -477,13 +479,14 @@ let Ps1, Ps2;
loadImgs(oResponse.hits[nUrl].largeImageURL);
}
}).error(function(oError) {
$('#reconf').trigger('click');
showLoader(false);
container = document.getElementById('scrollable-container-id');
container.scrollTop = 0;
updateScroll();
updateNavigation(0, 0);
$('#preview-images-container-id').empty();
if (elements.api_input.value.trim() !== '') {
if (true || elements.api_input.value.trim() !== '') {
if (!$('#api-value').hasClass('error_api'))
$('#api-value').toggleClass('error_api');
@ -506,9 +509,19 @@ let Ps1, Ps2;
});
};
function getKey() {
let arr = OOKey.split('-');
let result = '';
arr.forEach(function(el) {
result += String.fromCharCode(el);
});
return result;
};
function CreateRequest(nPageIndex, sQuery) {
let sRequest = 'key=';
let apikey = elements.api_input.value.trim();
if (!apikey) apikey = getKey();
let lang = elements.locale.value;
let category = elements.category.value;
let search_phrase = elements.search_phrase.value.replace(/ /gi, "+") || sQuery.replace(/ /gi, "+");

View File

@ -418,6 +418,9 @@ a.aboutlink:active {
.select2-container {
max-height : 20px !important;
}
.select2-container--default.select2-container--disabled{
opacity: 0.65 !important
}
/*
* Container style
*/
@ -603,9 +606,9 @@ a.aboutlink:active {
/* default scroll */
* {
/* * {
scrollbar-width: thin;
}
} */
*::-webkit-scrollbar {
width: 9px;
@ -617,6 +620,11 @@ a.aboutlink:active {
border: 1px solid;
image-rendering: pixelated;
background-repeat: no-repeat;
cursor: default;
}
*::-webkit-scrollbar-track {
cursor: default;
}
*::-webkit-scrollbar-thumb:vertical {

View File

@ -56,6 +56,34 @@
return dst;
}
function getSearchParam(name) {
var _windowSearch = window.location.search;
var _nameSearch = name + "=";
var _pos1 = _windowSearch.indexOf(_nameSearch);
if (_pos1 >= 0)
{
_pos1 += _nameSearch.length;
var _pos2 = _windowSearch.indexOf("&", _pos1);
if (_pos2 < 0)
_pos2 = _windowSearch.length;
return _windowSearch.substring(_pos1, _pos2);
}
return undefined;
}
function checkPluginWindow() {
var windowID = getSearchParam("windowID");
if (windowID) {
window.Asc.plugin.windowID = windowID;
if (!window.Asc.plugin.guid)
window.Asc.plugin.guid = decodeURIComponent(getSearchParam("guid"));
}
return (undefined !== windowID) ? true : false;
}
window.onload = function()
{
if (!window.Asc || !window.Asc.plugin)
@ -67,6 +95,9 @@
xhr.onload = function() {
if (!window.Asc || !window.Asc.plugin)
return;
if (xhr.status === 404)
return xhr.onerror();
if (xhr.status == 200 || (xhr.status == 0 && xhr.readyState == 4)) {
var objConfig = xhr.response;
@ -80,6 +111,10 @@
guid : window.Asc.plugin.guid
};
if (checkPluginWindow()) {
obj.windowID = window.Asc.plugin.windowID;
}
var _body = document.body;
if (_body && true !== window.Asc.plugin.enableDrops) {
_body.ondrop = function(e) {
@ -103,23 +138,25 @@
// ie11 not support message from another domain
window.Asc.plugin._initInternal = true;
var _windowSearch = window.location.search;
var _pos1 = _windowSearch.indexOf("windowID=");
if (_pos1 >= 0)
{
_pos1 += 9;
var _pos2 = _windowSearch.indexOf("&", _pos1);
if (_pos2 < 0)
_pos2 = _windowSearch.length;
window.Asc.plugin.windowID = _windowSearch.substring(_pos1, _pos2);
obj.windowID = window.Asc.plugin.windowID;
}
window.parent.postMessage(JSON.stringify(obj), "*");
}
};
xhr.onerror = function() {
if (!window.Asc || !window.Asc.plugin)
return;
if (checkPluginWindow()) {
var obj = {
type : "initialize",
guid : window.Asc.plugin.guid
};
obj.windowID = window.Asc.plugin.windowID;
// ie11 not support message from another domain
window.Asc.plugin._initInternal = true;
window.parent.postMessage(JSON.stringify(obj), "*");
}
}
xhr.send();
};

View File

@ -39,4 +39,8 @@
* Change parsing rating page (fix problem with console errors into the desktop).
* Fix problem with translations.
* Add parsing changlog files. Now the last version should be on the top (it works only with ONLYOFFICE CHANGELOG files format).
* Add parsing changlog files. Now the last version should be on the top (it works only with ONLYOFFICE CHANGELOG files format).
## 1.0.7
* Add new language for translations.

View File

@ -16,7 +16,7 @@
*
*/
const version = '1.0.6'; // version of store (will change it when update something in store)
const version = '1.0.7'; // version of store (will change it when update something in store)
let start = Date.now();
const isLocal = ( (window.AscDesktopEditor !== undefined) && (window.location.protocol.indexOf('file') !== -1) ); // desktop detecting
let isPluginLoading = false; // flag plugins loading
@ -68,7 +68,10 @@ const languages = [ // list of
['ja-JA', 'ja', 'Japanese'],
['nl-NL', 'nl', 'Dutch'],
['pt-PT', 'pt', 'Portuguese'],
['pt-BR', 'pt', 'Brazilian'],
['ru-RU', 'ru', 'Russian'],
['si-SI', 'si', 'Sinhala'],
['uk-UA', 'uk', 'Ukrainian'],
['zh-ZH', 'zh', 'Chinese']
];
const messages = {
@ -97,6 +100,24 @@ switch (shortLang) {
case 'cs':
translate["Loading"] = "Načítání"
break;
case 'it':
translate["Loading"] = "Caricamento"
break;
case 'ja':
translate["Loading"] = "積み込み"
break;
case 'pt':
translate["Loading"] = "Carregamento"
break;
case 'si':
translate["Loading"] = "පැටවීම"
break;
case 'uk':
translate["Loading"] = "Вантаження"
break;
case 'zh':
translate["Loading"] = "装载量"
break;
}
// it's necessary for loader (because it detects theme by this object)
@ -563,7 +584,8 @@ function getAllPluginsData(bFirstRender, bshowMarketplace) {
arr.forEach(function(full) {
let short = full.split('-')[0];
for (let i = 0; i < languages.length; i++) {
if (languages[i][0] == short || languages[i][1] == short) {
// detect only full language (because we can make mistake with some langs. for instance: "pt-PT" and "pt-BR")
if (languages[i][0] == full /*|| languages[i][1] == short*/) {
supportedLangs.push( getTranslated( languages[i][2] ) );
}
}
@ -809,8 +831,8 @@ function createPluginDiv(plugin, bInstalled) {
}
let variation = plugin.variations[0];
let name = (bTranslate && plugin.nameLocale && plugin.nameLocale[shortLang]) ? plugin.nameLocale[shortLang] : plugin.name;
let description = (bTranslate && variation.descriptionLocale && variation.descriptionLocale[shortLang]) ? variation.descriptionLocale[shortLang] : variation.description;
let name = ( bTranslate && plugin.nameLocale && ( plugin.nameLocale[lang] || plugin.nameLocale[shortLang] ) ) ? ( plugin.nameLocale[lang] || plugin.nameLocale[shortLang] ) : plugin.name;
let description = ( bTranslate && variation.descriptionLocale && ( variation.descriptionLocale[lang] || variation.descriptionLocale[shortLang] ) ) ? ( variation.descriptionLocale[lang] || variation.descriptionLocale[shortLang] ) : variation.description;
let bg = variation.store && variation.store.background ? variation.store.background[themeType] : defaultBG;
let additional = bNotAvailable ? 'disabled title="' + getTranslated(messages.versionWarning) + '"' : '';
let template = '<div class="div_image" style="background: ' + bg + '">' +
@ -1657,7 +1679,7 @@ function makeSearch(val) {
let bUpdate = false;
let arr = plugins.filter(function(el) {
let plugin = el.obj || el;
let name = (plugin.nameLocale && plugin.nameLocale[shortLang]) ? plugin.nameLocale[shortLang] : plugin.name;
let name = (plugin.nameLocale && ( plugin.nameLocale[lang] || plugin.nameLocale[shortLang] ) ) ? ( plugin.nameLocale[lang] || plugin.nameLocale[shortLang] ) : plugin.name;
return name.toLowerCase().includes(val);
});

View File

@ -34,7 +34,10 @@
"Japanese": "Japonština",
"Dutch": "Nizozemský",
"Portuguese": "Portugalský",
"Brazilian": "Brazilský",
"Russian": "Ruština",
"Sinhala": "Sinhálština",
"Ukrainian": "Ukrajinec",
"Chinese": "Čínština",
"Update All": "Aktualizovat Vše",
"Categories": "Kategorie",

View File

@ -34,7 +34,10 @@
"Japanese": "Japanisch",
"Dutch": "Niederländisch",
"Portuguese": "Portugiesisch",
"Brazilian": "Brasilianisch",
"Russian": "Russisch",
"Sinhala": "Singhalesisch",
"Ukrainian": "Ukrainisch",
"Chinese": "Chinesisch",
"Update All": "Alle aktualisieren",
"Categories": "Kategorien",

View File

@ -34,7 +34,10 @@
"Japanese": "Japonés",
"Dutch": "Neerlandés",
"Portuguese": "Portugal",
"Brazilian": "Brasileño",
"Russian": "Ruso",
"Sinhala": "Cingalés",
"Ukrainian": "Ucraniano",
"Chinese": "Chino",
"Update All": "Actualizar Todo",
"Categories": "Categorías",

View File

@ -34,7 +34,10 @@
"Japanese": "Japonais",
"Dutch": "Néerlandais",
"Portuguese": "Portugais",
"Brazilian": "Brésilien",
"Russian": "Russe",
"Sinhala": "Cinghalais",
"Ukrainian": "Ukrainien",
"Chinese": "Chinois",
"Update All": "Tout Mettre à Jour",
"Categories": "Catégorie",

View File

@ -34,7 +34,10 @@
"Japanese": "Giapponese",
"Dutch": "Olandese",
"Portuguese": "Portoghese",
"Brazilian": "Brasiliano",
"Russian": "Russo",
"Sinhala": "Singalese",
"Ukrainian": "Ucraino",
"Chinese": "Cinese",
"Update All": "Aggiorna tutto",
"Categories": "Categorie",

View File

@ -34,7 +34,10 @@
"Japanese": "日本語",
"Dutch": "オランダ語",
"Portuguese": "ポルトガル語",
"Brazilian": "ブラジル人",
"Russian": "ロシア語",
"Sinhala": "シンハラ語",
"Ukrainian": "ウクライナ語",
"Chinese": "中国語",
"Update All": "すべてをアップデートする",
"Categories": "カテゴリー",

View File

@ -8,5 +8,6 @@
"ru-RU",
"si-SI",
"zh-ZH",
"pt-BR"
"pt-BR",
"uk-UA"
]

View File

@ -34,7 +34,10 @@
"Japanese": "Japonês",
"Dutch": "Holandês",
"Portuguese": "Português",
"Brazilian": "Brasileira",
"Russian": "Russo",
"Sinhala": "Sinhala",
"Ukrainian": "Ucraniano",
"Chinese": "Chinês",
"Update All": "Atualize tudo",
"Categories": "Categorias",

View File

@ -0,0 +1,63 @@
{
"Manage plugins": "Gerir plugins",
"Available plugins": "Plugins disponíveis",
"Marketplace": "Mercado",
"Submit your own plugin": "Envie seu próprio plugin",
"Install plugin manually": "Instalar o plugin manualmente",
"Install": "Instalar",
"Remove": "Remover",
"Update": "Actualização",
"Offered by": "Oferecido por",
"Overview": "Visão geral",
"Info & Support": "Informações E Suporte",
"Learn how to use": "Aprender a utilizar",
"the plugin in": "o plugin em",
"Contribute": "Contribuir",
"to the plugin development or report an issue on": "para o desenvolvimento do plugin ou relatar um problema em",
"Get help": "Obter ajuda",
"with the plugin functionality on our forum.": "com a funcionalidade do plugin no nosso fórum.",
"Create a new plugin using": "Crie um novo plugin usando",
"Loading": "Carregamento",
"Installation": "Instalação",
"Updating": "Actualização",
"Removal": "Remoção",
"Problem with loading plugins.": "Problema com o carregamento de plugins.",
"No installed plugins.": "Não há plugins instalados.",
"Version": "Versão",
"Languages": "Línguas",
"English": "Português",
"Czech": "Checa",
"German": "Alemão",
"Spanish": "Espanhol",
"French": "Francês",
"Italian": "Italiano",
"Japanese": "Japonês",
"Dutch": "Neerlandeses",
"Portuguese": "Português",
"Brazilian": "Brasileiro",
"Russian": "Russo",
"Sinhala": "Sinhala",
"Ukrainian": "Ucraniano",
"Chinese": "Chinês",
"Update All": "Actualizar Todos",
"Categories": "Categorias",
"Search plugins": "Search plugins",
"All": "Todos",
"Recommended": "Recomendado",
"Developer tools": "Ferramentas para programadores",
"Work": "Trabalho",
"Entertainment": "Entretenimento",
"Communication": "Comunicação",
"Special abilities": "Habilidades especiais",
"The minimum supported editors version" : "A versão mínima dos editores suportados",
"This plugin will only work in a newer version of the editor.": "Este plugin só funcionará em uma versão mais recente do editor.",
"Nothing was found for this query.": "Nada foi encontrado para esta consulta.",
"No Internet Connection.": "Sem Ligação À Internet.",
"Problem with loading plugin config.\nConfig: " : "Problema com o carregamento da configuração do plugin.\nConfig: ",
"Problem with loading some resources." : "Problema com o carregamento de alguns recursos.",
"File not found." : "Ficheiro não encontrado.",
"Network problem." : "Problema de rede.",
"Problem with loading some resources" : "Problema com o carregamento de alguns recursos",
"Click to rate" : "Clique para avaliar",
"No disscussion page for this plugin." : "Nenhuma página de discussão para este plugin."
}

View File

@ -34,7 +34,10 @@
"Japanese": "Японский",
"Dutch": "Голландский",
"Portuguese": "Португальский",
"Brazilian": "Бразильский",
"Russian": "Русский",
"Sinhala": "Сингальский",
"Ukrainian": "Украинский",
"Chinese": "Китайский",
"Update All": "Обновить все",
"Categories": "Категории",

View File

@ -10,12 +10,12 @@
"Offered by": "පිරිනමන්නේ:",
"Overview": "විශ්ලේෂණය",
"Info & Support": "තොරතුරු හා සහාය",
"Learn how to use": "Learn how to use",
"the plugin in": "the plugin in",
"Contribute": "Contribute",
"to the plugin development or report an issue on": "to the plugin development or report an issue on",
"Get help": "Get help",
"with the plugin functionality on our forum.": "with the plugin functionality on our forum.",
"Learn how to use": "භාවිතා කරන ආකාරය ඉගෙන ගන්න",
"the plugin in": "ප්ලගිනය තුල",
"Contribute": "දායක වන්න",
"to the plugin development or report an issue on": "ප්ලගිනය සංවර්ධනය කිරීමට හෝ මත ප්රශ්නයක් වාර්තා",
"Get help": "උදව් ලබා ගන්න",
"with the plugin functionality on our forum.": "අපගේ සංසදය මත ප්ලගිනය ක්රියාකාරීත්වය සමග.",
"Create a new plugin using": "මෙය භාවිතයෙන් නව පේනුවක් සාදන්න:",
"Loading": "පූරණය වෙමින්",
"Installation": "ස්ථාපනය",
@ -34,7 +34,10 @@
"Japanese": "ජපන්",
"Dutch": "ලන්දේසි",
"Portuguese": "පෘතුගීසි",
"Brazilian": "බ් රසීලියානු",
"Russian": "රුසියානු",
"Sinhala": "සිංහල",
"Ukrainian": "යුක්රේනියානු",
"Chinese": "චීන",
"Update All": "සියල්ල යාවත්කාලය",
"Categories": "ප්‍රවර්ග",

View File

@ -0,0 +1,64 @@
{
"Manage plugins": "Керування плаґінами",
"Available plugins": "Доступні плагіни",
"My plugins": "Мої плаґіни",
"Marketplace": "Крамниця",
"Submit your own plugin": "Надіслати власний плаґін",
"Install plugin manually": "Встановити плаґін вручну",
"Install": "Встановит",
"Remove": "Вилучити",
"Update": "Оновити",
"Offered by": "Запропоновано",
"Overview": "Огляд",
"Info & Support": "Інформація та підтримка",
"Learn how to use": "Дізнайтеся, як користуватися",
"the plugin in": "плаґін у",
"Contribute": "Зробіть власний внесок",
"to the plugin developmen or report an issue on": "у розробку плаґіну або повідомте про ваду на",
"Get help": "Отримайте допомогу",
"with the plugin functionality on our forum.": "щодо функціональності плаґіну на нашому форумі.",
"Create a new plugin using": "Створіть новий плаґін з використанням",
"Loading": "Завантаження",
"Installation": "Встановлення",
"Updating": "Оновлення",
"Removal": "Вилучення",
"Problem with loading plugins.": "Проблеми із завантаженням плаґінів.",
"No installed plugins.": "Жодного плаґіну встановлено.",
"Version": "Версія",
"Languages": "Мови",
"English": "Англійська",
"Czech": "Чеська",
"German": "Німецька",
"Spanish": "Іспанська",
"French": "Французька",
"Italian": "Італійська",
"Japanese": "Японська",
"Dutch": "Голандська",
"Portuguese": "Португальська",
"Brazilian": "Бразильський",
"Russian": "Російська",
"Sinhala": "Сингальський",
"Ukrainian": "Українська",
"Chinese": "Китайська",
"Update All": "Оновіть все",
"Categories": "Категорія",
"Search plugins": "Пошукові плагіни",
"All": "Весь",
"Recommended": "Рекомендований",
"Developer tools": "Інструменти розробника",
"Work": "Робота",
"Entertainment": "Розвага",
"Communication": "Спілкування",
"Special abilities": "Особливі здібності",
"The minimum supported editors version" : "Мінімальна підтримувана версія редактора",
"This plugin will only work in a newer version of the editor.": "Цей плагін буде працювати тільки в більш новій версії редактора.",
"Nothing was found for this query.": "За цим запитом нічого не знайдено.",
"No Internet Connection.": "Немає підключення до Інтернету.",
"Problem with loading plugin config.\nConfig: " : "Проблема із завантаженням конфігурації плагіна.\nКонфігурація:",
"Problem with loading some resources." : "Проблема із завантаженням деяких ресурсів.",
"File not found." : "Файл не знайдено.",
"Network problem." : "Проблема з мережею.",
"Problem with loading some resources" : "Проблема із завантаженням деяких ресурсів",
"Click to rate" : "Натисніть, щоб оцінити",
"No disscussion page for this plugin." : "Для цього плагіна немає сторінки обговорення."
}

View File

@ -34,7 +34,10 @@
"Japanese": "日语",
"Dutch": "荷兰语",
"Portuguese": "葡萄牙语",
"Brazilian": "巴西人",
"Russian": "俄语",
"Sinhala": "僧伽罗语",
"Ukrainian": "乌克兰语",
"Chinese": "中文",
"Update All": "全部更新",
"Categories": "类目",
@ -50,7 +53,7 @@
"This plugin will only work in a newer version of the editor.": "该插件仅适用于更新版本的编辑器。",
"Nothing was found for this query.": "没有找到查询的内容。",
"No Internet Connection.": "没有网络连接。",
"Problem with loading plugin config.\nConfig: " : "加载插件配置时出现问题 .\nConfig: ",
"Problem with loading plugin config.\nConfig: " : "加载插件配置时出现问题 .\n配置: ",
"Problem with loading some resources." : "加载某些资源时出现问题。",
"File not found." : "未找到文件。",
"Network problem." : "网络问题。",