This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_image_pixel_hex_color(){ | |
var img = event.path[0]; | |
var canvas = document.createElement('canvas'); | |
canvas.width = img.width; | |
canvas.height = img.height; | |
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height); | |
var pixelData = canvas.getContext('2d').getImageData(event.offsetX, event.offsetY, 1, 1).data; | |
var hexColor = ('#' + | |
(pixelData[0].toString(16).length == 2 ? pixelData[0].toString(16) : '0' + pixelData[0].toString(16))+ | |
(pixelData[1].toString(16).length == 2 ? pixelData[1].toString(16) : '0' + pixelData[1].toString(16))+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function images_in_row(selector) { | |
var galleries = document.querySelectorAll(selector); | |
var galleryMarginWidth = 5; | |
Array.prototype.forEach.call(galleries, function(gallery, index) { | |
var images = gallery.getElementsByTagName("img"); | |
if (images.length == 0) { | |
return; | |
} | |
var galleryWidth = parseFloat(getComputedStyle(gallery).width).toFixed(2); | |
var galleryUsableWidth = galleryWidth - (galleryMarginWidth * images.length * 2); |
NewerOlder