PageSourceSearch

https://www.biopet.co.il/wp-content/themes/biopet/js/acanaTemplate.js?ver=1790319358

js biopet.co.il collected 2026-09-25 06:56:18 UTC 7,249 bytes, 156 lines download raw bytes

1jQuery(function ($) {
2    var $nav = $('.tabs[data-tabs="#tabs1"]'), $wrap = $('#tabs1');
3    var $panes = $wrap.children('.tab-pane');
4
5    var $activeBtn = $nav.find('.nav-link.is-active');
6    var $activePane = $panes.filter('.is-active');
7    if (!$activeBtn.length || !$activePane.length) {
8        var $firstBtn = $nav.find('.nav-link').first();
9        var firstSel = $firstBtn.data('target');
10        var $firstPane = firstSel ? $(firstSel) : $panes.first();
11        $nav.find('.nav-link').removeClass('is-active').attr('aria-selected', 'false');
12        $firstBtn.addClass('is-active').attr('aria-selected', 'true');
13        $panes.removeClass('is-active');
14        $firstPane.addClass('is-active');
15    }
16
17    $panes.hide().filter('.is-active').show();
18
19    $nav.on('click', '.nav-link', function (e) {
20        e.preventDefault();
21        var $b = $(this), t = $b.data('target');
22        if (!t || !$(t).length) return;
23
24        $nav.find('.nav-link').removeClass('is-active').attr('aria-selected', 'false');
25        $b.addClass('is-active').attr('aria-selected', 'true');
26
27        $panes.removeClass('is-active').hide();
28        $(t).addClass('is-active').show();
29    });
30});
31
32
33
34
35
36(function () {
37    const wrap = document.getElementById('diagram');
38    const svg = wrap.querySelector('svg.overlay');
39
40    function len(val, base) {
41        if (val == null || val === '') return 0;
42        const s = String(val).trim();
43        if (s.endsWith('%')) return parseFloat(s) / 100 * base;
44        return parseFloat(s);
45    }
46
47    function sideOf(el) {
48        if (el.classList.contains('right')) return 'left';
49        if (el.classList.contains('left')) return 'right';
50        if (el.classList.contains('top')) return 'bottom';
51        return 'top';
52    }
53
54    function getAnchor(el, cr) {
55        if (el.dataset.anchor) {
56            const [ax, ay] = el.dataset.anchor.split(/\s+/).map(Number);
57            return [cr.width * (ax / 100), cr.height * (ay / 100)];
58        }
59        const img = wrap.querySelector('img');
60        if (img) {
61            const ir = img.getBoundingClientRect();
62            return [(ir.left - cr.left) + ir.width / 2, (ir.top - cr.top) + ir.height / 2];
63        }
64        return [cr.width / 2, cr.height / 2];
65    }
66
67    function buildPath(pts) {
68        if (!pts.length) return '';
69        let d = `M ${pts[0][0]} ${pts[0][1]}`;
70        for (let i = 1; i < pts.length; i++) d += ` L ${pts[i][0]} ${pts[i][1]}`;
71        return d;
72    }
73
74    function draw() {
75        const cr = wrap.getBoundingClientRect();
76        svg.setAttribute('viewBox', `0 0 ${cr.width} ${cr.height}`);
77        while (svg.firstChild) svg.removeChild(svg.firstChild);
78
79        wrap.querySelectorAll('.labelGrap').forEach(el => {
80            const [anchorX, anchorY] = getAnchor(el, cr);
81
82            const lr = el.getBoundingClientRect();
83            const baseX = lr.left - cr.left;
84            const baseY = lr.top - cr.top;
85            const s = sideOf(el);
86
87            let lx, ly;
88            const num = el.querySelector('.n');
89            if (num) {
90                const nr = num.getBoundingClientRect();
91                let nx = (nr.left - cr.left) + nr.width / 2;
92                if (el.dataset.nRef === 'right') nx = (nr.right - cr.left);
93                if (el.dataset.nRef === 'left') nx = (nr.left - cr.left);
94                lx = nx;
95                ly = (nr.bottom - cr.top);
96                if (el.dataset.nOffsetX) lx += len(el.dataset.nOffsetX, cr.width);
97                if (el.dataset.nOffsetY) ly += len(el.dataset.nOffsetY, cr.height);
98            } else {
99                if (s === 'left') { lx = baseX; ly = baseY + lr.height / 2; }
100                if (s === 'right') { lx = baseX + lr.width; ly = baseY + lr.height / 2; }
101                if (s === 'top') { lx = baseX + lr.width / 2; ly = baseY; }
102                if (s === 'bottom') { lx = baseX + lr.width / 2; ly = baseY + lr.height; }
103            }
104
105            const plan = (el.dataset.plan || '').trim();
106            let points = [];
107
108            if (plan) {
109                let cx = lx, cy = ly;
110                points.push([cx, cy]);
111                const steps = plan.split(/[;,]/).map(s => s.trim()).filter(Boolean);
112                for (const step of steps) {
113                    const m = step.match(/^([a-z\-]+)\s*:\s*(-?\d+(?:\.\d+)?)(%?)$/i);
114                    if (!m) continue;
115                    const cmd = m[1].toLowerCase();
116                    const val = parseFloat(m[2]);
117                    const isPct = !!m[3];
118                    const dx = anchorX - cx, dy = anchorY - cy;
119                    const absdx = Math.abs(dx), absdy = Math.abs(dy);
120
121                    if (cmd === 'to') { if (absdx >= absdy) { const L = isPct ? val / 100 * cr.width : val; cx += Math.sign(dx) * L; } else { const L = isPct ? val / 100 * cr.height : val; cy += Math.sign(dy) * L; } }
122                    else if (cmd === 'to-h') { const L = isPct ? val / 100 * cr.width : val; cx += Math.sign(dx) * L; }
123                    else if (cmd === 'to-v') { const L = isPct ? val / 100 * cr.height : val; cy += Math.sign(dy) * L; }
124                    else if (cmd === 'left') { const L = isPct ? val / 100 * cr.width : val; cx -= L; }
125                    else if (cmd === 'right') { const L = isPct ? val / 100 * cr.width : val; cx += L; }
126                    else if (cmd === 'up') { const L = isPct ? val / 100 * cr.height : val; cy -= L; }
127                    else if (cmd === 'down') { const L = isPct ? val / 100 * cr.height : val; cy += L; }
128                    else if (cmd === 'h') { const L = isPct ? val / 100 * cr.width : val; cx += L; }
129                    else if (cmd === 'v') { const L = isPct ? val / 100 * cr.height : val; cy += L; }
130
131                    points.push([cx, cy]);
132                }
133            } else {
134                let route = el.dataset.route || ((s === 'left' || s === 'right') ? 'hv' : 'vh');
135                if (route === 'straight') { points = [[lx, ly], [anchorX, anchorY]]; }
136                else if (route === 'h' || route === 'hv1') { points = [[lx, ly], [anchorX, ly], [anchorX, anchorY]]; }
137                else if (route === 'v' || route === 'vh1') { points = [[lx, ly], [lx, anchorY], [anchorX, anchorY]]; }
138                else if (route === 'vh') { const my = (anchorY + ly) / 2; points = [[lx, ly], [lx, my], [anchorX, my], [anchorX, anchorY]]; }
139                else { const mx = (anchorX + lx) / 2; points = [[lx, ly], [mx, ly], [mx, anchorY], [anchorX, anchorY]]; }
140            }
141
142            const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
143            path.setAttribute('d', buildPath(points));
144            path.setAttribute('class', 'leader');
145            if (el.dataset.color) path.style.stroke = el.dataset.color;
146            if (el.dataset.width) path.style.strokeWidth = el.dataset.width;
147            svg.appendChild(path);
148        });
149    }
150
151    const ro = new ResizeObserver(draw);
152    ro.observe(wrap);
153    window.addEventListener('load', draw, { once: true });
154    window.addEventListener('resize', draw);
155})();
156

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.