1/** 2 * plugins/generic/wosReviewerLocator/js/wosrl.js 3 * 4 * Copyright (c) 2025 Clarivate 5 * Distributed under the GNU GPL v3. 6 * 7 * wosReviewerLocator JS functionality 8 * 9 */ 10 11function wosRLList(page_url) { 12 const wrapper = $('#wosRLGrid'); 13 $('a#wosRLSearch', wrapper.parent()).addClass('wosrl-hidden'); 14 wrapper.html('<div class="wosrl-loader"><span class="pkp_spinner"></span></div>'); 15 $.ajax({ 16 url: page_url, 17 dataType: 'json', 18 success: function(data) { 19 if (data.status === true && data.content) { 20 wrapper.html(data.content); 21 if($('#wosRLToolbar', wrapper).length) { 22 wosRLPagination(); 23 } 24 } else { 25 $('a#wosRLSearch', wrapper.parent()).removeClass('wosrl-hidden'); 26 wrapper.html('<div class="wosrl-placeholder">' + data.content + '</div>'); 27 } 28 }, 29 error: function() { 30 $('a#wosRLSearch', wrapper.parent()).removeClass('wosrl-hidden'); 31 wrapper.html('<div class="wosrl-placeholder">Failed request or invalid JSON returned.</div>'); 32 } 33 }); 34 return false; 35} 36 37function wosRLPagination() { 38 let prev = { start: 0, stop: 10 }; 39 let content = $('#wosRLList > table > tbody > tr').not('.wosrl-conflict'); 40 $('#wosRLPagination').paging(content.length, { 41 format: '- [<>]', 42 perpage: $('#wosRLToolbar #wosRLItems select[name=wosrl-item-count]').val(), 43 lapping: 0, 44 page: 1, 45 onSelect: function (page) { 46 let data = this.slice; 47 content.slice(prev[0], prev[1]).addClass('pkp_helpers_display_none'); 48 content.slice(data[0], data[1]).removeClass('pkp_helpers_display_none'); 49 prev = data; 50 return false; 51 }, 52 onFormat: function (type) { 53 switch (type) { 54 case 'block': // n and c 55 return '<a>' + this.value + '</a>'; 56 case 'next': // > 57 const _next = '<svg viewBox="0 0 24 24" focusable="false"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></svg>'; 58 return (this.active || (this.page === 1 && this.page !== this.pages)) ? '<a>' + _next + '</a>' : _next; 59 case 'prev': // < 60 const _prev = '<svg viewBox="0 0 24 24" focusable="false"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path></svg>'; 61 return (this.active || (this.page === this.pages && this.page !== 1)) ? '<a>' + _prev + '</a>' : _prev; 62 case 'first': // [ 63 const _first = '<svg viewBox="0 0 24 24" focusable="false"><path d="M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"></path></svg>'; 64 return this.active ? '<a>' + _first + '</a>' : _first; 65 case 'last': // ] 66 const _last = '<svg viewBox="0 0 24 24" focusable="false"><path d="M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"></path></svg>'; 67 return this.active ? '<a>' + _last + '</a>' : _last; 68 case 'fill': 69 const data = this.slice; 70 return '<span>' + (data[0] + 1) + ' - ' + data[1] + ' of ' + content.length + '</span>'; 71 } 72 } 73 }); 74} 75 76function wosRLConflictToggle(element, id) { 77 const target = $('tr[data-name=wosrl-conflict-' + id + ']', $(element).closest('#wosRLList')); 78 $.when(target.toggle('display')).then(function() { 79 const text = target.is(':hidden') ? $(element).data('view') : $(element).data('hide'); 80 $(element).html('<b>!</b> ' + text); 81 }); 82 return false; 83}
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.