2011-04-26 18:52:18 -04:00
|
|
|
var farbtastic;
|
2011-04-28 05:32:34 -04:00
|
|
|
|
|
|
|
(function($){
|
|
|
|
var pickColor = function(a) {
|
|
|
|
farbtastic.setColor(a);
|
|
|
|
$('#link-color').val(a);
|
|
|
|
$('#link-color-example').css('background-color', a);
|
2011-04-28 15:01:51 -04:00
|
|
|
};
|
2011-04-28 05:32:34 -04:00
|
|
|
|
External Libraries: Further fix jQuery deprecations in WordPress core.
Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].
Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.
Built from https://develop.svn.wordpress.org/trunk@52285
git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 12:18:01 -05:00
|
|
|
$( function() {
|
2011-06-08 13:39:12 -04:00
|
|
|
$('#default-color').wrapInner('<a href="#" />');
|
|
|
|
|
2011-04-28 05:32:34 -04:00
|
|
|
farbtastic = $.farbtastic('#colorPickerDiv', pickColor);
|
|
|
|
|
|
|
|
pickColor( $('#link-color').val() );
|
|
|
|
|
2011-04-28 15:01:51 -04:00
|
|
|
$('.pickcolor').click( function(e) {
|
2011-04-28 05:32:34 -04:00
|
|
|
$('#colorPickerDiv').show();
|
|
|
|
e.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#link-color').keyup( function() {
|
|
|
|
var a = $('#link-color').val(),
|
|
|
|
b = a;
|
|
|
|
|
|
|
|
a = a.replace(/[^a-fA-F0-9]/, '');
|
|
|
|
if ( '#' + a !== b )
|
|
|
|
$('#link-color').val(a);
|
|
|
|
if ( a.length === 3 || a.length === 6 )
|
|
|
|
pickColor( '#' + a );
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).mousedown( function() {
|
|
|
|
$('#colorPickerDiv').hide();
|
2011-04-26 18:52:18 -04:00
|
|
|
});
|
2011-06-08 13:39:12 -04:00
|
|
|
|
|
|
|
$('#default-color a').click( function(e) {
|
|
|
|
pickColor( '#' + this.innerHTML.replace(/[^a-fA-F0-9]/, '') );
|
|
|
|
e.preventDefault();
|
|
|
|
});
|
|
|
|
|
2011-06-10 09:41:51 -04:00
|
|
|
$('.image-radio-option.color-scheme input:radio').change( function() {
|
2011-06-08 13:39:12 -04:00
|
|
|
var currentDefault = $('#default-color a'),
|
2011-06-10 09:41:51 -04:00
|
|
|
newDefault = $(this).next().val();
|
|
|
|
|
|
|
|
if ( $('#link-color').val() == currentDefault.text() )
|
|
|
|
pickColor( newDefault );
|
|
|
|
|
2011-06-08 13:39:12 -04:00
|
|
|
currentDefault.text( newDefault );
|
|
|
|
});
|
External Libraries: Further fix jQuery deprecations in WordPress core.
Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].
Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.
Built from https://develop.svn.wordpress.org/trunk@52285
git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 12:18:01 -05:00
|
|
|
} );
|
|
|
|
})(jQuery);
|