scratch – Blame information for rev 58

Subversion Repositories:
Rev:
Rev Author Line No. Line
58 office 1 (function($) {
2 'use strict';
3  
4 // Adds the language variables
5 $.extend(true, $.trumbowyg, {
6 langs: {
7 en: {
8 template: 'Template'
9 },
10 nl: {
11 template: 'Sjabloon'
12 }
13 }
14 });
15  
16 // Adds the extra button definition
17 $.extend(true, $.trumbowyg, {
18 plugins: {
19 template: {
20 shouldInit: function(trumbowyg) {
21 return trumbowyg.o.plugins.hasOwnProperty('templates');
22 },
23 init: function(trumbowyg) {
24 trumbowyg.addBtnDef('template', {
25 dropdown: templateSelector(trumbowyg),
26 hasIcon: false,
27 text: trumbowyg.lang.template
28 });
29 }
30 }
31 }
32 });
33  
34 // Creates the template-selector dropdown.
35 function templateSelector(trumbowyg) {
36 var available = trumbowyg.o.plugins.templates;
37 var templates = [];
38  
39 $.each(available, function(index, template) {
40 trumbowyg.addBtnDef('template_' + index, {
41 fn: function(){
42 trumbowyg.html(template.html);
43 },
44 hasIcon: false,
45 title: template.name
46 });
47 templates.push('template_' + index);
48 });
49  
50 return templates;
51 }
52 })(jQuery);