Merge pull request #1 from ONLYOFFICE/develop

Develop
This commit is contained in:
Oleg Korshul
2020-05-28 07:04:13 +00:00
committed by GitHub
23 changed files with 13565 additions and 18 deletions

View File

@ -1,25 +1,13 @@
# Translator plugin
## Overview
Translator plugin allows translating selected text into other languages within ONLYOFFICE editors interface.
Translate the selected text into other languages.
The plugin uses Yandex Translator API. All the languages supported by the service are supported by the ONLYOFFICE plugin.
The plugin is pre-installed in ONLYOFFICE Enterprise Edition, Community Edition (Document Server + Community Server), ONLYOFFICE Integration Edition, ONLYOFFICE cloud service, and ONLYOFFICE Personal.
It is installed by default in cloud, [self-hosted](https://github.com/ONLYOFFICE/DocumentServer) and [desktop version](https://github.com/ONLYOFFICE/DesktopEditors) of ONLYOFFICE editors.
## How to use
1. Choose Translator from the Plugins tab.
2. Select a part of the text.
3. Select the language of the text from the dropdown list, or use the Auto option.
4. Select the language you are going to translate to.
## Documentation
Plugins structure and installation https://api.onlyoffice.com/plugin/basic.
Plugins code and methods https://api.onlyoffice.com/docbuilder/basic.
## User feedback and support
To ask questions and share feedback, use Issues in this repository.
1. Select text you want to translate.
2. Open the Plugins tab and press Translator.
3. Select the language you want your text to be translated to.

40
config.json Normal file
View File

@ -0,0 +1,40 @@
{
"name": "Translator",
"nameLocale": {
"ru": "Переводчик",
"fr": "Traducteur",
"es": "Traductor",
"de": "Übersetzer"
},
"guid": "asc.{7327FC95-16DA-41D9-9AF2-0E7F449F687D}",
"variations": [
{
"description": "Translator",
"descriptionLocale": {
"ru": "Переводчик",
"fr": "Traducteur",
"es": "Traductor",
"de": "Übersetzer"
},
"url": "index.html",
"icons": [ "icon.png", "icon@2x.png", "icon2.png", "icon2@2x.png" ],
"isViewer": true,
"EditorsSupport": [ "word", "cell", "slide" ],
"isVisual": true,
"isModal": false,
"isInsideMode": true,
"initDataType": "text",
"initData": "",
"isUpdateOleOnResize": false,
"buttons": [],
"initOnSelectionChanged": true
}
]
}

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
icon2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
icon2@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
icon@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

64
index.html Normal file
View File

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>translate</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<script src="translate.js"></script>
<link rel="stylesheet" href="select2-4.0.6-rc.1/dist/css/select2.css"/>
<script src="select2-4.0.6-rc.1/dist/js/select2.js"></script>
<style>
html, body {
min-height: 100% !important;
height: 100%;
overflow-y: hidden;
overflow-x: hidden;
}
.noselect {
-khtml-user-select: none;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
}
.combo {
background: #fff;
border: 1px solid #cfcfcf;
border-radius: 2px;
color: #444444;
font-size: 11px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
height: 22px;
cursor: pointer;
margin: 0px 0px 10px 0px;
box-sizing: border-box;
}
div::selection {
background: #a8d1ff;
}
div::-moz-selection {
background: #a8d1ff;
}
</style>
</head>
<body style="width: 100%;height: 100%; margin: 0;">
<div id="main-search-container-id" style="height: 74px; margin: 0px; padding: 10px; box-sizing: border-box; width: 100%;">
<div><select id="lang1_id" class="noselect combo" style="width: 100%"></select></div>
<div style="margin-top: 15px;"><select id="lang2_id" class="noselect combo" style="width: 100%"></select></div>
</div>
<div id="scrollable-container-id" style="position: relative; height: calc(100% - 144px); overflow: hidden">
<div id="translateresult_id" style="display: block; position: absolute; margin: 0; left:0px; top: 0px; width: 100%; box-sizing:border-box;padding-left: 5px; padding-right: 15px; color: #444444; font-size: 14px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; word-wrap: break-word;">
</div>
</div>
<div style="background: rgba(200, 200, 200, 0.5); position: relative; margin: 0px; padding: 10px; box-sizing: border-box; width: 100%; height: 70px; overflow: hidden; color: #444444; font-size: 14px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
<div id="id_progress" style="background: #A0A0A0; position: fixed; margin: -10px; padding: 0px; width: 0%; height: 100%; z-index: -100; display: none;-webkit-transition: width .5s ease-in-out; -moz-transition: width .5s ease-in-out; -o-transition: width .5s ease-in-out; transition: width .5s ease-in-out;"></div>
Переведено сервисом «Яндекс.Переводчик»
<a href="http://translate.yandex.ru/" target="_blank">http://translate.yandex.ru/</a>
</div>
</body>
</html>

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,123 @@
Select2
=======
[![Build Status][travis-ci-image]][travis-ci-status]
Select2 is a jQuery-based replacement for select boxes. It supports searching,
remote data sets, and pagination of results.
To get started, checkout examples and documentation at
https://select2.org/
Use cases
---------
* Enhancing native selects with search.
* Enhancing native selects with a better multi-select interface.
* Loading data from JavaScript: easily load items via AJAX and have them
searchable.
* Nesting optgroups: native selects only support one level of nesting. Select2
does not have this restriction.
* Tagging: ability to add new items on the fly.
* Working with large, remote datasets: ability to partially load a dataset based
on the search term.
* Paging of large datasets: easy support for loading more pages when the results
are scrolled to the end.
* Templating: support for custom rendering of results and selections.
Browser compatibility
---------------------
* IE 8+
* Chrome 8+
* Firefox 10+
* Safari 3+
* Opera 10.6+
Select2 is automatically tested on the following browsers.
[![Sauce Labs Test Status][saucelabs-matrix]][saucelabs-status]
Usage
-----
You can source Select2 directly from a CDN like [JSDliver][jsdelivr] or
[CDNJS][cdnjs], [download it from this GitHub repo][releases], or use one of
the integrations below.
Integrations
------------
Third party developers have created plugins for platforms which allow Select2 to be integrated more natively and quickly. For many platforms, additional plugins are not required because Select2 acts as a standard `<select>` box.
Plugins
* [Django]
- [django-autocomplete-light]
- [django-easy-select2]
- [django-select2]
* [Meteor] - [meteor-select2]
* [Ruby on Rails][ruby-on-rails] - [select2-rails]
* [Wicket] - [wicketstuff-select2]
* [Yii 2][yii2] - [yii2-widget-select2]
Themes
- [Bootstrap 3][bootstrap3] - [select2-bootstrap-theme]
- [Flat UI][flat-ui] - [select2-flat-theme]
- [Metro UI][metro-ui] - [select2-metro]
Missing an integration? Modify this `README` and make a pull request back here to Select2 on GitHub.
Internationalization (i18n)
---------------------------
Select2 supports multiple languages by simply including the right language JS
file (`dist/js/i18n/it.js`, `dist/js/i18n/nl.js`, etc.) after
`dist/js/select2.js`.
Missing a language? Just copy `src/js/select2/i18n/en.js`, translate it, and
make a pull request back to Select2 here on GitHub.
Documentation
-------------
The documentation for Select2 is available
[through GitHub Pages][documentation] and is located within this repository
in the [`docs` folder][documentation-folder].
Community
---------
You can find out about the different ways to get in touch with the Select2
community at the [Select2 community page][community].
Copyright and license
---------------------
The license is available within the repository in the [LICENSE][license] file.
[cdnjs]: http://www.cdnjs.com/libraries/select2
[community]: https://select2.org/getting-help
[documentation]: https://select2.org
[documentation-folder]: https://github.com/select2/select2/tree/master/docs
[freenode]: https://freenode.net/
[jsdelivr]: http://www.jsdelivr.com/#!select2
[license]: LICENSE.md
[releases]: https://github.com/select2/select2/releases
[saucelabs-matrix]: https://saucelabs.com/browser-matrix/select2.svg
[saucelabs-status]: https://saucelabs.com/u/select2
[travis-ci-image]: https://img.shields.io/travis/select2/select2/master.svg
[travis-ci-status]: https://travis-ci.org/select2/select2
[bootstrap3]: https://getbootstrap.com/
[django]: https://www.djangoproject.com/
[django-autocomplete-light]: https://github.com/yourlabs/django-autocomplete-light
[django-easy-select2]: https://github.com/asyncee/django-easy-select2
[django-select2]: https://github.com/applegrew/django-select2
[flat-ui]: http://designmodo.github.io/Flat-UI/
[meteor]: https://www.meteor.com/
[meteor-select2]: https://github.com/nate-strauser/meteor-select2
[metro-ui]: http://metroui.org.ua/
[select2-metro]: http://metroui.org.ua/select2.html
[ruby-on-rails]: http://rubyonrails.org/
[select2-bootstrap-theme]: https://github.com/select2/select2-bootstrap-theme
[select2-flat-theme]: https://github.com/techhysahil/select2-Flat_Theme
[select2-rails]: https://github.com/argerim/select2-rails
[vue.js]: http://vuejs.org/
[select2-vue]: http://vuejs.org/examples/select2.html
[wicket]: https://wicket.apache.org/
[wicketstuff-select2]: https://github.com/wicketstuff/core/tree/master/select2-parent
[yii2]: http://www.yiiframework.com/
[yii2-widget-select2]: https://github.com/kartik-v/yii2-widget-select2

489
select2-4.0.6-rc.1/dist/css/select2.css vendored Normal file
View File

@ -0,0 +1,489 @@
.select2-container {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle; }
.select2-container .select2-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;
height: 22px;
user-select: none;
-webkit-user-select: none; }
.select2-container .select2-selection--single .select2-selection__rendered {
font-size: 12px;
display: block;
padding-left: 8px;
padding-right: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container .select2-selection--single .select2-selection__clear {
position: relative; }
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 8px;
padding-left: 20px; }
.select2-container .select2-selection--multiple {
box-sizing: border-box;
cursor: pointer;
display: block;
min-height: 32px;
user-select: none;
-webkit-user-select: none; }
.select2-container .select2-selection--multiple .select2-selection__rendered {
display: inline-block;
overflow: hidden;
padding-left: 8px;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container .select2-search--inline {
float: left; }
.select2-container .select2-search--inline .select2-search__field {
box-sizing: border-box;
border: none;
font-size: 100%;
margin-top: 5px;
padding: 0; }
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-dropdown {
background-color: white;
border: 1px solid #aaa;
border-radius: 2px;
box-sizing: border-box;
display: block;
position: absolute;
left: -100000px;
width: 100%;
z-index: 1051; }
.select2-results {
display: block; }
.select2-results__options {
font-size: 12px;
list-style: none;
margin: 0;
padding: 0; }
.select2-results__option {
padding: 6px;
user-select: none;
-webkit-user-select: none; }
.select2-results__option[aria-selected] {
cursor: pointer; }
.select2-container--open .select2-dropdown {
left: 0; }
.select2-container--open .select2-dropdown--above {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--open .select2-dropdown--below {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-search--dropdown {
display: block;
padding: 4px; }
.select2-search--dropdown .select2-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box; }
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-search--dropdown.select2-search--hide {
display: none; }
.select2-close-mask {
border: 0;
margin: 0;
padding: 0;
display: block;
position: fixed;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
height: auto;
width: auto;
opacity: 0;
z-index: 99;
background-color: #fff;
filter: alpha(opacity=0); }
.select2-hidden-accessible {
border: 0 !important;
clip: rect(0 0 0 0) !important;
-webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important;
height: 1px !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
width: 1px !important;
white-space: nowrap !important; }
.select2-container--default .select2-selection--single {
outline: none;
background-color: #fff;
border: 1px solid #aaa;
border-radius: 2px; }
.select2-container--default .select2-selection--single .select2-selection__rendered {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #444;
line-height: 22px; }
.select2-container--default .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold; }
.select2-container--default .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 20px;
position: absolute;
top: 1px;
right: 1px;
width: 20px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; }
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
left: 1px;
right: auto; }
.select2-container--default.select2-container--disabled .select2-selection--single {
background-color: #eee;
cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
display: none; }
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; }
.select2-container--default .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
border-radius: 2px;
cursor: text; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0 5px;
width: 100%; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
list-style: none; }
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
color: #999;
margin-top: 5px;
float: left; }
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
margin-right: 10px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 2px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
color: #999;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
float: right; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
margin-left: 5px;
margin-right: auto; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto; }
.select2-container--default.select2-container--focus .select2-selection--multiple {
border: solid black 1px;
outline: 0; }
.select2-container--default.select2-container--disabled .select2-selection--multiple {
background-color: #eee;
cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
display: none; }
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--default .select2-search--dropdown .select2-search__field {
outline-color: #7d858c;
border: 1px solid #aaa; }
.select2-container--default .select2-search--inline .select2-search__field {
background: transparent;
border: none;
outline: 0;
box-shadow: none;
-webkit-appearance: textfield; }
.select2-container--default .select2-results > .select2-results__options {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
max-height: 200px;
overflow-y: auto; }
.select2-container--default .select2-results__option[role=group] {
padding: 0; }
.select2-container--default .select2-results__option[aria-disabled=true] {
color: #999; }
.select2-container--default .select2-results__option[aria-selected=true] {
background-color: #7d858c; }
.select2-container--default .select2-results__option .select2-results__option {
padding-left: 1em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
padding-left: 0; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
margin-left: -1em;
padding-left: 2em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -2em;
padding-left: 3em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -3em;
padding-left: 4em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -4em;
padding-left: 5em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -5em;
padding-left: 6em; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: rgba(200, 200, 200, 0.5);}
.select2-container--default .select2-results__group {
cursor: default;
display: block;
padding: 6px; }
.select2-container--classic .select2-selection--single {
background-color: #f7f7f7;
border: 1px solid #aaa;
border-radius: 2px;
outline: 0;
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
.select2-container--classic .select2-selection--single:focus {
border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 22px; }
.select2-container--classic .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-right: 10px; }
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--classic .select2-selection--single .select2-selection__arrow {
background-color: #ddd;
border: none;
border-left: 1px solid #aaa;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
height: 20px;
position: absolute;
top: 1px;
right: 1px;
width: 20px;
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; }
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
border: none;
border-right: 1px solid #aaa;
border-radius: 0;
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
left: 1px;
right: auto; }
.select2-container--classic.select2-container--open .select2-selection--single {
border: 1px solid #5897fb; }
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
background: transparent;
border: none; }
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; }
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
.select2-container--classic .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
border-radius: 2px;
cursor: text;
outline: 0; }
.select2-container--classic .select2-selection--multiple:focus {
border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
list-style: none;
margin: 0;
padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
display: none; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 2px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
color: #888;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #555; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
float: right;
margin-left: 5px;
margin-right: auto; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto; }
.select2-container--classic.select2-container--open .select2-selection--multiple {
border: 1px solid #5897fb; }
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--classic .select2-search--dropdown .select2-search__field {
border: 1px solid #aaa;
outline: 0; }
.select2-container--classic .select2-search--inline .select2-search__field {
outline: 0;
box-shadow: none; }
.select2-container--classic .select2-dropdown {
background-color: white;
border: 1px solid transparent; }
.select2-container--classic .select2-dropdown--above {
border-bottom: none; }
.select2-container--classic .select2-dropdown--below {
border-top: none; }
.select2-container--classic .select2-results > .select2-results__options {
max-height: 200px;
overflow-y: auto; }
.select2-container--classic .select2-results__option[role=group] {
padding: 0; }
.select2-container--classic .select2-results__option[aria-disabled=true] {
color: grey; }
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
background-color: #3875d7;
color: white; }
.select2-container--classic .select2-results__group {
cursor: default;
display: block;
padding: 6px; }
.select2-container--classic.select2-container--open .select2-dropdown {
border-color: #5897fb; }

File diff suppressed because one or more lines are too long

6559
select2-4.0.6-rc.1/dist/js/select2.full.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

5847
select2-4.0.6-rc.1/dist/js/select2.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
Effective beginning September 10, 2017, the Select2 documentation repository is now available at [`select2/docs`](https://github.com/select2/docs).

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>select2</title>
</head>
<body>
<script>
window.location = 'https://select2.org/upgrading/new-in-40';
</script>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>select2</title>
</head>
<body>
<script>
window.location = 'https://select2.org/getting-help';
</script>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>select2</title>
</head>
<body>
<script>
window.location = 'https://select2.org/getting-started/basic-usage';
</script>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>select2</title>
</head>
<body>
<script>
window.location = 'https://select2.org';
</script>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>select2</title>
</head>
<body>
<script>
window.location = 'https://select2.org/configuration';
</script>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>select2</title>
</head>
<body>
<script>
window.location = 'https://select2.org/configuration';
</script>
</body>
</html>

340
translate.js Normal file
View File

@ -0,0 +1,340 @@
(function(window, undefined){
window.oncontextmenu = function(e)
{
if (e.preventDefault)
e.preventDefault();
if (e.stopPropagation)
e.stopPropagation();
return false;
};
var translate_data = "";
var languages = [];
var language_current = "";
var translate_data_send = null;
var isBreakTranslate = false;
var breakTimeoutId = -1;
var isInit = false;
function updateScroll()
{
Ps.update();
}
function getLanguagesSupport()
{
var xhr = new XMLHttpRequest();
var _url = "https://translate.yandex.net/api/v1.5/tr.json/getLangs?";
_url += "key=trnsl.1.1.20160604T115612Z.107ebb05a7757bcc.804e900f347ddfbeadd7ca5999bd5cb6ca32805b";
_url += "&ui=en";
xhr.open('POST', _url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
try
{
var _obj = JSON.parse(this.responseText);
var _langs = _obj.langs;
languages = [];
for (var i in _langs)
{
languages.push( { id : i, lang : _langs[i] } );
}
var _defLang = "ru";
if (window.Asc.plugin.info.lang && window.Asc.plugin.info.lang.length == 5)
{
_defLang = Asc.plugin.info.lang.substr(0, 2);
}
languages.sort(function(a, b)
{
if (a.lang > b.lang)
{
return 1;
}
if (a.lang < b.lang)
{
return -1;
}
return 0;
});
languages.unshift( { id : "auto", lang : "Auto" } );
var _len = languages.length;
var _defaultDest = 0;
var _langs = "";
for (var i = 1; i < _len; i++)
{
_langs += ("<option value=\"" + languages[i].id + "\">" + languages[i].lang + "</option>");
if (languages[i].id == _defLang)
_defaultDest = i - 1;
}
document.getElementById("lang1_id").innerHTML = "<option value='auto'>Auto</option>" + _langs;
document.getElementById("lang2_id").innerHTML = _langs;
document.getElementById("lang2_id").selectedIndex = _defaultDest;
$('#lang1_id').select2({
// minimumResultsForSearch: Infinity
}).on('select2:select', function (e) { translate(); });
$('#lang2_id').select2({
// minimumResultsForSearch: Infinity
}).on('change', function (e) { translate(); });
translate();
}
catch (err)
{
window.Asc.plugin.executeCommand("close", "");
}
}
else if (this.readyState == 4)
{
try
{
var _obj = JSON.parse(this.responseText);
if (_obj.message)
console.log("[translator] : " + _obj.message);
}
catch (err)
{
}
}
};
xhr.send(null);
}
function getTranslateArray(data)
{
var return_array = [];
// split by max_size
var max_size = 9000;
var index = 0;
var test_border = max_size - 500;
var chars = [".", "%2C", "%20"];
while (data.length > max_size)
{
for (var i = 0; i < chars.length; i++)
{
index = data.lastIndexOf(chars[i], max_size);
if (index > test_border)
{
index += chars[i].length;
break;
}
else
{
index = max_size;
}
}
return_array.push(data.substr(0, index));
data = data.substr(index);
}
return_array.push(data);
return { parts : return_array, current : 0 };
}
function translateIter()
{
if (!translate_data_send)
return;
if (translate_data_send.current >= translate_data_send.parts.length)
{
translate_data_send = null;
var _select1 = document.getElementById("lang1_id");
var _select2 = document.getElementById("lang2_id");
_select1.removeAttribute("disabled");
_select2.removeAttribute("disabled");
document.getElementById("id_progress").style.display = "none";
return;
}
var _text = translate_data_send.parts[translate_data_send.current];
translate_data_send.current++;
if (_text == "")
return translateIter();
if (translate_data_send.parts.length != 1)
{
document.getElementById("id_progress").style.display = "block";
var _cur = (100 * translate_data_send.current / translate_data_send.parts.length) >> 0;
if (_cur > 100)
_cur = 100;
document.getElementById("id_progress").style.width = _cur + "%";
}
var xhr = new XMLHttpRequest();
var _url = "https://translate.yandex.net/api/v1.5/tr.json/translate?";
_url += "key=trnsl.1.1.20160604T115612Z.107ebb05a7757bcc.804e900f347ddfbeadd7ca5999bd5cb6ca32805b";
_url += "&text=";
_url += _text;
_url += ("&lang=" + language_current);
_url += "&format=plain";
xhr.open('POST', _url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200 && !closed)
{
try
{
if (isBreakTranslate)
{
translate();
return;
}
var _obj = JSON.parse(this.responseText);
var _text = _obj.text[0];
if (null == translate_data_send)
document.getElementById("translateresult_id").innerHTML = "";
else if (1 == translate_data_send.current)
document.getElementById("translateresult_id").innerHTML = _text;
else
document.getElementById("translateresult_id").innerHTML += _text;
updateScroll();
translateIter();
}
catch (err)
{
}
}
else if (401 == this.readyState || 404 == this.readyState || 413 == this.readyState || 422 == this.readyState || 501 == this.readyState || 403 == this.status)
{
if (isBreakTranslate)
{
translate();
return;
}
translateIter();
}
else if (this.readyState == 4)
{
try
{
var _obj = JSON.parse(this.responseText);
if (_obj.message)
console.log("[translator] : " + _obj.message);
}
catch (err)
{
}
}
};
xhr.send(null);
}
function translate()
{
isBreakTranslate = false;
if (-1 != breakTimeoutId)
{
clearTimeout(breakTimeoutId);
breakTimeoutId = -1;
}
document.getElementById("translateresult_id").innerHTML = "";
updateScroll();
if (translate_data == "")
return;
language_current = "";
var _select1 = document.getElementById("lang1_id");
var _select2 = document.getElementById("lang2_id");
_select1.setAttribute("disabled", "disabled");
_select2.setAttribute("disabled", "disabled");
if (!_select1.options[_select1.selectedIndex])
return;
if (_select1.selectedIndex != 0)
language_current += (_select1.options[_select1.selectedIndex].value + "-");
language_current += _select2.options[_select2.selectedIndex].value;
translate_data_send = getTranslateArray(encodeURIComponent(translate_data));
translateIter();
}
window.Asc.plugin.init = function(text)
{
document.getElementById("translateresult_id").innerHTML = "";
text = text.replace(/;/g, "%3B");
translate_data = text;
if (!isInit)
{
var container = document.getElementById('scrollable-container-id');
Ps = new PerfectScrollbar('#' + container.id, { minScrollbarLength: 20 });
getLanguagesSupport();
window.onresize = function()
{
updateScroll();
};
}
else
{
if (null == translate_data_send)
{
translate();
}
else
{
isBreakTranslate = true;
breakTimeoutId = setTimeout(function() { translate(); }, 5000);
}
}
isInit = true;
updateScroll();
};
window.Asc.plugin.button = function(id)
{
this.executeCommand("close", "");
};
window.Asc.plugin.onExternalMouseUp = function()
{
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("mouseup", true, true, window, 1, 0, 0, 0, 0,
false, false, false, false, 0, null);
document.dispatchEvent(evt);
};
})(window, undefined);