forked from samuelet/indexmenu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
80 lines (69 loc) · 2.12 KB
/
script.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Context menu
var indexmenu_contextmenu = {'all': []};
/* DOKUWIKI:include scripts/nojsindex.js */
/* DOKUWIKI:include scripts/toolbarindexwizard.js */
/* DOKUWIKI:include scripts/contextmenu.js */
/* DOKUWIKI:include scripts/indexmenu.js */
/* DOKUWIKI:include scripts/contextmenu.local.js */
/**
* Add button action for the indexmenu wizard button
*
* @param {jQuery} $btn Button element to add the action to
* @param {Array} props Associative array of button properties
* @param {string} edid ID of the editor textarea
* @return {boolean} If button should be appended
*/
function addBtnActionIndexmenu($btn, props, edid) {
indexmenu_wiz.init(jQuery('#' + edid));
$btn.click(function () {
indexmenu_wiz.toggle();
return false;
});
return true;
}
// try to add button to toolbar
if (window.toolbar != undefined) {
window.toolbar[window.toolbar.length] = {
"type": "Indexmenu",
"title": "Insert the Indexmenu tree",
"icon": "../../plugins/indexmenu/images/indexmenu_toolbar.png"
}
}
/**
* functions for js index renderer and contextmenu
*/
var IndexmenuUtils = {
/**
* Determine extension from given theme dir name
*
* @param {string} themedir name of theme dir
* @returns {string} extension gif, png or jpg
*/
determineExtension: function (themedir) {
var extension = "gif";
var posext = themedir.lastIndexOf(".");
if (posext > -1) {
posext++;
var ext = themedir.substring(posext, themedir.length).toLowerCase();
if ((ext == "png") || (ext == "jpg")) {
extension = ext;
}
}
return extension;
},
/**
* Create div with given id and class on body and return it
*
* @param {string} id picker id
* @param {string} cl class(es)
* @return {jQuery} jQuery div
*/
createPicker: function (id, cl) {
return jQuery('<div>')
.addClass(cl || 'picker')
.attr('id', id)
.css({position: 'absolute'})
.hide()
.appendTo('body');
}
};