Giter VIP home page Giter VIP logo

colorpicker's People

Contributors

rayden avatar somatonic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

colorpicker's Issues

compatibility with Repeater and Repeater Matrix

very quick and dirty hack, but seems to work. Not sure if it would cause any other issues.

function SetUpCPicker(){
$('div[id^=ColorPicker_]').each(function(){
var $colorpicker = $(this);

    $colorpicker.ColorPicker({
        color: $(this).data('color').toString(),
        onShow: function (colpkr) {
            $(colpkr).fadeIn(500);
            return false;
        },
        onHide: function (colpkr) {
            $(colpkr).fadeOut(500);
            return false;
        },
        onChange: function (hsb, hex, rgb) {
            $colorpicker.css('backgroundColor', '#' + hex);
            $colorpicker.css('background-image', 'none');
            $colorpicker.next('input').val(hex).trigger('change');
        }
    });

});

$('a.ColorPickerReset').on('click',function(e){
    e.preventDefault();
    var color = $(this).data('default') && $(this).data('default') != 'transp' ? '#' + $(this).data('default').toString() : 'transparent';
    $(this).parent().find('input').val($(this).data('default')).trigger('change');
    $(this).parent().find('div[id^=ColorPicker_]').ColorPickerSetColor($(this).data('default').toString());
    $(this).parent().find('div[id^=ColorPicker_]')
        .css('backgroundColor', color)
        .css('background-image', 'none')
        .attr('data-color', $(this).data('default').toString());
    if(color == 'transparent') {
        var modurl = $(this).data('modurl');
        $(this).parent().find('div[id^=ColorPicker_]')
            .css('background-image', 'url(' + modurl + 'transparent.gif)');
    }
});

/* additions (swatches) by @Rayden */
$('div.ColorPickerSwatch').on('click',function(e){
    e.preventDefault();
    var color = $(this).data('color') && $(this).data('color') != 'transp' ? '#' + $(this).data('color').toString() : 'transparent';
    $(this).closest('.ui-widget-content, .InputfieldContent').find('input').val($(this).data('color')).trigger('change');
    $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]').ColorPickerSetColor($(this).data('color').toString());
    $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]')
        .css('backgroundColor', color)
        .css('background-image', 'none')
        .attr('data-color', $(this).data('color').toString());
    if(color == 'transparent') {
        var modurl = $(this).closest('.ui-widget-content, .InputfieldContent').find('.ColorPickerReset').data('modurl');
        $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]')
            .css('background-image', 'url(' + modurl + 'transparent.gif)');
    }
});

};
$(document).ready(function() {
SetUpCPicker();
$(document).on('repeateradd', '.InputfieldRepeaterMatrix .InputfieldRepeaterMatrixAddLink', SetUpCPicker);
$(document).on('opened', '.InputfieldRepeaterItem', SetUpCPicker);
});

Adding feature for color swatch and transparent color

Hello Soma,

I have cloned the color picker and i have added the capability to use predefined color swatch and the posibility to use "transparent" as a value. This works great for 99%.
There is one known bug in that fork by me. That is that it always loads up with the default color. Do you perhaps can see what causes this problem?

I hope you like the idea of color swatches and transparent as value (in some cases i want to be able to use transparent as background, while being able to pick an other color). If you like it i hope you can implement these features in the original processwire colorpicker module.

Can't install with modules manager

problem

After I installed this with Modules Manager, and created new field, system automatically locks up whenever I try to edit this field with

TemplateFile: Method InputfieldColorPicker::moduleGetInfo does not exist or is not callable in this context

I also can't uninstall it, since the systems just locks up when the error comes up.

steps to reproduce

  1. download plugin via MM
  2. install plugin
  3. create new field named e.g. 'color'
  4. locked

z-index issue in PW 3.12

Perhaps some earlier versions has this too, but I had to increase the z-index in the css for the .colorpicker

colors starting with 0E break output formatting

Hey, I noticed with output formatting active, #0E1779 becomes #000000.

Must be this line and some funny php behaviour.

var_dump("0E1779" == "0"); // bool(true)

I guess PHP interprets the color as 0e1779 (scientific notation), becoming 0.
Strict comparison === fixes this.

Edit: I'm not really sure what this line does to begin with. I only see it "trigger" when I configure a Default Value "0".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.