Sha256: f716480a28725e9983e3eb20eeea3422bbbfe6c57cd020ba43e8f7abafeb1093

Contents?: true

Size: 1.96 KB

Versions: 30

Compression:

Stored size: 1.96 KB

Contents

// Copyright (c) 2017 Florian Klampfer <https://qwtel.com/>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// Compress via uglify:
// uglifyjs load-js.js -c -m > load-js.min.js
!function(window, document) {
  'use strict';

  function addEvent(el, type, cb, opts) {
    if (el.addEventListener) el.addEventListener(type, cb, opts);
    else if (el.attachEvent) el.attachEvent('on' + type, cb);
    else el['on' + type] = cb;
  }

  window.loadJS = function(src, cb) {
    var script = document.createElement('script');
    script.src = src;
    if (cb) addEvent(script, 'load', cb, { once: true });
    var ref = document.scripts[0];
    ref.parentNode.insertBefore(script, ref);

    return script;
  };

  window._loaded = false;
  window.loadJSDeferred = function(src, cb) {
    var script = document.createElement('script');
    script.src = src;

    function insert() {
      window._loaded = true;
      if (cb) addEvent(script, 'load', cb, { once: true });
      var ref = document.scripts[0];
      ref.parentNode.insertBefore(script, ref);
    }

    if (window._loaded) insert();
    else addEvent(window, 'load', insert, { once: true });

    return script;
  };

  window.setRel = window.setRelStylesheet = function (id) {
    var link = document.getElementById(id);
    function set() { this.rel = 'stylesheet'; }
    addEvent(link, 'load', set, { once: true });
  };
}(window, document);

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
jekyll-theme-hydejack-9.2.1 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.2.0 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.9 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.8 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.7 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.6 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.5 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.4 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.3 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.2 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.1 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.1.0 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.0.4 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.0.3 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.0.2 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.0.1 _includes/scripts/load-js.js
jekyll-theme-hydejack-9.0.0 _includes/scripts/load-js.js
jekyll-theme-hydebetty-1.0.2 _includes/scripts/load-js.js
jekyll-theme-hydebetty-1.0.1 _includes/scripts/load-js.js
jekyll-theme-hydejack-8.5.2 _includes/scripts/load-js.js