File modules/editor/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js
Last commit: Tue Aug 28 00:33:27 2018 +0200 Jan Dankert Editoren für Markdown (SimpleMDE) und HTML (Trumbowyg) installiert.
1 /*/* =========================================================== 2 * trumbowyg.insertaudio.js v1.0 3 * InsertAudio plugin for Trumbowyg 4 * http://alex-d.github.com/Trumbowyg 5 * =========================================================== 6 * Author : Adam Hess (AdamHess) 7 */ 8 9 (function ($) { 10 'use strict'; 11 12 var insertAudioOptions = { 13 src: { 14 label: 'URL', 15 required: true 16 }, 17 autoplay: { 18 label: 'AutoPlay', 19 required: false, 20 type: 'checkbox' 21 }, 22 muted: { 23 label: 'Muted', 24 required: false, 25 type: 'checkbox' 26 }, 27 preload: { 28 label: 'preload options', 29 required: false 30 } 31 }; 32 33 34 $.extend(true, $.trumbowyg, { 35 langs: { 36 en: { 37 insertAudio: 'Insert Audio' 38 }, 39 fr: { 40 insertAudio: 'Insérer un son' 41 }, 42 ru: { 43 insertAudio: 'Вставить аудио' 44 }, 45 ja: { 46 insertAudio: '音声の挿入' 47 }, 48 tr: { 49 insertAudio: 'Ses Ekle' 50 } 51 }, 52 plugins: { 53 insertAudio: { 54 init: function (trumbowyg) { 55 var btnDef = { 56 fn: function () { 57 var insertAudioCallback = function (v) { 58 // controls should always be show otherwise the audio will 59 // be invisible defeating the point of a wysiwyg 60 var html = '<audio controls'; 61 if (v.src) { 62 html += ' src=\'' + v.src + '\''; 63 } 64 if (v.autoplay) { 65 html += ' autoplay'; 66 } 67 if (v.muted) { 68 html += ' muted'; 69 } 70 if (v.preload) { 71 html += ' preload=\'' + v + '\''; 72 } 73 html += '></audio>'; 74 var node = $(html)[0]; 75 trumbowyg.range.deleteContents(); 76 trumbowyg.range.insertNode(node); 77 return true; 78 }; 79 80 trumbowyg.openModalInsert(trumbowyg.lang.insertAudio, insertAudioOptions, insertAudioCallback); 81 } 82 }; 83 84 trumbowyg.addBtnDef('insertAudio', btnDef); 85 } 86 } 87 } 88 }); 89 })(jQuery);
Downloadmodules/editor/trumbowyg/plugins/insertaudio/trumbowyg.insertaudio.js
History Tue, 28 Aug 2018 00:33:27 +0200 Jan Dankert Editoren für Markdown (SimpleMDE) und HTML (Trumbowyg) installiert.