<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16305] trunk: Farbtastic 1.3u.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16305">16305</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-11-11 16:34:22 +0000 (Thu, 11 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Farbtastic 1.3u. Props flashingcursor. fixes <a href="http://trac.wordpress.org/ticket/14707">#14707</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjsfarbtasticjs">trunk/wp-admin/js/farbtastic.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjsfarbtasticjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/farbtastic.js (16304 => 16305)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/farbtastic.js        2010-11-11 16:28:49 UTC (rev 16304)
+++ trunk/wp-admin/js/farbtastic.js        2010-11-11 16:34:22 UTC (rev 16305)
</span><span class="lines">@@ -1,26 +1,29 @@
</span><del>-// $Id: farbtastic.js,v 1.2 2007/01/08 22:53:01 unconed Exp $
-// Farbtastic 1.2
</del><ins>+/*!
+ * Farbtastic: jQuery color picker plug-in v1.3u
+ *
+ * Licensed under the GPL license:
+ * http://www.gnu.org/licenses/gpl.html
+ */
+(function($) {
</ins><span class="cx">
</span><del>-var farbtastic_click = false;
-
-jQuery.fn.farbtastic = function (callback) {
- jQuery.farbtastic(this, callback);
</del><ins>+$.fn.farbtastic = function (options) {
+ $.farbtastic(this, options);
</ins><span class="cx"> return this;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-jQuery.farbtastic = function (container, callback) {
- var container = jQuery(container).get(0);
- return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
-}
</del><ins>+$.farbtastic = function (container, callback) {
+ var container = $(container).get(0);
+ return container.farbtastic || (container.farbtastic = new $._farbtastic(container, callback));
+};
</ins><span class="cx">
</span><del>-jQuery._farbtastic = function (container, callback) {
</del><ins>+$._farbtastic = function (container, callback) {
</ins><span class="cx"> // Store farbtastic object
</span><span class="cx"> var fb = this;
</span><span class="cx">
</span><span class="cx"> // Insert markup
</span><del>- jQuery(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
- var e = jQuery('.farbtastic', container);
- fb.wheel = jQuery('.wheel', container).get(0);
</del><ins>+ $(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
+ var e = $('.farbtastic', container);
+ fb.wheel = $('.wheel', container).get(0);
</ins><span class="cx"> // Dimensions
</span><span class="cx"> fb.radius = 84;
</span><span class="cx"> fb.square = 100;
</span><span class="lines">@@ -28,11 +31,11 @@
</span><span class="cx">
</span><span class="cx"> // Fix background PNGs in IE6
</span><span class="cx"> if (navigator.appVersion.match(/MSIE [0-6]\./)) {
</span><del>- jQuery('*', e).each(function () {
</del><ins>+ $('*', e).each(function () {
</ins><span class="cx"> if (this.currentStyle.backgroundImage != 'none') {
</span><span class="cx"> var image = this.currentStyle.backgroundImage;
</span><span class="cx"> image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
</span><del>- jQuery(this).css({
</del><ins>+ $(this).css({
</ins><span class="cx"> 'backgroundImage': 'none',
</span><span class="cx"> 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
</span><span class="cx"> });
</span><span class="lines">@@ -46,7 +49,7 @@
</span><span class="cx"> fb.linkTo = function (callback) {
</span><span class="cx"> // Unbind previous nodes
</span><span class="cx"> if (typeof fb.callback == 'object') {
</span><del>- jQuery(fb.callback).unbind('keyup', fb.updateValue);
</del><ins>+ $(fb.callback).unbind('keyup', fb.updateValue);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Reset color
</span><span class="lines">@@ -57,19 +60,19 @@
</span><span class="cx"> fb.callback = callback;
</span><span class="cx"> }
</span><span class="cx"> else if (typeof callback == 'object' || typeof callback == 'string') {
</span><del>- fb.callback = jQuery(callback);
</del><ins>+ fb.callback = $(callback);
</ins><span class="cx"> fb.callback.bind('keyup', fb.updateValue);
</span><span class="cx"> if (fb.callback.get(0).value) {
</span><span class="cx"> fb.setColor(fb.callback.get(0).value);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> return this;
</span><del>- }
</del><ins>+ };
</ins><span class="cx"> fb.updateValue = function (event) {
</span><span class="cx"> if (this.value && this.value != fb.color) {
</span><span class="cx"> fb.setColor(this.value);
</span><span class="cx"> }
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Change color with HTML syntax #123456
</span><span class="lines">@@ -83,7 +86,7 @@
</span><span class="cx"> fb.updateDisplay();
</span><span class="cx"> }
</span><span class="cx"> return this;
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Change color with HSL triplet [0..1, 0..1, 0..1]
</span><span class="lines">@@ -94,7 +97,7 @@
</span><span class="cx"> fb.color = fb.pack(fb.rgb);
</span><span class="cx"> fb.updateDisplay();
</span><span class="cx"> return this;
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> /////////////////////////////////////////////////////
</span><span class="cx">
</span><span class="lines">@@ -103,64 +106,17 @@
</span><span class="cx"> * of the widget.
</span><span class="cx"> */
</span><span class="cx"> fb.widgetCoords = function (event) {
</span><del>- var x, y;
- var el = event.target || event.srcElement;
- var reference = fb.wheel;
</del><ins>+ var offset = $(fb.wheel).offset();
+ return { x: (event.pageX - offset.left) - fb.width / 2, y: (event.pageY - offset.top) - fb.width / 2 };
+ };
</ins><span class="cx">
</span><del>- if (typeof event.offsetX != 'undefined') {
- // Use offset coordinates and find common offsetParent
- var pos = { x: event.offsetX, y: event.offsetY };
-
- // Send the coordinates upwards through the offsetParent chain.
- var e = el;
- while (e) {
- e.mouseX = pos.x;
- e.mouseY = pos.y;
- pos.x += e.offsetLeft;
- pos.y += e.offsetTop;
- e = e.offsetParent;
- }
-
- // Look for the coordinates starting from the wheel widget.
- var e = reference;
- var offset = { x: 0, y: 0 }
- while (e) {
- if (typeof e.mouseX != 'undefined') {
- x = e.mouseX - offset.x;
- y = e.mouseY - offset.y;
- break;
- }
- offset.x += e.offsetLeft;
- offset.y += e.offsetTop;
- e = e.offsetParent;
- }
-
- // Reset stored coordinates
- e = el;
- while (e) {
- e.mouseX = undefined;
- e.mouseY = undefined;
- e = e.offsetParent;
- }
- }
- else {
- // Use absolute coordinates
- var pos = fb.absolutePosition(reference);
- x = (event.pageX || 0*(event.clientX + jQuery('html').get(0).scrollLeft)) - pos.x;
- y = (event.pageY || 0*(event.clientY + jQuery('html').get(0).scrollTop)) - pos.y;
- }
- // Subtract distance to middle
- return { x: x - fb.width / 2, y: y - fb.width / 2 };
- }
-
</del><span class="cx"> /**
</span><span class="cx"> * Mousedown handler
</span><span class="cx"> */
</span><span class="cx"> fb.mousedown = function (event) {
</span><del>-        farbtastic_click = true;
</del><span class="cx"> // Capture mouse
</span><span class="cx"> if (!document.dragging) {
</span><del>- jQuery(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
</del><ins>+ $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
</ins><span class="cx"> document.dragging = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -171,7 +127,7 @@
</span><span class="cx"> // Process
</span><span class="cx"> fb.mousemove(event);
</span><span class="cx"> return false;
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Mousemove handler
</span><span class="lines">@@ -192,18 +148,17 @@
</span><span class="cx"> fb.setHSL([fb.hsl[0], sat, lum]);
</span><span class="cx"> }
</span><span class="cx"> return false;
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Mouseup handler
</span><span class="cx"> */
</span><span class="cx"> fb.mouseup = function () {
</span><span class="cx"> // Uncapture mouse
</span><del>-        farbtastic_click = false;
- jQuery(document).unbind('mousemove', fb.mousemove);
- jQuery(document).unbind('mouseup', fb.mouseup);
</del><ins>+ $(document).unbind('mousemove', fb.mousemove);
+ $(document).unbind('mouseup', fb.mouseup);
</ins><span class="cx"> document.dragging = false;
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Update the markers and styles
</span><span class="lines">@@ -211,29 +166,29 @@
</span><span class="cx"> fb.updateDisplay = function () {
</span><span class="cx"> // Markers
</span><span class="cx"> var angle = fb.hsl[0] * 6.28;
</span><del>- jQuery('.h-marker', e).css({
</del><ins>+ $('.h-marker', e).css({
</ins><span class="cx"> left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
</span><span class="cx"> top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
</span><span class="cx"> });
</span><span class="cx">
</span><del>- jQuery('.sl-marker', e).css({
</del><ins>+ $('.sl-marker', e).css({
</ins><span class="cx"> left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
</span><span class="cx"> top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> // Saturation/Luminance gradient
</span><del>- jQuery('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
</del><ins>+ $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
</ins><span class="cx">
</span><span class="cx"> // Linked elements or callback
</span><span class="cx"> if (typeof fb.callback == 'object') {
</span><span class="cx"> // Set background/foreground color
</span><del>- jQuery(fb.callback).css({
</del><ins>+ $(fb.callback).css({
</ins><span class="cx"> backgroundColor: fb.color,
</span><span class="cx"> color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> // Change linked value
</span><del>- jQuery(fb.callback).each(function() {
</del><ins>+ $(fb.callback).each(function() {
</ins><span class="cx"> if (this.value && this.value != fb.color) {
</span><span class="cx"> this.value = fb.color;
</span><span class="cx"> }
</span><span class="lines">@@ -242,20 +197,6 @@
</span><span class="cx"> else if (typeof fb.callback == 'function') {
</span><span class="cx"> fb.callback.call(fb, fb.color);
</span><span class="cx"> }
</span><del>- }
-
- /**
- * Get absolute position of element
- */
- fb.absolutePosition = function (el) {
- var r = { x: el.offsetLeft, y: el.offsetTop };
- // Resolve relative to offsetParent
- if (el.offsetParent) {
- var tmp = fb.absolutePosition(el.offsetParent);
- r.x += tmp.x;
- r.y += tmp.y;
- }
- return r;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /* Various color utility functions */
</span><span class="lines">@@ -266,7 +207,7 @@
</span><span class="cx"> return '#' + (r < 16 ? '0' : '') + r.toString(16) +
</span><span class="cx"> (g < 16 ? '0' : '') + g.toString(16) +
</span><span class="cx"> (b < 16 ? '0' : '') + b.toString(16);
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> fb.unpack = function (color) {
</span><span class="cx"> if (color.length == 7) {
</span><span class="lines">@@ -279,7 +220,7 @@
</span><span class="cx"> parseInt('0x' + color.substring(2, 3)) / 15,
</span><span class="cx"> parseInt('0x' + color.substring(3, 4)) / 15];
</span><span class="cx"> }
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> fb.HSLToRGB = function (hsl) {
</span><span class="cx"> var m1, m2, r, g, b;
</span><span class="lines">@@ -289,7 +230,7 @@
</span><span class="cx"> return [this.hueToRGB(m1, m2, h+0.33333),
</span><span class="cx"> this.hueToRGB(m1, m2, h),
</span><span class="cx"> this.hueToRGB(m1, m2, h-0.33333)];
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> fb.hueToRGB = function (m1, m2, h) {
</span><span class="cx"> h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
</span><span class="lines">@@ -297,7 +238,7 @@
</span><span class="cx"> if (h * 2 < 1) return m2;
</span><span class="cx"> if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
</span><span class="cx"> return m1;
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> fb.RGBToHSL = function (rgb) {
</span><span class="cx"> var min, max, delta, h, s, l;
</span><span class="lines">@@ -318,10 +259,10 @@
</span><span class="cx"> h /= 6;
</span><span class="cx"> }
</span><span class="cx"> return [h, s, l];
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> // Install mousedown handler (the others are set on the document on-demand)
</span><del>- jQuery('*', e).mousedown(fb.mousedown);
</del><ins>+ $('*', e).mousedown(fb.mousedown);
</ins><span class="cx">
</span><span class="cx"> // Init color
</span><span class="cx"> fb.setColor('#000000');
</span><span class="lines">@@ -330,4 +271,6 @@
</span><span class="cx"> if (callback) {
</span><span class="cx"> fb.linkTo(callback);
</span><span class="cx"> }
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+};
+
+})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (16304 => 16305)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-11-11 16:28:49 UTC (rev 16304)
+++ trunk/wp-includes/script-loader.php        2010-11-11 16:34:22 UTC (rev 16305)
</span><span class="lines">@@ -497,7 +497,7 @@
</span><span class="cx">         $styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20101020' );
</span><span class="cx">         $styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20100402' );
</span><span class="cx">         $styles->add( 'theme-install', "/wp-admin/css/theme-install$suffix.css", array(), '20100523' );
</span><del>-        $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
</del><ins>+        $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u' );
</ins><span class="cx">         $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
</span><span class="cx">         $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
</span><span class="cx">         $styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' );
</span></span></pre>
</div>
</div>
</body>
</html>