-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcredits_shortcode_plugin.js
53 lines (43 loc) · 1.47 KB
/
credits_shortcode_plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
(function() {
tinymce.create('tinymce.plugins.Credits', {
init : function(ed, url) {
ed.addCommand('addcredits', function() {
var ctype = prompt("What do you want to add (Source/ Via) ? "),
shortcode;
if (ctype !== null)
{
ctype=ctype.toLowerCase();
if(ctype=="source"|| ctype=="via")
{
var clink = prompt("Link?"), shortcode;
var cname = prompt("Link Name"), shortcode;
shortcode = '[credits link="'+ clink +'" type="' + ctype + '"]' + cname +'[/credits]';
ed.execCommand('mceInsertContent', 0, shortcode);
}
else
{
alert("Invalid type");
}
}
});
ed.addButton('addcredits', {
title : 'Add Credits',
cmd : 'addcredits',
image : url + '/credits_logo.png'
});
},
createControl : function(n, cm) {
return null;
},
getInfo : function() {
return {
longname : 'Credits Buttons',
author : 'Jash Jacob',
authorurl : 'http://jashjacob.com',
infourl : 'http://techzei.com',
version : "1.2"
};
}
});
tinymce.PluginManager.add('credits', tinymce.plugins.Credits );
})();