PageSourceSearch

https://aau.edu.sd/Modules/Home/js/pages/media.js

js aau.edu.sd collected 2026-10-02 21:27:28 UTC 5,269 bytes, 171 lines download raw bytes

1var trans;
2if (direction === "rtl") {
3    trans = {
4        "message_done": "تم إرسال رسالتك بنجاح",
5        "message_error": "خطأ ",
6        "419": "صفحة منتهية الصلاحية .",
7        "401": "غير مصرح لك.",
8        "500": "خطأ في الخادم.",
9        "501": "لم يتم تنفيذ العملية.",
10        "PleaseWait": "الرجاء الإنتظار ... ",
11
12
13    }
14} else {
15    trans = {
16        "message_done": "Your message was sent successfully",
17        "message_error": "Error ",
18        "419": "Page expired.",
19        "401": "Unauthorized .",
20        "500": "Internal Server Error.",
21        "501": "Not Implemented.",
22        "PleaseWait": "Please wait... ",
23
24
25    }
26}
27
28var _token = $('meta[name="csrf-token"]').attr('content')
29var type = $('meta[name="type"]').attr('content')
30$(document).on('click', '.likeAction', function () {
31    let item = $(this).find('span')
32    let id = $(this).data('id')
33    let type = $(this).data('type')
34    item.html(parseInt(item.html()) + 1)
35    $.ajax({
36        url: location.origin + '/media/' + type + '/like',
37        dataType: "json",
38        data: {_token, id},
39        type: 'post',
40        success: function (data) {
41
42        }
43    })
44
45})
46function loadingArea(status = false, selector, callback = null, style = null) {
47    var $item = $(selector);
48    $item.html('').height('400px')
49    let html = ' <div class="loadingArea">\n' +
50        '<div class="loader" style="' + style + '">\n' +
51        '</div>\n' +
52        '</div>';
53    if (status === true) {
54        $item.prepend(html);
55    } else {
56        $item.find('.loadingArea').delay(200).fadeOut('slow').remove();
57    }
58    if (typeof callback == "function")
59        callback();
60
61}
62
63let date
64let category
65let tag
66const params = new URLSearchParams(location.search);
67$(document).ready(function () {
68    if (params.get('date')) {
69        $('[name="date"]').val(params.get('date'))
70        date = params.get('date');
71        $('.date').find('[data-value="'+date+'"]').addClass('active')
72    }else{
73        $('.date').find('[data-value=""]').addClass('active')
74    }
75    if (params.get('category')) {
76        $('[name="category"]').val(params.get('category'))
77        category = params.get('category');
78        $('.categories').find('[data-value="'+category+'"]').addClass('active')
79    }else {
80        $('.categories').find('[data-value=""]').addClass('active')
81    }
82    if (params.get('tag')) {
83        tag = params.get('tag');
84        $('.tags').find('[data-value="'+tag+'"]').addClass('active')
85    }else {
86        $('.tags').find('[data-value=""]').addClass('active')
87    }
88})
89
90$(document).on('click', '.action', function (event) {
91    event.preventDefault()
92    $('.load').hide();
93    let type = $(this).data('type')
94    if (type === 'date'){
95        $('.date').find('a').removeClass('active')
96    }else if (type === 'category'){
97        $('.categories').find('a').removeClass('active')
98    }else if (type === 'tag'){
99        $('.tags').find('a').removeClass('active')
100    }
101    $(this).addClass('active')
102    parent = $(".items-area")
103    loadingArea(true, ".items-area")
104    value = $(this).data('value') ? $(this).data('value') :  null;
105    if (value){
106        params.set(type, value);
107    }else{
108        params.delete(type);
109    }
110    params.toString();
111    window.history.replaceState({}, '', `${location.pathname}?${params.toString()}`);
112    $.ajax({
113        url: location.href,
114        dataType: "json",
115        data: {_token},
116        type: 'post',
117        success: function (data) {
118            parent.html('')
119            $(data.html).hide().appendTo(parent).fadeIn('normal').fadeIn('normal');
120            if (data.nextPage < data.pages) {
121                $('.load').attr('data-pages', data.pages).show()
122                $('.load').attr('data-nextPage', data.nextPage).show()
123            } else {
124                $('.load').hide();
125            }
126        }
127    })
128})
129
130function fetch_data(page, pages) {
131    var form = new FormData();
132    form.set('page', page)
133    form.set('_token', _token)
134    $.ajax({
135        url: location.origin + '/media/'+type+'/pagination' + location.search,
136        method: "POST",
137        cache: false,
138        contentType: false,
139        processData: false,
140        data: form,
141        success: function (data) {
142            parent = $(".items-area")
143            $(data.html).hide().appendTo(parent).fadeIn('normal').fadeIn('normal');
144            if (data.nextPage <= pages) {
145                $('.load').attr('data-nextPage', data.nextPage)
146            } else {
147                $('.load').hide();
148            }
149            $('[aria-live="loading"]').removeClass('fa fa-circle-o-notch fa-spin').addClass('fa fa-arrow-down')
150
151        }
152    });
153}
154
155$(document).on('click', '.load', function (event) {
156    event.preventDefault();
157    var pages = parseInt($(this).attr('data-pages'));
158    var page = parseInt($(this).attr('data-nextPage'));
159    if (page <= pages) {
160        $('[aria-live="loading"]').removeClass('fa fa-arrow-down').addClass('fa fa-circle-o-notch fa-spin')
161        fetch_data(page, pages);
162    } else {
163        $('.load').hide();
164    }
165});
166
167$(document).ready(function() {
168    $('a[data-lightbox-gallery]').nivoLightbox({
169        effect: 'fade'
170    });
171});

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.