Skip to content

Commit

Permalink
feat(scripts): replace intense.js with lightense.js
Browse files Browse the repository at this point in the history
BREAKING CHANGE: I've rewrote the `intense.js` from the ground up and rebranded it as `lightense.js`, a minimalism “lightbox” script less than 2 KB (not gzipped!).

If you have used Intensed Images, you have to changes the plugin keyword in your front-matter fields from:

```yml
plugin: intense
```

to:

```yml
plugin: lightense
```
  • Loading branch information
sparanoid committed Mar 9, 2016
1 parent f4aa4ae commit d66189c
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 420 deletions.
8 changes: 1 addition & 7 deletions _app/_includes/themes/curtana/includes/content.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<!-- Main content wrap -->
{% capture plugin_intense_class %}
{% if page.plugin == 'intense' %}
intense-wrap
{% endif %}
{% endcapture %}

<main class="content {{ page.class }} {{plugin_intense_class}}" role=main>
<main class="content {{ page.class }}" role=main>
{{ content }}
</main>
20 changes: 6 additions & 14 deletions _app/_includes/themes/curtana/includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,13 @@
{% endif %}

<!-- The following code is an example use of including external JavaScript libraries -->
{% if page.plugin == 'intense' %}
<script src="{{ '/js/intense.js' | prepend: amsf_theme_assets }}"></script>
{% if page.plugin == 'lightense' %}
<script src="{{ '/js/lightense.js' | prepend: amsf_theme_assets }}"></script>
<script>
window.onload = function() {
var fx = document.querySelectorAll('p > img:not(.no-intense)');
var el = document.body;
var cl = 'loaded'

if (el.classList)
el.classList.add(cl);
else
el.className += ' ' + cl;

Intense(fx);
}
window.addEventListener('load', function () {
var el = document.querySelectorAll('p > img:not(.no-lightense)');
Lightense(el);
}, false);
</script>
{% endif %}

Expand Down
16 changes: 8 additions & 8 deletions _app/_posts/note/2014-06-01-custom-html-markups.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: post
title: Custom HTML Markups
category: note
plugin: intense
plugin: lightense
tags: curtana
---

Expand Down Expand Up @@ -70,23 +70,23 @@ Please note that you can't apply CSS classes in Markdown, so you have to use HTM

### Example

<p class="browser"><img src="http://rsrc.sparanoid.com/delicious.com.png" alt="Delicious Preview" class="no-intense"></p>
<p class="browser"><img src="http://rsrc.sparanoid.com/delicious.com.png" alt="Delicious Preview" class="no-lightense"></p>

## [intense.js](http://github.com/tholman/intense-images)
## [lightense.js](https://github.com/sparanoid/lightense-images)

A simple library by [Tim Holman](https://github.com/tholman) to view large images up close using simple mouse interaction, and the full screen.
A simple library inspired by [Tim Holman](https://github.com/tholman) to view large images up close using simple mouse interaction, and the full screen.

### Usage

Add the following setting to your post [front-matter field](http://jekyllrb.com/docs/frontmatter/):

```
plugin: intense
plugin: lightense
```

Markdown markup:

```
```markdown
![Image](http://sparanoid.com/photo.jpg)
```

Expand All @@ -98,11 +98,11 @@ Or simply use HTML:
</p>
```

`intense.js` is activated globally by default, if you want to disable this effect for specific image, you can simply apply `.no-intense` CSS class to your `<img>`:
`lightense.js` is activated globally by default, if you want to disable this effect for specific image, you can simply apply `.no-lightense` CSS class to your `<img>`:

```html
<p>
<img src="http://sparanoid.com/photo.jpg" class="no-intense" alt="Image">
<img src="http://sparanoid.com/photo.jpg" class="no-lightense" alt="Image">
</p>
```

Expand Down
1 change: 1 addition & 0 deletions _app/assets/themes/curtana/_js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Theme script goes here
Loading

0 comments on commit d66189c

Please sign in to comment.