(function (global) {
  // Add array index of for old browsers (IE<9).
  if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function(obj, start) {
      var i, j;
      i = start || 0;
      j = this.length;
      while (i < j) {
        if (this[i] === obj) {
          return i;
        }
        i++;
      }
      return -1;
    };
  }

  // Make a global object to store stuff in.
  if (!global.KIWidgets) { global.KIWidgets = {}; };
  var KIWidgets = global.KIWidgets;

  // To keep track of which embeds we have already processed.
  if (!KIWidgets.processedScripts) { KIWidgets.processedScripts = []; };
  var processedScripts = KIWidgets.processedScripts;

  if (!KIWidgets.styleTags) { KIWidgets.styleTags = []; };
  var styleTags = KIWidgets.styleTags;

  var scriptTags = document.getElementsByTagName('script');
  var thisRequestUrl = 'https://news.ki.se/widget/view/news?type=news&au=Extern&ty=announcement&aa=0&ae=0&ar=0&m=0&d=widget_compact&n=4&l=1&lang=en&id=45245186-175d-4723-99ac-1b7194c7e0da';

  for (var i = 0; i < scriptTags.length; i++) {
    var scriptTag = scriptTags[i];

    // src matches the url of this request, and not processed it yet.
    if (scriptTag.src == thisRequestUrl && processedScripts.indexOf(scriptTag) < 0) {
      processedScripts.push(scriptTag);

      // Add the style tag into the head (once only).
      if (styleTags.length == 0) {
        // Add a style tag to the head.
        var styleTag = document.createElement("link");
        styleTag.rel = "stylesheet";
        styleTag.type = "text/css";
        styleTag.href =  "https://news.ki.se/modules/custom/ki_widget_builder/css/dist/widgets_v1.css";
        styleTag.media = "all";
        document.getElementsByTagName('head')[0].appendChild(styleTag);
        styleTags.push(styleTag);
      }

      // Create a div
      var div = document.createElement('div');
      div.id = 'ki-embed-45245186-175d-4723-99ac-1b7194c7e0da';
      div.className = '';

      scriptTag.parentNode.insertBefore(div, scriptTag);
      div.innerHTML = '  <div class=\"news-listing-results\">    <div class=\"inner\">      <div class=\"item-listing item-listing__compact item-listing__news\"><div class=\"inside--listing\"><div><h3>        <div class=\"header\">Participants sought for studies</div><a href=\"https://news.ki.se/research-subjects-wanted/are-you-pregnant-or-have-you-had-a-baby-within-the-past-year-help-researchers-test-a-new-app\" target=\"_parent\"><span>Are you pregnant or have you had a baby within the past year? Help researchers test a new app</span></a></h3><p class=\"date\">24-06-2025&nbsp;09:23</p></div></div></div><div class=\"item-listing item-listing__compact item-listing__news\"><div class=\"inside--listing\"><div><h3>        <div class=\"header\">Participants sought for studies</div><a href=\"https://news.ki.se/research-subjects-wanted/exploring-the-psychological-emotional-and-behavioural-effects-of-artificial-lighting\" target=\"_parent\"><span>Exploring the Psychological, Emotional and Behavioural Effects of Artificial Lighting</span></a></h3><p class=\"date\">16-06-2025&nbsp;11:37</p></div></div></div><div class=\"item-listing item-listing__compact item-listing__news\"><div class=\"inside--listing\"><div><h3>        <div class=\"header\">Participants sought for studies</div><a href=\"https://news.ki.se/research-subjects-wanted/do-you-work-as-cabin-crew-or-pilot-in-europe\" target=\"_parent\"><span>Do you work as cabin crew or pilot in Europe? </span></a></h3><p class=\"date\">09-06-2025&nbsp;11:02</p></div></div></div><div class=\"item-listing item-listing__compact item-listing__news\"><div class=\"inside--listing\"><div><h3>        <div class=\"header\">Participants sought for studies</div><a href=\"https://news.ki.se/research-subjects-wanted/have-you-ever-had-symptoms-of-an-eating-disorder-but-never-sought-help\" target=\"_parent\"><span>Have you ever had symptoms of an eating disorder but never sought help?</span></a></h3><p class=\"date\">02-06-2025&nbsp;14:55</p></div></div></div>              <a href=\"https://news.ki.se/news-archive?field_audience_value=Extern&amp;type=4\" class=\"read-more__news\">More announcements</a>            <a href=\"https://news.ki.se/widget/rss/news?au=Extern&amp;ty=announcement&amp;aa=0&amp;ae=0&amp;ar=0&amp;m=0&amp;n=4&amp;lang=en\" target=\"_blank\" class=\"read-more__rss\">RSS</a>    </div>  </div>';

      scriptTag.parentNode.querySelector('#ki-embed-loading-45245186-175d-4723-99ac-1b7194c7e0da').classList.remove('ki-embed-loading');
    }
  }
})(this);