mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 17:49:39 +02:00
code review: no need for callback arg
This commit is contained in:
parent
d9161aeffa
commit
e35f6b3df6
@ -179,7 +179,7 @@ var renderRules = (function() {
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var applyDiff = function(permanent, toAdd, toRemove, callback) {
|
var applyDiff = function(permanent, toAdd, toRemove) {
|
||||||
messaging.send(
|
messaging.send(
|
||||||
'dashboard',
|
'dashboard',
|
||||||
{
|
{
|
||||||
@ -188,7 +188,7 @@ var applyDiff = function(permanent, toAdd, toRemove, callback) {
|
|||||||
toAdd: toAdd,
|
toAdd: toAdd,
|
||||||
toRemove: toRemove
|
toRemove: toRemove
|
||||||
},
|
},
|
||||||
callback
|
renderRules
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ mergeView.options.revertChunk = function(
|
|||||||
{ line: toStart.line, ch: 0 },
|
{ line: toStart.line, ch: 0 },
|
||||||
{ line: toEnd.line, ch: 0 }
|
{ line: toEnd.line, ch: 0 }
|
||||||
);
|
);
|
||||||
applyDiff(from === mv.editor(), toAdd, toRemove, renderRules);
|
applyDiff(from === mv.editor(), toAdd, toRemove);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -238,7 +238,7 @@ function handleImportFilePicker() {
|
|||||||
.replace(/\|/g, ' ')
|
.replace(/\|/g, ' ')
|
||||||
.replace(/\n/g, ' * noop\n');
|
.replace(/\n/g, ' * noop\n');
|
||||||
}
|
}
|
||||||
applyDiff(false, result, '', renderRules);
|
applyDiff(false, result, '');
|
||||||
};
|
};
|
||||||
var file = this.files[0];
|
var file = this.files[0];
|
||||||
if ( file === undefined || file.name === '' ) { return; }
|
if ( file === undefined || file.name === '' ) { return; }
|
||||||
@ -359,7 +359,7 @@ var revertAllHandler = function() {
|
|||||||
toAdd.push(addedLines.trim());
|
toAdd.push(addedLines.trim());
|
||||||
toRemove.push(removedLines.trim());
|
toRemove.push(removedLines.trim());
|
||||||
}
|
}
|
||||||
applyDiff(false, toAdd.join('\n'), toRemove.join('\n'), renderRules);
|
applyDiff(false, toAdd.join('\n'), toRemove.join('\n'));
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -380,7 +380,7 @@ var commitAllHandler = function() {
|
|||||||
toAdd.push(addedLines.trim());
|
toAdd.push(addedLines.trim());
|
||||||
toRemove.push(removedLines.trim());
|
toRemove.push(removedLines.trim());
|
||||||
}
|
}
|
||||||
applyDiff(true, toAdd.join('\n'), toRemove.join('\n'), renderRules);
|
applyDiff(true, toAdd.join('\n'), toRemove.join('\n'));
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -402,28 +402,24 @@ var editSaveHandler = function() {
|
|||||||
toRemove.push(diff[1]);
|
toRemove.push(diff[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
applyDiff(false, toAdd.join(''), toRemove.join(''), renderRules);
|
applyDiff(false, toAdd.join(''), toRemove.join(''));
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var getCloudData = function() {
|
self.cloud.onPush = function() {
|
||||||
return mergeView.leftOriginal().getValue().trim();
|
return mergeView.leftOriginal().getValue().trim();
|
||||||
};
|
};
|
||||||
|
|
||||||
var setCloudData = function(data, append) {
|
self.cloud.onPull = function(data, append) {
|
||||||
if ( typeof data !== 'string' ) { return; }
|
if ( typeof data !== 'string' ) { return; }
|
||||||
applyDiff(
|
applyDiff(
|
||||||
false,
|
false,
|
||||||
data,
|
data,
|
||||||
append ? '' : mergeView.editor().getValue().trim(),
|
append ? '' : mergeView.editor().getValue().trim()
|
||||||
renderRules
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.cloud.onPush = getCloudData;
|
|
||||||
self.cloud.onPull = setCloudData;
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
messaging.send('dashboard', { what: 'getRules' }, renderRules);
|
messaging.send('dashboard', { what: 'getRules' }, renderRules);
|
||||||
|
Loading…
Reference in New Issue
Block a user