scratch – Diff between revs 58 and 125

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 58 Rev 125
1 /*/* =========================================================== 1 /*/* ===========================================================
2 * trumbowyg.insertaudio.js v1.0 2 * trumbowyg.insertaudio.js v1.0
3 * InsertAudio plugin for Trumbowyg 3 * InsertAudio plugin for Trumbowyg
4 * http://alex-d.github.com/Trumbowyg 4 * http://alex-d.github.com/Trumbowyg
5 * =========================================================== 5 * ===========================================================
6 * Author : Adam Hess (AdamHess) 6 * Author : Adam Hess (AdamHess)
7 */ 7 */
8   8  
9 (function ($) { 9 (function ($) {
10 'use strict'; 10 'use strict';
11   11  
12 var insertAudioOptions = { 12 var insertAudioOptions = {
13 src: { 13 src: {
14 label: 'URL', 14 label: 'URL',
15 required: true 15 required: true
16 }, 16 },
17 autoplay: { 17 autoplay: {
18 label: 'AutoPlay', 18 label: 'AutoPlay',
19 required: false, 19 required: false,
20 type: 'checkbox' 20 type: 'checkbox'
21 }, 21 },
22 muted: { 22 muted: {
23 label: 'Muted', 23 label: 'Muted',
24 required: false, 24 required: false,
25 type: 'checkbox' 25 type: 'checkbox'
26 }, 26 },
27 preload: { 27 preload: {
28 label: 'preload options', 28 label: 'preload options',
29 required: false 29 required: false
30 } 30 }
31 }; 31 };
32   32  
33   33  
34 $.extend(true, $.trumbowyg, { 34 $.extend(true, $.trumbowyg, {
35 langs: { 35 langs: {
36 en: { 36 en: {
37 insertAudio: 'Insert Audio' 37 insertAudio: 'Insert Audio'
-   38 },
-   39 ja: {
-   40 insertAudio: '音声の挿入'
38 } 41 }
39 }, 42 },
40 plugins: { 43 plugins: {
41 insertAudio: { 44 insertAudio: {
42 init: function (trumbowyg) { 45 init: function (trumbowyg) {
43 var btnDef = { 46 var btnDef = {
44 fn: function () { 47 fn: function () {
45 var insertAudioCallback = function (v) { 48 var insertAudioCallback = function (v) {
46 // controls should always be show otherwise the audio will 49 // controls should always be show otherwise the audio will
47 // be invisible defeating the point of a wysiwyg 50 // be invisible defeating the point of a wysiwyg
48 var html = '<audio controls'; 51 var html = '<audio controls';
49 if (v.src) { 52 if (v.src) {
50 html += ' src=\'' + v.src + '\''; 53 html += ' src=\'' + v.src + '\'';
51 } 54 }
52 if (v.autoplay) { 55 if (v.autoplay) {
53 html += ' autoplay'; 56 html += ' autoplay';
54 } 57 }
55 if (v.muted) { 58 if (v.muted) {
56 html += ' muted'; 59 html += ' muted';
57 } 60 }
58 if (v.preload) { 61 if (v.preload) {
59 html += ' preload=\'' + v + '\''; 62 html += ' preload=\'' + v + '\'';
60 } 63 }
61 html += '></audio>'; 64 html += '></audio>';
62 var node = $(html)[0]; 65 var node = $(html)[0];
63 trumbowyg.range.deleteContents(); 66 trumbowyg.range.deleteContents();
64 trumbowyg.range.insertNode(node); 67 trumbowyg.range.insertNode(node);
65 return true; 68 return true;
66 }; 69 };
67   70  
68 trumbowyg.openModalInsert(trumbowyg.lang.insertAudio, insertAudioOptions, insertAudioCallback); 71 trumbowyg.openModalInsert(trumbowyg.lang.insertAudio, insertAudioOptions, insertAudioCallback);
69 } 72 }
70 }; 73 };
71   74  
72 trumbowyg.addBtnDef('insertAudio', btnDef); 75 trumbowyg.addBtnDef('insertAudio', btnDef);
73 } 76 }
74 } 77 }
75 } 78 }
76 }); 79 });
77 })(jQuery); 80 })(jQuery);
78   81  
79
Generated by GNU Enscript 1.6.5.90.
82
Generated by GNU Enscript 1.6.5.90.
80   83  
81   84  
82   85