PageSourceSearch

https://added.gov.ae/assets/DED/js/publications.js?v=24092026104751

js added.gov.ae collected 2026-09-24 18:48:22 UTC 8,609 bytes, 202 lines download raw bytes

1$(document).ready(function () {
2    var pageNo = 1;
3    var pageSize = 8;
4    var culture = $("#culture").val();
5
6    var obj = getPublicationDataSet();
7    resetTabs();
8
9    $('body').on('click', '.tabsHead ul li.nav-item', function () {
10        pageNo = 1;
11        resetTabs();
12    });
13
14    $('.search-btn').on('click', function () {
15        var obj = getPublicationDataSet();
16        if (obj.page && obj.page === "publicationslisting") {
17            pageNo = 1;
18            getPublicationsListing(obj);
19        }
20    });
21
22    $('.publicationSortBy').on('change', function () {
23        var obj = getPublicationDataSet();
24        if (obj.page && obj.page === "publicationslisting") {
25            getPublicationsListing(obj);
26        }
27     
28    });
29
30    function getPublicationDataSet() {
31        var obj = {
32            sourceID: $('#sourceID').val(),
33            division: $('#division').val(),
34            category: $('#category').val(),
35            keyword: $('#eventSearch').val(),
36            sortBy: $('select[name=sortby]').val(),
37            page: $('#page').val()
38        }
39        return obj;
40    }
41
42    function resetTabs() {
43        if (obj.page && obj.page === "divisionspublications") {
44            $('.general-pagination').hide();
45            var activeTab = getActiveTab();
46            var activeTabId = getActiveTabId();
47            getDivisionsPublications(activeTabId, activeTab);
48        }
49        else if (obj.page && obj.page === "publicationslisting") {
50            $('.general-pagination').hide();
51            getPublicationsListing(obj);
52        }
53    }
54
55    function getPublicationsListing(obj) {
56        let data = { sourceID: obj.sourceID, keyword: obj.keyword, sortBy: obj.sortBy, division: obj.division, category: obj.category, pageNo: pageNo, pageSize: pageSize, culture: culture };
57        getPublicationsListingAPI(data)
58            .then(response => {
59                if (response != "" && response != undefined && response != null) {
60                    if (response.Items.length > 0) {
61                        var html = _divisionPublications(response.Items);
62                        $('.initiatives-list').html('');
63                        $('.initiatives-list').html(html);
64                        animateElements();
65                        if (response.TotalRecordCount > response.PageSize) {
66                            $('.general-pagination').show();
67                            setupPagination(response.PageNo, response.PageSize, response.TotalRecordCount);
68                        }
69                        else {
70                            $('.general-pagination').hide();
71                        }
72                        setTimeout(function () {
73                            $(".page").each(function () {
74                                $(this).bind("click", function () {
75                                    pageNo = parseInt($(this).attr('page'));
76                                    var obj = getPublicationDataSet();
77                                    getPublicationsListing(obj);
78                                    $('html, body').animate({
79                                        scrollTop: $(".adbcPublication").offset().top
80                                    }, 500);
81                                })
82                            });
83                        }, 800);
84                    }
85                    else {
86                        noRecord();
87                    }
88                }
89                else {
90                    noRecord();
91                }
92            });
93    }
94
95    function getDivisionsPublications(tabId, category) {
96        let sourceID = $('#sourceID').val();
97        let division = $('#division').val();
98
99        let data = { sourceID: sourceID, division: division, category: category, pageNo: pageNo, pageSize: pageSize, culture: culture };
100        getDivisionsPublicationsAPI(data)
101            .then(response => {
102                if (response != "" && response != undefined && response != null) {
103                    if (response.Items.length > 0) {
104                        var html = _divisionPublications(response.Items);
105                        $('.initiatives-list').html('');
106                        $('#' + tabId + ' .initiatives-list').html(html);
107                        animateElements();
108                        if (response.TotalRecordCount > response.PageSize) {
109                            $('.general-pagination').show();
110                            setupPagination(response.PageNo, response.PageSize, response.TotalRecordCount);
111                        }
112                        else {
113                            $('.general-pagination').hide();
114                        }
115                        setTimeout(function () {
116                            $(".page").each(function () {
117                                $(this).bind("click", function () {
118                                    pageNo = parseInt($(this).attr('page'));
119                                    resetTabs();
120                                    $('html, body').animate({
121                                        scrollTop: $(".tab-content").offset().top
122                                    }, 500);
123                                })
124                            });
125                        }, 800);
126                    }
127                    else {
128                        noRecord();
129                    }
130                }
131                else {
132                    noRecord();
133                }
134            });
135    }
136
137    function _divisionPublications(obj) {
138        let _template = ``;
139        $.each(obj, function (ind, val) {
140            _template += `<div class="gallery-item animate" data-animation="fadeInLeft" data-duration="300">
141                                    <div class="pubRegularCard">
142                                        <div class="card-body">
143                                            <h5><a href="${val.File}" target="_blank"><span class="resizable">${val.Title}</span></a></h5>
144                                        </div>
145                                        <div class="card-footer">
146                                            <div class="card-footer-box">
147                                                <div class="pdfSize">
148                                                    <span class="formatText ${val.Class} resizable">${val.FileExtension}</span>
149                                                    <span class="fileSize resizable">${val.FileSize}</span>
150                                                </div>
151                                                <div class="downloadLink">
152                                                    <a href="${val.File}" target="_blank" class="textLink textLink-black">
153                                                        <span class="resizable">${val.DownloadCaption}</span>
154                                                        <i class="icon-download"></i>
155                                                    </a>
156                                                </div>
157                                            </div>
158                                        </div>
159                                    </div>
160                                </div>`;
161
162        });
163        return _template;
164    }
165
166    function getActiveTab() {
167        let activeTab = '';
168        $('.tabsHead ul li.nav-item').each(function () {
169            if ($(this).find('button').hasClass('active')) {
170                activeTab = $(this).find('button').attr('data-title');
171            }
172        });
173        return activeTab;
174    }
175
176    function setupPagination(pn, ps, rc) {
177        $(".Pager").ASPSnippets_Pager({
178            ActiveCssClass: "active",
179            PagerCssClass: "pager",
180            PageIndex: pn,
181            PageSize: ps,
182            RecordCount: rc
183        });
184    }
185
186    function getActiveTabId() {
187        let activeTabId = '';
188        $('.tabsHead ul li.nav-item').each(function () {
189            if ($(this).find('button').hasClass('active')) {
190                activeTabId = $(this).find('button').attr('data-tab-id');
191            }
192        });
193        return activeTabId;
194    }
195
196    function noRecord() {
197        $('.initiatives-list').html('');
198        $('.general-pagination').hide();
199        $('.initiatives-list').html('<h3 style="justify-content:center"><span class="resizable">' + $('#noRecordFound').val() + '</span></h3>');
200    }
201
202});

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.