diff --git a/sdkjs-plugins/content/apertium/config.json b/sdkjs-plugins/content/apertium/config.json index 3bfab219..69b42d4a 100644 --- a/sdkjs-plugins/content/apertium/config.json +++ b/sdkjs-plugins/content/apertium/config.json @@ -90,7 +90,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work"] } } ] diff --git a/sdkjs-plugins/content/autocomplete/config.json b/sdkjs-plugins/content/autocomplete/config.json index 5e2018b6..5e19c81a 100644 --- a/sdkjs-plugins/content/autocomplete/config.json +++ b/sdkjs-plugins/content/autocomplete/config.json @@ -43,7 +43,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work", "recommended"] } } ] diff --git a/sdkjs-plugins/content/chess/config.json b/sdkjs-plugins/content/chess/config.json index fecd64a6..6fc8bc15 100644 --- a/sdkjs-plugins/content/chess/config.json +++ b/sdkjs-plugins/content/chess/config.json @@ -1,6 +1,6 @@ { "name": "Сhess", - "nameLocale": { + "nameLocale": { "ru": "Шахматы", "fr": "Échecs", "es": "Ajedrez", @@ -11,7 +11,7 @@ "variations": [ { "description": "Play chess with other collaborators right in the editors. ", - "descriptionLocale": { + "descriptionLocale": { "ru": "Играйте в шахматы с другими пользователями прямо в редакторах.", "fr": "Jouez aux échecs avec vos collaborateurs directement dans les éditeurs.", "es": "Juegue al ajedrez con otros colaboradores directamente en los editores.", @@ -20,7 +20,7 @@ "url" : "index.html", "icons" : ["resources/light/icon.png", "resources/light/icon@2x.png"], - "icons2": [ + "icons2": [ { "style" : "light", @@ -81,14 +81,15 @@ "dark" : "#444444;" }, "screenshots" : [ - "resources/store/screenshots/screen_1.png", - "resources/store/screenshots/screen_2.png", - "resources/store/screenshots/screen_3.png" - ], + "resources/store/screenshots/screen_1.png", + "resources/store/screenshots/screen_2.png", + "resources/store/screenshots/screen_3.png" + ], "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["entertainment", "specAbilities"] } }, { diff --git a/sdkjs-plugins/content/deepl/config.json b/sdkjs-plugins/content/deepl/config.json index 18c70411..88b0f3e3 100644 --- a/sdkjs-plugins/content/deepl/config.json +++ b/sdkjs-plugins/content/deepl/config.json @@ -86,7 +86,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work"] } } ] diff --git a/sdkjs-plugins/content/doc2md/config.json b/sdkjs-plugins/content/doc2md/config.json index 3cfb5b2f..a723fd97 100644 --- a/sdkjs-plugins/content/doc2md/config.json +++ b/sdkjs-plugins/content/doc2md/config.json @@ -79,7 +79,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work"] } }, { diff --git a/sdkjs-plugins/content/drawio/config.json b/sdkjs-plugins/content/drawio/config.json index c1fb12b3..daeb4126 100644 --- a/sdkjs-plugins/content/drawio/config.json +++ b/sdkjs-plugins/content/drawio/config.json @@ -107,7 +107,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work", "recommended"] } } ] diff --git a/sdkjs-plugins/content/easybib/config.json b/sdkjs-plugins/content/easybib/config.json index 2bca08e5..6a12f93e 100644 --- a/sdkjs-plugins/content/easybib/config.json +++ b/sdkjs-plugins/content/easybib/config.json @@ -44,7 +44,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work"] } } ] diff --git a/sdkjs-plugins/content/glavred/config.json b/sdkjs-plugins/content/glavred/config.json index d0579eba..ce6b394b 100644 --- a/sdkjs-plugins/content/glavred/config.json +++ b/sdkjs-plugins/content/glavred/config.json @@ -78,7 +78,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } } ] diff --git a/sdkjs-plugins/content/grammalecte/config.json b/sdkjs-plugins/content/grammalecte/config.json index 243aa41f..16232b48 100644 --- a/sdkjs-plugins/content/grammalecte/config.json +++ b/sdkjs-plugins/content/grammalecte/config.json @@ -91,7 +91,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work"] } }, { diff --git a/sdkjs-plugins/content/highlightcode/config.json b/sdkjs-plugins/content/highlightcode/config.json index 1b8ef8b0..9c631cf0 100644 --- a/sdkjs-plugins/content/highlightcode/config.json +++ b/sdkjs-plugins/content/highlightcode/config.json @@ -97,7 +97,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work", "devTools"] } } ], diff --git a/sdkjs-plugins/content/html/config.json b/sdkjs-plugins/content/html/config.json index 4b198d4c..ea689274 100644 --- a/sdkjs-plugins/content/html/config.json +++ b/sdkjs-plugins/content/html/config.json @@ -78,7 +78,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work", "devTools"] } } ] diff --git a/sdkjs-plugins/content/jitsi/config.json b/sdkjs-plugins/content/jitsi/config.json index 5d9ec4bc..d6d7cf4a 100644 --- a/sdkjs-plugins/content/jitsi/config.json +++ b/sdkjs-plugins/content/jitsi/config.json @@ -78,7 +78,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "communication"] } } ] diff --git a/sdkjs-plugins/content/languagetool/config.json b/sdkjs-plugins/content/languagetool/config.json index 86702c49..c358533f 100644 --- a/sdkjs-plugins/content/languagetool/config.json +++ b/sdkjs-plugins/content/languagetool/config.json @@ -86,7 +86,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work", "recommended"] } }, { diff --git a/sdkjs-plugins/content/macros/config.json b/sdkjs-plugins/content/macros/config.json index 49e67083..fad255bb 100644 --- a/sdkjs-plugins/content/macros/config.json +++ b/sdkjs-plugins/content/macros/config.json @@ -99,7 +99,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work", "recommended", "devTools"] } } ] diff --git a/sdkjs-plugins/content/mendeley/config.json b/sdkjs-plugins/content/mendeley/config.json index d2a618a9..fd351118 100644 --- a/sdkjs-plugins/content/mendeley/config.json +++ b/sdkjs-plugins/content/mendeley/config.json @@ -77,7 +77,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } } ] diff --git a/sdkjs-plugins/content/ocr/config.json b/sdkjs-plugins/content/ocr/config.json index 9ac5e444..9794cd6c 100644 --- a/sdkjs-plugins/content/ocr/config.json +++ b/sdkjs-plugins/content/ocr/config.json @@ -103,7 +103,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work"] } }, { diff --git a/sdkjs-plugins/content/photoeditor/config.json b/sdkjs-plugins/content/photoeditor/config.json index ec404f53..61f9a41b 100644 --- a/sdkjs-plugins/content/photoeditor/config.json +++ b/sdkjs-plugins/content/photoeditor/config.json @@ -100,7 +100,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "work", "recommended"] } }, { diff --git a/sdkjs-plugins/content/rainbow/config.json b/sdkjs-plugins/content/rainbow/config.json index 6e3bfc24..fdd35fbd 100644 --- a/sdkjs-plugins/content/rainbow/config.json +++ b/sdkjs-plugins/content/rainbow/config.json @@ -90,7 +90,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } }, { diff --git a/sdkjs-plugins/content/speech/config.json b/sdkjs-plugins/content/speech/config.json index a1fc06a5..2cd3b1f6 100644 --- a/sdkjs-plugins/content/speech/config.json +++ b/sdkjs-plugins/content/speech/config.json @@ -85,7 +85,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } }, { diff --git a/sdkjs-plugins/content/telegram/config.json b/sdkjs-plugins/content/telegram/config.json index 9696013f..45033876 100644 --- a/sdkjs-plugins/content/telegram/config.json +++ b/sdkjs-plugins/content/telegram/config.json @@ -46,7 +46,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "communication", "entertainment"] } } ] diff --git a/sdkjs-plugins/content/thesaurus/config.json b/sdkjs-plugins/content/thesaurus/config.json index 3033f464..b91eea45 100644 --- a/sdkjs-plugins/content/thesaurus/config.json +++ b/sdkjs-plugins/content/thesaurus/config.json @@ -79,7 +79,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } } ] diff --git a/sdkjs-plugins/content/translator/config.json b/sdkjs-plugins/content/translator/config.json index 829085e9..a0d5b8ac 100644 --- a/sdkjs-plugins/content/translator/config.json +++ b/sdkjs-plugins/content/translator/config.json @@ -48,7 +48,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } } ] diff --git a/sdkjs-plugins/content/typograf/config.json b/sdkjs-plugins/content/typograf/config.json index 2b544fa1..ee331198 100644 --- a/sdkjs-plugins/content/typograf/config.json +++ b/sdkjs-plugins/content/typograf/config.json @@ -54,7 +54,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } } ] diff --git a/sdkjs-plugins/content/wordscounter/config.json b/sdkjs-plugins/content/wordscounter/config.json index f1e2bb64..5b8fef29 100644 --- a/sdkjs-plugins/content/wordscounter/config.json +++ b/sdkjs-plugins/content/wordscounter/config.json @@ -79,7 +79,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } } ] diff --git a/sdkjs-plugins/content/youtube/config.json b/sdkjs-plugins/content/youtube/config.json index 9136da8e..f9f27566 100644 --- a/sdkjs-plugins/content/youtube/config.json +++ b/sdkjs-plugins/content/youtube/config.json @@ -67,7 +67,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "entertainment", "recommended"] } } ] diff --git a/sdkjs-plugins/content/zoom/config.json b/sdkjs-plugins/content/zoom/config.json index ebdbfbb9..a4f0adde 100644 --- a/sdkjs-plugins/content/zoom/config.json +++ b/sdkjs-plugins/content/zoom/config.json @@ -126,7 +126,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities", "entertainment", "communication"] } } ] diff --git a/sdkjs-plugins/content/zotero/config.json b/sdkjs-plugins/content/zotero/config.json index f728bc77..629723de 100644 --- a/sdkjs-plugins/content/zotero/config.json +++ b/sdkjs-plugins/content/zotero/config.json @@ -78,7 +78,8 @@ "icons" : { "light" : "resources/store/icons", "dark" : "resources/store/icons" - } + }, + "categories": ["specAbilities"] } } ] diff --git a/store/index.html b/store/index.html index 7983632f..d49633a8 100644 --- a/store/index.html +++ b/store/index.html @@ -52,19 +52,21 @@ + - + +
Sort by
- +
diff --git a/store/scripts/code.js b/store/scripts/code.js index 476d5f6d..a3d73745 100644 --- a/store/scripts/code.js +++ b/store/scripts/code.js @@ -170,7 +170,7 @@ window.onload = function() { $('#select_categories').select2({ minimumResultsForSearch: Infinity }).on('change', function(event) { - console.log(event.currentTarget.value); + filterByCategory(event.currentTarget.value); }); $('#select_sortBy').select2({ @@ -194,7 +194,7 @@ window.addEventListener('message', function(message) { installedPlugins = message.data.filter(function(el) { return (el.guid !== guidMarkeplace && el.guid !== guidSettings); }); - sortPlugins(false, true); + sortPlugins(false, true, 'name'); } else { installedPlugins = []; } @@ -222,7 +222,7 @@ window.addEventListener('message', function(message) { removed: false } ); - sortPlugins(false, true); + sortPlugins(false, true, 'name'); } else if (installed) { installed.removed = false; } @@ -495,7 +495,7 @@ function getAllPluginsData() { if (!count) { // console.log('getAllPluginsData: ' + (Date.now() - start)); removeUnloaded(Unloaded); - sortPlugins(true, false); + sortPlugins(true, false, 'name'); isPluginLoading = false; showMarketplace(); } @@ -525,7 +525,7 @@ function getAllPluginsData() { createError(new Error('Problem with loading plugin config.\nConfig: ' + confUrl)); if (!count) { removeUnloaded(Unloaded); - sortPlugins(true, false); + sortPlugins(true, false, 'name'); isPluginLoading = false; showMarketplace(); } @@ -1131,16 +1131,27 @@ function toogleView(current, oldEl, text, bAll) { } }; -function sortPlugins(bAll, bInst) { - if (bAll) { - allPlugins.sort(function(a, b) { - return a.name.localeCompare(b.name); - }); - } - if (bInst) { - installedPlugins.sort(function(a, b) { - return a.obj.name.localeCompare(b.obj.name); - }); +function sortPlugins(bAll, bInst, type) { + switch (type) { + case 'raiting': + // todo + break; + case 'instalations': + // todo + break; + + default: + if (bAll) { + allPlugins.sort(function(a, b) { + return a.name.localeCompare(b.name); + }); + } + if (bInst) { + installedPlugins.sort(function(a, b) { + return a.obj.name.localeCompare(b.obj.name); + }); + } + break; } }; @@ -1175,6 +1186,17 @@ function makeSearch(event) { }, 100); }; +function filterByCategory(category) { + let plugins = elements.btnMarketplace.classList.contains('btn_toolbar_active') ? allPlugins : installedPlugins; + let arr = plugins.filter(function(plugin) { + let variation = plugin.obj.variations[0] || plugin.variations[0]; + let arrCat = (variation.store && variation.store.categories) ? pvariation.store.categories : []; + return arrCat.includes(category); + }); + + showListofPlugins(null, arr); +}; + function createDefaultTranslations() { translate = { "Submit your own plugin": "Submit your own plugin",