Untitled

 avatar
unknown
plain_text
3 years ago
1.7 kB
6
Indexable
(function () {
  var debug = false;
  try {
    function waitForElement(selector, callback) {
      var maxCheck = 200;
      var interval = window.setInterval(function () {
        if (document.querySelectorAll(selector).length > 0) {
          callback();
          window.clearInterval(interval);
        } else if (--maxCheck < 0) {
          window.clearInterval(interval);
        }
      }, 50);
    }

    var configObj = {
      '/over-abp/actueel/nieuws/vernieuwd-stelsel-geeft-meer-kans-op-hogere-pensioenen.aspx': {
        title: 'What is Lorem Ipsum?',
        para: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.",
      },
      '/over-abp/actueel/nieuws/ik-wil-betekenisvol-blijven.aspx': {
        title: 'Where does it come from?',
        para: 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.',
      },
    };

    function init() {
      var articleTitles = document.querySelectorAll('.actueel-news .news-blok .news-item');
      articleTitles.forEach(function (item, index) {
        var obj = configObj[item.getAttribute('href')];
        console.log(obj);
        if (obj != undefined) {
          item.querySelector('.news-item-titel').textContent = obj.title;
          item.querySelector('.news-item-txt').textContent = obj.para;
        }
      });
    }

    waitForElement('.actueel-news .news-blok .news-item', init);
  } catch (e) {
    if (debug) console.log(e, ' - error');
  }
})();
Editor is loading...