mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-05 16:00:01 +01:00
Eslint operator spacing config (#1109)
* Eslint operator spacing config * consistent spacing after comma * comma styling config * Trailing spaces config
This commit is contained in:
@@ -17,7 +17,7 @@ module.exports = {
|
||||
'indent': ['error',2],
|
||||
'linebreak-style': ['error','unix'],
|
||||
'quotes': ['error','single'],
|
||||
'semi': ['error','always'],
|
||||
'semi': ['error','always'], //
|
||||
'no-undef': 0,
|
||||
'no-console': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
@@ -27,6 +27,10 @@ module.exports = {
|
||||
'no-mixed-spaces-and-tabs':'off',
|
||||
'no-self-assign':'off',
|
||||
'no-constant-condition':'off',
|
||||
'no-dupe-keys':'off'
|
||||
'no-dupe-keys':'off',
|
||||
'space-infix-ops': ['error', {'int32Hint': false}], // Enforce spaces around operators
|
||||
'comma-spacing': ['error', { "before": false, "after": true }], // require spacing after a comma
|
||||
'comma-style': ['error', 'last'], // requires comma after and on the same line
|
||||
'no-trailing-spaces': ['error', { 'skipBlankLines': true }], // Disallows trailing whitespace on end of lines and empty lines
|
||||
}
|
||||
};
|
||||
@@ -46,7 +46,7 @@ window.onload = function() {
|
||||
$(':root').animate({scrollTop: 0});
|
||||
}
|
||||
|
||||
$('#move-up').on('click',topFunction);
|
||||
$('#move-up').on('click', topFunction);
|
||||
|
||||
|
||||
// UI for each step:
|
||||
@@ -63,14 +63,14 @@ window.onload = function() {
|
||||
}
|
||||
|
||||
var resetSequence = function(){
|
||||
var r=confirm('Do you want to reset the sequence?');
|
||||
var r = confirm('Do you want to reset the sequence?');
|
||||
if (r)
|
||||
window.location = '/';
|
||||
};
|
||||
|
||||
$('#addStep select').on('change', ui.selectNewStepUi);
|
||||
$('#addStep #add-step-btn').on('click', ui.addStepUi);
|
||||
$('#resetButton').on('click',resetSequence);
|
||||
$('#resetButton').on('click', resetSequence);
|
||||
|
||||
//Module button radio selection
|
||||
$('.radio-group .radio').on('click', function() {
|
||||
@@ -113,7 +113,7 @@ window.onload = function() {
|
||||
|
||||
var button = event.target;
|
||||
button.disabled = true;
|
||||
button.innerHTML='<i class="fa fa-circle-o-notch fa-spin"></i>';
|
||||
button.innerHTML = '<i class="fa fa-circle-o-notch fa-spin"></i>';
|
||||
|
||||
try {
|
||||
// Select all images from previous steps
|
||||
@@ -187,34 +187,34 @@ window.onload = function() {
|
||||
onLoad: function onFileReaderLoad(progress) {
|
||||
var reader = progress.target;
|
||||
var step = sequencer.steps[0];
|
||||
var util= intermediateHtmlStepUi(sequencer);
|
||||
var util = intermediateHtmlStepUi(sequencer);
|
||||
step.output.src = reader.result;
|
||||
sequencer.run({ index: 0 });
|
||||
if(typeof step.options !=='undefined')
|
||||
if(typeof step.options !== 'undefined')
|
||||
step.options.step.imgElement.src = reader.result;
|
||||
else
|
||||
step.imgElement.src = reader.result;
|
||||
insertPreview.updatePreviews(reader.result,'#addStep');
|
||||
insertPreview.updatePreviews(sequencer.steps[0].imgElement.src,'.insertDiv');
|
||||
insertPreview.updatePreviews(reader.result, '#addStep');
|
||||
insertPreview.updatePreviews(sequencer.steps[0].imgElement.src, '.insertDiv');
|
||||
},
|
||||
onTakePhoto: function (url) {
|
||||
var step = sequencer.steps[0];
|
||||
step.output.src = url;
|
||||
sequencer.run({ index: 0 });
|
||||
if(typeof step.options !=='undefined')
|
||||
if(typeof step.options !== 'undefined')
|
||||
step.options.step.imgElement.src = url;
|
||||
else
|
||||
step.imgElement.src = url;
|
||||
insertPreview.updatePreviews(url,'#addStep');
|
||||
insertPreview.updatePreviews(sequencer.steps[0].imgElement.src,'.insertDiv');
|
||||
insertPreview.updatePreviews(url, '#addStep');
|
||||
insertPreview.updatePreviews(sequencer.steps[0].imgElement.src, '.insertDiv');
|
||||
}
|
||||
});
|
||||
|
||||
setupCache();
|
||||
|
||||
if (urlHash.getUrlHashParameter('src')) {
|
||||
insertPreview.updatePreviews(urlHash.getUrlHashParameter('src'),'#addStep');
|
||||
insertPreview.updatePreviews(urlHash.getUrlHashParameter('src'), '#addStep');
|
||||
} else {
|
||||
insertPreview.updatePreviews('images/tulips.png','#addStep');
|
||||
insertPreview.updatePreviews('images/tulips.png', '#addStep');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ function DefaultHtmlSequencerUi(_sequencer, options) {
|
||||
|
||||
function onLoad() {
|
||||
importStepsFromUrlHash();
|
||||
if ($('#selectStep').val()==='none')
|
||||
if ($('#selectStep').val() === 'none')
|
||||
$(addStepSel + ' #add-step-btn').prop('disabled', true);
|
||||
handleSaveSequence();
|
||||
}
|
||||
@@ -73,8 +73,8 @@ function DefaultHtmlSequencerUi(_sequencer, options) {
|
||||
}
|
||||
|
||||
function handleSaveSequence(){
|
||||
var stepCount=sequencer.steps.length;
|
||||
if(stepCount<2)
|
||||
var stepCount = sequencer.steps.length;
|
||||
if(stepCount < 2)
|
||||
$(' #save-seq').prop('disabled', true);
|
||||
else
|
||||
$(' #save-seq').prop('disabled', false);
|
||||
|
||||
@@ -29,8 +29,8 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
<div class="panel panel-default">\
|
||||
<div class="panel-heading">\
|
||||
<div class="trash-container pull-right"></div>\
|
||||
<h3 class="panel-title">' +
|
||||
'<span class="toggle">' +step.name + ' <span class="caret toggleIcon rotated"></span>\
|
||||
<h3 class="panel-title">' +
|
||||
'<span class="toggle">' + step.name + ' <span class="caret toggleIcon rotated"></span>\
|
||||
<span class="load-spin pull-right" style="display:none;padding:1px 8px;"><i class="fa fa-circle-o-notch fa-spin"></i></span>\
|
||||
</h3>\
|
||||
</div>\
|
||||
@@ -106,7 +106,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
'"max="' +
|
||||
inputDesc.max +
|
||||
'"step="' +
|
||||
(inputDesc.step ? inputDesc.step : 1)+ '">' + '<span>' + paramVal + '</span>';
|
||||
(inputDesc.step ? inputDesc.step : 1) + '">' + '<span>' + paramVal + '</span>';
|
||||
|
||||
}
|
||||
else html += '">';
|
||||
@@ -138,7 +138,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
<button class="pull-right btn btn-default btn-sm download-btn" style="margin-right:2px" >\
|
||||
<i class="fa fa-download"></i>\
|
||||
</button>'
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
if (step.name != 'load-image') {
|
||||
@@ -147,14 +147,14 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
.prepend(
|
||||
parser.parseFromString(tools, 'text/html').querySelector('div')
|
||||
);
|
||||
$(step.ui.querySelectorAll('.remove')).on('click', function() {notify('Step Removed','remove-notification');});
|
||||
$(step.ui.querySelectorAll('.insert-step')).on('click', function() { util.insertStep(step.ID); });
|
||||
$(step.ui.querySelectorAll('.remove')).on('click', function() {notify('Step Removed', 'remove-notification');});
|
||||
$(step.ui.querySelectorAll('.insert-step')).on('click', function() { util.insertStep(step.ID); });
|
||||
// Insert the step's UI in the right place
|
||||
if (stepOptions.index == _sequencer.steps.length) {
|
||||
stepsEl.appendChild(step.ui);
|
||||
$('#steps .step-container:nth-last-child(1) .insert-step').prop('disabled',true);
|
||||
$('#steps .step-container:nth-last-child(1) .insert-step').prop('disabled', true);
|
||||
if($('#steps .step-container:nth-last-child(2)'))
|
||||
$('#steps .step-container:nth-last-child(2) .insert-step').prop('disabled',false);
|
||||
$('#steps .step-container:nth-last-child(2) .insert-step').prop('disabled', false);
|
||||
} else {
|
||||
stepsEl.insertBefore(step.ui, $(stepsEl).children()[stepOptions.index]);
|
||||
}
|
||||
@@ -201,7 +201,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
return inputChanged;
|
||||
}
|
||||
|
||||
var
|
||||
var
|
||||
changedInputs = 0,
|
||||
optionsChanged = false;
|
||||
$(step.ui.querySelector('.input-form')).on('submit', saveOptions);
|
||||
@@ -209,7 +209,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
$(input)
|
||||
.data('initValue', $(input).val())
|
||||
.data('hasChangedBefore', false)
|
||||
.on('input change' , function() {
|
||||
.on('input change', function() {
|
||||
$(this)
|
||||
.focus()
|
||||
.data('hasChangedBefore',
|
||||
@@ -253,7 +253,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
return output.split('/')[1].split(';')[0];
|
||||
}
|
||||
|
||||
$(step.ui.querySelectorAll('.download-btn')).on('click', () => {
|
||||
$(step.ui.querySelectorAll('.download-btn')).on('click', () => {
|
||||
|
||||
for (let index = 0; index < step.linkElements.length; index++){
|
||||
|
||||
@@ -297,24 +297,24 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
|
||||
var img = $(step.imgElement);
|
||||
|
||||
img.mousemove(function(e) {
|
||||
img.mousemove(function(e) {
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = img.width();
|
||||
canvas.height = img.height();
|
||||
var context = canvas.getContext('2d');
|
||||
context.drawImage(this,0,0);
|
||||
context.drawImage(this, 0, 0);
|
||||
|
||||
var offset = $(this).offset();
|
||||
var xPos = e.pageX - offset.left;
|
||||
var yPos = e.pageY - offset.top;
|
||||
var myData = context.getImageData(xPos, yPos, 1, 1);
|
||||
img[0].title = 'rgb: ' +myData.data[0]+','+ myData.data[1]+','+myData.data[2];//+ rgbdata;
|
||||
});
|
||||
img[0].title = 'rgb: ' + myData.data[0] + ',' + myData.data[1] + ',' + myData.data[2];//+ rgbdata;
|
||||
});
|
||||
}
|
||||
|
||||
function onRemove(step) {
|
||||
step.ui.remove();
|
||||
$('#steps .step-container:nth-last-child(1) .insert-step').prop('disabled',true);
|
||||
$('#steps .step-container:nth-last-child(1) .insert-step').prop('disabled', true);
|
||||
$('div[class*=imgareaselect-]').remove();
|
||||
}
|
||||
|
||||
@@ -322,8 +322,8 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
return step.imgElement;
|
||||
}
|
||||
|
||||
function notify(msg,id){
|
||||
if ($('#'+id).length == 0) {
|
||||
function notify(msg, id){
|
||||
if ($('#' + id).length == 0) {
|
||||
var notification = document.createElement('span');
|
||||
notification.innerHTML = ' <i class="fa fa-info-circle" aria-hidden="true"></i> ' + msg ;
|
||||
notification.id = id;
|
||||
@@ -332,7 +332,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
$('body').append(notification);
|
||||
}
|
||||
|
||||
$('#'+id).fadeIn(500).delay(200).fadeOut(500);
|
||||
$('#' + id).fadeIn(500).delay(200).fadeOut(500);
|
||||
}
|
||||
|
||||
|
||||
@@ -341,14 +341,14 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
onSetup: onSetup,
|
||||
onComplete: onComplete,
|
||||
onRemove: onRemove,
|
||||
onDraw: onDraw,
|
||||
onDraw: onDraw,
|
||||
notify: notify,
|
||||
imageHover: imageHover
|
||||
};
|
||||
}
|
||||
|
||||
if(typeof window === 'undefined'){
|
||||
module.exports={
|
||||
module.exports = {
|
||||
DefaultHtmlStepUi: DefaultHtmlStepUi
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ function generatePreview(previewStepName, customValues, path, selector) {
|
||||
}
|
||||
|
||||
function updatePreviews(src, selector) {
|
||||
$(selector+' img').remove();
|
||||
$(selector + ' img').remove();
|
||||
|
||||
var previewSequencerSteps = {
|
||||
'resize': '125%',
|
||||
|
||||
@@ -17,7 +17,7 @@ self.addEventListener('activate', function(e) {
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', function(event) {
|
||||
|
||||
2
index.js
2
index.js
@@ -61,7 +61,7 @@ else {
|
||||
}
|
||||
},
|
||||
notify: function(msg) {
|
||||
console.log('\x1b[36m%s\x1b[0m','🌟 '+msg);
|
||||
console.log('\x1b[36m%s\x1b[0m', '🌟 ' + msg);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ describe('Default sequencer HTML', function() {
|
||||
beforeEach(()=>{
|
||||
defaultHtmlSequencerUi = new DefaultHtmlSequencerUi(sequencer);
|
||||
|
||||
spyOn(defaultHtmlSequencerUi,'onLoad');
|
||||
spyOn(defaultHtmlSequencerUi,'selectNewStepUi');
|
||||
spyOn(defaultHtmlSequencerUi,'removeStepUi');
|
||||
spyOn(defaultHtmlSequencerUi,'addStepUi');
|
||||
spyOn(defaultHtmlSequencerUi,'importStepsFromUrlHash');
|
||||
spyOn(defaultHtmlSequencerUi, 'onLoad');
|
||||
spyOn(defaultHtmlSequencerUi, 'selectNewStepUi');
|
||||
spyOn(defaultHtmlSequencerUi, 'removeStepUi');
|
||||
spyOn(defaultHtmlSequencerUi, 'addStepUi');
|
||||
spyOn(defaultHtmlSequencerUi, 'importStepsFromUrlHash');
|
||||
|
||||
defaultHtmlSequencerUi.onLoad();
|
||||
defaultHtmlSequencerUi.selectNewStepUi();
|
||||
|
||||
@@ -18,19 +18,19 @@ describe('Sequencer step HTML', function() {
|
||||
beforeEach(()=>{
|
||||
defaultHtmlStepUi = new DefaultHtmlStepUi(sequencer);
|
||||
|
||||
spyOn(defaultHtmlStepUi,'getPreview');
|
||||
spyOn(defaultHtmlStepUi,'onSetup');
|
||||
spyOn(defaultHtmlStepUi,'onComplete');
|
||||
spyOn(defaultHtmlStepUi,'onDraw');
|
||||
spyOn(defaultHtmlStepUi,'onRemove');
|
||||
spyOn(defaultHtmlStepUi,'notify');
|
||||
spyOn(defaultHtmlStepUi, 'getPreview');
|
||||
spyOn(defaultHtmlStepUi, 'onSetup');
|
||||
spyOn(defaultHtmlStepUi, 'onComplete');
|
||||
spyOn(defaultHtmlStepUi, 'onDraw');
|
||||
spyOn(defaultHtmlStepUi, 'onRemove');
|
||||
spyOn(defaultHtmlStepUi, 'notify');
|
||||
|
||||
defaultHtmlStepUi.getPreview();
|
||||
defaultHtmlStepUi.onSetup(step,options);
|
||||
defaultHtmlStepUi.onSetup(step, options);
|
||||
defaultHtmlStepUi.onComplete(step);
|
||||
defaultHtmlStepUi.onDraw(step);
|
||||
defaultHtmlStepUi.onRemove(step);
|
||||
defaultHtmlStepUi.notify('Step removed','remove-notification');
|
||||
defaultHtmlStepUi.notify('Step removed', 'remove-notification');
|
||||
});
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('Sequencer step HTML', function() {
|
||||
});
|
||||
|
||||
it('load initial setup ui', function() {
|
||||
expect(defaultHtmlStepUi.onSetup).toHaveBeenCalledWith(step,options);
|
||||
expect(defaultHtmlStepUi.onSetup).toHaveBeenCalledWith(step, options);
|
||||
});
|
||||
|
||||
it('load completion ui', function() {
|
||||
@@ -55,7 +55,7 @@ describe('Sequencer step HTML', function() {
|
||||
});
|
||||
|
||||
it('notification ui', function() {
|
||||
expect(defaultHtmlStepUi.notify).toHaveBeenCalledWith('Step removed','remove-notification');
|
||||
expect(defaultHtmlStepUi.notify).toHaveBeenCalledWith('Step removed', 'remove-notification');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -8,19 +8,19 @@ describe('Preview UI HTML', function() {
|
||||
beforeEach(()=>{
|
||||
insertPreview = InsertPreview;
|
||||
|
||||
spyOn(insertPreview,'generatePreview');
|
||||
spyOn(insertPreview,'updatePreviews');
|
||||
spyOn(insertPreview, 'generatePreview');
|
||||
spyOn(insertPreview, 'updatePreviews');
|
||||
|
||||
insertPreview.generatePreview('brightness',options,'src','selector');
|
||||
insertPreview.updatePreviews('src','selector');
|
||||
insertPreview.generatePreview('brightness', options, 'src', 'selector');
|
||||
insertPreview.updatePreviews('src', 'selector');
|
||||
});
|
||||
|
||||
it('generate preview ui', function() {
|
||||
expect(insertPreview.generatePreview).toHaveBeenCalledWith('brightness',options,'src','selector');
|
||||
expect(insertPreview.generatePreview).toHaveBeenCalledWith('brightness', options, 'src', 'selector');
|
||||
});
|
||||
|
||||
it('update preview ui', function() {
|
||||
expect(insertPreview.updatePreviews).toHaveBeenCalledWith('src','selector');
|
||||
expect(insertPreview.updatePreviews).toHaveBeenCalledWith('src', 'selector');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -7,7 +7,7 @@ describe('Intermediate step HTML', function() {
|
||||
beforeEach(()=>{
|
||||
intermediateHtmlStepUi = new IntermediateHtmlStepUi(sequencer);
|
||||
|
||||
spyOn(intermediateHtmlStepUi,'insertStep');
|
||||
spyOn(intermediateHtmlStepUi, 'insertStep');
|
||||
|
||||
intermediateHtmlStepUi.insertStep();
|
||||
});
|
||||
|
||||
@@ -10,15 +10,15 @@ describe('URL manipulation methods', function() {
|
||||
beforeEach(()=>{
|
||||
urlHash = UrlHash;
|
||||
|
||||
spyOn(urlHash,'getUrlHashParameters');
|
||||
spyOn(urlHash,'getUrlHashParameter');
|
||||
spyOn(urlHash,'setUrlHashParameters');
|
||||
spyOn(urlHash,'setUrlHashParameter');
|
||||
spyOn(urlHash, 'getUrlHashParameters');
|
||||
spyOn(urlHash, 'getUrlHashParameter');
|
||||
spyOn(urlHash, 'setUrlHashParameters');
|
||||
spyOn(urlHash, 'setUrlHashParameter');
|
||||
|
||||
urlHash.getUrlHashParameters();
|
||||
urlHash.getUrlHashParameter('module');
|
||||
urlHash.setUrlHashParameters(params);
|
||||
urlHash.setUrlHashParameter('module','brightness');
|
||||
urlHash.setUrlHashParameter('module', 'brightness');
|
||||
});
|
||||
|
||||
it('gets url hash params from window hash', function() {
|
||||
@@ -34,7 +34,7 @@ describe('URL manipulation methods', function() {
|
||||
});
|
||||
|
||||
it('accepts param key-value pair and sets url hash params', function() {
|
||||
expect(urlHash.setUrlHashParameter).toHaveBeenCalledWith('module','brightness');
|
||||
expect(urlHash.setUrlHashParameter).toHaveBeenCalledWith('module', 'brightness');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
// add steps to the sequencer
|
||||
function AddStep(_sequencer, name, o) {
|
||||
return require('./InsertStep')(_sequencer,-1,name,o);
|
||||
return require('./InsertStep')(_sequencer, -1, name, o);
|
||||
}
|
||||
module.exports = AddStep;
|
||||
|
||||
@@ -4,9 +4,9 @@ var fs = require('fs');
|
||||
* This function checks if the directory exists, if not it creates one on the given path
|
||||
* Callback is called with argument error if an error is encountered
|
||||
*/
|
||||
function makedir(path,callback){
|
||||
fs.access(path,function(err){
|
||||
if(err) fs.mkdir(path,function(err){
|
||||
function makedir(path, callback){
|
||||
fs.access(path, function(err){
|
||||
if(err) fs.mkdir(path, function(err){
|
||||
if(err) callback(err);
|
||||
callback();
|
||||
});
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
function objTypeOf(object){
|
||||
return Object.prototype.toString.call(object).split(' ')[1].slice(0,-1);
|
||||
return Object.prototype.toString.call(object).split(' ')[1].slice(0, -1);
|
||||
}
|
||||
|
||||
function getPrimitive(object){
|
||||
return (objTypeOf(object)=='Array')?object[0]:object;
|
||||
return (objTypeOf(object) == 'Array') ? object[0] : object;
|
||||
}
|
||||
|
||||
function makeArray(input) {
|
||||
return (objTypeOf(input)=='Array')?input:[input];
|
||||
return (objTypeOf(input) == 'Array') ? input : [input];
|
||||
}
|
||||
|
||||
function copy(a) {
|
||||
@@ -23,7 +23,7 @@ function copy(a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
function formatInput(args,format,images) {
|
||||
function formatInput(args, format, images) {
|
||||
var json_q = {};
|
||||
var format_i = format;
|
||||
if (format == '+')
|
||||
@@ -35,26 +35,26 @@ function formatInput(args,format,images) {
|
||||
else if (format == 'r')
|
||||
format = ['o_number'];
|
||||
else if (format == 'l')
|
||||
format = ['string','o_function'];
|
||||
format = ['string', 'o_function'];
|
||||
|
||||
|
||||
if(format[format.length-1] == 'o_object') {
|
||||
if(objTypeOf(args[args.length-1]) != 'Object')
|
||||
if(format[format.length - 1] == 'o_object') {
|
||||
if(objTypeOf(args[args.length - 1]) != 'Object')
|
||||
args.push({});
|
||||
}
|
||||
else if (format[format.length-1] == 'o_number') {
|
||||
if(typeof(args[args.length-1]) != 'number' && objTypeOf(args[0])!='Object')
|
||||
else if (format[format.length - 1] == 'o_number') {
|
||||
if(typeof(args[args.length - 1]) != 'number' && objTypeOf(args[0]) != 'Object')
|
||||
args.push(1);
|
||||
}
|
||||
else if (format[format.length-1] == 'o_function') {
|
||||
if(objTypeOf(args[args.length-1]) != 'Function' && objTypeOf(args[0])!='Object')
|
||||
else if (format[format.length - 1] == 'o_function') {
|
||||
if(objTypeOf(args[args.length - 1]) != 'Function' && objTypeOf(args[0]) != 'Object')
|
||||
args.push(function(){});
|
||||
}
|
||||
|
||||
|
||||
if(args.length == format.length) {//making of arrays
|
||||
for (var i in format) {
|
||||
if (format[i].substr(format[i].length-2,2)=='_a')
|
||||
if (format[i].substr(format[i].length - 2, 2) == '_a')
|
||||
args[i] = makeArray(args[i]);
|
||||
}
|
||||
}
|
||||
@@ -62,8 +62,8 @@ function formatInput(args,format,images) {
|
||||
if (args.length == 1 ) {
|
||||
if(format_i == 'r') json_q = {0:copy(args[0])};
|
||||
else if(format_i == '-') {
|
||||
json_q=[];
|
||||
json_q= copy(args[0]);
|
||||
json_q = [];
|
||||
json_q = copy(args[0]);
|
||||
}
|
||||
}
|
||||
else if (format_i == 'r' ) {
|
||||
@@ -90,8 +90,8 @@ function formatInput(args,format,images) {
|
||||
if(format_i == '^') {
|
||||
var size = this.steps.length;
|
||||
var index = args[0];
|
||||
index = (index==size)?index:index%size;
|
||||
if (index<0) index += size+1;
|
||||
index = (index == size) ? index : index % size;
|
||||
if (index < 0) index += size + 1;
|
||||
json_q.push({
|
||||
index: index,
|
||||
name: args[1],
|
||||
|
||||
@@ -152,7 +152,7 @@ ImageSequencer = function ImageSequencer(options) {
|
||||
sequencer.image = arguments[0];
|
||||
for (var arg in arguments) args.push(copy(arguments[arg]));
|
||||
var json_q = formatInput.call(this, args, 'l');
|
||||
if(this.getSteps().length!=0){
|
||||
if(this.getSteps().length != 0){
|
||||
this.options.sequencerCounter = 0;
|
||||
inputlog = [];
|
||||
this.steps = [];
|
||||
@@ -169,9 +169,9 @@ ImageSequencer = function ImageSequencer(options) {
|
||||
setUI: this.setUI
|
||||
};
|
||||
function loadPrevSteps(ref){
|
||||
if(prevSteps.length!=0){
|
||||
if(prevSteps.length != 0){
|
||||
ref.addSteps(prevSteps);
|
||||
prevSteps=[];
|
||||
prevSteps = [];
|
||||
}
|
||||
}
|
||||
require('./ui/LoadImage')(sequencer, 'image', json_q.image, function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Uses a given image as input and replaces it with the output.
|
||||
// Works only in the browser.
|
||||
function ReplaceImage(ref,selector,steps,options) {
|
||||
function ReplaceImage(ref, selector, steps, options) {
|
||||
if(!ref.options.inBrowser) return false; // This isn't for Node.js
|
||||
var tempSequencer = ImageSequencer({ui: false});
|
||||
var this_ = ref;
|
||||
@@ -26,18 +26,18 @@ function ReplaceImage(ref,selector,steps,options) {
|
||||
// https://github.com/publiclab/image-sequencer/issues/241
|
||||
// https://stackoverflow.com/a/20048852/1116657
|
||||
var raw = '';
|
||||
var i,j,subArray,chunk = 5000;
|
||||
for (i=0,j=arr.length; i<j; i+=chunk) {
|
||||
subArray = arr.subarray(i,i+chunk);
|
||||
var i, j, subArray, chunk = 5000;
|
||||
for (i = 0, j = arr.length; i < j; i += chunk) {
|
||||
subArray = arr.subarray(i, i + chunk);
|
||||
raw += String.fromCharCode.apply(null, subArray);
|
||||
}
|
||||
|
||||
var base64 = btoa(raw);
|
||||
var dataURL='data:image/'+ext+';base64,' + base64;
|
||||
var dataURL = 'data:image/' + ext + ';base64,' + base64;
|
||||
make(dataURL);
|
||||
};
|
||||
|
||||
if(url.substr(0,11).toLowerCase()!='data:image/') xmlHTTP.send();
|
||||
if(url.substr(0, 11).toLowerCase() != 'data:image/') xmlHTTP.send();
|
||||
else make(url);
|
||||
|
||||
function make(url) {
|
||||
@@ -46,7 +46,7 @@ function ReplaceImage(ref,selector,steps,options) {
|
||||
var sequence = this.addSteps(steps);
|
||||
if (ref.detectStringSyntax(steps))
|
||||
sequence = this.stringToSteps(steps);
|
||||
sequence.run({stop:function(){}},function(out){
|
||||
sequence.run({stop:function(){}}, function(out){
|
||||
img.src = out;
|
||||
});
|
||||
});
|
||||
@@ -54,8 +54,8 @@ function ReplaceImage(ref,selector,steps,options) {
|
||||
}
|
||||
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
replaceImage(images[i],steps);
|
||||
if (i == images.length-1)
|
||||
replaceImage(images[i], steps);
|
||||
if (i == images.length - 1)
|
||||
options.callback();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ function Run(ref, json_q, callback, ind, progressObj) {
|
||||
inputForNextStep,
|
||||
function onEachStep() {
|
||||
|
||||
// This output is accessible by UI
|
||||
// This output is accessible by UI
|
||||
ref.steps[i].options.step.output = ref.steps[i].output.src;
|
||||
|
||||
// Tell UI that step has been drawn.
|
||||
@@ -75,7 +75,7 @@ function Run(ref, json_q, callback, ind, progressObj) {
|
||||
while (
|
||||
typeof prevstep == 'undefined' ||
|
||||
typeof prevstep.output == 'undefined'
|
||||
) {
|
||||
) {
|
||||
prevstep = ref.steps[--json_q[0] - 1];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ module.exports = function(steps, modulesInfo, addSteps, copy) {
|
||||
function toCliString() {
|
||||
var cliStringSteps = '"', cliOptions = {};
|
||||
for (var step in this.steps) {
|
||||
var name = (typeof this.steps[step].options !== 'undefined')? this.steps[step].options.name : this.steps[step].name;
|
||||
var name = (typeof this.steps[step].options !== 'undefined') ? this.steps[step].options.name : this.steps[step].name;
|
||||
if (name !== 'load-image'){
|
||||
cliStringSteps += `${name} `;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ module.exports = function(steps, modulesInfo, addSteps, copy) {
|
||||
|
||||
// Stringifies one step of the sequence
|
||||
function stepToString(step) {
|
||||
var arg = (step.name)?step.name:step.options.name;
|
||||
var arg = (step.name) ? step.name : step.options.name;
|
||||
let inputs = modulesInfo(arg).inputs || {}, op = {};
|
||||
|
||||
for (let input in inputs) {
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = function AddQR(options, UI) {
|
||||
return [r, g, b, a];
|
||||
}
|
||||
|
||||
function extraManipulation(pixels,generateOutput) {
|
||||
function extraManipulation(pixels, generateOutput) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = function Dynamic(options, UI, util) {
|
||||
this.output = input;
|
||||
UI.notify('Offset Unavailable', 'offset-notification');
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
getPixels(priorStep.output.src, function(err, pixels) {
|
||||
options.firstImagePixels = pixels;
|
||||
|
||||
@@ -44,11 +44,11 @@ module.exports = exports = function(pixels, blur) {
|
||||
|
||||
for (let y = -2; y <= 2; y++) {
|
||||
kernel.push([]);
|
||||
for (let x = -2; x <= 2; x++) {
|
||||
for (let x = -2; x <= 2; x++) {
|
||||
let r = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
||||
kernel[y + 2].push(Math.exp(-(r / s)));
|
||||
sum += kernel[y + 2][x + 2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let x = 0; x < 5; x++){
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* Accepts a value from 0-255 and returns the new color-mapped pixel
|
||||
* from a lookup table, which can be specified as an array of [begin, end]
|
||||
* gradients, where begin and end are represented as [r, g, b] colors. In
|
||||
* Accepts a value from 0-255 and returns the new color-mapped pixel
|
||||
* from a lookup table, which can be specified as an array of [begin, end]
|
||||
* gradients, where begin and end are represented as [r, g, b] colors. In
|
||||
* combination, a lookup table which maps values from 0 - 255 smoothly from black to white looks like:
|
||||
* [
|
||||
* [0, [0, 0, 0], [255, 255, 255]],
|
||||
* [1, [255, 255, 255], [255, 255, 255]]
|
||||
* ]
|
||||
*
|
||||
*
|
||||
* Adapted from bgamari's work in Infragram: https://github.com/p-v-o-s/infragram-js/commit/346c97576a07b71a55671d17e0153b7df74e803b
|
||||
*/
|
||||
|
||||
@@ -58,118 +58,118 @@ var colormaps = {
|
||||
]),
|
||||
|
||||
bluwhtgrngis: colormap([
|
||||
[0, [6,23,86], [6,25, 84] ],
|
||||
[0.0625, [6,25,84], [6,25, 84] ],//1
|
||||
[0.125, [6,25,84], [6,25, 84] ],//2
|
||||
[0.1875, [6,25,84], [6,25, 84] ],
|
||||
[0.25, [6,25,84], [6,25,84] ],
|
||||
[0.3125, [6,25,84], [9,24, 84] ],//5
|
||||
[0.3438, [9,24, 84], [119,120,162] ],//5
|
||||
[0.375, [119,129,162],[249,250,251] ], //6
|
||||
[0.406, [249,250,251],[255,255,255] ], //6.5
|
||||
[0.4375, [255,255,255],[255,255,255] ], //7 white
|
||||
[0.50, [255,255,255],[214,205,191] ],//8
|
||||
[0.52, [214,205,191],[178,175,96] ],//8.2
|
||||
[0.5625, [178,175,96], [151,176,53] ],//9
|
||||
[0.593, [151,176,53], [146,188,12] ],//9.5
|
||||
[0.625, [146,188,12], [96,161,1] ], //10
|
||||
[0.6875, [96,161,1], [30,127,3] ],//11
|
||||
[0.75, [30,127,3], [0,99,1] ],//12
|
||||
[0.8125, [0,99,1], [0,74,1] ],//13
|
||||
[0.875, [0,74,1], [0,52, 0] ],//14
|
||||
[0.9375, [0,52, 0], [0,34,0] ], //15
|
||||
[0.968, [0,34,0], [68,70,67] ] //16
|
||||
[0, [6, 23, 86], [6, 25, 84] ],
|
||||
[0.0625, [6, 25, 84], [6, 25, 84] ], //1
|
||||
[0.125, [6, 25, 84], [6, 25, 84] ], //2
|
||||
[0.1875, [6, 25, 84], [6, 25, 84] ],
|
||||
[0.25, [6, 25, 84], [6, 25, 84] ],
|
||||
[0.3125, [6, 25, 84], [9, 24, 84] ], //5
|
||||
[0.3438, [9, 24, 84], [119, 120, 162] ], //5
|
||||
[0.375, [119, 129, 162], [249, 250, 251] ], //6
|
||||
[0.406, [249, 250, 251], [255, 255, 255] ], //6.5
|
||||
[0.4375, [255, 255, 255], [255, 255, 255] ], //7 white
|
||||
[0.50, [255, 255, 255], [214, 205, 191] ], //8
|
||||
[0.52, [214, 205, 191], [178, 175, 96] ], //8.2
|
||||
[0.5625, [178, 175, 96], [151, 176, 53] ], //9
|
||||
[0.593, [151, 176, 53], [146, 188, 12] ], //9.5
|
||||
[0.625, [146, 188, 12], [96, 161, 1] ], //10
|
||||
[0.6875, [96, 161, 1], [30, 127, 3] ], //11
|
||||
[0.75, [30, 127, 3], [0, 99, 1] ], //12
|
||||
[0.8125, [0, 99, 1], [0, 74, 1] ], //13
|
||||
[0.875, [0, 74, 1], [0, 52, 0] ], //14
|
||||
[0.9375, [0, 52, 0], [0, 34, 0] ], //15
|
||||
[0.968, [0, 34, 0], [68, 70, 67] ] //16
|
||||
]),
|
||||
|
||||
|
||||
brntogrn: colormap([
|
||||
[0, [110,12,3], [118,6,1] ],
|
||||
[0.0625, [118,6,1], [141,19,6] ],
|
||||
[0.125, [141,19,6], [165,35,13] ],
|
||||
[0.1875, [165,35,13], [177,59,25] ],
|
||||
[0.2188, [177,59,25], [192,91,36] ],
|
||||
[0.25, [192,91,36], [214, 145, 76] ],
|
||||
[0.3125, [214,145,76], [230,183,134] ],
|
||||
[0.375, [230,183,134],[243, 224, 194]],
|
||||
[0.4375, [243,224,194],[250,252,229] ],
|
||||
[0.50, [250,252,229],[217,235,185] ],
|
||||
[0.5625, [217,235,185],[184,218,143] ],
|
||||
[0.625, [184,218,143],[141,202,89] ],
|
||||
[0.6875, [141,202,89], [80,176,61] ],
|
||||
[0.75, [80,176,61], [0, 147, 32] ],
|
||||
[0.8125, [0,147,32], [1, 122, 22] ],
|
||||
[0.875, [1,122,22], [0, 114, 19] ],
|
||||
[0.90, [0,114,19], [0,105,18] ],
|
||||
[0.9375, [0,105,18], [7,70,14] ]
|
||||
[0, [110, 12, 3], [118, 6, 1] ],
|
||||
[0.0625, [118, 6, 1], [141, 19, 6] ],
|
||||
[0.125, [141, 19, 6], [165, 35, 13] ],
|
||||
[0.1875, [165, 35, 13], [177, 59, 25] ],
|
||||
[0.2188, [177, 59, 25], [192, 91, 36] ],
|
||||
[0.25, [192, 91, 36], [214, 145, 76] ],
|
||||
[0.3125, [214, 145, 76], [230, 183, 134] ],
|
||||
[0.375, [230, 183, 134], [243, 224, 194]],
|
||||
[0.4375, [243, 224, 194], [250, 252, 229] ],
|
||||
[0.50, [250, 252, 229], [217, 235, 185] ],
|
||||
[0.5625, [217, 235, 185], [184, 218, 143] ],
|
||||
[0.625, [184, 218, 143], [141, 202, 89] ],
|
||||
[0.6875, [141, 202, 89], [80, 176, 61] ],
|
||||
[0.75, [80, 176, 61], [0, 147, 32] ],
|
||||
[0.8125, [0, 147, 32], [1, 122, 22] ],
|
||||
[0.875, [1, 122, 22], [0, 114, 19] ],
|
||||
[0.90, [0, 114, 19], [0, 105, 18] ],
|
||||
[0.9375, [0, 105, 18], [7, 70, 14] ]
|
||||
|
||||
]),
|
||||
|
||||
|
||||
blutoredjet: colormap([
|
||||
[0, [0,0,140], [1,1,186] ],
|
||||
[0.0625, [1,1,186], [0,1,248] ],
|
||||
[0.125, [0,1,248], [0,70,254] ],
|
||||
[0.1875, [0,70,254], [0,130,255] ],
|
||||
[0.25, [0,130,255], [2,160,255] ],
|
||||
[0.2813, [2,160,255], [0,187,255] ], //inset
|
||||
[0.3125, [0,187,255], [6,250,255] ],
|
||||
[0, [0, 0, 140], [1, 1, 186] ],
|
||||
[0.0625, [1, 1, 186], [0, 1, 248] ],
|
||||
[0.125, [0, 1, 248], [0, 70, 254] ],
|
||||
[0.1875, [0, 70, 254], [0, 130, 255] ],
|
||||
[0.25, [0, 130, 255], [2, 160, 255] ],
|
||||
[0.2813, [2, 160, 255], [0, 187, 255] ], //inset
|
||||
[0.3125, [0, 187, 255], [6, 250, 255] ],
|
||||
// [0.348, [0,218,255], [8,252,251] ],//inset
|
||||
[0.375, [8,252,251], [27,254,228] ],
|
||||
[0.406, [27,254,228], [70,255,187] ], //insert
|
||||
[0.4375, [70,255,187], [104,254,151]],
|
||||
[0.47, [104,254,151],[132,255,19] ],//insert
|
||||
[0.50, [132,255,19], [195,255,60] ],
|
||||
[0.5625, [195,255,60], [231,254,25] ],
|
||||
[0.5976, [231,254,25], [253,246,1] ],//insert
|
||||
[0.625, [253,246,1], [252,210,1] ], //yellow
|
||||
[0.657, [252,210,1], [255,183,0] ],//insert
|
||||
[0.6875, [255,183,0], [255,125,2] ],
|
||||
[0.75, [255,125,2], [255,65, 1] ],
|
||||
[0.8125, [255,65, 1], [247, 1, 1] ],
|
||||
[0.875, [247,1,1], [200, 1, 3] ],
|
||||
[0.9375, [200,1,3], [122, 3, 2] ]
|
||||
[0.375, [8, 252, 251], [27, 254, 228] ],
|
||||
[0.406, [27, 254, 228], [70, 255, 187] ], //insert
|
||||
[0.4375, [70, 255, 187], [104, 254, 151]],
|
||||
[0.47, [104, 254, 151], [132, 255, 19] ], //insert
|
||||
[0.50, [132, 255, 19], [195, 255, 60] ],
|
||||
[0.5625, [195, 255, 60], [231, 254, 25] ],
|
||||
[0.5976, [231, 254, 25], [253, 246, 1] ], //insert
|
||||
[0.625, [253, 246, 1], [252, 210, 1] ], //yellow
|
||||
[0.657, [252, 210, 1], [255, 183, 0] ], //insert
|
||||
[0.6875, [255, 183, 0], [255, 125, 2] ],
|
||||
[0.75, [255, 125, 2], [255, 65, 1] ],
|
||||
[0.8125, [255, 65, 1], [247, 1, 1] ],
|
||||
[0.875, [247, 1, 1], [200, 1, 3] ],
|
||||
[0.9375, [200, 1, 3], [122, 3, 2] ]
|
||||
|
||||
]),
|
||||
|
||||
|
||||
colors16: colormap([
|
||||
[0, [0,0,0], [0,0,0] ],
|
||||
[0.0625, [3,1,172], [3,1,172] ],
|
||||
[0.125, [3,1,222], [3,1, 222] ],
|
||||
[0.1875, [0,111,255], [0,111,255] ],
|
||||
[0.25, [3,172,255], [3,172,255] ],
|
||||
[0.3125, [1,226,255], [1,226,255] ],
|
||||
[0.375, [2,255,0], [2,255,0] ],
|
||||
[0.4375, [198,254,0], [190,254,0] ],
|
||||
[0.50, [252,255,0], [252,255,0] ],
|
||||
[0.5625, [255,223,3], [255,223,3] ],
|
||||
[0.625, [255,143,3], [255,143,3] ],
|
||||
[0.6875, [255,95,3], [255,95,3] ],
|
||||
[0.75, [242,0,1], [242,0,1] ],
|
||||
[0.8125, [245,0,170], [245,0,170] ],
|
||||
[0.875, [223,180,225], [223,180,225] ],
|
||||
[0.9375, [255,255,255], [255,255, 255]]
|
||||
[0, [0, 0, 0], [0, 0, 0] ],
|
||||
[0.0625, [3, 1, 172], [3, 1, 172] ],
|
||||
[0.125, [3, 1, 222], [3, 1, 222] ],
|
||||
[0.1875, [0, 111, 255], [0, 111, 255] ],
|
||||
[0.25, [3, 172, 255], [3, 172, 255] ],
|
||||
[0.3125, [1, 226, 255], [1, 226, 255] ],
|
||||
[0.375, [2, 255, 0], [2, 255, 0] ],
|
||||
[0.4375, [198, 254, 0], [190, 254, 0] ],
|
||||
[0.50, [252, 255, 0], [252, 255, 0] ],
|
||||
[0.5625, [255, 223, 3], [255, 223, 3] ],
|
||||
[0.625, [255, 143, 3], [255, 143, 3] ],
|
||||
[0.6875, [255, 95, 3], [255, 95, 3] ],
|
||||
[0.75, [242, 0, 1], [242, 0, 1] ],
|
||||
[0.8125, [245, 0, 170], [245, 0, 170] ],
|
||||
[0.875, [223, 180, 225], [223, 180, 225] ],
|
||||
[0.9375, [255, 255, 255], [255, 255, 255]]
|
||||
|
||||
]),
|
||||
|
||||
default: colormap([
|
||||
[0, [45,1,121], [25,1,137] ],
|
||||
[0.125, [25,1,137], [0,6,156] ],
|
||||
[0.1875, [0,6,156], [7,41,172] ],
|
||||
[0.25, [7,41,172], [22,84,187] ],
|
||||
[0.3125, [22,84,187], [25,125,194] ],
|
||||
[0.375, [25,125,194], [26,177,197] ],
|
||||
[0.4375, [26,177,197], [23,199,193] ],
|
||||
[0.47, [23,199,193], [25, 200,170] ],
|
||||
[0.50, [25, 200,170], [21,209,27] ],
|
||||
[0.5625, [21,209,27], [108,215,18] ],
|
||||
[0.625, [108,215,18], [166,218,19] ],
|
||||
[0.6875, [166,218,19], [206,221,20] ],
|
||||
[0.75, [206,221,20], [222,213,19 ] ],
|
||||
[0.7813, [222,213,19], [222, 191, 19]],
|
||||
[0.8125, [222, 191, 19], [227,133,17] ],
|
||||
[0.875, [227,133,17], [231,83,16] ],
|
||||
[0.9375, [231,83,16], [220,61,48] ]
|
||||
[0, [45, 1, 121], [25, 1, 137] ],
|
||||
[0.125, [25, 1, 137], [0, 6, 156] ],
|
||||
[0.1875, [0, 6, 156], [7, 41, 172] ],
|
||||
[0.25, [7, 41, 172], [22, 84, 187] ],
|
||||
[0.3125, [22, 84, 187], [25, 125, 194] ],
|
||||
[0.375, [25, 125, 194], [26, 177, 197] ],
|
||||
[0.4375, [26, 177, 197], [23, 199, 193] ],
|
||||
[0.47, [23, 199, 193], [25, 200, 170] ],
|
||||
[0.50, [25, 200, 170], [21, 209, 27] ],
|
||||
[0.5625, [21, 209, 27], [108, 215, 18] ],
|
||||
[0.625, [108, 215, 18], [166, 218, 19] ],
|
||||
[0.6875, [166, 218, 19], [206, 221, 20] ],
|
||||
[0.75, [206, 221, 20], [222, 213, 19 ] ],
|
||||
[0.7813, [222, 213, 19], [222, 191, 19]],
|
||||
[0.8125, [222, 191, 19], [227, 133, 17] ],
|
||||
[0.875, [227, 133, 17], [231, 83, 16] ],
|
||||
[0.9375, [231, 83, 16], [220, 61, 48] ]
|
||||
|
||||
]),
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = function Crop(input,options,callback) {
|
||||
module.exports = function Crop(input, options, callback) {
|
||||
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
||||
var getPixels = require('get-pixels'),
|
||||
savePixels = require('save-pixels');
|
||||
@@ -6,7 +6,7 @@ module.exports = function Crop(input,options,callback) {
|
||||
options.x = parseInt(options.x) || defaults.x;
|
||||
options.y = parseInt(options.y) || defaults.y;
|
||||
|
||||
getPixels(input.src,function(err,pixels){
|
||||
getPixels(input.src, function(err, pixels){
|
||||
options.w = parseInt(options.w) || Math.floor(pixels.shape[0]);
|
||||
options.h = parseInt(options.h) || Math.floor(pixels.shape[1]);
|
||||
options.backgroundColor = options.backgroundColor || defaults.backgroundColor;
|
||||
@@ -19,26 +19,26 @@ module.exports = function Crop(input,options,callback) {
|
||||
var backgroundArray = [];
|
||||
backgroundColor = options.backgroundColor.split(' ');
|
||||
for(var i = 0; i < w ; i++){
|
||||
backgroundArray = backgroundArray.concat([backgroundColor[0],backgroundColor[1],backgroundColor[2],backgroundColor[3]]);
|
||||
backgroundArray = backgroundArray.concat([backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]]);
|
||||
}
|
||||
// var newarray = new Uint8Array(4*w*h);
|
||||
var array = [];
|
||||
for (var n = oy; n < oy + h; n++) {
|
||||
var offsetValue = 4*w*n;
|
||||
if(n<ih){
|
||||
var start = n*4*iw + ox*4;
|
||||
var end = n*4*iw + ox*4 + 4*w;
|
||||
var offsetValue = 4 * w * n;
|
||||
if(n < ih){
|
||||
var start = n * 4 * iw + ox * 4;
|
||||
var end = n * 4 * iw + ox * 4 + 4 * w;
|
||||
var pushArray = Array.from(pixels.data.slice(start, end ));
|
||||
array.push.apply(array,pushArray);
|
||||
array.push.apply(array, pushArray);
|
||||
} else {
|
||||
array.push.apply(array,backgroundArray);
|
||||
array.push.apply(array, backgroundArray);
|
||||
}
|
||||
}
|
||||
|
||||
var newarray = Uint8Array.from(array);
|
||||
pixels.data = newarray;
|
||||
pixels.shape = [w,h,4];
|
||||
pixels.stride[1] = 4*w;
|
||||
pixels.shape = [w, h, 4];
|
||||
pixels.stride[1] = 4 * w;
|
||||
|
||||
options.format = input.format;
|
||||
|
||||
@@ -54,7 +54,7 @@ module.exports = function Crop(input,options,callback) {
|
||||
r.on('end', function(){
|
||||
var data = Buffer.concat(chunks, totalLength).toString('base64');
|
||||
var datauri = 'data:image/' + options.format + ';base64,' + data;
|
||||
callback(datauri,options.format);
|
||||
callback(datauri, options.format);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = function CropModule(options, UI) {
|
||||
setupComplete = false;
|
||||
|
||||
// This function is caled everytime the step has to be redrawn
|
||||
function draw(input,callback) {
|
||||
function draw(input, callback) {
|
||||
|
||||
var step = this;
|
||||
|
||||
@@ -32,7 +32,7 @@ module.exports = function CropModule(options, UI) {
|
||||
var parseCornerCoordinateInputs = require('../../util/ParseInputCoordinates');
|
||||
|
||||
//parse the inputs
|
||||
parseCornerCoordinateInputs(options,{
|
||||
parseCornerCoordinateInputs(options, {
|
||||
src: input.src,
|
||||
x: { valInp: options.x, type: 'horizontal' },
|
||||
y: { valInp: options.y, type: 'vertical' },
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
/*
|
||||
* Decodes QR from a given image.
|
||||
*/
|
||||
module.exports = function DoNothing(options,UI) {
|
||||
module.exports = function DoNothing(options, UI) {
|
||||
|
||||
var output;
|
||||
var jsQR = require('jsqr');
|
||||
var getPixels = require('get-pixels');
|
||||
|
||||
// This function is called everytime a step has to be redrawn
|
||||
function draw(input,callback,progressObj) {
|
||||
function draw(input, callback, progressObj) {
|
||||
|
||||
progressObj.stop(true);
|
||||
progressObj.overrideFlag = true;
|
||||
|
||||
var step = this;
|
||||
|
||||
getPixels(input.src,function(err,pixels){
|
||||
getPixels(input.src, function(err, pixels){
|
||||
|
||||
if(err) throw err;
|
||||
|
||||
var w = pixels.shape[0];
|
||||
var h = pixels.shape[1];
|
||||
var decoded = jsQR(pixels.data,w,h);
|
||||
var decoded = jsQR(pixels.data, w, h);
|
||||
|
||||
|
||||
// Tell Image Sequencer that this step is complete
|
||||
options.step.qrval = (decoded)?decoded.data:'undefined';
|
||||
options.step.qrval = (decoded) ? decoded.data : 'undefined';
|
||||
});
|
||||
|
||||
function output(image, datauri, mimetype){
|
||||
|
||||
@@ -2,7 +2,7 @@ module.exports = function Dither(options, UI){
|
||||
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
||||
var output;
|
||||
|
||||
function draw(input,callback,progressObj){
|
||||
function draw(input, callback, progressObj){
|
||||
|
||||
progressObj.stop(true);
|
||||
progressObj.overrideFlag = true;
|
||||
|
||||
@@ -9,13 +9,13 @@ module.exports = exports = function(pixels, options){
|
||||
ih = pixels.shape[1],
|
||||
thickness = Number(options.thickness) || defaults.thickness,
|
||||
ex = options.endX = Number(options.endX) - thickness || iw - 1,
|
||||
ey = options.endY = Number(options.endY) -thickness || ih - 1,
|
||||
ey = options.endY = Number(options.endY) - thickness || ih - 1,
|
||||
color = options.color || defaults.color;
|
||||
color = color.split(' ');
|
||||
|
||||
var drawSide = function(startX, startY, endX, endY){
|
||||
for (var n=startX; n <= endX+thickness; n++){
|
||||
for (var k=startY; k <= endY+thickness; k++){
|
||||
for (var n = startX; n <= endX + thickness; n++){
|
||||
for (var k = startY; k <= endY + thickness; k++){
|
||||
pixels.set(n, k, 0, color[0]);
|
||||
pixels.set(n, k, 1, color[1]);
|
||||
pixels.set(n, k, 2, color[2]);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module.exports = function Dynamic(options,UI) {
|
||||
module.exports = function Dynamic(options, UI) {
|
||||
|
||||
var output;
|
||||
|
||||
// This function is called on every draw.
|
||||
function draw(input,callback,progressObj) {
|
||||
function draw(input, callback, progressObj) {
|
||||
|
||||
progressObj.stop(true);
|
||||
progressObj.overrideFlag = true;
|
||||
@@ -45,12 +45,12 @@ module.exports = function Dynamic(options,UI) {
|
||||
}
|
||||
|
||||
/* Functions to get the neighbouring pixel by position (x,y) */
|
||||
function getNeighbourPixel(pixels,curX,curY,distX,distY){
|
||||
function getNeighbourPixel(pixels, curX, curY, distX, distY){
|
||||
return [
|
||||
pixels.get(curX+distX,curY+distY,0)
|
||||
,pixels.get(curX+distX,curY+distY,1)
|
||||
,pixels.get(curX+distX,curY+distY,2)
|
||||
,pixels.get(curX+distX,curY+distY,3)
|
||||
pixels.get(curX + distX, curY + distY, 0),
|
||||
pixels.get(curX + distX, curY + distY, 1),
|
||||
pixels.get(curX + distX, curY + distY, 2),
|
||||
pixels.get(curX + distX, curY + distY, 3)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ module.exports = function Dynamic(options,UI) {
|
||||
}
|
||||
}
|
||||
|
||||
function output(image,datauri,mimetype){
|
||||
function output(image, datauri, mimetype){
|
||||
|
||||
// This output is accessible by Image Sequencer
|
||||
step.output = { src: datauri, format: mimetype };
|
||||
|
||||
@@ -5,7 +5,7 @@ const kernelx = [
|
||||
[-1, 0, 1]
|
||||
],
|
||||
kernely = [
|
||||
[-1,-2,-1],
|
||||
[-1, -2, -1],
|
||||
[ 0, 0, 0],
|
||||
[ 1, 2, 1]
|
||||
];
|
||||
@@ -69,8 +69,8 @@ function sobelFilter(pixels, x, y) {
|
||||
yn = y + b - 1;
|
||||
|
||||
if (isOutOfBounds(pixels, xn, yn)) {
|
||||
gradX += pixels.get(xn+1, yn+1, 0) * kernelx[a][b];
|
||||
gradY += pixels.get(xn+1, yn+1, 0) * kernely[a][b];
|
||||
gradX += pixels.get(xn + 1, yn + 1, 0) * kernelx[a][b];
|
||||
gradY += pixels.get(xn + 1, yn + 1, 0) * kernely[a][b];
|
||||
}
|
||||
else {
|
||||
gradX += pixels.get(xn, yn, 0) * kernelx[a][b];
|
||||
@@ -98,7 +98,7 @@ function categorizeAngle(angle){
|
||||
* 2 => NE-SW
|
||||
* 3 => N-S
|
||||
* 4 => NW-SE
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
function isOutOfBounds(pixels, x, y){
|
||||
@@ -107,7 +107,7 @@ function isOutOfBounds(pixels, x, y){
|
||||
|
||||
const removeElem = (arr = [], elem) => {
|
||||
return arr = arr.filter((arrelem) => {
|
||||
return arrelem !== elem;
|
||||
return arrelem !== elem;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -120,7 +120,7 @@ function nonMaxSupress(pixels, grads, angles) {
|
||||
|
||||
let angleCategory = categorizeAngle(angles[x][y]);
|
||||
|
||||
if (!isOutOfBounds(pixels, x - 1, y - 1) && !isOutOfBounds(pixels, x+1, y+1)){
|
||||
if (!isOutOfBounds(pixels, x - 1, y - 1) && !isOutOfBounds(pixels, x + 1, y + 1)){
|
||||
switch (angleCategory){
|
||||
case 1:
|
||||
if (!((grads[x][y] >= grads[x][y + 1]) && (grads[x][y] >= grads[x][y - 1]))) {
|
||||
@@ -186,17 +186,17 @@ function hysteresis(strongEdgePixels, weakEdgePixels){
|
||||
let x = pixel[0],
|
||||
y = pixel[1];
|
||||
|
||||
if (weakEdgePixels.includes([x+1, y])) {
|
||||
removeElem(weakEdgePixels, [x+1, y]);
|
||||
}
|
||||
else if (weakEdgePixels.includes([x-1, y])) {
|
||||
removeElem(weakEdgePixels, [x-1, y]);
|
||||
if (weakEdgePixels.includes([x + 1, y])) {
|
||||
removeElem(weakEdgePixels, [x + 1, y]);
|
||||
}
|
||||
else if (weakEdgePixels.includes([x, y+1])) {
|
||||
removeElem(weakEdgePixels, [x, y+1]);
|
||||
}
|
||||
else if(weakEdgePixels.includes([x, y-1])) {
|
||||
removeElem(weakEdgePixels, [x, y-1]);
|
||||
else if (weakEdgePixels.includes([x - 1, y])) {
|
||||
removeElem(weakEdgePixels, [x - 1, y]);
|
||||
}
|
||||
else if (weakEdgePixels.includes([x, y + 1])) {
|
||||
removeElem(weakEdgePixels, [x, y + 1]);
|
||||
}
|
||||
else if(weakEdgePixels.includes([x, y - 1])) {
|
||||
removeElem(weakEdgePixels, [x, y - 1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
* Changes the Image Exposure
|
||||
*/
|
||||
|
||||
module.exports = function Exposure(options,UI){
|
||||
module.exports = function Exposure(options, UI){
|
||||
|
||||
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
||||
var output;
|
||||
|
||||
function draw(input,callback,progressObj){
|
||||
function draw(input, callback, progressObj){
|
||||
|
||||
options.exposure = options.exposure || defaults.exposure;
|
||||
var exposure = Math.pow(2, options.exposure);
|
||||
@@ -18,16 +18,16 @@ module.exports = function Exposure(options,UI){
|
||||
|
||||
function changePixel(r, g, b, a){
|
||||
|
||||
r = Math.min(255, r*exposure);
|
||||
g = Math.min(255, g*exposure);
|
||||
b = Math.min(255, b*exposure);
|
||||
r = Math.min(255, r * exposure);
|
||||
g = Math.min(255, g * exposure);
|
||||
b = Math.min(255, b * exposure);
|
||||
return [r, g, b, a];
|
||||
}
|
||||
|
||||
function output(image,datauri,mimetype){
|
||||
function output(image, datauri, mimetype){
|
||||
|
||||
// This output is accessible by Image Sequencer
|
||||
step.output = {src:datauri,format:mimetype};
|
||||
step.output = {src:datauri, format:mimetype};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,15 +11,15 @@ module.exports = function flipImage(oldPixels, pixels, axis) {
|
||||
|
||||
function flip(){
|
||||
if(axis.toLowerCase() == 'vertical'){
|
||||
for (var n=0; n < width; n++){
|
||||
for (var m=0; m < height; m++){
|
||||
for (var n = 0; n < width; n++){
|
||||
for (var m = 0; m < height; m++){
|
||||
copyPixel(n, m, n, height - m - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var n=0; n < width; n++){
|
||||
for (var m=0; m < height; m++){
|
||||
for (var n = 0; n < width; n++){
|
||||
for (var m = 0; m < height; m++){
|
||||
copyPixel(n, m, width - n - 1, m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = exports = function(pixels, options){
|
||||
color = options.color || defaults.color;
|
||||
color = color.split(' ');
|
||||
|
||||
for(var x = 0; x < pixels.shape[0]; x+=options.x){
|
||||
for(var x = 0; x < pixels.shape[0]; x += options.x){
|
||||
for(var y = 0 ; y < pixels.shape[1]; y++){
|
||||
pixels.set(x, y, 0, color[0]);
|
||||
pixels.set(x, y, 1, color[1]);
|
||||
@@ -15,14 +15,14 @@ module.exports = exports = function(pixels, options){
|
||||
}
|
||||
}
|
||||
|
||||
for(var y = 0; y < pixels.shape[1]; y+=options.y){
|
||||
for(var y = 0; y < pixels.shape[1]; y += options.y){
|
||||
for(var x = 0 ; x < pixels.shape[0]; x++){
|
||||
pixels.set(x, y, 0, color[0]);
|
||||
pixels.set(x, y, 1, color[1]);
|
||||
pixels.set(x, y, 2, color[2]);
|
||||
pixels.set(x, y, 3, color[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pixels;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
module.exports = function GridOverlay(options,UI) {
|
||||
module.exports = function GridOverlay(options, UI) {
|
||||
|
||||
var output;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ module.exports = function ImportImageModuleUi(step, ui) {
|
||||
var dropzoneId = 'dropzone-import-image-' + step.ID;
|
||||
|
||||
// add a file input listener
|
||||
var dropZone ='\
|
||||
var dropZone = '\
|
||||
<div class="dropzone" style="padding: 30px;margin: 10px 20% 30px;border: 4px dashed #ccc;border-radius: 8px;text-align: center;color: #444;" id="' + dropzoneId + '">\
|
||||
<p>\
|
||||
<i>Select or drag in an image to overlay.</i>\
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = function CropModuleUi(step, ui) {
|
||||
var xPos = e.pageX - offset.left;
|
||||
var yPos = e.pageY - offset.top;
|
||||
var ndvi = canvas.getContext('2d').getImageData(xPos, yPos, 1, 1).data[0];
|
||||
ndvi = ndvi/127.5 - 1 ;
|
||||
ndvi = ndvi / 127.5 - 1 ;
|
||||
ndvi = ndvi.toFixed(2);
|
||||
ndviImage[0].title = 'NDVI: ' + ndvi;
|
||||
});
|
||||
|
||||
@@ -11,30 +11,30 @@ module.exports = exports = function(pixels, options){
|
||||
cb = color[2];
|
||||
|
||||
var tolerance = options.tolerance || 50;
|
||||
var maxFactor = (1 + tolerance/100);
|
||||
var minFactor = (1 - tolerance/100);
|
||||
var maxFactor = (1 + tolerance / 100);
|
||||
var minFactor = (1 - tolerance / 100);
|
||||
|
||||
function isSimilar(r, g, b){
|
||||
return ( r >= cr*minFactor && r <= cr*maxFactor &&
|
||||
g >= cg*minFactor && g <= cg*maxFactor &&
|
||||
b >= cb*minFactor && b <= cb*maxFactor);
|
||||
return ( r >= cr * minFactor && r <= cr * maxFactor &&
|
||||
g >= cg * minFactor && g <= cg * maxFactor &&
|
||||
b >= cb * minFactor && b <= cb * maxFactor);
|
||||
}
|
||||
|
||||
for(var i = 0; i < pixels.shape[0]; i++){
|
||||
for(var j = 0; j < pixels.shape[1]; j++){
|
||||
var r = pixels.get(i,j,0),
|
||||
g = pixels.get(i,j,1),
|
||||
b = pixels.get(i,j,2);
|
||||
if(isSimilar(r,g,b)){
|
||||
var r = pixels.get(i, j, 0),
|
||||
g = pixels.get(i, j, 1),
|
||||
b = pixels.get(i, j, 2);
|
||||
if(isSimilar(r, g, b)){
|
||||
if (replaceMethod == 'greyscale'){
|
||||
var avg = (r + g + b)/3;
|
||||
pixels.set(i,j,0,avg);
|
||||
pixels.set(i,j,1,avg);
|
||||
pixels.set(i,j,2,avg);
|
||||
var avg = (r + g + b) / 3;
|
||||
pixels.set(i, j, 0, avg);
|
||||
pixels.set(i, j, 1, avg);
|
||||
pixels.set(i, j, 2, avg);
|
||||
}else {
|
||||
pixels.set(i,j,0,replaceColor[0]);
|
||||
pixels.set(i,j,1,replaceColor[1]);
|
||||
pixels.set(i,j,2,replaceColor[2]);
|
||||
pixels.set(i, j, 0, replaceColor[0]);
|
||||
pixels.set(i, j, 1, replaceColor[1]);
|
||||
pixels.set(i, j, 2, replaceColor[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ module.exports = function Resize(options, UI) {
|
||||
});
|
||||
|
||||
pixels.data = resized._data.data;
|
||||
pixels.shape = [new_width,new_height,4];
|
||||
pixels.shape = [new_width, new_height, 4];
|
||||
pixels.stride[1] = 4 * new_width;
|
||||
|
||||
return pixels;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Rotates image
|
||||
* Rotates image
|
||||
*/
|
||||
module.exports = function Rotate(options, UI) {
|
||||
|
||||
@@ -22,16 +22,16 @@ module.exports = function Rotate(options, UI) {
|
||||
}
|
||||
|
||||
function extraManipulation(pixels) {
|
||||
var rotate_value = (options.rotate)%360;
|
||||
var rotate_value = (options.rotate) % 360;
|
||||
|
||||
if(rotate_value%360 == 0)
|
||||
if(rotate_value % 360 == 0)
|
||||
return pixels;
|
||||
|
||||
var bitmap = new imagejs.Bitmap({width: pixels.shape[0], height: pixels.shape[1]});
|
||||
bitmap._data.data = pixels.data;
|
||||
|
||||
var rotated = bitmap.rotate({
|
||||
degrees: rotate_value,
|
||||
degrees: rotate_value,
|
||||
});
|
||||
pixels.data = rotated._data.data;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Saturate an image with a value from 0 to 1
|
||||
*/
|
||||
module.exports = function Saturation(options,UI) {
|
||||
module.exports = function Saturation(options, UI) {
|
||||
|
||||
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
||||
var output;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
module.exports = function TextOverlay(options,UI) {
|
||||
module.exports = function TextOverlay(options, UI) {
|
||||
|
||||
var output;
|
||||
|
||||
@@ -17,8 +17,8 @@ module.exports = function TextOverlay(options,UI) {
|
||||
var priorStep = this.getStep(-1); // get the previous step to add text onto it.
|
||||
|
||||
function extraManipulation(pixels) {
|
||||
//if (options.step.inBrowser)
|
||||
pixels = require('./TextOverlay')(pixels, options,priorStep);
|
||||
//if (options.step.inBrowser)
|
||||
pixels = require('./TextOverlay')(pixels, options, priorStep);
|
||||
return pixels;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = exports = function(pixels, options,priorstep){
|
||||
module.exports = exports = function(pixels, options, priorstep){
|
||||
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
||||
|
||||
options.text = options.text || defaults.text;
|
||||
@@ -18,10 +18,10 @@ module.exports = exports = function(pixels, options,priorstep){
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(img[0], 0, 0);
|
||||
ctx.fillStyle = options.color;
|
||||
ctx.font = options.size +'px ' + options.font;
|
||||
ctx.font = options.size + 'px ' + options.font;
|
||||
ctx.fillText(options.text, options.x, options.y);
|
||||
|
||||
var myImageData = ctx.getImageData(0,0,canvas.width,canvas.height);
|
||||
var myImageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
pixels.data = myImageData.data;
|
||||
return pixels;
|
||||
};
|
||||
@@ -127,7 +127,7 @@ module.exports = function DoNothing(options, UI) {
|
||||
var offsetY = matrix2northmost - matrix1northmost;
|
||||
|
||||
canvas.draw(texture,
|
||||
image.width,// * ratio,
|
||||
image.width, // * ratio,
|
||||
image.height// * ratio
|
||||
);
|
||||
|
||||
|
||||
@@ -18,15 +18,15 @@ module.exports = function Balance(options, UI) {
|
||||
function extraManipulation(pixels) {
|
||||
|
||||
var i = 0;
|
||||
var red_factor = 255/options.red;
|
||||
var green_factor = 255/options.green;
|
||||
var blue_factor = 255/options.blue;
|
||||
var red_factor = 255 / options.red;
|
||||
var green_factor = 255 / options.green;
|
||||
var blue_factor = 255 / options.blue;
|
||||
|
||||
while (i < pixels.data.length) {
|
||||
pixels.data[i] = Math.min(255, pixels.data[i]*red_factor);
|
||||
pixels.data[i+1] = Math.min(255, pixels.data[i+1]*green_factor);
|
||||
pixels.data[i+2] = Math.min(255, pixels.data[i+2]*blue_factor);
|
||||
i+=4;
|
||||
pixels.data[i] = Math.min(255, pixels.data[i] * red_factor);
|
||||
pixels.data[i + 1] = Math.min(255, pixels.data[i + 1] * green_factor);
|
||||
pixels.data[i + 2] = Math.min(255, pixels.data[i + 2] * blue_factor);
|
||||
i += 4;
|
||||
}
|
||||
|
||||
return pixels;
|
||||
|
||||
@@ -6,7 +6,7 @@ const GPU = require('gpu.js').GPU;
|
||||
* @param {Float32Array|Unit8Array|Float64Array} kernel kernelto be convolved on all the matrices.
|
||||
* @param {Boolean} pipeMode Whether to save the output to a texture.
|
||||
* @param {Boolean} normalize Whether to normailize the output by dividing it by the total value of the kernel.
|
||||
* @returns {Float32Array}
|
||||
* @returns {Float32Array}
|
||||
*/
|
||||
const convolve = (arrays, kernel, options = {}) => {
|
||||
const pipeMode = options.pipeMode || false,
|
||||
@@ -66,7 +66,7 @@ const convolve = (arrays, kernel, options = {}) => {
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {Float32Array|'Object'} outputSize Output size of the compute function.
|
||||
* @param {Function} computeFunc The compute function. Cannot be an arrow function.
|
||||
* @param {'Object'} constants Constants to be passed to the function. Can be accessed inside the compute function using `this.constants`.
|
||||
|
||||
@@ -30,16 +30,16 @@ function setInputStepInit() {
|
||||
|
||||
function runVideo(){
|
||||
/* event handler for Take-Photo */
|
||||
document.getElementById('video').style.display='inline';
|
||||
document.getElementById('capture').style.display='inline';
|
||||
document.getElementById('close').style.display='inline';
|
||||
document.getElementById('video').style.display = 'inline';
|
||||
document.getElementById('capture').style.display = 'inline';
|
||||
document.getElementById('close').style.display = 'inline';
|
||||
|
||||
var video = document.getElementById('video');
|
||||
canvas = document.getElementById('canvas'),
|
||||
context = canvas.getContext('2d'),
|
||||
vendorUrl = window.URL || window.webkitURL;
|
||||
|
||||
const constraints = { audio: false,video: true};
|
||||
const constraints = { audio: false, video: true};
|
||||
|
||||
function handleSuccess(stream) {
|
||||
window.stream = stream; // make stream available to browser console
|
||||
@@ -66,9 +66,9 @@ function setInputStepInit() {
|
||||
stream.getVideoTracks().forEach(function (track) {
|
||||
track.stop();
|
||||
});
|
||||
document.getElementById('video').style.display='none';
|
||||
document.getElementById('capture').style.display='none';
|
||||
document.getElementById('close').style.display='none';
|
||||
document.getElementById('video').style.display = 'none';
|
||||
document.getElementById('capture').style.display = 'none';
|
||||
document.getElementById('close').style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ module.exports = function UserInterface(events = {}) {
|
||||
// No UI
|
||||
} else if(step.inBrowser) {
|
||||
// Create and append an HTML Element
|
||||
console.log('Added Step "'+step.name+'"');
|
||||
console.log('Added Step "' + step.name + '"');
|
||||
} else {
|
||||
// Create a NodeJS Object
|
||||
console.log('\x1b[36m%s\x1b[0m','Added Step "'+step.name+'"');
|
||||
console.log('\x1b[36m%s\x1b[0m', 'Added Step "' + step.name + '"');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,10 +21,10 @@ module.exports = function UserInterface(events = {}) {
|
||||
// No UI
|
||||
} else if(step.inBrowser) {
|
||||
// Overlay a loading spinner
|
||||
console.log('Drawing Step "'+step.name+'"');
|
||||
console.log('Drawing Step "' + step.name + '"');
|
||||
} else {
|
||||
// Don't do anything
|
||||
console.log('\x1b[33m%s\x1b[0m','Drawing Step "'+step.name+'"');
|
||||
console.log('\x1b[33m%s\x1b[0m', 'Drawing Step "' + step.name + '"');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,10 +34,10 @@ module.exports = function UserInterface(events = {}) {
|
||||
} else if(step.inBrowser) {
|
||||
// Update the DIV Element
|
||||
// Hide the laoding spinner
|
||||
console.log('Drawn Step "'+step.name+'"');
|
||||
console.log('Drawn Step "' + step.name + '"');
|
||||
} else {
|
||||
// Update the NodeJS Object
|
||||
console.log('\x1b[32m%s\x1b[0m','Drawn Step "'+step.name+'"');
|
||||
console.log('\x1b[32m%s\x1b[0m', 'Drawn Step "' + step.name + '"');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,10 +46,10 @@ module.exports = function UserInterface(events = {}) {
|
||||
// No UI
|
||||
} else if(step.inBrowser) {
|
||||
// Remove the DIV Element
|
||||
console.log('Removing Step "'+step.name+'"');
|
||||
console.log('Removing Step "' + step.name + '"');
|
||||
} else {
|
||||
// Delete the NodeJS Object
|
||||
console.log('\x1b[31m%s\x1b[0m','Removing Step "'+step.name+'"');
|
||||
console.log('\x1b[31m%s\x1b[0m', 'Removing Step "' + step.name + '"');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -35,6 +35,6 @@ module.exports = function GetFormat(src) {
|
||||
return supportedFormats.includes(data);
|
||||
}
|
||||
|
||||
return validateFormat(format)?format:'jpg';
|
||||
return validateFormat(format) ? format : 'jpg';
|
||||
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = function parseCornerCoordinateInputs(options,coord,callback) {
|
||||
module.exports = function parseCornerCoordinateInputs(options, coord, callback) {
|
||||
var getPixels = require('get-pixels');
|
||||
getPixels(coord.src, function(err, pixels) {
|
||||
var iw = pixels.shape[0],
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
const cliUtils = require('../../src/CliUtils');
|
||||
const test = require('tape');
|
||||
|
||||
test('Output directory is correctly generated',function(t){
|
||||
cliUtils.makedir('./output/',function(){
|
||||
require('fs').access('./output/.',function(err){
|
||||
t.true(!err,'Access the created dir');
|
||||
test('Output directory is correctly generated', function(t){
|
||||
cliUtils.makedir('./output/', function(){
|
||||
require('fs').access('./output/.', function(err){
|
||||
t.true(!err, 'Access the created dir');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const testModule = require('../templates/module-test'),
|
||||
options = {size:200, qrCodeString:'https://github.com/publiclab/image-sequencer'},
|
||||
benchmark= 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAklEQVR4AewaftIAAAApSURBVKXBAQEAAAiAIPP/5+qDMPsIJJJIIokkkkgiiSSSSCKJJJJIogNrygQcXEYsHQAAAABJRU5ErkJggg==';
|
||||
benchmark = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAklEQVR4AewaftIAAAApSURBVKXBAQEAAAiAIPP/5+qDMPsIJJJIIokkkkgiiSSSSCKJJJJIogNrygQcXEYsHQAAAABJRU5ErkJggg==';
|
||||
|
||||
testModule('add-qr', options, benchmark);
|
||||
File diff suppressed because one or more lines are too long
@@ -21,7 +21,7 @@ var invert = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9h
|
||||
|
||||
test('Load invert module', function(t) {
|
||||
sequencer.loadImages( red);
|
||||
t.equal(sequencer.steps.length, 1,'Image loaded');
|
||||
t.equal(sequencer.steps.length, 1, 'Image loaded');
|
||||
sequencer.addSteps('invert');
|
||||
t.equal(sequencer.steps[1].options.name, 'invert', 'Invert step added');
|
||||
t.end();
|
||||
@@ -33,7 +33,7 @@ test('Inverted image isn\'t identical', function(t) {
|
||||
var output = sequencer.steps[1].output.src;
|
||||
input = DataURItoBuffer(input);
|
||||
output = DataURItoBuffer(output);
|
||||
t.notEqual(input,output,'Not equal');
|
||||
t.notEqual(input, output, 'Not equal');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ require('../../../src/ImageSequencer.js');
|
||||
|
||||
var sequencer = ImageSequencer({ ui: false });
|
||||
var options = {text : 'Hello World'};
|
||||
var target = 'test_outputs';
|
||||
var target = 'test_outputs';
|
||||
var red = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEX+AAD///+KQee0AAAAAWJLR0QB/wIt3gAAAAd0SU1FB+EGHRIVAvrm6EMAAAAMSURBVAjXY2AgDQAAADAAAceqhY4AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDYtMjlUMTg6MjE6MDIrMDI6MDDGD83DAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTA2LTI5VDE4OjIxOjAyKzAyOjAwt1J1fwAAAABJRU5ErkJggg==';
|
||||
|
||||
// Test 1 to check text overlay module is getting loaded.
|
||||
|
||||
@@ -20,7 +20,7 @@ test('loadImages/loadImage has a name generator.', function (t){
|
||||
test('loadImages/loadImage returns a wrapper in the callback.', function (t){
|
||||
sequencer.loadImage(red, function() {
|
||||
var returnval = this;
|
||||
t.equal(returnval.name,'ImageSequencer Wrapper', 'Wrapper is returned');
|
||||
t.equal(returnval.name, 'ImageSequencer Wrapper', 'Wrapper is returned');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
@@ -29,54 +29,54 @@ test('addSteps is two-way chainable.', function (t){
|
||||
sequencer.loadImage(red, function(){
|
||||
var returnval = this;
|
||||
this.addSteps('invert');
|
||||
t.equal(returnval.name,'ImageSequencer Wrapper', 'Wrapper is returned');
|
||||
t.equal(sequencer.steps.length,2,'Loaded image is affected');
|
||||
t.equal(sequencer.steps[1].options.name,'invert','Correct Step Added');
|
||||
t.equal(returnval.name, 'ImageSequencer Wrapper', 'Wrapper is returned');
|
||||
t.equal(sequencer.steps.length, 2, 'Loaded image is affected');
|
||||
t.equal(sequencer.steps[1].options.name, 'invert', 'Correct Step Added');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test('addSteps is two-way chainable without loadImages.', function (t){
|
||||
var returnval = sequencer.addSteps('ndvi');
|
||||
t.equal(returnval.name,'ImageSequencer','Sequencer is returned');
|
||||
t.equal(sequencer.steps.length,3,'Step length increased');
|
||||
t.equal(sequencer.steps[2].options.name,'ndvi','Correct Step Added');
|
||||
t.equal(returnval.name, 'ImageSequencer', 'Sequencer is returned');
|
||||
t.equal(sequencer.steps.length, 3, 'Step length increased');
|
||||
t.equal(sequencer.steps[2].options.name, 'ndvi', 'Correct Step Added');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('removeSteps is two-way chainable.', function (t){
|
||||
sequencer.loadImage(red,function(){
|
||||
sequencer.loadImage(red, function(){
|
||||
var returnval = this;
|
||||
|
||||
this.addSteps('invert').removeSteps(1);
|
||||
t.equal(returnval.name,'ImageSequencer Wrapper', 'Wrapper is returned');
|
||||
t.equal(sequencer.steps.length,3);
|
||||
t.equal(returnval.name, 'ImageSequencer Wrapper', 'Wrapper is returned');
|
||||
t.equal(sequencer.steps.length, 3);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test('removeSteps is two-way chainable without loadImages.', function (t){
|
||||
var returnval = sequencer.addSteps('blur').removeSteps(3);
|
||||
t.equal(returnval.name,'ImageSequencer','Sequencer is returned');
|
||||
t.equal(sequencer.steps.length,3);
|
||||
t.equal(returnval.name, 'ImageSequencer', 'Sequencer is returned');
|
||||
t.equal(sequencer.steps.length, 3);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('insertSteps is two-way chainable.', function (t){
|
||||
sequencer.loadImage(red,function() {
|
||||
sequencer.loadImage(red, function() {
|
||||
var returnval = this;
|
||||
this.insertSteps(1,'invert');
|
||||
t.equal(returnval.name,'ImageSequencer Wrapper','Wrapper is returned');
|
||||
t.equal(sequencer.steps.length,4);
|
||||
t.equal(sequencer.steps[1].options.name,'invert','Correct Step Inserrted');
|
||||
this.insertSteps(1, 'invert');
|
||||
t.equal(returnval.name, 'ImageSequencer Wrapper', 'Wrapper is returned');
|
||||
t.equal(sequencer.steps.length, 4);
|
||||
t.equal(sequencer.steps[1].options.name, 'invert', 'Correct Step Inserrted');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test('insertSteps is two-way chainable without loadImages.', function (t){
|
||||
var returnval = sequencer.insertSteps(1,'ndvi');
|
||||
t.equal(returnval.name,'ImageSequencer','Sequencer is returned');
|
||||
t.equal(sequencer.steps.length,5);
|
||||
t.equal(sequencer.steps[1].options.name,'ndvi','Correct Step Inserrted');
|
||||
var returnval = sequencer.insertSteps(1, 'ndvi');
|
||||
t.equal(returnval.name, 'ImageSequencer', 'Sequencer is returned');
|
||||
t.equal(sequencer.steps.length, 5);
|
||||
t.equal(sequencer.steps[1].options.name, 'ndvi', 'Correct Step Inserrted');
|
||||
t.end();
|
||||
});
|
||||
|
||||
@@ -160,15 +160,15 @@ test('insertSteps(position,"module") inserts a step', function(t) {
|
||||
test('getSteps() returns correct array of steps', function(t){
|
||||
var sequencer = ImageSequencer({ ui: false });
|
||||
sequencer.loadImages('test', red);
|
||||
sequencer.addSteps(['blur','invert']);
|
||||
sequencer.addSteps(['blur', 'invert']);
|
||||
var stepsArray = sequencer.getSteps('test');
|
||||
t.equal(stepsArray.length, sequencer.steps.length, 'getSteps() returns correct length of steps');
|
||||
var flag=0;
|
||||
for (var i = 0; i<sequencer.steps.length; i++){
|
||||
if(stepsArray[i].options.name==(sequencer.steps[i].options.name))
|
||||
var flag = 0;
|
||||
for (var i = 0; i < sequencer.steps.length; i++){
|
||||
if(stepsArray[i].options.name == (sequencer.steps[i].options.name))
|
||||
continue;
|
||||
else
|
||||
flag=1;
|
||||
flag = 1;
|
||||
}
|
||||
t.equal(flag, 0, 'getSteps() returns correct array of steps');
|
||||
t.end();
|
||||
|
||||
@@ -18,8 +18,8 @@ test('replaceImage works.', function (t){
|
||||
if (typeof(window) === 'undefined')
|
||||
t.end();
|
||||
|
||||
sequencer.replaceImage('img','invert',{ callback: function(){
|
||||
t.equal(0,0, 'replaceImage works');
|
||||
sequencer.replaceImage('img', 'invert', { callback: function(){
|
||||
t.equal(0, 0, 'replaceImage works');
|
||||
t.end();
|
||||
} });
|
||||
});
|
||||
|
||||
@@ -14,13 +14,13 @@ sequencer.addSteps('invert');
|
||||
sequencer.addSteps('invert');
|
||||
sequencer.addSteps('invert');
|
||||
|
||||
test('run() works with all possible argument combinations',function(t){
|
||||
test('run() works with all possible argument combinations', function(t){
|
||||
sequencer.run(function (out) {
|
||||
var output1 = DataURItoBuffer(sequencer.steps.slice(-1)[0].output.src);
|
||||
sequencer.steps.splice(1,1);
|
||||
sequencer.run({index: 1},function(out){
|
||||
sequencer.steps.splice(1, 1);
|
||||
sequencer.run({index: 1}, function(out){
|
||||
var output2 = DataURItoBuffer(sequencer.steps.slice(-1)[0].output.src);
|
||||
t.deepEqual(output1,output2,'output remains same after removing a step and running sequencer from a greater index');
|
||||
t.deepEqual(output1, output2, 'output remains same after removing a step and running sequencer from a greater index');
|
||||
sequencer.run(function(out){
|
||||
t.end();
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ test('Notify function works for all three UIs', function (t) {
|
||||
console.log = oldLog;
|
||||
return result;
|
||||
}
|
||||
t.equal(doesLogMessage(UserInterface().notify, 'Test Message'),true,'Default notify() produces correct output');
|
||||
t.equal(doesLogMessage(UserInterface().notify, 'Test Message'), true, 'Default notify() produces correct output');
|
||||
sequencer.setUI(DefaultHtmlStepUi(sequencer));
|
||||
t.equal(typeof sequencer.events.notify, 'function', 'Html UI contains notify function');
|
||||
t.end();
|
||||
|
||||
@@ -7,11 +7,11 @@ describe('Default sequencer HTML', function() {
|
||||
beforeEach(()=>{
|
||||
defaultHtmlSequencerUi = new DefaultHtmlSequencerUi(sequencer);
|
||||
|
||||
spyOn(defaultHtmlSequencerUi,'onLoad');
|
||||
spyOn(defaultHtmlSequencerUi,'selectNewStepUi');
|
||||
spyOn(defaultHtmlSequencerUi,'removeStepUi');
|
||||
spyOn(defaultHtmlSequencerUi,'addStepUi');
|
||||
spyOn(defaultHtmlSequencerUi,'importStepsFromUrlHash');
|
||||
spyOn(defaultHtmlSequencerUi, 'onLoad');
|
||||
spyOn(defaultHtmlSequencerUi, 'selectNewStepUi');
|
||||
spyOn(defaultHtmlSequencerUi, 'removeStepUi');
|
||||
spyOn(defaultHtmlSequencerUi, 'addStepUi');
|
||||
spyOn(defaultHtmlSequencerUi, 'importStepsFromUrlHash');
|
||||
|
||||
defaultHtmlSequencerUi.onLoad();
|
||||
defaultHtmlSequencerUi.selectNewStepUi();
|
||||
|
||||
@@ -18,19 +18,19 @@ describe('Sequencer step HTML', function() {
|
||||
beforeEach(()=>{
|
||||
defaultHtmlStepUi = new DefaultHtmlStepUi(sequencer);
|
||||
|
||||
spyOn(defaultHtmlStepUi,'getPreview');
|
||||
spyOn(defaultHtmlStepUi,'onSetup');
|
||||
spyOn(defaultHtmlStepUi,'onComplete');
|
||||
spyOn(defaultHtmlStepUi,'onDraw');
|
||||
spyOn(defaultHtmlStepUi,'onRemove');
|
||||
spyOn(defaultHtmlStepUi,'notify');
|
||||
spyOn(defaultHtmlStepUi, 'getPreview');
|
||||
spyOn(defaultHtmlStepUi, 'onSetup');
|
||||
spyOn(defaultHtmlStepUi, 'onComplete');
|
||||
spyOn(defaultHtmlStepUi, 'onDraw');
|
||||
spyOn(defaultHtmlStepUi, 'onRemove');
|
||||
spyOn(defaultHtmlStepUi, 'notify');
|
||||
|
||||
defaultHtmlStepUi.getPreview();
|
||||
defaultHtmlStepUi.onSetup(step,options);
|
||||
defaultHtmlStepUi.onSetup(step, options);
|
||||
defaultHtmlStepUi.onComplete(step);
|
||||
defaultHtmlStepUi.onDraw(step);
|
||||
defaultHtmlStepUi.onRemove(step);
|
||||
defaultHtmlStepUi.notify('Step removed','remove-notification');
|
||||
defaultHtmlStepUi.notify('Step removed', 'remove-notification');
|
||||
});
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('Sequencer step HTML', function() {
|
||||
});
|
||||
|
||||
it('load initial setup ui', function() {
|
||||
expect(defaultHtmlStepUi.onSetup).toHaveBeenCalledWith(step,options);
|
||||
expect(defaultHtmlStepUi.onSetup).toHaveBeenCalledWith(step, options);
|
||||
});
|
||||
|
||||
it('load completion ui', function() {
|
||||
@@ -55,7 +55,7 @@ describe('Sequencer step HTML', function() {
|
||||
});
|
||||
|
||||
it('notification ui', function() {
|
||||
expect(defaultHtmlStepUi.notify).toHaveBeenCalledWith('Step removed','remove-notification');
|
||||
expect(defaultHtmlStepUi.notify).toHaveBeenCalledWith('Step removed', 'remove-notification');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -8,19 +8,19 @@ describe('Preview UI HTML', function() {
|
||||
beforeEach(()=>{
|
||||
insertPreview = InsertPreview;
|
||||
|
||||
spyOn(insertPreview,'generatePreview');
|
||||
spyOn(insertPreview,'updatePreviews');
|
||||
spyOn(insertPreview, 'generatePreview');
|
||||
spyOn(insertPreview, 'updatePreviews');
|
||||
|
||||
insertPreview.generatePreview('brightness',options,'src','selector');
|
||||
insertPreview.updatePreviews('src','selector');
|
||||
insertPreview.generatePreview('brightness', options, 'src', 'selector');
|
||||
insertPreview.updatePreviews('src', 'selector');
|
||||
});
|
||||
|
||||
it('generate preview ui', function() {
|
||||
expect(insertPreview.generatePreview).toHaveBeenCalledWith('brightness',options,'src','selector');
|
||||
expect(insertPreview.generatePreview).toHaveBeenCalledWith('brightness', options, 'src', 'selector');
|
||||
});
|
||||
|
||||
it('update preview ui', function() {
|
||||
expect(insertPreview.updatePreviews).toHaveBeenCalledWith('src','selector');
|
||||
expect(insertPreview.updatePreviews).toHaveBeenCalledWith('src', 'selector');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -7,7 +7,7 @@ describe('Intermediate step HTML', function() {
|
||||
beforeEach(()=>{
|
||||
intermediateHtmlStepUi = new IntermediateHtmlStepUi(sequencer);
|
||||
|
||||
spyOn(intermediateHtmlStepUi,'insertStep');
|
||||
spyOn(intermediateHtmlStepUi, 'insertStep');
|
||||
|
||||
intermediateHtmlStepUi.insertStep();
|
||||
});
|
||||
|
||||
@@ -10,15 +10,15 @@ describe('URL manipulation methods', function() {
|
||||
beforeEach(()=>{
|
||||
urlHash = UrlHash;
|
||||
|
||||
spyOn(urlHash,'getUrlHashParameters');
|
||||
spyOn(urlHash,'getUrlHashParameter');
|
||||
spyOn(urlHash,'setUrlHashParameters');
|
||||
spyOn(urlHash,'setUrlHashParameter');
|
||||
spyOn(urlHash, 'getUrlHashParameters');
|
||||
spyOn(urlHash, 'getUrlHashParameter');
|
||||
spyOn(urlHash, 'setUrlHashParameters');
|
||||
spyOn(urlHash, 'setUrlHashParameter');
|
||||
|
||||
urlHash.getUrlHashParameters();
|
||||
urlHash.getUrlHashParameter('module');
|
||||
urlHash.setUrlHashParameters(params);
|
||||
urlHash.setUrlHashParameter('module','brightness');
|
||||
urlHash.setUrlHashParameter('module', 'brightness');
|
||||
});
|
||||
|
||||
it('gets url hash params from window hash', function() {
|
||||
@@ -34,7 +34,7 @@ describe('URL manipulation methods', function() {
|
||||
});
|
||||
|
||||
it('accepts param key-value pair and sets url hash params', function() {
|
||||
expect(urlHash.setUrlHashParameter).toHaveBeenCalledWith('module','brightness');
|
||||
expect(urlHash.setUrlHashParameter).toHaveBeenCalledWith('module', 'brightness');
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user