aboutsummaryrefslogtreecommitdiff
path: root/sources/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'sources/plugins')
-rw-r--r--sources/plugins/html5video/dialogs/html5video.js152
-rw-r--r--sources/plugins/html5video/icons/html5video.pngbin0 -> 14773 bytes
-rw-r--r--sources/plugins/html5video/lang/de.js14
-rw-r--r--sources/plugins/html5video/lang/en.js14
-rw-r--r--sources/plugins/html5video/lang/es.js14
-rw-r--r--sources/plugins/html5video/lang/eu.js14
-rw-r--r--sources/plugins/html5video/lang/fr.js14
-rw-r--r--sources/plugins/html5video/lang/ru.js14
-rw-r--r--sources/plugins/html5video/lang/uk.js14
-rw-r--r--sources/plugins/html5video/lang/uz.js14
-rw-r--r--sources/plugins/html5video/plugin.js129
11 files changed, 393 insertions, 0 deletions
diff --git a/sources/plugins/html5video/dialogs/html5video.js b/sources/plugins/html5video/dialogs/html5video.js
new file mode 100644
index 0000000..99f89c3
--- /dev/null
+++ b/sources/plugins/html5video/dialogs/html5video.js
@@ -0,0 +1,152 @@
1CKEDITOR.dialog.add( 'html5video', function( editor ) {
2 return {
3 title: editor.lang.html5video.title,
4 minWidth: 500,
5 minHeight: 100,
6 contents: [ {
7 id: 'info',
8 label: editor.lang.html5video.infoLabel,
9 elements: [ {
10 type: 'vbox',
11 padding: 0,
12 children: [
13 {
14 type: 'hbox',
15 widths: [ '365px', '110px' ],
16 align: 'right',
17 children: [ {
18 type: 'text',
19 id: 'url',
20 label: editor.lang.html5video.allowed,
21 required: true,
22 validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.html5video.urlMissing ),
23 setup: function( widget ) {
24 this.setValue( widget.data.src );
25 },
26 commit: function( widget ) {
27 widget.setData( 'src', this.getValue() );
28 }
29 },
30 {
31 type: 'button',
32 id: 'browse',
33 // v-align with the 'txtUrl' field.
34 // TODO: We need something better than a fixed size here.
35 style: 'display:inline-block;margin-top:14px;',
36 align: 'center',
37 label: editor.lang.common.browseServer,
38 hidden: true,
39 filebrowser: 'info:url'
40 } ]
41 } ]
42 },
43 {
44 type: 'hbox',
45 id: 'size',
46 children: [ {
47 type: 'text',
48 id: 'width',
49 label: editor.lang.common.width,
50 'default': 400,
51 setup: function( widget ) {
52 if ( widget.data.width ) {
53 this.setValue( widget.data.width );
54 }
55 },
56 commit: function( widget ) {
57 widget.setData( 'width', this.getValue() );
58 }
59 },
60 {
61 type: 'text',
62 id: 'height',
63 label: editor.lang.common.height,
64 'default': 300,
65 setup: function( widget ) {
66 if ( widget.data.height ) {
67 this.setValue( widget.data.height );
68 }
69 },
70 commit: function( widget ) {
71 widget.setData( 'height', this.getValue() );
72 }
73 },
74 ]
75 },
76
77 {
78 type: 'hbox',
79 id: 'alignment',
80 children: [ {
81 type: 'radio',
82 id: 'align',
83 label: editor.lang.common.align,
84 items: [
85 [editor.lang.common.alignCenter, 'center'],
86 [editor.lang.common.alignLeft, 'left'],
87 [editor.lang.common.alignRight, 'right'],
88 [editor.lang.common.alignNone, 'none']
89 ],
90 'default': 'center',
91 setup: function( widget ) {
92 if ( widget.data.align ) {
93 this.setValue( widget.data.align );
94 }
95 },
96 commit: function( widget ) {
97 widget.setData( 'align', this.getValue() );
98 }
99 } ]
100 } ]
101 },
102 {
103 id: 'Upload',
104 hidden: true,
105 filebrowser: 'uploadButton',
106 label: editor.lang.html5video.upload,
107 elements: [ {
108 type: 'file',
109 id: 'upload',
110 label: editor.lang.html5video.btnUpload,
111 style: 'height:40px',
112 size: 38
113 },
114 {
115 type: 'fileButton',
116 id: 'uploadButton',
117 filebrowser: 'info:url',
118 label: editor.lang.html5video.btnUpload,
119 'for': [ 'Upload', 'upload' ]
120 } ]
121 },
122 {
123 id: 'advanced',
124 label: editor.lang.html5video.advanced,
125 elements: [ {
126 type: 'vbox',
127 padding: 0,
128 children: [ {
129 type: 'hbox',
130 children: [ {
131 type: 'radio',
132 id: 'autoplay',
133 label: editor.lang.html5video.autoplay,
134 items: [
135 [editor.lang.html5video.yes, 'yes'],
136 [editor.lang.html5video.no, 'no']
137 ],
138 'default': 'no',
139 setup: function( widget ) {
140 if ( widget.data.autoplay ) {
141 this.setValue( widget.data.autoplay );
142 }
143 },
144 commit: function( widget ) {
145 widget.setData( 'autoplay', this.getValue() );
146 }
147 } ]
148 } ]
149 } ]
150 } ]
151 };
152} );
diff --git a/sources/plugins/html5video/icons/html5video.png b/sources/plugins/html5video/icons/html5video.png
new file mode 100644
index 0000000..a246517
--- /dev/null
+++ b/sources/plugins/html5video/icons/html5video.png
Binary files differ
diff --git a/sources/plugins/html5video/lang/de.js b/sources/plugins/html5video/lang/de.js
new file mode 100644
index 0000000..ddf4c8b
--- /dev/null
+++ b/sources/plugins/html5video/lang/de.js
@@ -0,0 +1,14 @@
1CKEDITOR.plugins.setLang( 'html5video', 'de', {
2 button: 'HTML5 Video einfügen',
3 title: 'HTML5 Video',
4 infoLabel: 'Video Infos',
5 allowed: 'Erlaubte Dateierweiterungen: MP4, WebM, Ogv',
6 urlMissing: 'Sie haben keine URL zur Video-Datei angegeben.',
7 videoProperties: 'Video-Einstellungen',
8 upload: 'Hochladen',
9 btnUpload: 'Zum Server senden',
10 advanced: 'Erweitert',
11 autoplay: 'Autoplay?',
12 yes: 'Ja',
13 no: 'Nein'
14} );
diff --git a/sources/plugins/html5video/lang/en.js b/sources/plugins/html5video/lang/en.js
new file mode 100644
index 0000000..ebac6e5
--- /dev/null
+++ b/sources/plugins/html5video/lang/en.js
@@ -0,0 +1,14 @@
1CKEDITOR.plugins.setLang( 'html5video', 'en', {
2 button: 'Insert HTML5 video',
3 title: 'HTML5 video',
4 infoLabel: 'Video info',
5 allowed: 'Allowed file extensions: MP4, WebM, Ogv',
6 urlMissing: 'Video source URL is missing.',
7 videoProperties: 'Video properties',
8 upload: 'Upload',
9 btnUpload: 'Send it to the server',
10 advanced: 'Advanced',
11 autoplay: 'Autoplay?',
12 yes: 'Yes',
13 no: 'No'
14} );
diff --git a/sources/plugins/html5video/lang/es.js b/sources/plugins/html5video/lang/es.js
new file mode 100644
index 0000000..4077935
--- /dev/null
+++ b/sources/plugins/html5video/lang/es.js
@@ -0,0 +1,14 @@
1CKEDITOR.plugins.setLang( 'html5video', 'es', {
2 button: 'Insertar video HTML5',
3 title: 'Video HTML5',
4 infoLabel: 'Información del video',
5 allowed: 'Extensiones de archivo permitidas: MP4, WebM, Ogv',
6 urlMissing: 'La URL del video no puede estar vacia.',
7 videoProperties: 'Propiedades del video',
8 upload: 'Cargar',
9 btnUpload: 'Enviar al servidor',
10 advanced: 'Avanzado',
11 autoplay: '¿Reproducir automáticamente?',
12 yes: 'Si',
13 no: 'No'
14} );
diff --git a/sources/plugins/html5video/lang/eu.js b/sources/plugins/html5video/lang/eu.js
new file mode 100644
index 0000000..78635d7
--- /dev/null
+++ b/sources/plugins/html5video/lang/eu.js
@@ -0,0 +1,14 @@
1CKEDITOR.plugins.setLang( 'html5video', 'eu', {
2 button: 'Txertatu HTML5 bideoa',
3 title: 'HTML5 bideoa',
4 infoLabel: 'Bideoaren informazioa',
5 allowed: 'Baimendutako fitxategi luzapenak: MP4, WebM, Ogv',
6 urlMissing: 'Bideoaren URLak ezin du hutsik egon.',
7 videoProperties: 'Bideoaren propietateak',
8 upload: 'Kargatu',
9 btnUpload: 'Bidali zerbitzarira',
10 advanced: 'Aurreratua',
11 autoplay: 'Automatikoki erreproduzitu?',
12 yes: 'Bai',
13 no: 'Ez'
14} );
diff --git a/sources/plugins/html5video/lang/fr.js b/sources/plugins/html5video/lang/fr.js
new file mode 100644
index 0000000..326f622
--- /dev/null
+++ b/sources/plugins/html5video/lang/fr.js
@@ -0,0 +1,14 @@
1CKEDITOR.plugins.setLang( 'html5video', 'fr', {
2 button: 'Insérer un lecteur video HTML5',
3 title: 'HTML5 video',
4 infoLabel: 'Informations video',
5 allowed: 'Extensions de fichiers autorisées: MP4, WebM, Ogv',
6 urlMissing: 'URL de la source video manquante. Veuillez la renseigner.',
7 videoProperties: 'Propriétés Video',
8 upload: 'Télécharger',
9 btnUpload: 'Envoyer vers le serveur',
10 advanced: 'Avancé',
11 autoplay: 'Jouer automatiquement ?',
12 yes: 'Oui',
13 no: 'Non'
14} );
diff --git a/sources/plugins/html5video/lang/ru.js b/sources/plugins/html5video/lang/ru.js
new file mode 100644
index 0000000..5eeeba6
--- /dev/null
+++ b/sources/plugins/html5video/lang/ru.js
@@ -0,0 +1,14 @@
1CKEDITOR.plugins.setLang( 'html5video', 'ru', {
2 button: 'Вставить HTML5 видео',
3 title: 'HTML5 видео',
4 infoLabel: 'Видео',
5 allowed: 'Допустимые расширения файлов: MP4, WebM, Ogv',
6 urlMissing: 'Не выбран источник видео',
7 videoProperties: 'Свойства видео',
8 upload: 'Загрузить',
9 btnUpload: 'Загрузить на сервер',
10 advanced: 'Дополнительно',
11 autoplay: 'Автовоспроизведение',
12 yes: 'Да',
13 no: 'Нет'
14} );
diff --git a/sources/plugins/html5video/lang/uk.js b/sources/plugins/html5video/lang/uk.js
new file mode 100644
index 0000000..32b920c
--- /dev/null
+++ b/sources/plugins/html5video/lang/uk.js
@@ -0,0 +1,14 @@
1CKEDITOR.plugins.setLang( 'html5video', 'uk', {
2 button: 'Вставити HTML5 відео',
3 title: 'HTML5 відео',
4 infoLabel: 'Інформація',
5 allowed: 'Допустимі розширення файлів: MP4, WebM, Ogv',
6 urlMissing: 'Не обрано джерела відео',
7 videoProperties: 'Властивості відео',
8 upload: 'Відвантажити',
9 btnUpload: 'Відвантажити на сервер',
10 advanced: 'Додатково',
11 autoplay: 'Автовідтворення?',
12 yes: 'Так',
13 no: 'Ні'
14} );
diff --git a/sources/plugins/html5video/lang/uz.js b/sources/plugins/html5video/lang/uz.js
new file mode 100644
index 0000000..5fec9a2
--- /dev/null
+++ b/sources/plugins/html5video/lang/uz.js
@@ -0,0 +1,14 @@
1CKEDITOR.plugins.setLang( 'html5video', 'uz', {
2 button: 'HTML5 video qo‘shing',
3 title: 'HTML5 video',
4 infoLabel: 'Video ma\'lumot',
5 allowed: 'Ruxsat etilgan kengaytmalar: MP4, WebM, Ogv',
6 urlMissing: 'Video\'ning URL manbasi topilmadi.',
7 videoProperties: 'Video xususiyatlari',
8 upload: 'Yuklash',
9 btnUpload: 'Serverga jo‘natish',
10 advanced: 'Kengaytrilgan',
11 autoplay: 'Avtoijro?',
12 yes: 'Ha',
13 no: 'Yo‘q'
14} );
diff --git a/sources/plugins/html5video/plugin.js b/sources/plugins/html5video/plugin.js
new file mode 100644
index 0000000..1bfff7f
--- /dev/null
+++ b/sources/plugins/html5video/plugin.js
@@ -0,0 +1,129 @@
1CKEDITOR.plugins.add( 'html5video', {
2 requires: 'widget',
3 lang: 'de,en,eu,es,ru,uk,fr',
4 icons: 'html5video',
5 init: function( editor ) {
6 editor.widgets.add( 'html5video', {
7 button: editor.lang.html5video.button,
8 template: '<div class="ckeditor-html5-video"></div>',
9 /*
10 * Allowed content rules (http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules):
11 * - div-s with text-align,float,margin-left,margin-right inline style rules and required ckeditor-html5-video class.
12 * - video tags with src and controls attributes.
13 */
14 allowedContent: 'div(!ckeditor-html5-video){text-align,float,margin-left,margin-right}; video[src,controls,autoplay];',
15 requiredContent: 'div(ckeditor-html5-video); video[src,controls];',
16 upcast: function( element ) {
17 return element.name === 'div' && element.hasClass( 'ckeditor-html5-video' );
18 },
19 dialog: 'html5video',
20 init: function() {
21 var src = '';
22 var autoplay = '';
23 var align = this.element.getStyle( 'text-align' );
24
25 var width = '';
26 var height = '';
27
28 // If there's a child (the video element)
29 if ( this.element.getChild( 0 ) ) {
30 // get it's attributes.
31 src = this.element.getChild( 0 ).getAttribute( 'src' );
32 width = this.element.getChild( 0 ).getAttribute( 'width' );
33 height = this.element.getChild( 0 ).getAttribute( 'height' );
34 autoplay = this.element.getChild( 0 ).getAttribute( 'autoplay' );
35 }
36
37 if ( src ) {
38 this.setData( 'src', src );
39
40 if ( align ) {
41 this.setData( 'align', align );
42 } else {
43 this.setData( 'align', 'none' );
44 }
45
46 if ( width ) {
47 this.setData( 'width', width );
48 } else {
49 this.setData( 'width', '400' );
50 }
51
52 if ( height ) {
53 this.setData( 'height', height );
54 } else {
55 this.setData( 'height', '300' );
56 }
57
58 if ( autoplay ) {
59 this.setData( 'autoplay', 'yes' );
60 }
61 }
62 },
63 data: function() {
64 // If there is an video source
65 if ( this.data.src ) {
66 // and there isn't a child (the video element)
67 if ( !this.element.getChild( 0 ) ) {
68 // Create a new <video> element.
69 var videoElement = new CKEDITOR.dom.element( 'video' );
70 // Set the controls attribute.
71 videoElement.setAttribute( 'controls', 'controls' );
72 // Append it to the container of the plugin.
73 this.element.append( videoElement );
74 }
75 this.element.getChild( 0 ).setAttribute( 'src', this.data.src )
76 .setAttribute( 'width', this.data.width )
77 .setAttribute( 'height', this.data.height );
78 }
79
80 this.element.removeStyle( 'float' );
81 this.element.removeStyle( 'margin-left' );
82 this.element.removeStyle( 'margin-right' );
83
84 if ( this.data.align === 'none' ) {
85 this.element.removeStyle( 'text-align' );
86 } else {
87 this.element.setStyle( 'text-align', this.data.align );
88 }
89
90 if ( this.data.align === 'left' ) {
91 this.element.setStyle( 'float', this.data.align );
92 this.element.setStyle( 'margin-right', '10px' );
93 } else if ( this.data.align === 'right' ) {
94 this.element.setStyle( 'float', this.data.align );
95 this.element.setStyle( 'margin-left', '10px' );
96 }
97
98 if ( this.element.getChild( 0 ) ) {
99 if ( this.data.autoplay === 'yes' ) {
100 this.element.getChild( 0 ).setAttribute( 'autoplay', 'autoplay' );
101 } else {
102 this.element.getChild( 0 ).removeAttribute( 'autoplay' );
103 }
104 }
105 }
106 } );
107
108 if ( editor.contextMenu ) {
109 editor.addMenuGroup( 'html5videoGroup' );
110 editor.addMenuItem( 'html5videoPropertiesItem', {
111 label: editor.lang.html5video.videoProperties,
112 icon: 'html5video',
113 command: 'html5video',
114 group: 'html5videoGroup'
115 });
116
117 editor.contextMenu.addListener( function( element ) {
118 if ( element &&
119 element.getChild( 0 ) &&
120 element.getChild( 0 ).hasClass &&
121 element.getChild( 0 ).hasClass( 'ckeditor-html5-video' ) ) {
122 return { html5videoPropertiesItem: CKEDITOR.TRISTATE_OFF };
123 }
124 });
125 }
126
127 CKEDITOR.dialog.add( 'html5video', this.path + 'dialogs/html5video.js' );
128 }
129} );