xref: /dokuwiki/lib/plugins/styling/script.js (revision 6667cd8743e57a4492cfbcbe1066ea48d444f7a2)
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
9    if (!$styling_plugin.hasClass('ispopup')) {
10        var $hl = $styling_plugin.find('h1').first();
11        var $btn = jQuery('<button class="btn">' + LANG.plugins.styling.popup + '</button>');
12        $hl.append($btn);
13
14        $btn.click(function (e) {
15            var windowFeatures = "menubar=no,location=no,resizable=yes,scrollbars=yes,status=false,width=500,height=500";
16            window.open(DOKU_BASE + 'lib/plugins/styling/popup.php', 'styling', windowFeatures)
17        });
18        return;
19    }
20
21    // add the color picker
22    $styling_plugin.find('.color').iris({});
23
24    // load preview in main window
25    var now = new Date().getTime();
26    var $style = window.opener.jQuery('link[rel=stylesheet][href*="lib/exe/css.php"]');
27    $style.attr('href', DOKU_BASE + 'lib/exe/css.php?preview=1&tseed=' + now);
28
29});
30