Widget:Laad meer berichten: verschil tussen versies
Uit Dorpsbelang Den Hout
Regel 29: | Regel 29: | ||
console.log(data.parse.text['*']) | console.log(data.parse.text['*']) | ||
var newrow = document.createElement('div'); | var newrow = document.createElement('div'); | ||
− | + | // newrow.classList.add('row') | |
− | document. | + | document.body.appendChild(newrow); |
+ | |||
newrow.innerHTML = data.parse.text['*']; | newrow.innerHTML = data.parse.text['*']; | ||
+ | newrow.querySelectorAll('.col-md-6').forEach(el){ | ||
+ | |||
+ | document.querySelector('.fa-plus').closest('.row').insertBefore(el, document.querySelector('.fa-plus').closest('.col-md-6')) | ||
+ | } | ||
+ | |||
}) | }) |
Versie van 19 aug 2020 22:35
<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(el){
document.querySelector('.fa-plus').closest('.row').insertBefore(el, document.querySelector('.fa-plus').closest('.col-md-6'))
}
})
} </script>