Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a custom flag to prevent re-init of the alpha colorpicker. Fixes #13 #15

Merged
merged 3 commits into from
Nov 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions dist/wp-color-picker-alpha.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions src/wp-color-picker-alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
* Only run in input and is defined data alpha in true
*
* Version: 2.1.2
* Version: 2.1.3
* https://github.com/kallookoo/wp-color-picker-alpha
* Licensed under the GPLv2 license.
*/
( function( $ ) {
// Prevent double-init.
if ( $.wp.wpColorPicker.prototype._hasAlpha ) {
return;
}

// Variable for some backgrounds ( grid )
var image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==',
// html stuff for wpColorPicker copy of the original color-picker.js
Expand Down Expand Up @@ -48,6 +53,7 @@
* Overwrite wpColorPicker
*/
$.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, {
_hasAlpha: true,
/**
* @summary Creates the color picker.
*
Expand Down Expand Up @@ -487,4 +493,4 @@
// Auto Call plugin is class is color-picker
jQuery( document ).ready( function( $ ) {
$( '.color-picker' ).wpColorPicker();
} );
} );