PageSourceSearch

https://www.usaswimming.org/scripts/widgets/NewsDetail.js

js usaswimming.org collected 2026-09-24 15:27:32 UTC 4,446 bytes, 128 lines download raw bytes

1var Usas = Usas || {};
2
3Usas.Content_NewsDetail = Usas.Content_NewsDetail || {};
4
5Usas.Content_NewsDetail.Index =
6
7    (function () {
8
9        function initializePage(divId) {
10            $(".downloadLink").click(function (e) {
11                //debugger;
12                e.preventDefault();
13                var url = $(this).attr("data-navTo");
14                downloadDocument(url);
15            });
16
17            $(window).resize(function () {
18                handleDocumentTitles();
19            });
20
21            handleDocumentTitles();
22        }
23
24        function handleDocumentTitles() {
25            $.each($(".document-title"), function (index, element) {
26                $(element).hide();
27            });
28            setTimeout(formatDocumentTitle, 300);
29        }
30
31        function formatDocumentTitle() {
32            //if we have documents, loop through them
33            if ($(".document-title").length > 0) {
34
35                $.each($(".document-title"), function (index, element) {
36                    //if title is larger than container, then lower font
37                    var titleHeight = $(element).height();
38                    var containerHeight = $(element).parent().height() - 90;
39                    var currentFontSize = parseInt($(element).css('font-size'));
40                    //if title is larger than container, then lower font
41                    if (titleHeight > containerHeight) {
42                        while (titleHeight > containerHeight && currentFontSize > 8) {
43                            $(element).css("font-size", (currentFontSize - 1) + "px");
44                            titleHeight = $(element).height();
45                            currentFontSize = parseInt($(element).css('font-size'));
46                        }
47                    }
48                    else { //otherwise, increase the font
49                        while (titleHeight < containerHeight && currentFontSize < 18) {
50                            $(element).css("font-size", (currentFontSize + 1) + "px");
51                            titleHeight = $(element).height();
52                            currentFontSize = parseInt($(element).css('font-size'));
53                        }
54                    }
55                    //once we're done resizing, then fade the title back in
56                    $(element).fadeIn();
57                    if (!$(element).is(":visible")) {
58                        $(element).show();
59                    }
60                });
61            }
62        }
63
64        function onChangeVideo(arg) {
65            var index = this.select().index(),
66                dataItem = this.dataSource.view()[index];
67            DisplayItem(dataItem.ItemDefaultUrl);
68        };
69
70        function DisplayItem(linkUrl) {
71
72            var loc = videoLandingUrl + linkUrl;
73            window.location.href = loc;
74
75        }
76        function displayDocument(arg) {
77            //debugger;
78            var index = this.select().index(),
79                dataItem = this.dataSource.view()[index];
80            window.open(dataItem.Url);
81        };
82
83        function downloadDocument(url) {
84            //debugger;
85            var a = $("<a>")
86                .attr("href", url)
87                .attr("download", "img.png")
88                .appendTo("body");
89
90            a[0].click();
91
92            a.remove();
93
94        };
95
96        function relativeSticky(divId, padding) {
97
98            var $sidebar = $(divId),
99                $window = $(window),
100                offset = $sidebar.offset()
101
102            $window.scroll(function () {
103                var scrollTop = $window.scrollTop();
104                var footerTop = $('.usas-footer').position().top;
105                if (scrollTop > offset.top && scrollTop + 150 < footerTop) {
106                    $sidebar.stop().animate({
107                        marginTop: $window.scrollTop() - offset.top + padding
108                    });
109                } else {
110                    $sidebar.stop().animate({
111                        marginTop: 0
112                    });
113                }
114            });
115
116        };
117
118
119
120        return {
121            onChangeVideo: onChangeVideo,
122            displayDocument: displayDocument,
123            initializePage: initializePage,
124            relativeSticky: relativeSticky
125            //iframeClick: iframeClick
126        };
127
128    })();

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.