diff --git a/config/vufind/availabilityplus-resolver-Unpaywall.yaml b/config/vufind/availabilityplus-resolver-Unpaywall.yaml
index e69de29bb..b181c68e6 100644
--- a/config/vufind/availabilityplus-resolver-Unpaywall.yaml
+++ b/config/vufind/availabilityplus-resolver-Unpaywall.yaml
@@ -0,0 +1,29 @@
+# In this file rules can be configured to change the output of a resolver.
+# These rules are used in function applyCustomChanges in the resolver class.
+#
+#TestRule: # name of the rule, required
+# descripton: 'description' # optional
+# reason: 'reason for rule' # optional
+# date: 'date yyyy-mm-dd' # optional
+# creator: 'John Doe' # optional
+# examples: 'e.g. an id in the index' # optional
+# details: 'http://www.more-details.vufind' # optional, a url
+# conditions: # one or multiple conditions can be specified that need to match for the actions to take place
+# - { field: 'field1->subfield1', content: '(.*)' } #field: specifies the path to a field that needs to be checked, use -> to indicate a subfield, subsubfield ... / content: can be a string or regular expression
+# actions: # indicate what actions are to be taken, if all conditions are fullfilled
+# - { field: 'field1->subfield1->subsubfield1', content: '' } # complete string replacement by indicating a field and the new content
+# - { field: 'field1->subfield1', content_field: 'field2->contentfromsubfield2', pattern: '(.*?):(.*)', replacement: '$2'} # regex-based replacement, content can be from the same field or another field
+# - { function: 'removeItem'} # a function in the resolver can be specified, currently only one function is supported for all resolvers: removeItem
+# - { function: 'adjustScore', score: 200} # DAIA also supports the function adjustScore, requiring a score parameter with an integer
+# Example
+RemoveItemForUrl1:
+ description: 'Entfernung eines Items, mit URL, die nicht zum Volltext führt'
+ reason: ''
+ date: ''
+ creator: ''
+ examples: 'PPN 517096420'
+ detailsLink: ''
+ conditions:
+ - { field: 'url', content: 'https://www.degruyter.com/document/doi/10.1515/jag-2021-frontmatter3/pdf' }
+ actions:
+ - { function: 'removeItem'}
diff --git a/themes/availabilityplus/js/check_item_statuses.js b/themes/availabilityplus/js/check_item_statuses.js
index 34d7a916a..e1fda8e4f 100644
--- a/themes/availabilityplus/js/check_item_statuses.js
+++ b/themes/availabilityplus/js/check_item_statuses.js
@@ -1,22 +1,11 @@
/*global Hunt, VuFind */
/*exported checkItemStatuses, itemStatusFail */
-function linkCallnumbers(callnumber, callnumber_handler) {
- if (callnumber_handler) {
- var cns = callnumber.split(',\t');
- for (var i = 0; i < cns.length; i++) {
- cns[i] = '' + cns[i] + '';
- }
- return cns.join(',\t');
- }
- return callnumber;
-}
-
function displayItemStatus(results, item) {
item.removeClass('js-item-pending');
item.find('.ajax-availability').removeClass('ajax-availability hidden');
item.find('.status').empty();
- var id = item.attr('data-id');
+ let id = item.attr('data-id');
$.each(results, function(index, result){
if (typeof(result.error) != 'undefined'
&& result.error.length > 0
@@ -48,18 +37,16 @@ function itemStatusFail(response, textStatus) {
.append(typeof response.responseJSON.data === 'string' ? response.responseJSON.data : VuFind.translate('error_occurred'));
}
-var itemStatusIds = [];
-var itemStatusEls = {};
-var itemStatusTimer = null;
-var itemStatusDelay = 200;
-var itemStatusRunning = false;
-var itemStatusList = false;
-var itemStatusSource = '';
-var itemStatusHideLink = '';
-var itemStatusType = '';
-var itemStatusMediatype = '';
-var itemLanguage = '';
-var itemStatusDebug = '';
+let itemStatusIds = [];
+let itemStatusEls = {};
+let itemStatusTimer = null;
+let itemStatusDelay = 200;
+let itemStatusRunning = false;
+let itemStatusList = false;
+let itemStatusSource = '';
+let itemStatusMediatype = '';
+let itemLanguage = '';
+let itemStatusDebug = '';
function runItemAjaxForQueue() {
// Only run one item status AJAX request at a time:
@@ -69,8 +56,8 @@ function runItemAjaxForQueue() {
}
itemStatusRunning = true;
- for (var i=0; i $(window).scrollTop() && $(this).find('.ajax-availability').length !== 0 ) {
+ let id = $(this).attr('data-id');
+ itemStatusSource = $(this).attr('data-src');
+ itemStatusList = ($(this).attr('data-list') == 1);
+ itemStatusMediatype = $(this).attr('data-mediatype');
+ itemLanguage = $(this).attr('data-language');
+ itemStatusDebug = $(this).attr('data-debug');
+ itemQueueAjax(id, $(this));
+ }
+ });
}
$(document).ready(function() {
- function checkItemStatusReady() {
- if (typeof Hunt === 'undefined') {
- checkItemStatuses();
- } else {
- itemStatusObserver = new Hunt(
- $('.availabilityItem').toArray(),
- {
- enter: checkItemStatus,
- offset: 100000
- }
- );
- }
- }
- checkItemStatusReady();
+ checkItemStatuses();
+ $(window).on('scroll resize', function() {
+ checkItemStatuses();
+ });
});
function initDaiaPlusOverlay () {