]> git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blobdiff - sources/plugins/html5audio/dialogs/html5audio.js
Change html5 audio player
[perso/Immae/Projets/packagist/ludivine-ckeditor-component.git] / sources / plugins / html5audio / dialogs / html5audio.js
diff --git a/sources/plugins/html5audio/dialogs/html5audio.js b/sources/plugins/html5audio/dialogs/html5audio.js
new file mode 100644 (file)
index 0000000..0ab0d7d
--- /dev/null
@@ -0,0 +1,117 @@
+CKEDITOR.dialog.add( 'html5audio', function( editor ) {\r
+    return {\r
+        title: editor.lang.html5audio.title,\r
+        minWidth: 500,\r
+        minHeight: 100,\r
+        contents: [ {\r
+            id: 'info',\r
+            label: editor.lang.html5audio.infoLabel,\r
+            elements: [ {\r
+                type: 'vbox',\r
+                padding: 0,\r
+                children: [ {\r
+                    type: 'hbox',\r
+                    widths: [ '365px', '110px' ],\r
+                    align: 'right',\r
+                    children: [ {\r
+                        type: 'text',\r
+                        id: 'url',\r
+                        label: editor.lang.common.url,\r
+                        required: true,\r
+                        validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.html5audio.urlMissing ),\r
+                        setup: function( widget ) {\r
+                            this.setValue( widget.data.src );\r
+                        },\r
+                        commit: function( widget ) {\r
+                            widget.setData( 'src', this.getValue() );\r
+                        }\r
+                    },\r
+                    {\r
+                        type: 'button',\r
+                        id: 'browse',\r
+                        // v-align with the 'txtUrl' field.\r
+                        // TODO: We need something better than a fixed size here.\r
+                        style: 'display:inline-block;margin-top:14px;',\r
+                        align: 'center',\r
+                        label: editor.lang.common.browseServer,\r
+                        hidden: true,\r
+                        filebrowser: 'info:url'\r
+                    } ]\r
+                } ]\r
+            },\r
+            {\r
+                type: 'hbox',\r
+                id: 'alignment',\r
+                children: [ {\r
+                    type: 'radio',\r
+                    id: 'align',\r
+                    label: editor.lang.common.align,\r
+                    items: [\r
+                        [editor.lang.common.alignCenter, 'center'],\r
+                        [editor.lang.common.alignLeft, 'left'],\r
+                        [editor.lang.common.alignRight, 'right'],\r
+                        [editor.lang.common.alignNone, 'none']\r
+                    ],\r
+                    'default': 'center',\r
+                    setup: function( widget ) {\r
+                        if ( widget.data.align ) {\r
+                            this.setValue( widget.data.align );\r
+                        }\r
+                    },\r
+                    commit: function( widget ) {\r
+                        widget.setData( 'align', this.getValue() );\r
+                    }\r
+                } ]\r
+            } ]\r
+        },\r
+        {\r
+            id: 'Upload',\r
+            hidden: true,\r
+            filebrowser: 'uploadButton',\r
+            label: editor.lang.html5audio.upload,\r
+            elements: [ {\r
+                type: 'file',\r
+                id: 'upload',\r
+                label: editor.lang.html5audio.btnUpload,\r
+                style: 'height:40px',\r
+                size: 38\r
+            },\r
+            {\r
+                type: 'fileButton',\r
+                id: 'uploadButton',\r
+                filebrowser: 'info:url',\r
+                label: editor.lang.html5audio.btnUpload,\r
+                'for': [ 'Upload', 'upload' ]\r
+            } ]\r
+        },\r
+        {\r
+            id: 'advanced',\r
+            label: editor.lang.html5audio.advanced,\r
+            elements: [ {\r
+                type: 'vbox',\r
+                padding: 0,\r
+                children: [ {\r
+                    type: 'hbox',\r
+                    children: [ {\r
+                        type: 'radio',\r
+                        id: 'autoplay',\r
+                        label: editor.lang.html5audio.autoplay,\r
+                        items: [\r
+                            [editor.lang.html5audio.yes, 'yes'],\r
+                            [editor.lang.html5audio.no, 'no']\r
+                        ],\r
+                        'default': 'no',\r
+                        setup: function( widget ) {\r
+                            if ( widget.data.autoplay ) {\r
+                                this.setValue( widget.data.autoplay );\r
+                            }\r
+                        },\r
+                        commit: function( widget ) {\r
+                            widget.setData( 'autoplay', this.getValue() );\r
+                        }\r
+                    } ]\r
+                } ]\r
+            } ]\r
+        } ]\r
+    };\r
+} );\r