Commit 204e359d authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

js compatibility with chrome 30 / tolino

parent 431681b6
......@@ -18,7 +18,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
var mdSearchActive = false;
var contentSearchActive = false;
formArray.forEach(function(val) {
$(formArray).each(function(id, val) {
if(val.name === 'fulltext') {
fulltext = val.value;
}
......
......@@ -56,7 +56,7 @@ function removeFromAggregatorItemString(tgObjectUri) {
// are there any objects left on the shelf?
if(itemArr.length > 0) {
basketItemString = itemArr.join(',');
document.querySelectorAll('.aggregator-items').forEach( elem => {
$('.aggregator-items').each((id, elem) => {
elem.href = elem.href.replace(basketItemStringOld, basketItemString);
});
} else {
......@@ -66,7 +66,7 @@ function removeFromAggregatorItemString(tgObjectUri) {
// disable download and voyant links if shelf is empty
function removeUselessActionsFromEmptyShelf() {
document.querySelectorAll('.remove_on_shelf_empty').forEach( elem => {
$('.remove_on_shelf_empty').each((id, elem) => {
elem.remove();
});
}
\ No newline at end of file
Sentry.init({ dsn: 'https://0e2560ec0cda414897840b800e9c03e7@dev2.discuss-data.net/4' });
......@@ -122,13 +122,12 @@ $( function() {
/* retrieve number of basket items on page load to set number display */
document.addEventListener("DOMContentLoaded", event => {
fetch("/service/shelf/count")
.then(response => response.text())
.then(cnt => setBasketCount(cnt));
$.ajax("/service/shelf/count")
.done(response => setBasketCount(response));
});
/* show number of items in basket */
function setBasketCount(num) {
document.querySelectorAll('.topbox_shelf-count').forEach( elem => {
$('.topbox_shelf-count').each((id, elem) => {
elem.textContent = num;
})
}
......@@ -188,12 +187,12 @@ document.addEventListener("DOMContentLoaded", function(event) {
var filters = [];
// get the filters from the left sidebar to append them to the search form
document.querySelectorAll('.tgrep.sidebar_item.-filter').forEach( elem => {
$('.tgrep.sidebar_item.-filter').each((id, elem) => {
filters.push(elem.dataset.filter);
});
function addFiltersToSearchForm(filters) {
filters.forEach(function(filter) {
$(filters).each(function(id, filter) {
$('form.search').append($('<input type="hidden" class="hiddenFilterInput" name="filter" value="'+filter+'" />'));
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment