PageSourceSearch

https://primeflight.com/modules/custom/pm_news_ajax/js/ajax_news.js?tjsrtc

js primeflight.com collected 2026-09-26 05:34:45 UTC 3,540 bytes, 115 lines download raw bytes

1(function ($) {
2
3  Drupal.behaviors.ajaxViewNews = {
4    attach: function (context, settings) {
5      // Make news archive and news teaser ajaxible.
6      var $attachLink = this.attachLink;
7
8      var $archiveTitle = $('.view-news-archive .month-archive-content .views-row .views-field-title');
9
10      $(once('attach-links', $archiveTitle)).each($attachLink);
11
12      // Other post.
13      var $otherPost = $('.view-display-id-news_block .view-display-id-block_other_posts .views-row');
14
15      $(once('attach-links', $otherPost.find('.news-other-title'))).each($attachLink);
16      $(once('attach-links', $otherPost.find('.image-read-more'))).each($attachLink);
17      $(once('attach-links', $otherPost.find('.read-more-div'))).each($attachLink);
18
19      $(once('attach-links', $('.hidden-link-news'))).each($attachLink);
20
21      $('.paragraph--type--news-section .link-more').click(function (e) {
22        e.preventDefault();
23        e.stopPropagation();
24
25        $(location).attr('href',"/news");
26
27        var homepageLearnMoreUrl = $('.paragraph--type--news-section .link-more').attr('href');
28        var $localStorage = localStorage;
29
30        $localStorage.setItem('homepageLearnMoreUrl', homepageLearnMoreUrl);
31
32      });
33
34      // Scroll to current news.
35      function srollCurrentNews() {
36        var $currentNews = $('#current-news');
37
38        $('html, body').stop(true, false).animate({
39          scrollTop: $currentNews.offset().top - 50
40        }, 1300);
41      }
42
43      $('.page-type--news-archive a[href*="/node/"]').on('click', function () {
44
45        $(document).ajaxComplete(function () {
46          srollCurrentNews();
47        })
48      });
49
50    },
51
52    attachLink: function (idx, column) {
53
54      //Add url from LocalStorage in hidden link.
55      var urlLocalStorage = localStorage.getItem('homepageLearnMoreUrl');
56      var $hiddenLink = $('.hidden-link-news a');
57
58      $hiddenLink.attr('href', urlLocalStorage);
59
60      // Dig out the node id from the header link.
61        var link = $(column).find('a');
62        var href = $(link).attr('href');
63      if (href) {
64          var matches = /node\/(\d*)/.exec(href);
65          var nid = matches[1];
66
67          // Everything we need to specify about the view.
68          var view_info = {
69            view_name: 'news',
70            view_display_id: 'news_block',
71            view_args: nid,
72            view_dom_id: 'ajax-news'
73          };
74
75          // Details of the ajax action.
76          var ajax_settings = {
77            submit: view_info,
78            url: '/views/ajax',
79            element: column,
80            event: 'click'
81          };
82
83          setTimeout(function () {
84            Drupal.ajax(ajax_settings);
85          }, 0);
86
87          // Scroll to current news.
88          function srollCurrentNews() {
89            var $currentNews = $('#current-news');
90
91            $('html, body').stop(true, false).animate({
92              scrollTop: $currentNews.offset().top - 50
93            }, 1300);
94          }
95
96          // Load news if LocalStorage is not empty.
97          window.onload = function () {
98            var $localStorage = localStorage;
99
100            setTimeout(function () {
101              if ($localStorage.getItem('homepageLearnMoreUrl') !== false) {
102                $hiddenLink.trigger('click');
103
104                // Clear homepageLearnMoreUrl.
105                $localStorage.clear('homepageLearnMoreUrl');
106
107                // Scroll to current news.
108                srollCurrentNews();
109              }
110            }, 0)
111          };
112        }
113    }
114  };
115})(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.