mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-11 23:28:18 +02:00
git-svn-id: http://svn.automattic.com/wordpress/trunk@17735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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);
|
|
}
|
|
});
|
|
});
|
|
}); |