Widget:Laad meer berichten: verschil tussen versies
Uit Dorpsbelang Den Hout
Regel 33: | Regel 33: | ||
newrow.innerHTML = data.parse.text['*']; | newrow.innerHTML = data.parse.text['*']; | ||
− | newrow.querySelectorAll('.col-md-6').forEach(el){ | + | newrow.querySelectorAll('.col-md-6').forEach(function(el){ |
document.querySelector('.fa-plus').closest('.row').insertBefore(el, document.querySelector('.fa-plus').closest('.col-md-6')) | document.querySelector('.fa-plus').closest('.row').insertBefore(el, document.querySelector('.fa-plus').closest('.col-md-6')) | ||
− | } | + | }) |
Versie van 19 aug 2020 22:37
<script>var offset=0; function loadMoreBerichten(set){
var wikitext = `... meer resultaten`;
offset += set;
var params = {
action: 'parse',
text: wikitext,
contentmodel: 'wikitext',
format: 'json'
},
api = new mw.Api();
api.post( params ).done( function ( data ) {
console.log(data.parse.text['*'])
var newrow = document.createElement('div');
// newrow.classList.add('row')
document.body.appendChild(newrow);
newrow.innerHTML = data.parse.text['*'];
newrow.querySelectorAll('.col-md-6').forEach(function(el){
document.querySelector('.fa-plus').closest('.row').insertBefore(el, document.querySelector('.fa-plus').closest('.col-md-6'))
})
})
} </script>