metalsmith-hover
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -35,9 +35,11 @@ | ||
Object.keys(files).forEach(function(file) { | ||
var page = cheerio.load(files[file].contents); | ||
var links = page('a'); | ||
for (var i = 0; i < links.length; i++) { | ||
if (image(links[i].attribs.href)) page(links[i]).append(img(links[i].attribs.href)); | ||
if (!~file.indexOf('.html')) return; | ||
var $ = cheerio.load(files[file].contents); | ||
var links = $('a'); | ||
for (var i = links.length - 1; i >= 0; i--) { | ||
var url = links[i].attribs.href; | ||
if (image(url)) $(links[i]).append(img(url)); | ||
} | ||
page.root().prepend(css()); | ||
files[file].contents = new Buffer(page.html()); | ||
$.root().prepend(css()); | ||
files[file].contents = new Buffer($.html()); | ||
}); | ||
@@ -53,2 +55,3 @@ done(); | ||
function image(filename) { | ||
if (!filename) return; | ||
var ext = filename.split('.')[filename.split('.').length - 1]; | ||
@@ -55,0 +58,0 @@ return ~extensions.join().indexOf(ext); |
{ | ||
"name": "metalsmith-hover", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "A Metalsmith plugin to load links to images and gifs on hover.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5847
63