<div class="js-mynewsdesk">
    <div id="mnd-script"></div>
</div>
-
  //- Prepare attr object
  attr = attr || {};
  attr.class = classList(attr.class);

//- Render slider
.js-mynewsdesk&attributes(attr)
  #mnd-script
/* No context defined for this component. */
  • Content:
    class Mynewsdesk {
      constructor($el) {
        this.$el = $el;
    
        this.DOMAIN_FORMAT = /([a-z0-9-]+\.((police|co|org|gov|com)\.\w{2}|\w+))$/i;
    
        this.init();
      }
    
      init() {
        this.setDocumentDomain();
        this.createScriptTag();
        this.insertScriptTag();
      }
    
      setDocumentDomain() {
        const hostname = this.DOMAIN_FORMAT.exec(window.location.hostname);
    
        if (hostname) document.domain = hostname[0];
      }
    
      createScriptTag() {
        this.$script = document.createElement('script');
        this.$script.type = 'text/javascript';
        this.$script.async = true;
        this.$script.src = '//hkk.mynewsdesk.com/hosted_newsroom.js';
      }
    
      insertScriptTag() {
        this.$el.appendChild(this.$script);
      }
    }
    
    document
      .querySelectorAll('.js-mynewsdesk')
      .forEach($el => new Mynewsdesk($el));
    
  • URL: /components/raw/mynewsdesk/mynewsdesk.js
  • Filesystem Path: src/components/organisms/mynewsdesk/mynewsdesk.js
  • Size: 794 Bytes

There are no notes for this item.