Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
9 lars 1
var ComponentsColorPickers = function() {
2
 
3
    var handleColorPicker = function () {
4
        if (!jQuery().colorpicker) {
5
            return;
6
        }
7
        $('.colorpicker-default').colorpicker({
8
            format: 'hex'
9
        });
10
        $('.colorpicker-rgba').colorpicker();
11
    }
12
 
13
    var handleMiniColors = function() {
14
        $('.demo').each(function() {
15
            //
16
            // Dear reader, it's actually very easy to initialize MiniColors. For example:
17
            //
18
            //  $(selector).minicolors();
19
            //
20
            // The way I've done it below is just for the demo, so don't get confused
21
            // by it. Also, data- attributes aren't supported at this time...they're
22
            // only used for this demo.
23
            //
24
            $(this).minicolors({
25
                control: $(this).attr('data-control') || 'hue',
26
                defaultValue: $(this).attr('data-defaultValue') || '',
27
                inline: $(this).attr('data-inline') === 'true',
28
                letterCase: $(this).attr('data-letterCase') || 'lowercase',
29
                opacity: $(this).attr('data-opacity'),
30
                position: $(this).attr('data-position') || 'bottom left',
31
                change: function(hex, opacity) {
32
                    if (!hex) return;
33
                    if (opacity) hex += ', ' + opacity;
34
                    if (typeof console === 'object') {
35
                        console.log(hex);
36
                    }
37
                },
38
                theme: 'bootstrap'
39
            });
40
 
41
        });
42
    }
43
 
44
    return {
45
        //main function to initiate the module
46
        init: function() {
47
            handleMiniColors();
48
            handleColorPicker();
49
        }
50
    };
51
 
52
}();
53
 
54
jQuery(document).ready(function() {
55
   ComponentsColorPickers.init();
56
});