mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 18:01:42 +01:00
39 lines
905 B
JavaScript
39 lines
905 B
JavaScript
|
var farbtastic;
|
||
|
function pickColor(a) {
|
||
|
farbtastic.setColor(a);
|
||
|
jQuery("#link-color").val(a);
|
||
|
jQuery("#link-color").css("background-color", a);
|
||
|
}
|
||
|
jQuery(document).ready(function() {
|
||
|
jQuery("#pickcolor").click(function() {
|
||
|
jQuery("#colorPickerDiv").show();
|
||
|
return false;
|
||
|
});
|
||
|
jQuery("#link-color").keyup(function() {
|
||
|
var b = jQuery("#link-color").val(),
|
||
|
a = b;
|
||
|
if (a.charAt(0) != "#") {
|
||
|
a = "#" + a;
|
||
|
}
|
||
|
a = a.replace(/[^#a-fA-F0-9]+/, "");
|
||
|
if (a != b) {
|
||
|
jQuery("#link-color").val(a);
|
||
|
}
|
||
|
if (a.length == 4 || a.length == 7) {
|
||
|
pickColor(a);
|
||
|
}
|
||
|
});
|
||
|
farbtastic = jQuery.farbtastic("#colorPickerDiv",
|
||
|
function(a) {
|
||
|
pickColor(a);
|
||
|
});
|
||
|
pickColor(jQuery("#link-color").val());
|
||
|
jQuery(document).mousedown(function() {
|
||
|
jQuery("#colorPickerDiv").each(function() {
|
||
|
var a = jQuery(this).css("display");
|
||
|
if (a == "block") {
|
||
|
jQuery(this).fadeOut(2);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|