upz, forgot to take out comments
[boxroom-stian.git] / public / javascripts / tiny_mce / plugins / ntattachlink / editor_plugin_src.js
blobe499f27148372a206d3254fa367add53e63db8f4
1 /* Import plugin specific language pack */
2 tinyMCE.importPluginLanguagePack('ntattachlink', 'en,tr,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br,nl,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,cy,es,is,zh_tw,zh_tw_utf8,sk,da');
4 var TinyMCE_NTAttachLinkPlugin = {
5         getInfo : function() {
6                 return {
7                         longname : 'Near-Time Attach Linker',
8                         author : 'Blake Watters',
9                         authorurl : 'http://thatswhatimtalkingabout.org/',
10                         infourl : 'http://www.near-time.net/',
11                         version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
12                 };
13         },
15         getControlHTML : function(cn) {
16                 switch (cn) {
17                         case "ntattachlink":
18                                 return tinyMCE.getButtonHTML(cn, 'lang_attach_desc', '{$themeurl}/images/attach.gif', 'mceNearTimeAttachLink');
19                 }
21                 return "";
22         },
24         execCommand : function(editor_id, element, command, user_interface, value) {
25                 switch (command) {
26                         case "mceNearTimeAttachLink":
27                                 Element.hide('formatbar_image');                                
28                                 Element.hide('formatbar_link');
29                                 Element.toggleWithHighlight('formatbar_attach');
30                                 return true;
31                 }
33                 return false;
34         },
36         handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
37                 if (node == null)
38                         return;
40                 do {
41                         if (node.nodeName == "A" && tinyMCE.getAttrib(node, 'href') != "") {
42                                 tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonSelected');
43                                 return true;
44                         }
45                 } while ((node = node.parentNode));
47                 if (any_selection) {
48                         tinyMCE.switchClass(editor_id + '_Attachlinker', 'mceButtonNormal');
49                         return true;
50                 }
52                 tinyMCE.switchClass(editor_id + '_Attachlinker', 'mceButtonDisabled');
54                 return true;
55         }
58 tinyMCE.addPlugin("ntattachlink", TinyMCE_NTAttachLinkPlugin);