PageSourceSearch

https://www.dowty.com/modules/custom/aeroblox/js/aero-rss-feed.js?v=11.3.14

js dowty.com collected 2026-10-02 19:43:49 UTC 4,030 bytes, 107 lines download raw bytes

1// aero rss feed script
2(function () {
3
4  function escapeHtml(str) {
5    var div = document.createElement('div');
6    div.appendChild(document.createTextNode(String(str)));
7    return div.innerHTML;
8  }
9
10  function safeUrl(url) {
11    try {
12      var parsed = new URL(url);
13      return (parsed.protocol === 'https:' || parsed.protocol === 'http:') ? url : '#';
14    } catch (e) {
15      return '#';
16    }
17  }
18
19  document.addEventListener('DOMContentLoaded', function (event) {
20    document.querySelectorAll(".wp-block-aero-rss-feeds").forEach(function (el) {
21      var idx = el.getAttribute('data-instance-id');
22      let linkTargetValue = el.getAttribute('data-link');
23      var section = document.querySelector(".wp-block-aero-rss-feeds[data-instance-id='" + idx + "']");
24      var rssEndpoint = section.getAttribute('data-feed-source');
25      var rssFeedItems;
26      // Using fetch to retrieve RSS Feeds
27      fetch(rssEndpoint, {
28        method: 'GET',
29        mode: 'cors',
30        cache: 'no-cache',
31        headers: {
32          "Content-Type": "application/rss+xml; charset=utf-8",
33          "Accept": "application/rss+xml",
34          "Access-Control-Allow-Origin": "*",
35          "Access-Control-Allow-Headers": "Origin, Content-Type, Accept",
36        },
37
38      }).then((response) => {
39        if (!response.ok) {
40          return;
41        }
42        else {
43          return response.text();
44        }
45      }).then((text) => {
46        return text;
47      }).then((data) => {
48
49        var results = new DOMParser().parseFromString(data, "text/xml");
50        var items = results.querySelectorAll("item");
51
52        var rss_items = [];
53        if (items.length) {
54          items.forEach(function (el) {
55            var pubDate = el.querySelector("publishedOn").querySelector("time").textContent;
56            var date = new Date(pubDate);
57            var months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
57November", "December");
58            var string = months[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear();
59
60            rss_items.push({
61              "title": escapeHtml(el.querySelector("title").textContent),
62              "link": escapeHtml(safeUrl(el.querySelector("link").textContent.trim())),
63              "description": escapeHtml(el.querySelector("description").textContent),
64              "contentType": escapeHtml(el.querySelector("contentType").textContent),
65              "pubDate": escapeHtml(string),
66            });
67          });
68        }
69
70        return rss_items;
71      }).then((feed_items) => {
72
73        var feeds_markup = '';
74
75        if (feed_items.length) {
76          let linkTargetAttr = (linkTargetValue === "newTab") ? '_blank' : '_self';
77          let relAttr = (linkTargetValue === "newTab") ? 'rel="noopener noreferrer"' : '';
78          feed_items.forEach(function (item) {
79
80            feeds_markup +=
81              `<div class="news-item">
82                <div class="news-info">
83                    <a href="${item.link}" target="${linkTargetAttr}" ${relAttr} class="news-category">${item.description}</a>
84                    <a href="${item.link}" target="${linkTargetAttr}" ${relAttr} class="news-type">${item.contentType}</a>
85                    <span class="news-date">${item.pubDate}</span>
86                </div>
87                <a href="${item.link}" target="${linkTargetAttr}" ${relAttr} class="row news-row">
88                    <h4 class="news-title col-9 col-sm-10">
89                    ${item.title}
90                    </h4>
91                    <div class="col-3 d-flex justify-content-end mt-2 col-sm-2">
92                        <button class="cir-button cir-light-10 btn-arrow-right-icon mt-1"></button>
93                    </div>
94                </a>
95            </div>`;
96          });
97        }
98
99        document.querySelector(".wp-block-aero-rss-feeds[data-instance-id = '" + idx + "'] .news").innerHTML = feeds_markup;
100
101      }).catch(err => console.log('error', err));
102
103    })
104
105  });
106
107})();

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.