aboutsummaryrefslogtreecommitdiff
path: root/sources/plugins/html5audio
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2017-01-26 15:12:37 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2017-01-26 15:12:37 +0100
commitd1844275460a3e3a32e199326f6b36938a329091 (patch)
tree2f32bc1c5a5db42aeaadc3733ffe1b3377c0d84a /sources/plugins/html5audio
parenteaa9271590ab73b6eef3fa88bc74a9553eefd857 (diff)
downloadludivine-ckeditor-component-d1844275460a3e3a32e199326f6b36938a329091.tar.gz
ludivine-ckeditor-component-d1844275460a3e3a32e199326f6b36938a329091.tar.zst
ludivine-ckeditor-component-d1844275460a3e3a32e199326f6b36938a329091.zip
Change html5 audio player4.6.2.4
Diffstat (limited to 'sources/plugins/html5audio')
-rw-r--r--sources/plugins/html5audio/dialogs/html5audio.js117
-rw-r--r--sources/plugins/html5audio/icons/html5audio.pngbin0 -> 560 bytes
-rw-r--r--sources/plugins/html5audio/lang/de.js13
-rw-r--r--sources/plugins/html5audio/lang/en.js13
-rw-r--r--sources/plugins/html5audio/lang/es.js13
-rw-r--r--sources/plugins/html5audio/lang/eu.js13
-rw-r--r--sources/plugins/html5audio/lang/fr.js13
-rw-r--r--sources/plugins/html5audio/lang/ru.js13
-rw-r--r--sources/plugins/html5audio/lang/uk.js13
-rw-r--r--sources/plugins/html5audio/lang/uz.js13
-rw-r--r--sources/plugins/html5audio/plugin.js112
11 files changed, 333 insertions, 0 deletions
diff --git a/sources/plugins/html5audio/dialogs/html5audio.js b/sources/plugins/html5audio/dialogs/html5audio.js
new file mode 100644
index 0000000..0ab0d7d
--- /dev/null
+++ b/sources/plugins/html5audio/dialogs/html5audio.js
@@ -0,0 +1,117 @@
1CKEDITOR.dialog.add( 'html5audio', function( editor ) {
2 return {
3 title: editor.lang.html5audio.title,
4 minWidth: 500,
5 minHeight: 100,
6 contents: [ {
7 id: 'info',
8 label: editor.lang.html5audio.infoLabel,
9 elements: [ {
10 type: 'vbox',
11 padding: 0,
12 children: [ {
13 type: 'hbox',
14 widths: [ '365px', '110px' ],
15 align: 'right',
16 children: [ {
17 type: 'text',
18 id: 'url',
19 label: editor.lang.common.url,
20 required: true,
21 validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.html5audio.urlMissing ),
22 setup: function( widget ) {
23 this.setValue( widget.data.src );
24 },
25 commit: function( widget ) {
26 widget.setData( 'src', this.getValue() );
27 }
28 },
29 {
30 type: 'button',
31 id: 'browse',
32 // v-align with the 'txtUrl' field.
33 // TODO: We need something better than a fixed size here.
34 style: 'display:inline-block;margin-top:14px;',
35 align: 'center',
36 label: editor.lang.common.browseServer,
37 hidden: true,
38 filebrowser: 'info:url'
39 } ]
40 } ]
41 },
42 {
43 type: 'hbox',
44 id: 'alignment',
45 children: [ {
46 type: 'radio',
47 id: 'align',
48 label: editor.lang.common.align,
49 items: [
50 [editor.lang.common.alignCenter, 'center'],
51 [editor.lang.common.alignLeft, 'left'],
52 [editor.lang.common.alignRight, 'right'],
53 [editor.lang.common.alignNone, 'none']
54 ],
55 'default': 'center',
56 setup: function( widget ) {
57 if ( widget.data.align ) {
58 this.setValue( widget.data.align );
59 }
60 },
61 commit: function( widget ) {
62 widget.setData( 'align', this.getValue() );
63 }
64 } ]
65 } ]
66 },
67 {
68 id: 'Upload',
69 hidden: true,
70 filebrowser: 'uploadButton',
71 label: editor.lang.html5audio.upload,
72 elements: [ {
73 type: 'file',
74 id: 'upload',
75 label: editor.lang.html5audio.btnUpload,
76 style: 'height:40px',
77 size: 38
78 },
79 {
80 type: 'fileButton',
81 id: 'uploadButton',
82 filebrowser: 'info:url',
83 label: editor.lang.html5audio.btnUpload,
84 'for': [ 'Upload', 'upload' ]
85 } ]
86 },
87 {
88 id: 'advanced',
89 label: editor.lang.html5audio.advanced,
90 elements: [ {
91 type: 'vbox',
92 padding: 0,
93 children: [ {
94 type: 'hbox',
95 children: [ {
96 type: 'radio',
97 id: 'autoplay',
98 label: editor.lang.html5audio.autoplay,
99 items: [
100 [editor.lang.html5audio.yes, 'yes'],
101 [editor.lang.html5audio.no, 'no']
102 ],
103 'default': 'no',
104 setup: function( widget ) {
105 if ( widget.data.autoplay ) {
106 this.setValue( widget.data.autoplay );
107 }
108 },
109 commit: function( widget ) {
110 widget.setData( 'autoplay', this.getValue() );
111 }
112 } ]
113 } ]
114 } ]
115 } ]
116 };
117} );
diff --git a/sources/plugins/html5audio/icons/html5audio.png b/sources/plugins/html5audio/icons/html5audio.png
new file mode 100644
index 0000000..4367015
--- /dev/null
+++ b/sources/plugins/html5audio/icons/html5audio.png
Binary files differ
diff --git a/sources/plugins/html5audio/lang/de.js b/sources/plugins/html5audio/lang/de.js
new file mode 100644
index 0000000..e084a60
--- /dev/null
+++ b/sources/plugins/html5audio/lang/de.js
@@ -0,0 +1,13 @@
1CKEDITOR.plugins.setLang( 'html5audio', 'de', {
2 button: 'HTML5 Audio einfügen',
3 title: 'HTML5 Audio',
4 infoLabel: 'Audio Infos',
5 urlMissing: 'Sie haben keine URL zur Audio-Datei angegeben.',
6 audioProperties: 'Audio-Einstellungen',
7 upload: 'Hochladen',
8 btnUpload: 'Zum Server senden',
9 advanced: 'Erweitert',
10 autoplay: 'Autoplay?',
11 yes: 'Ja',
12 no: 'Nein'
13} );
diff --git a/sources/plugins/html5audio/lang/en.js b/sources/plugins/html5audio/lang/en.js
new file mode 100644
index 0000000..fffce1e
--- /dev/null
+++ b/sources/plugins/html5audio/lang/en.js
@@ -0,0 +1,13 @@
1CKEDITOR.plugins.setLang( 'html5audio', 'en', {
2 button: 'Insert HTML5 audio',
3 title: 'HTML5 audio',
4 infoLabel: 'Audio info',
5 urlMissing: 'Audio source URL is missing.',
6 audioProperties: 'Audio properties',
7 upload: 'Upload',
8 btnUpload: 'Send it to the server',
9 advanced: 'Advanced',
10 autoplay: 'Autoplay?',
11 yes: 'Yes',
12 no: 'No'
13} );
diff --git a/sources/plugins/html5audio/lang/es.js b/sources/plugins/html5audio/lang/es.js
new file mode 100644
index 0000000..f1aec8e
--- /dev/null
+++ b/sources/plugins/html5audio/lang/es.js
@@ -0,0 +1,13 @@
1CKEDITOR.plugins.setLang( 'html5audio', 'es', {
2 button: 'Insertar audio HTML5',
3 title: 'Audio HTML5',
4 infoLabel: 'Información del audio',
5 urlMissing: 'La URL del audio no puede estar vacia.',
6 audioProperties: 'Propiedades del audio',
7 upload: 'Cargar',
8 btnUpload: 'Enviar al servidor',
9 advanced: 'Avanzado',
10 autoplay: '¿Reproducir automáticamente?',
11 yes: 'Si',
12 no: 'No'
13} );
diff --git a/sources/plugins/html5audio/lang/eu.js b/sources/plugins/html5audio/lang/eu.js
new file mode 100644
index 0000000..9275d88
--- /dev/null
+++ b/sources/plugins/html5audio/lang/eu.js
@@ -0,0 +1,13 @@
1CKEDITOR.plugins.setLang( 'html5audio', 'eu', {
2 button: 'Txertatu HTML5 audioa',
3 title: 'HTML5 audioa',
4 infoLabel: 'Audioaren informazioa',
5 urlMissing: 'Audioaren URLak ezin du hutsik egon.',
6 audioProperties: 'Audioaren propietateak',
7 upload: 'Kargatu',
8 btnUpload: 'Bidali zerbitzarira',
9 advanced: 'Aurreratua',
10 autoplay: 'Automatikoki erreproduzitu?',
11 yes: 'Bai',
12 no: 'Ez'
13} );
diff --git a/sources/plugins/html5audio/lang/fr.js b/sources/plugins/html5audio/lang/fr.js
new file mode 100644
index 0000000..b9fa4af
--- /dev/null
+++ b/sources/plugins/html5audio/lang/fr.js
@@ -0,0 +1,13 @@
1CKEDITOR.plugins.setLang( 'html5audio', 'fr', {
2 button: 'Insérer un lecteur audio HTML5',
3 title: 'HTML5 audio',
4 infoLabel: 'Informations audio',
5 urlMissing: 'URL de la source audio manquante. Veuillez la renseigner.',
6 audioProperties: 'Propriétés Audio',
7 upload: 'Télécharger',
8 btnUpload: 'Envoyer vers le serveur',
9 advanced: 'Avancé',
10 autoplay: 'Jouer automatiquement ?',
11 yes: 'Oui',
12 no: 'Non'
13} );
diff --git a/sources/plugins/html5audio/lang/ru.js b/sources/plugins/html5audio/lang/ru.js
new file mode 100644
index 0000000..94be193
--- /dev/null
+++ b/sources/plugins/html5audio/lang/ru.js
@@ -0,0 +1,13 @@
1CKEDITOR.plugins.setLang( 'html5audio', 'ru', {
2 button: 'Вставить HTML5 аудио',
3 title: 'HTML5 аудио',
4 infoLabel: 'Аудио',
5 urlMissing: 'Не выбран источник аудио',
6 audioProperties: 'Свойства аудио',
7 upload: 'Загрузить',
8 btnUpload: 'Загрузить на сервер',
9 advanced: 'Дополнительно',
10 autoplay: 'Автовоспроизведение',
11 yes: 'Да',
12 no: 'Нет'
13} );
diff --git a/sources/plugins/html5audio/lang/uk.js b/sources/plugins/html5audio/lang/uk.js
new file mode 100644
index 0000000..6e050f1
--- /dev/null
+++ b/sources/plugins/html5audio/lang/uk.js
@@ -0,0 +1,13 @@
1CKEDITOR.plugins.setLang( 'html5audio', 'uk', {
2 button: 'Вставити HTML5 аудіо',
3 title: 'HTML5 аудіо',
4 infoLabel: 'Інформація',
5 urlMissing: 'Не обрано джерела аудіо',
6 audioProperties: 'Властивості аудіо',
7 upload: 'Відвантажити',
8 btnUpload: 'Відвантажити на сервер',
9 advanced: 'Додатково',
10 autoplay: 'Автовідтворення?',
11 yes: 'Так',
12 no: 'Ні'
13} );
diff --git a/sources/plugins/html5audio/lang/uz.js b/sources/plugins/html5audio/lang/uz.js
new file mode 100644
index 0000000..8827b53
--- /dev/null
+++ b/sources/plugins/html5audio/lang/uz.js
@@ -0,0 +1,13 @@
1CKEDITOR.plugins.setLang( 'html5audio', 'uz', {
2 button: 'HTML5 audio qo‘shing',
3 title: 'HTML5 audio',
4 infoLabel: 'Audio ma\'lumot',
5 urlMissing: 'Audio\'ning URL manbasi topilmadi.',
6 audioProperties: 'Audio xususiyatlari',
7 upload: 'Yuklash',
8 btnUpload: 'Serverga jo‘natish',
9 advanced: 'Kengaytrilgan',
10 autoplay: 'Avtoijro?',
11 yes: 'Ha',
12 no: 'Yo‘q'
13} );
diff --git a/sources/plugins/html5audio/plugin.js b/sources/plugins/html5audio/plugin.js
new file mode 100644
index 0000000..86bcfbd
--- /dev/null
+++ b/sources/plugins/html5audio/plugin.js
@@ -0,0 +1,112 @@
1CKEDITOR.plugins.add( 'html5audio', {
2 requires: 'widget',
3 lang: 'de,en,eu,es,fr,ru,uk,uz',
4 icons: 'html5audio',
5 init: function( editor ) {
6 editor.widgets.add( 'html5audio', {
7 button: editor.lang.html5audio.button,
8 template: '<div class="ckeditor-html5-audio"></div>', // We add the audio element when needed in the data function, to avoid having an undefined src attribute.
9 // See issue #9 on github: https://github.com/iametza/ckeditor-html5-audio/issues/9
10 editables: {},
11 /*
12 * Allowed content rules (http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules):
13 * - div-s with text-align,float,margin-left,margin-right inline style rules and required ckeditor-html5-audio class.
14 * - audio tags with src and controls attributes.
15 */
16 allowedContent: 'div(!ckeditor-html5-audio){text-align,float,margin-left,margin-right}; audio[src,controls,autoplay];',
17 requiredContent: 'div(ckeditor-html5-audio); audio[src,controls];',
18 upcast: function( element ) {
19 return element.name === 'div' && element.hasClass( 'ckeditor-html5-audio' );
20 },
21 dialog: 'html5audio',
22 init: function() {
23 var src = '';
24 var autoplay = '';
25 var align = this.element.getStyle( 'text-align' );
26
27 // If there's a child (the audio element)
28 if ( this.element.getChild( 0 ) ) {
29 // get it's attributes.
30 src = this.element.getChild( 0 ).getAttribute( 'src' );
31 autoplay = this.element.getChild( 0 ).getAttribute( 'autoplay' );
32 }
33
34 if ( src ) {
35 this.setData( 'src', src );
36
37 if ( align ) {
38 this.setData( 'align', align );
39 } else {
40 this.setData( 'align', 'none' );
41 }
42
43 if ( autoplay ) {
44 this.setData( 'autoplay', 'yes' );
45 }
46 }
47 },
48 data: function() {
49 // If there is an audio source
50 if ( this.data.src ) {
51 // and there isn't a child (the audio element)
52 if ( !this.element.getChild( 0 ) ) {
53 // Create a new <audio> element.
54 var audioElement = new CKEDITOR.dom.element( 'audio' );
55 // Set the controls attribute.
56 audioElement.setAttribute( 'controls', 'controls' );
57 // Append it to the container of the plugin.
58 this.element.append( audioElement );
59 }
60 this.element.getChild( 0 ).setAttribute( 'src', this.data.src );
61 }
62
63 this.element.removeStyle( 'float' );
64 this.element.removeStyle( 'margin-left' );
65 this.element.removeStyle( 'margin-right' );
66
67 if ( this.data.align === 'none' ) {
68 this.element.removeStyle( 'text-align' );
69 } else {
70 this.element.setStyle( 'text-align', this.data.align );
71 }
72
73 if ( this.data.align === 'left' ) {
74 this.element.setStyle( 'float', this.data.align );
75 this.element.setStyle( 'margin-right', '10px' );
76 } else if ( this.data.align === 'right' ) {
77 this.element.setStyle( 'float', this.data.align );
78 this.element.setStyle( 'margin-left', '10px' );
79 }
80
81 if ( this.element.getChild( 0 ) ) {
82 if ( this.data.autoplay === 'yes' ) {
83 this.element.getChild( 0 ).setAttribute( 'autoplay', 'autoplay' );
84 } else {
85 this.element.getChild( 0 ).removeAttribute( 'autoplay' );
86 }
87 }
88 }
89 } );
90
91 if ( editor.contextMenu ) {
92 editor.addMenuGroup( 'html5audioGroup' );
93 editor.addMenuItem( 'html5audioPropertiesItem', {
94 label: editor.lang.html5audio.audioProperties,
95 icon: 'html5audio',
96 command: 'html5audio',
97 group: 'html5audioGroup'
98 });
99
100 editor.contextMenu.addListener( function( element ) {
101 if ( element &&
102 element.getChild( 0 ) &&
103 element.getChild( 0 ).hasClass &&
104 element.getChild( 0 ).hasClass( 'ckeditor-html5-audio' ) ) {
105 return { html5audioPropertiesItem: CKEDITOR.TRISTATE_OFF };
106 }
107 });
108 }
109
110 CKEDITOR.dialog.add( 'html5audio', this.path + 'dialogs/html5audio.js' );
111 }
112} );