PageSourceSearch

https://www.anjournal.com/sites/all/themes/cni/js/jquery.color.js?tlin4x

js anjournal.com collected 2026-09-28 07:44:06 UTC 4,605 bytes, 126 lines download raw bytes

1(function (jQuery) {
2    /*
3     * jQuery Color Animations
4     * Copyright 2007 John Resig
5     * Released under the MIT and GPL licenses.
6     */
7
8// We override the animation for all of these color styles
9    jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function (i, attr) {
10        jQuery.fx.step[attr] = function (fx) {
11            if (fx.state == 0) {
12                fx.start = getColor(fx.elem, attr);
13                fx.end = getRGB(fx.end);
14            }
15
16            fx.elem.style[attr] = "rgb(" + [
17                    Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
18                    Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
19                    Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
20                ].join(",") + ")";
21        }
22    });
23
24// Color Conversion functions from highlightFade
25// By Blair Mitchelmore
26// http://jquery.offput.ca/highlightFade/
27
28// Parse strings looking for color tuples [255,255,255]
29    function getRGB(color) {
30        var result;
31
32        // Check if we're already dealing with an array of colors
33        if (color && color.constructor == Array && color.length == 3)
34            return color;
35
36        // Look for rgb(num,num,num)
37        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
38            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
39
40        // Look for rgb(num%,num%,num%)
41        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
42            return [parseFloat(result[1]) * 2.55, parseFloat(result[2]) * 2.55, parseFloat(result[3]) * 2.55];
43
44        // Look for #a0b1c2
45        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
46            return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)];
47
48        // Look for #fff
49        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
50            return [parseInt(result[1] + result[1], 16), parseInt(result[2] + result[2], 16), parseInt(result[3] + result[3], 16)];
51
52        // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
53        if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
54            return colors['transparent']
55
56        // Otherwise, we're most likely dealing with a named color
57        return colors[jQuery.trim(color).toLowerCase()];
58    }
59
60    function getColor(elem, attr) {
61        var color;
62
63        do {
64            color = jQuery.curCSS(elem, attr);
65
66            // Keep going until we find an element that has color, or we hit the body
67            if (color != '' && color != 'transparent' || jQuery.nodeName(elem, "body"))
68                break;
69
70            attr = "backgroundColor";
71        } while (elem = elem.parentNode);
72
73        return getRGB(color);
74    };
75
76// Some named colors to work with
77// From Interface by Stefan Petre
78// http://interface.eyecon.ro/
79
80    var colors = {
81        aqua: [0, 255, 255],
82        azure: [240, 255, 255],
83        beige: [245, 245, 220],
84        black: [0, 0, 0],
85        blue: [0, 0, 255],
86        brown: [165, 42, 42],
87        cyan: [0, 255, 255],
88        darkblue: [0, 0, 139],
89        darkcyan: [0, 139, 139],
90        darkgrey: [169, 169, 169],
91        darkgreen: [0, 100, 0],
92        darkkhaki: [189, 183, 107],
93        darkmagenta: [139, 0, 139],
94        darkolivegreen: [85, 107, 47],
95        darkorange: [255, 140, 0],
96        darkorchid: [153, 50, 204],
97        darkred: [139, 0, 0],
98        darksalmon: [233, 150, 122],
99        darkviolet: [148, 0, 211],
100        fuchsia: [255, 0, 255],
101        gold: [255, 215, 0],
102        green: [0, 128, 0],
103        indigo: [75, 0, 130],
104        khaki: [240, 230, 140],
105        lightblue: [173, 216, 230],
106        lightcyan: [224, 255, 255],
107        lightgreen: [144, 238, 144],
108        lightgrey: [211, 211, 211],
109        lightpink: [255, 182, 193],
110        lightyellow: [255, 255, 224],
111        lime: [0, 255, 0],
112        magenta: [255, 0, 255],
113        maroon: [128, 0, 0],
114        navy: [0, 0, 128],
115        olive: [128, 128, 0],
116        orange: [255, 165, 0],
117        pink: [255, 192, 203],
118        purple: [128, 0, 128],
119        violet: [128, 0, 128],
120        red: [255, 0, 0],
121        silver: [192, 192, 192],
122        white: [255, 255, 255],
123        yellow: [255, 255, 0],
124        transparent: [255, 255, 255]
125    };
126})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.