PageSourceSearch

https://navigatorresearch.org/wp-content/themes/ldwp/assets/scripts/scripts.js?ver=1789479257

js navigatorresearch.org collected 2026-10-02 03:57:07 UTC 14,878 bytes, 325 lines download raw bytes

1jQuery(document).ready(function ($) {
2  $(".wpb-content-wrapper .vc_row.wpb_row.vc_row-fluid")
3    .not(":last")
4    .each(function () {
5      if ($(this).find("ul li").length > 0) {
6        $(this).addClass("sgl-res-has-list");
7      }
8    });
9
10  // date field in research page
11  $(".date-field").each(function () {
12    const input = $(this).find('input[type="date"]');
13
14    input.on("input", function () {
15      $(this).closest(".date-field").attr("data-value", $(this).val());
16    });
17
18    $(this).on("click", function () {
19      const nativeInput = input[0];
20      if (nativeInput.showPicker) {
21        nativeInput.showPicker();
22      } else {
23        input.focus();
24      }
25    });
26  });
27
28
29
30
31  
32  /*
33  if ($(".chart_content").length > 0) {
34    document
35      .querySelector(".dnld-as-img")
36      .addEventListener("click", function (e) {
37        e.preventDefault();
38
39        const activeChartContent = document.querySelector(
40          ".chart_content.active"
41        );
42        const imgName = activeChartContent.getAttribute("data-name");
43
44        html2canvas(activeChartContent).then((canvas) => {
45          const image = canvas.toDataURL("image/png");
46
47          const link = document.createElement("a");
48          link.download = imgName + "-chart.png";
49          link.href = image;
50
51          link.click();
52        });
53      });
54  }*/
55
56
57  // bottom buttons and research full content null
58  if ($('.research_full_content_null').length && $.trim($('.research_full_content_null').html()) === '') {
59
60    // find first paragraph WITH real content
61    var $firstContentP = $(".post_the_content p").filter(function () {
62      return $.trim($(this).text()).length > 0 && $.trim($(this).text()) !== "|";
63    }).first();
64
65    if ($firstContentP.length) {
66
67      // get wrapper that contains this paragraph
68      var $wrapper = $firstContentP.closest(".wpb_wrapper");
69      var $links   = $wrapper.find("a");
70
71      if ($links.length) {
72        // clone ONLY – original remains unchanged
73        var $cloneForContent = $links.clone(true);
74        var $cloneForBottom  = $links.clone(true);
75
76        // modify clones only
77        $cloneForContent.addClass("featured_res btn primary").attr("target", "_blank").appendTo(".research_full_content_null");
78
79        if (!$(".single_bottom_buttons .subtitle").length) {
80          $(".single_bottom_buttons").prepend(
81            '<div class="subtitle">Download</div>'
82          );
83        }
84
85        $cloneForBottom.addClass("p-dnw-btn").attr("target", "_blank").appendTo(".single_bottom_buttons");
86      }
87
88      // cleanup pipe-only elements
89      $wrapper.find("p, strong, span").each(function () {
90        if ($.trim($(this).text()) === "|") {
91          $(this).remove();
92        }
93      });
94    }
95  }
96
97 
98
99
100
101
102  // big takeaway
103
104   var acfSectionExists = $(".single_big_text").length > 0 
105     && $(".single_big_text .single_big_text_content").length > 0;
106
107    if (!acfSectionExists) { 
108        var $heading = $(".post_the_content")
109            .find("p strong")
110            .filter(function () {
111                return $(this).text().trim().toUpperCase().includes("BIG TAKEAWAYS");
112            });
113
114        if ($heading.length) {
115            var $ul = $heading.closest("p").next("ul");
116
117            if ($ul.length) {
118                var highlights = [];
119                $ul.find("li").each(function () {
120                    var text = $(this).text().trim();
121                    if (text) highlights.push(text);
122                });
123
124                if (highlights.length) {
125                    $(".post_the_content").before(`
126                        <section class="single_big_text">
127                            <div class="container">
128                                <div class="single_big_text_heading">
129                                    <h4>${$heading.text().trim()}</h4>
130                                </div>
131                                <div class="single_big_text_content"></div>
132                            </div>
133                        </section>
134                    `);
135
136                    var $acfWrapper = $(".single_big_text_content").last();
137                    highlights.forEach(function (t) {
138                        $acfWrapper.append(`<p>${t}</p>`);
139                    });
140                }
141            }
142        }
143    }
144});
145
146
147//Download as Image
148document.addEventListener('DOMContentLoaded', function() {
149    
150    const downloadBtn = document.querySelector('.dnld-as-img');
151
152    // --- UPDATED SVG CODE ---
153    const logoSVG = `
154        <svg width="200" height="44" viewBox="0 0 200 44" fill="none" xmlns="http://www.w3.org/2000/svg">
155		<path d="M77.5839 0.0189367C82.8936 0.591599 82.408 8.41645 77.1991 8.36148C72.1414 8.3065 71.7016 0.706131 76.8143 0.0189367C77.0113 -0.00855104 77.3824 -0.00396975 77.5839 0.0189367Z" fill="#101D32"/>
156		<path d="M200 30.1687L197.801 30.8284C197.645 30.9933 199.084 32.4365 199.019 32.8396C199.001 32.9541 197.393 34.017 197.146 34.1132C197.017 33.8154 195.982 32.3219 195.78 32.3677C195.538 32.4181 194.621 34.1728 194.351 34.1132L192.629 32.8442C192.61 32.4594 194.017 31.0163 193.847 30.8284C193.343 30.6681 192.372 30.5077 191.946 30.2603C191.827 30.1916 191.767 30.1779 191.763 30.013C191.763 29.8205 192.367 28.1346 192.491 28.0934L194.617 28.634V26.3296H197.036V28.634L199.161 28.0934C199.418 28.1759 199.743 29.7701 200 30.0588V30.1687Z" fill="#03C2FE"/>
157		<path d="M100.66 13.3915V11.1971H107.362V32.8483C106.845 37.7961 104.055 41.7727 99.1205 43.0463C92.8396 44.668 85.056 42.2766 83.6221 35.3176L89.816 33.6638C90.7643 36.999 94.1407 38.1168 97.2789 37.0448C99.0106 36.4538 100.435 34.4609 100.435 32.6284V30.7088C97.0956 34.2823 90.9109 33.6317 87.4108 30.6035C80.9878 25.0418 83.0586 13.3686 91.511 11.1192C94.6446 10.2854 98.5341 10.7252 100.655 13.3915H100.66ZM95.144 16.9329C89.225 17.4826 89.3029 26.4757 95.002 26.9842C102.474 27.6531 102.103 16.2869 95.144 16.9329Z" fill="#101D32"/>
158		<path d="M162.287 10.4646C178.381 9.80036 179.366 33.6964 163.795 34.7684C147.165 35.9137 145.928 11.1381 162.287 10.4646ZM161.843 17.0434C156.552 17.6802 156.13 26.5954 161.27 28.0797C164.633 29.051 167.629 26.8474 167.909 23.4251C168.234 19.4623 166.035 16.5394 161.843 17.0434Z" fill="#101D32"/>
159		<path d="M131.318 34.1129H125.11C124.803 34.1129 124.808 32.0238 124.67 31.7031C120.364 37.7046 108.865 34.3511 110.487 26.3247C111.737 20.1262 118.38 21.1799 122.879 19.9384C124.94 19.3703 124.395 17.1071 122.787 16.365C120.62 15.3662 117.991 16.2046 117.134 18.4815C117.038 18.7335 117.074 19.2283 116.85 19.3016L110.871 18.0326C111.293 13.6803 115.169 11.0278 119.283 10.5421C125.156 9.85036 130.649 12.2693 131.093 18.7106C131.391 23.0078 130.896 27.6395 131.093 31.978C131.125 32.6606 131.322 33.4165 131.318 34.1129ZM124.175 24.1348C121.834 24.7121 116.424 24.1577 117.43
1596 28.061C117.977 30.1409 121.358 29.8798 122.751 28.794C123.369 28.313 124.175 26.934 124.175 26.1598V24.1303V24.1348Z" fill="#101D32"/>
160		<path d="M45.4967 34.113H39.2891C39.1654 34.0168 39.0142 33.4167 39.0142 33.293V31.5933C34.5429 37.833 22.7232 34.3009 24.8077 25.9171C26.2737 20.0118 33.0219 21.2213 37.2596 19.9202C39.2708 19.3017 38.437 16.8919 36.7373 16.2689C34.3505 15.3984 31.3497 16.5621 31.2123 19.3155L25.1238 18.1197C24.7023 17.8403 25.9392 15.1648 26.2233 14.7158C29.8471 8.95714 41.6622 8.85177 44.4934 15.3251C46.0511 18.8848 45.1073 27.1815 45.2722 31.4284C45.3089 32.2943 45.538 33.2288 45.4967 34.1085V34.113ZM38.4599 24.135C37.1084 24.3045 35.7019 24.4465 34.3734 24.7168C33.2143 24.9504 31.8628 25.3078 31.588 26.6501C30.8183 30.4114 36.6136 30.558 37.9651 27.5297C38.1071 27.209 38.4599 26.0225 38.4599 25.7247V24.135Z" fill="#101D32"/>
161		<path d="M21.6465 34.1129H14.6692C14.6692 34.1129 14.5043 33.9618 14.5043 33.948V19.8056C14.5043 19.5719 13.9958 18.5274 13.8263 18.2892C12.626 16.6124 9.60236 16.562 8.18216 17.9914C7.83856 18.3395 7.14221 19.5719 7.14221 20.0255V33.948C7.14221 33.948 6.99103 34.1129 6.97728 34.1129H0.164926C0.164926 34.1129 0 33.9618 0 33.948V11.2019H6.81236V13.6116C7.87063 12.338 9.14881 11.3897 10.7706 10.927C16.062 9.40602 20.8585 12.3839 21.5274 17.8448C21.8023 23.2507 21.5778 28.6933 21.6511 34.1129H21.6465Z" fill="#101D32"/>
162		<path d="M53.6282 11.2021L58.7913 25.2347L63.7895 11.2021H71.0966L62.4746 34.0078L62.1494 34.1178L55.3828 34.0582L45.9316 11.2021H53.6282Z" fill="#101D32"/>
163		<path d="M144.177 4.51325V11.2019H148.68V17.3409H144.177V26.0545C144.177 26.1003 144.31 26.7921 144.337 26.8791C144.887 28.6887 147.132 28.1665 148.57 28.0794V33.8885C147.897 34.0809 147.228 34.3237 146.522 34.4245C143.013 34.9147 139.146 33.7511 137.795 30.2189C137.63 29.7883 137.25 28.5376 137.25 28.1344V17.3363H133.182V11.1974H134.776C136.279 11.1974 137.91 9.571 137.91 8.07292V4.50867H144.172L144.177 4.51325Z" fill="#101D32"/>
164		<path d="M192.529 18.1059C189.583 17.4829 186.514 18.0189 185.382 21.1204C185.258 21.4595 184.947 22.4673 184.947 22.7651V34.113H177.805V11.2019H184.727V13.9415L185.662 12.7367C186.775 11.7929 188.241 11.0966 189.725 10.9774C190.078 10.95 192.533 10.9316 192.533 11.2569V18.1105L192.529 18.1059Z" fill="#101D32"/>
165		<path d="M80.7676 11.2021H73.7354V34.1132H80.7676V11.2021Z" fill="#101D32"/>
166		</svg>
167    `;
168    // --------------------------------
169
170    if (downloadBtn) {
171        downloadBtn.addEventListener('click', function(e) {
172            e.preventDefault();
173
174            // 1. Target Elements
175            const activeContainer = document.querySelector('.chart_content.active');
176            if (!activeContainer) { alert("Please select a chart tab."); return; }
177            
178            const activeCanvas = activeContainer.querySelector('.chart-container canvas');
179            const legendLabels = activeContainer.querySelectorAll('.custom-chart-legend label');
180            const h2Element = document.querySelector('.data_chart_section_inner h2');
181            const activeBtn = document.querySelector('.chart_button .chart_btn.active');
182
183            if (!activeCanvas) return;
184
185            // --- CONFIGURATION ---
186            const logoWidth = 120;  // *** UPDATED WIDTH ***
187            const padding = 20;
188            
189            const titleSpace = 50;
190            const legendSpace = 40;
191            const footerSpace = 80;
192
193            const actualLegendHeight = (legendLabels.length > 0) ? legendSpace : 0;
194            const topHeaderHeight = titleSpace + actualLegendHeight;
195
196            // --- PREPARE TITLE ---
197            let titleText = h2Element ? h2Element.innerText.trim() : '';
198            const btnText = activeBtn ? activeBtn.innerText.trim() : '';
199            if (btnText) titleText += ` (${btnText})`;
200
201            // --- CREATE TEMP CANVAS ---
202            const tempCanvas = document.createElement('canvas');
203            tempCanvas.width = activeCanvas.width;
204            tempCanvas.height = activeCanvas.height + topHeaderHeight + footerSpace;
205            const ctx = tempCanvas.getContext('2d');
206
207            // 1. White Background
208            ctx.fillStyle = '#FFFFFF';
209            ctx.fillRect(0, 0, tempCanvas.width, tempCanvas.height);
210
211            // 2. Draw Title
212            ctx.fillStyle = '#000000';
213            ctx.font = 'bold 24px Arial';
214            ctx.textAlign = 'center';
215            ctx.textBaseline = 'middle';
216            ctx.fillText(titleText, tempCanvas.width / 2, titleSpace / 2 + 10);
217
218            // 3. Draw Custom Legend
219            if (legendLabels.length > 0) {
220                ctx.font = '14px Arial';
221                ctx.textAlign = 'left';
222                ctx.textBaseline = 'middle';
223                
224                let totalLegendWidth = 0;
225                const gap = 20;
226                const iconSize = 10;
227                const iconGap = 5;
228                
229                const itemsToDraw = [];
230
231                legendLabels.forEach(label => {
232                    const text = label.innerText.trim();
233                    const color = label.style.color || '#000';
234                    const textWidth = ctx.measureText(text).width;
235                    const itemWidth = iconSize + iconGap + textWidth;
236                    itemsToDraw.push({ text, color, width: itemWidth });
237                    totalLegendWidth += itemWidth + gap;
238                });
239                
240                totalLegendWidth -= gap;
241
242                let currentX = (tempCanvas.width - totalLegendWidth) / 2;
243                const legendY = titleSpace + (actualLegendHeight / 2);
244
245                itemsToDraw.forEach(item => {
246                    ctx.fillStyle = item.color;
247                    ctx.beginPath();
248                    ctx.arc(currentX + (iconSize/2), legendY, iconSize/2, 0, 2 * Math.PI);
249                    ctx.fill();
250
251                    ctx.fillStyle = '#666666';
252                    ctx.fillText(item.text, currentX + iconSize + iconGap, legendY);
253                    currentX += item.width + gap;
254                });
255            }
256
257            // 4. Draw Chart
258            ctx.drawImage(activeCanvas, 0, topHeaderHeight);
259
260            // 5. Draw Logo & Download
261            const img = new Image();
262            const svgBlob = new Blob([logoSVG], {type: 'image/svg+xml;charset=utf-8'});
263            const url = URL.createObjectURL(svgBlob);
264
265            img.onload = function() {
266                const aspectRatio = (img.width && img.height) ? (img.width / img.height) : 1;
267                const logoHeight = logoWidth / aspectRatio;
268                const x = tempCanvas.width - logoWidth - padding;
269                const y = tempCanvas.height - logoHeight - padding;
270
271                ctx.drawImage(img, x, y, logoWidth, logoHeight);
272
273                // Download
274                const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
275                const link = document.createElement('a');
276                link.download = `chart-export-${timestamp}.png`;
277                link.href = tempCanvas.toDataURL("image/png");
278                document.body.appendChild(link);
279                link.click();
280                document.body.removeChild(link);
281                URL.revokeObjectURL(url);
282            };
283
284            img.src = url;
285        });
286    }
287});
288
289
290
291// Check box Dropdown for Key Issue Area
292jQuery(document).ready(function ($) {
293
294    $('#key_issue_area > label').wrapAll(
295        '<div class="checkbox-label-group"></div>'
296    );
297
298    $('#key_issue_area .checkbox-label-group').hide();
299
300    $('#key_issue_area').on('click', function (e) {
301        e.stopPropagation();
302
303        $(this).toggleClass('active');
304        $(this).find('.checkbox-label-group').toggle(); 
305        $(this).parent('.filter-dropdown').toggleClass('active', $(this).hasClass('active'));
306    });
307
308    $(document).on('click', function () {
309      $('#key_issue_area').removeClass('active').find('.checkbox-label-group').hide();
310      $('#key_issue_area').parent('.filter-dropdown').removeClass('active');
311    });
312
313});
314
315
316
317
318
319
320
321
322
323
324
325

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.