dokuwiki-indexmenu-plugin – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | // Context menu |
||
3 | var indexmenu_contextmenu = {'all': []}; |
||
4 | |||
5 | /* DOKUWIKI:include scripts/nojsindex.js */ |
||
6 | /* DOKUWIKI:include scripts/toolbarindexwizard.js */ |
||
7 | /* DOKUWIKI:include scripts/contextmenu.js */ |
||
8 | /* DOKUWIKI:include scripts/indexmenu.js */ |
||
9 | /* DOKUWIKI:include scripts/contextmenu.local.js */ |
||
10 | |||
11 | |||
12 | /** |
||
13 | * Add button action for the indexmenu wizard button |
||
14 | * |
||
15 | * @param {jQuery} $btn Button element to add the action to |
||
16 | * @param {Array} props Associative array of button properties |
||
17 | * @param {string} edid ID of the editor textarea |
||
18 | * @return {boolean} If button should be appended |
||
19 | */ |
||
20 | function addBtnActionIndexmenu($btn, props, edid) { |
||
21 | indexmenu_wiz.init(jQuery('#' + edid)); |
||
22 | $btn.click(function () { |
||
23 | indexmenu_wiz.toggle(); |
||
24 | return false; |
||
25 | }); |
||
26 | return true; |
||
27 | } |
||
28 | |||
29 | |||
30 | // try to add button to toolbar |
||
31 | if (window.toolbar != undefined) { |
||
32 | window.toolbar[window.toolbar.length] = { |
||
33 | "type": "Indexmenu", |
||
34 | "title": "Insert the Indexmenu tree", |
||
35 | "icon": "../../plugins/indexmenu/images/indexmenu_toolbar.png" |
||
36 | } |
||
37 | } |
||
38 | |||
39 | |||
40 | /** |
||
41 | * functions for js index renderer and contextmenu |
||
42 | */ |
||
43 | var IndexmenuUtils = { |
||
44 | |||
45 | /** |
||
46 | * Determine extension from given theme dir name |
||
47 | * |
||
48 | * @param {string} themedir name of theme dir |
||
49 | * @returns {string} extension gif, png or jpg |
||
50 | */ |
||
51 | determineExtension: function (themedir) { |
||
52 | var extension = "gif"; |
||
53 | var posext = themedir.lastIndexOf("."); |
||
54 | if (posext > -1) { |
||
55 | posext++; |
||
56 | var ext = themedir.substring(posext, themedir.length).toLowerCase(); |
||
57 | if ((ext == "png") || (ext == "jpg")) { |
||
58 | extension = ext; |
||
59 | } |
||
60 | } |
||
61 | return extension; |
||
62 | }, |
||
63 | |||
64 | /** |
||
65 | * Create div with given id and class on body and return it |
||
66 | * |
||
67 | * @param {string} id picker id |
||
68 | * @param {string} cl class(es) |
||
69 | * @return {jQuery} jQuery div |
||
70 | */ |
||
71 | createPicker: function (id, cl) { |
||
72 | return jQuery('<div>') |
||
73 | .addClass(cl || 'picker') |
||
74 | .attr('id', id) |
||
75 | .css({position: 'absolute'}) |
||
76 | .hide() |
||
77 | .appendTo('body'); |
||
78 | } |
||
79 | |||
80 | }; |