Skip to content

Commit

Permalink
feat(curtana): update Lightense Images
Browse files Browse the repository at this point in the history
  • Loading branch information
sparanoid committed Jan 17, 2017
1 parent 3edeffc commit 55ea836
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
3 changes: 1 addition & 2 deletions _app/_includes/themes/curtana/includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
<script src="{{ '/js/lightense.js?assets-inline' | prepend: amsf_theme_assets }}"></script>
<script>
window.addEventListener('load', function () {
var el = document.querySelectorAll('p > img:not(.no-lightense),.lightense');
Lightense(el);
Lightense('p > img:not(.no-lightense),.lightense');
}, false);
</script>
{% endif %}
Expand Down
42 changes: 30 additions & 12 deletions _app/assets/themes/curtana/_js/lightense.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! lightense-images v1.0.2 | © Tunghsiao Liu | MIT */
/*! lightense-images v1.0.3 | © Tunghsiao Liu | MIT */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down Expand Up @@ -59,13 +59,15 @@ return /******/ (function(modules) { // webpackBootstrap

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var Lightense = function () {
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var Lightense = function Lightense() {
'use strict';

// Save some bytes

var w = window,
d = document;
var w = window;
var d = document;

// default options
var defaults = {
Expand All @@ -80,6 +82,22 @@ return /******/ (function(modules) { // webpackBootstrap
// Init user options
var config = {};

// Init target elements
var elements;

function getElements(elements) {
switch (typeof elements === 'undefined' ? 'undefined' : _typeof(elements)) {
case 'undefined':
throw 'You need to pass an element!';

case 'string':
return document.querySelectorAll(elements);

case 'object':
return elements;
}
}

function startTracking(passedElements) {
// If passed an array of elements, assign tracking to all
var len = passedElements.length;
Expand Down Expand Up @@ -266,15 +284,13 @@ return /******/ (function(modules) { // webpackBootstrap
}
}

function main(elements) {
function main(target) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

// Parse arguments
if (!elements) {
throw 'You need to pass an element!';
}
// Parse elements
elements = getElements(target);

// Get user options
// Parse user options
config = _extends({}, defaults, options);

// Prepare stylesheets
Expand All @@ -288,9 +304,11 @@ return /******/ (function(modules) { // webpackBootstrap
}

return main;
}();
};

var singleton = Lightense();

module.exports = Lightense;
module.exports = singleton;

/***/ }
/******/ ])
Expand Down

0 comments on commit 55ea836

Please sign in to comment.