1/*
2 * DokuWiki Bootstrap3 Template: Plugins Hacks!
3 *
4 * Home     http://dokuwiki.org/template:bootstrap3
5 * Author   Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
6 * License  GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 */
8
9// Move Plugin
10
11jQuery(document).on('bootstrap3:plugin-move', function (event) {
12
13    if (!jQuery('#plugin_move__tree').length) return false;
14
15    // console.debug(event.type + ' event fired');
16
17    setTimeout(function () {
18
19        var $directories = jQuery('li.type-d a.idx_dir'),
20            $pages = jQuery('li.type-f a.wikilink1');
21
22        jQuery.each($directories, function () {
23
24            var $directory = jQuery(this),
25                $closed = $directory.parents('.closed'),
26                $open = $directory.parents('.open');
27
28            if (!$directory.find('svg').length) {
29                $directory.prepend(Iconify.getSVG('mdi:folder'));
30            }
31
32            if ($open.length) {
33                $directory.find('svg').replaceWith(Iconify.getSVG('mdi:folder-open'));
34            }
35
36            if ($closed.length) {
37                $directory.find('svg').replaceWith(Iconify.getSVG('mdi:folder'));
38            }
39
40            $directory.find('svg').addClass('iconify text-primary mr-2');
41
42        });
43
44        jQuery.each($pages, function () {
45
46            var $page = jQuery(this);
47
48            if (!$page.find('svg').length) {
49                $page.prepend(Iconify.getSVG('mdi:file-document-outline'));
50            }
51            $page.find('svg').addClass('text-muted mr-2');
52
53        });
54
55    }, 0);
56
57});
58
59jQuery('#plugin_move__tree a').click(function (e) {
60    dw_template.modeIndex();
61});
62
63jQuery(document).trigger('bootstrap3:plugin-move');
64
65jQuery(document).ajaxSuccess(function (e) {
66    jQuery(document).trigger('bootstrap3:plugin-move');
67});
68