1 2$(document).ready(function () { 3 var $host = "www.vdu.lt"; 4 var $httphost = 'https://' + $host; 5 if ($('.program_list').length) { 6 7 var ahref = location.href.replace(location.search, ''); 8 var old_h1 = $('.program_list').prev('h1').text(); 9 var new_h1 = $('<a></a>').attr("href", ahref).html(old_h1); 10 $('.program_list').prev('h1').html(new_h1); 11 12 var $faculty = $('.program_list').data('faculty'); 13 if (!$faculty) { 14 return; 15 } 16 var $reload = $('.program_list').data('reload'); 17 18 var $loading = $('.program_list').data('loading'); 19 var $img = $('<img />').attr('src', $loading); 20 21 function load_programs() { 22 $.ajax({ 23 data: { 24 action: 'study-list-programs', 25 faculty: $faculty 26 }, 27 url: ajax_object.ajax_url, 28 }).done(function (data) { 29 $('.program_list').html(data); 30 $('.program_list a').not('b').on('click', function () { 31 $('.program_list').html($img); 32 var $program_link = $(this).attr('href').replace($httphost, ''); 33 history.pushState({}, '', '?' + $program_link); 34 load_program($program_link); 35 return false; 36 }) 37 }); 38 } 39 40 function load_program($url) { 41 42 $.ajax({ 43 data: { 44 action: 'study-get-data', 45 url: $url, 46 }, 47 url: ajax_object.ajax_url, 48 }).done(function (data) { 49 var $response = $(data).find('article'); 50 $('.program_list').html($response); 51 $('.program_list a').on('click', function () { 52 53 if (this.host !== $host || this.href.split('.').pop() === 'pdf') { 54 // external 55 $(this).attr('target', '_blank'); 56 return true; 57 } 58 $('.program_list').html($img); 59 var $program_link = $(this).attr('href').replace($httphost, ''); 60 history.pushState({}, '', '?' + $program_link); 61 load_program($program_link); 62 return false; 63 }) 64 65 }); 66 } 67 68 $(window).on('load', function () { 69 setTimeout(function () { 70 $(window).on("popstate", function (e) { 71 72 if (e.originalEvent.state !== null) { 73 74 var $back = location.search.replace('?', ''); 75 $('.program_list').html($img); 76 load_program($back); 77 } else { 78 location.reload(); 79 } 80 }); 81 82 }, 0); 83 }); 84 85 86 var $back = location.search.replace('?',''); 87 88 if ($back) { 89 $('.program_list').html($img); 90 load_program($back); 91 } else { 92 if ($reload) { 93 load_program($reload); 94 } 95 else { 96 load_programs(); 97 } 98 } 99 100 } 101 102}); 103 104 105 106
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.