Megre "feature/changelog" into "master". Resolve conflicts into "store/scripts/code.js" and "sdkjs-plugins/content/openai/CHANGELOG.md".

This commit is contained in:
AlexeyMatveev686
2023-10-16 12:17:09 +03:00
8 changed files with 159 additions and 20 deletions

View File

@ -26,4 +26,4 @@
## 1.1.2
* Enable plugin for IE.
* Enable plugin for IE.

View File

@ -10,4 +10,10 @@ License File: Select2.license
2. jQuery - Query is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. (http://jquery.com/)
License: MIT License
License File: jQuery.license
License File: jQuery.license
3. marked - low-level compiler for parsing markdown without caching or blocking for long periods of time. (https://github.com/markedjs/marked)
License: MIT License
License File: marked.license

View File

@ -25,6 +25,7 @@
<script type="text/javascript" src="scripts/polyfill.js"></script>
<script type="text/javascript" src="scripts/code.js"></script>
<script src="vendor/select2-4.0.13/js/select2.js"></script>
<script src="vendor/marked/marked.min.js"></script>
</head>
<body class="noselect">
<img class="stars_grey" style="opacity: 0; z-index: -1000;" src="./resources/img/stars/rating-stars.svg"/>
@ -115,8 +116,9 @@
<div id="div_selected_main" class="div_selected_main hidden">
<div style="width:100%; height:100%">
<div>
<span id="span_overview" class="span_caption span_selected" onclick="onSelectPreview(event.target, true)">Overview</span>
<span id="span_info" class="span_caption" onclick="onSelectPreview(event.target, false)">Info & Support</span>
<span id="span_overview" class="span_caption span_selected" onclick="onSelectPreview(event.target, 1)">Overview</span>
<span id="span_info" class="span_caption" onclick="onSelectPreview(event.target, 2)">Info & Support</span>
<span id="span_changelog" class="span_caption" onclick="onSelectPreview(event.target, 3)">Changelog</span>
<hr>
</div>
<div id="div_selected_preview" class="div_selected_preview">
@ -166,6 +168,9 @@
<a class="aboutlink link_info" target="blank" href="https://api.onlyoffice.com/plugin/basic">ONLYOFFICE API.</a>
</div>
</div>
<div id="div_selected_changelog" class="div_selected_preview hidden">
<div id="div_changelog_preview"></div>
</div>
</div>
</div>
<div id="div_error" class="error_main hidden"><div class="loader_background"></div></div>

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,44 @@
# License information
## Contribution License Agreement
If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. `</legalese>`
## Marked
Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## Markdown
Copyright © 2004, John Gruber
http://daringfireball.net/
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

View File

@ -303,8 +303,9 @@ label.header {
.div_selected_preview {
width: 100%;
height: calc(100% - 25px);
height: calc(100% - 60px);
margin-top: 25px;
position: absolute;
}
.div_selected_info {

View File

@ -49,6 +49,8 @@ let timeout = null; // delay fo
let defaultBG = themeType == 'light' ? "#F5F5F5" : '#555555'; // default background color for plugin header
let isResizeOnStart = false; // flag for firs resize on start
let slideIndex = 1; // index for slides
let PsMain = null; // scroll for list of plugins
let PsChanglog = null; // scroll for changlog preview
const proxyUrl = 'https://plugins-services.onlyoffice.com/proxy'; // url to proxy for getting rating
const supportedScaleValues = [1, 1.25, 1.5, 1.75, 2]; // supported scale
let scale = { // current scale
@ -551,7 +553,7 @@ function getAllPluginsData(bFirstRender, bshowMarketplace) {
config.baseUrl = pluginUrl;
arr[i] = config;
makeRequest(pluginUrl + 'translations/langs.json', 'GET', null, null, true).then(
makeRequest(pluginUrl + 'translations/langs.json', 'GET', null, null, false).then(
function(response) {
let supportedLangs = [ getTranslated('English') ];
let arr = JSON.parse(response);
@ -570,6 +572,13 @@ function getAllPluginsData(bFirstRender, bshowMarketplace) {
config.languages = [ getTranslated('English') ];
}
);
makeRequest(pluginUrl + 'CHANGELOG.md', 'GET', null, null, false).then(
function(response) {
let settings = getMarkedSetting()
let lexed = marked.lexer(response.replace('# Change Log\n\n', ''), settings);
config.changelog = marked.parser(lexed, settings);
}
);
if (plugin.discussion) {
discussionCount++;
config.discussionUrl = discussionsUrl + plugin.discussion;
@ -703,18 +712,24 @@ function showListofPlugins(bAll, sortedArr) {
if (plugin && plugin.guid)
createPluginDiv(plugin, !bAll);
});
setTimeout(function(){if (Ps) Ps.update(); toogleLoader(false);});
setTimeout(function(){if (PsMain) PsMain.update(); toogleLoader(false);});
} else {
// if no istalled plugins and available plugins button was clicked
let notification = Array.isArray(sortedArr) ? 'Nothing was found for this query.' : bAll ? 'Problem with loading plugins.' : 'No installed plugins.';
createNotification(notification);
toogleLoader(false);
}
if (!Ps) {
Ps = new PerfectScrollbar('#div_main', {});
Ps.update();
// scroll for list of plugins
if (!PsMain) {
PsMain = new PerfectScrollbar('#div_main', {});
PsMain.update();
} else {
Ps.update();
PsMain.update();
}
// scroll for changelog preview
if (!PsChanglog) {
PsChanglog = new PerfectScrollbar('#div_selected_changelog', {});
PsChanglog.update();
}
};
@ -820,7 +835,7 @@ function createPluginDiv(plugin, bInstalled) {
'</div>';
div.innerHTML = template;
elements.divMain.appendChild(div);
if (Ps) Ps.update();
if (PsMain) PsMain.update();
};
function showRating() {
@ -1054,6 +1069,14 @@ function onClickItem() {
elements.divLanguages.classList.add('hidden');
}
if (plugin.changelog) {
document.getElementById('span_changelog').classList.remove('hidden');
document.getElementById('div_changelog_preview').innerHTML = plugin.changelog;
} else {
document.getElementById('span_changelog').classList.add('hidden');
document.getElementById('div_changelog_preview').innerHTML = '';
}
let pluginUrl = plugin.baseUrl.replace(OOMarketplaceUrl, (OOIO + 'tree/master/') );
// TODO problem with plugins icons (different margin from top)
@ -1117,22 +1140,25 @@ function onClickBack() {
elements.divSelected.classList.add('hidden');
elements.divSelectedMain.classList.add('hidden');
elements.divBody.classList.remove('hidden');
if(Ps) Ps.update();
if(PsMain) PsMain.update();
};
function onSelectPreview(target, isOverview) {
function onSelectPreview(target, type) {
// change mode of preview
if ( !target.classList.contains('span_selected') ) {
$(".span_selected").removeClass("span_selected");
target.classList.add("span_selected");
$(".div_selected_preview").addClass("hidden");
if (isOverview) {
document.getElementById('div_selected_info').classList.add('hidden');
// type: 1 - Overview; 2 - Info; 3 - Changelog;
if (type === 1) {
document.getElementById('div_selected_preview').classList.remove('hidden');
setDivHeight();
} else {
document.getElementById('div_selected_preview').classList.add('hidden');
} else if (type === 2) {
document.getElementById('div_selected_info').classList.remove('hidden');
} else {
document.getElementById('div_selected_changelog').classList.remove('hidden');
PsChanglog.update();
}
}
};
@ -1181,7 +1207,7 @@ function createError(err, bDontShow) {
function setDivHeight() {
// set height for div with image in preview mode
if (Ps) Ps.update();
if (PsMain) PsMain.update();
// console.log(Math.round(window.devicePixelRatio * 100));
if (elements.divScreen) {
let height = elements.divScreen.parentNode.clientHeight - elements.divScreen.previousElementSibling.clientHeight - 70 + 'px';
@ -1220,6 +1246,7 @@ window.onresize = function(bForce) {
}
$('.div_item').css('border', ((revZoom > 1 ? 1 : revZoom) +'px solid ' + (themeType == 'ligh' ? '#c0c0c0' : '#666666')));
}
if (PsChanglog) PsChanglog.update();
};
// zoom on start if we start with a non 100% zoom
@ -1519,7 +1546,7 @@ function toogleView(current, oldEl, text, bAll, bForce) {
if ( ( bAll && (!isOnline || isPluginLoading) ) || flag) {
$('.div_notification').remove();
$('.div_item').remove();
setTimeout(function(){if (Ps) Ps.update()});
setTimeout(function(){if (PsMain) PsMain.update()});
toolbar.classList.add('hidden');
createNotification('No Internet Connection.', 'Problem with loading some resources')
} else {
@ -1823,4 +1850,33 @@ function showSlides(n) {
if(dots.length)
dots[slideIndex-1].className += ' active';
};
function getMarkedSetting() {
// function for marked librry
let defaults = {};
const settings = {};
if (typeof marked.getDefaults === 'function') {
defaults = marked.getDefaults();
} else if ('defaults' in marked) {
for (const prop in marked.defaults) {
defaults[prop] = marked.defaults[prop];
}
}
const invalidOptions = [
'renderer',
'tokenizer',
'walkTokens',
'extensions',
'highlight',
'sanitizer'
];
for (const prop in defaults) {
if (!invalidOptions.includes(prop))
settings[prop] = defaults[prop]
}
return settings;
};

6
store/vendor/marked/marked.min.js vendored Normal file

File diff suppressed because one or more lines are too long