mirror of
https://github.com/janishutz/color-thief.git
synced 2025-11-26 06:14:25 +00:00
code: Remove unused vars and add missing semis
This commit is contained in:
@@ -86,7 +86,6 @@ ColorThief.prototype.getPalette = function(sourceImage, colorCount, quality) {
|
|||||||
// Create custom CanvasImage object
|
// Create custom CanvasImage object
|
||||||
var image = new CanvasImage(sourceImage);
|
var image = new CanvasImage(sourceImage);
|
||||||
var imageData = image.getImageData();
|
var imageData = image.getImageData();
|
||||||
var pixels = imageData.data;
|
|
||||||
var pixelCount = image.width * image.height;
|
var pixelCount = image.width * image.height;
|
||||||
|
|
||||||
const pixelArray = core.createPixelArray(imageData.data, pixelCount, options.quality);
|
const pixelArray = core.createPixelArray(imageData.data, pixelCount, options.quality);
|
||||||
@@ -114,18 +113,18 @@ ColorThief.prototype.getColorFromUrl = function(imageUrl, callback, quality) {
|
|||||||
ColorThief.prototype.getImageData = function(imageUrl, callback) {
|
ColorThief.prototype.getImageData = function(imageUrl, callback) {
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', imageUrl, true);
|
xhr.open('GET', imageUrl, true);
|
||||||
xhr.responseType = 'arraybuffer'
|
xhr.responseType = 'arraybuffer';
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
if (this.status == 200) {
|
if (this.status == 200) {
|
||||||
let uInt8Array = new Uint8Array(this.response)
|
let uInt8Array = new Uint8Array(this.response);
|
||||||
i = uInt8Array.length
|
i = uInt8Array.length;
|
||||||
let binaryString = new Array(i);
|
let binaryString = new Array(i);
|
||||||
for (var i = 0; i < uInt8Array.length; i++){
|
for (var i = 0; i < uInt8Array.length; i++){
|
||||||
binaryString[i] = String.fromCharCode(uInt8Array[i])
|
binaryString[i] = String.fromCharCode(uInt8Array[i]);
|
||||||
}
|
}
|
||||||
let data = binaryString.join('')
|
let data = binaryString.join('');
|
||||||
let base64 = window.btoa(data)
|
let base64 = window.btoa(data);
|
||||||
callback ("data:image/png;base64,"+base64)
|
callback ('data:image/png;base64,' + base64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
|||||||
Reference in New Issue
Block a user