PageSourceSearch

https://www.infonova.com.br/assets/js/jquery.circleType.js

js infonova.com.br collected 2026-10-02 22:26:41 UTC 4,731 bytes, 150 lines download raw bytes

1/*
2 * CircleType 0.34
3 * Peter Hrynkow
4 * Copyright 2013, Licensed GPL & MIT
5 *
6 */
7
8$.fn.circleType = function (options) {
9
10    var settings = {
11        dir: 1,
12        position: 'relative'
13    };
14    if (typeof ($.fn.lettering) !== 'function') {
15        console.log('Lettering.js is required');
16        return;
17    }
18    return this.each(function () {
19
20        if (options) {
21            $.extend(settings, options);
22        }
23        var elem = this,
24            delta = (180 / Math.PI),
25            ch = parseInt($(elem).css('line-height'), 10),
26            fs = parseInt($(elem).css('font-size'), 10),
27            txt = elem.innerHTML.replace(/^\s+|\s+$/g, '').replace(/\s/g, ' '),
28            letters,
29            center;
30
31        elem.innerHTML = txt
32        $(elem).lettering();
33
34        elem.style.position = settings.position;
35
36        letters = elem.getElementsByTagName('span');
37        center = Math.floor(letters.length / 2)
38
39        var layout = function () {
40            var tw = 0,
41                i,
42                offset = 0,
43                minRadius,
44                origin,
45                innerRadius,
46                l, style, r, transform;
47
48            for (i = 0; i < letters.length; i++) {
49                tw += letters[i].offsetWidth;
50            }
51            minRadius = (tw / Math.PI) / 2 + ch;
52
53            if (settings.fluid && !settings.fitText) {
54                settings.radius = Math.max(elem.offsetWidth / 2, minRadius);
55            } else if (!settings.radius) {
56                settings.radius = minRadius;
57            }
58
59            if (settings.dir === -1) {
60                origin = 'center ' + (-settings.radius + ch) / fs + 'em';
61            } else {
62                origin = 'center ' + settings.radius / fs + 'em';
63            }
64
65            innerRadius = settings.radius - ch;
66
67            for (i = 0; i < letters.length; i++) {
68                l = letters[i];
69                offset += l.offsetWidth / 2 / innerRadius * delta;
70                l.rot = offset;
71                offset += l.offsetWidth / 2 / innerRadius * delta;
72            }
73            for (i = 0; i < letters.length; i++) {
74                l = letters[i]
75                style = l.style
76                r = (-offset * settings.dir / 2) + l.rot * settings.dir
77                transform = 'rotate(' + r + 'deg)';
78
79                style.position = 'absolute';
80                style.left = '50%';
81                style.marginLeft = -(l.offsetWidth / 2) / fs + 'em';
82
83                style.webkitTransform = transform;
84                style.MozTransform = transform;
85                style.OTransform = transform;
86                style.msTransform = transform;
87                style.transform = transform;
88
89                style.webkitTransformOrigin = origin;
90                style.MozTransformOrigin = origin;
91                style.OTransformOrigin = origin;
92                style.msTransformOrigin = origin;
93                style.transformOrigin = origin;
94                if (settings.dir === -1) {
95                    style.bottom = 0;
96                }
97            }
98
99            if (settings.fitText) {
100                if (typeof ($.fn.fitText) !== 'function') {
101                    console.log('FitText.js is required when using the fitText option');
102                } else {
103                    $(elem).fitText();
104                    $(window).resize(function () {
105                        updateHeight();
106                    });
107                }
108            }
109            updateHeight();
110        };
111
112        var getBounds = function (elem) {
113            var docElem = document.documentElement,
114                box = elem.getBoundingClientRect();
115            return {
116                top: box.top + window.pageYOffset - docElem.clientTop,
117                left: box.left + window.pageXOffset - docElem.clientLeft,
118                height: box.height
119            };
120        };
121
122        var updateHeight = function () {
123            var mid = getBounds(letters[center]),
124                first = getBounds(letters[0]),
125                h;
126            if (mid.top < first.top) {
127                h = first.top - mid.top + first.height;
128            } else {
129                h = mid.top - first.top + first.height;
130            }
131            elem.style.height = h + 'px';
132        }
133
134        if (settings.fluid && !settings.fitText) {
135            $(window).resize(function () {
136                layout();
137            });
138        }
139
140        if (document.readyState !== "complete") {
141            elem.style.visibility = 'hidden';
142            $(window).load(function () {
143                elem.style.visibility = 'visible';
144                layout();
145            });
146        } else {
147            layout();
148        }
149    });
150};

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.