scratch – Diff between revs 58 and 125
?pathlinks?
Rev 58 | Rev 125 | |||
---|---|---|---|---|
1 | (function($) { |
1 | (function($) { |
|
2 | 'use strict'; |
2 | 'use strict'; |
|
3 | |
3 | |
|
4 | // Adds the language variables |
4 | // Adds the language variables |
|
5 | $.extend(true, $.trumbowyg, { |
5 | $.extend(true, $.trumbowyg, { |
|
6 | langs: { |
6 | langs: { |
|
7 | en: { |
7 | en: { |
|
8 | template: 'Template' |
8 | template: 'Template' |
|
9 | }, |
9 | }, |
|
10 | nl: { |
10 | nl: { |
|
11 | template: 'Sjabloon' |
11 | template: 'Sjabloon' |
|
- | 12 | }, |
||
- | 13 | ja: { |
||
- | 14 | template: 'テンプレート' |
||
12 | } |
15 | } |
|
13 | } |
16 | } |
|
14 | }); |
17 | }); |
|
15 | |
18 | |
|
16 | // Adds the extra button definition |
19 | // Adds the extra button definition |
|
17 | $.extend(true, $.trumbowyg, { |
20 | $.extend(true, $.trumbowyg, { |
|
18 | plugins: { |
21 | plugins: { |
|
19 | template: { |
22 | template: { |
|
20 | shouldInit: function(trumbowyg) { |
23 | shouldInit: function(trumbowyg) { |
|
21 | return trumbowyg.o.plugins.hasOwnProperty('templates'); |
24 | return trumbowyg.o.plugins.hasOwnProperty('templates'); |
|
22 | }, |
25 | }, |
|
23 | init: function(trumbowyg) { |
26 | init: function(trumbowyg) { |
|
24 | trumbowyg.addBtnDef('template', { |
27 | trumbowyg.addBtnDef('template', { |
|
25 | dropdown: templateSelector(trumbowyg), |
28 | dropdown: templateSelector(trumbowyg), |
|
26 | hasIcon: false, |
29 | hasIcon: false, |
|
27 | text: trumbowyg.lang.template |
30 | text: trumbowyg.lang.template |
|
28 | }); |
31 | }); |
|
29 | } |
32 | } |
|
30 | } |
33 | } |
|
31 | } |
34 | } |
|
32 | }); |
35 | }); |
|
33 | |
36 | |
|
34 | // Creates the template-selector dropdown. |
37 | // Creates the template-selector dropdown. |
|
35 | function templateSelector(trumbowyg) { |
38 | function templateSelector(trumbowyg) { |
|
36 | var available = trumbowyg.o.plugins.templates; |
39 | var available = trumbowyg.o.plugins.templates; |
|
37 | var templates = []; |
40 | var templates = []; |
|
38 | |
41 | |
|
39 | $.each(available, function(index, template) { |
42 | $.each(available, function(index, template) { |
|
40 | trumbowyg.addBtnDef('template_' + index, { |
43 | trumbowyg.addBtnDef('template_' + index, { |
|
41 | fn: function(){ |
44 | fn: function(){ |
|
42 | trumbowyg.html(template.html); |
45 | trumbowyg.html(template.html); |
|
43 | }, |
46 | }, |
|
44 | hasIcon: false, |
47 | hasIcon: false, |
|
45 | title: template.name |
48 | title: template.name |
|
46 | }); |
49 | }); |
|
47 | templates.push('template_' + index); |
50 | templates.push('template_' + index); |
|
48 | }); |
51 | }); |
|
49 | |
52 | |
|
50 | return templates; |
53 | return templates; |
|
51 | } |
54 | } |
|
52 | })(jQuery); |
55 | })(jQuery); |
|
53 | |
56 | |
|
54 |
|
57 |
|
|
55 | |
58 | |
|
56 | |
59 | |
|
57 | |
60 | |