xref: /dokuwiki/lib/plugins/styling/script.js (revision bcea9d64ebf4b0cc2c80209b7669e3e7e954c4c8)
1/* DOKUWIKI:include_once iris.js */
2
3jQuery(function () {
4
5    var $styling_plugin = jQuery('#plugin__styling');
6    if (!$styling_plugin.length) return;
7
8    // add the color picker
9    $styling_plugin.find('.color').iris({});
10
11    if (!$styling_plugin.hasClass('ispopup')) {
12        var $hl = $styling_plugin.find('h1').first();
13        var $btn = jQuery('<button class="btn">' + LANG.plugins.styling.popup + '</button>');
14        $hl.append($btn);
15
16        $btn.click(function (e) {
17            var windowFeatures = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=false,width=500,height=500";
18            window.open(DOKU_BASE + 'lib/plugins/styling/popup.php', 'styling', windowFeatures)
19        });
20        return;
21    }
22
23    // append the loader screen
24    $loader = window.opener.jQuery('#plugin__styling_loader');
25    if (!$loader.length) {
26        $loader = jQuery('<div id="plugin__styling_loader">' + LANG.plugins.styling.loader + '</div>');
27        $loader.css({
28            'position':         'absolute',
29            'width':            '100%',
30            'height':           '100%',
31            'top':              0,
32            'left':             0,
33            'z-index':          5000,
34            'background-color': '#fff',
35            'opacity':          '0.7',
36            'color':            '#000',
37            'font-size':        '40px',
38            'text-align':       'center',
39            'line-height':      '90px'
40        });
41        window.opener.jQuery('body').append($loader);
42    }
43
44    // load preview in main window
45    var now = new Date().getTime();
46    var $style = window.opener.jQuery('link[rel=stylesheet][href*="lib/exe/css.php"]');
47    $style.attr('href', DOKU_BASE + 'lib/exe/css.php?preview=1&tseed=' + now);
48});
49