Widget:Laad meer berichten: verschil tussen versies
Uit Dorpsbelang Den Hout
Regel 30: | Regel 30: | ||
var newrow = document.createElement('div'); | var newrow = document.createElement('div'); | ||
// newrow.classList.add('row') | // newrow.classList.add('row') | ||
− | + | // document.body.appendChild(newrow); | |
newrow.innerHTML = data.parse.text['*']; | newrow.innerHTML = data.parse.text['*']; |
Versie van 19 aug 2020 22:40
<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>