2014-12-31 23:26:17 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
|
2016-03-06 16:51:06 +01:00
|
|
|
uBlock Origin - a browser extension to block requests.
|
2018-03-11 15:59:39 +01:00
|
|
|
Copyright (C) 2014-2018 Raymond Hill
|
2014-12-31 23:26:17 +01:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
|
|
|
|
|
|
Home: https://github.com/gorhill/uMatrix
|
|
|
|
*/
|
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
/* global diff_match_patch, CodeMirror, uDom, uBlockDashboard */
|
|
|
|
|
|
|
|
'use strict';
|
2014-12-31 23:26:17 +01:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2016-03-06 16:51:06 +01:00
|
|
|
var messaging = vAPI.messaging;
|
2014-12-31 23:26:17 +01:00
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
var mergeView = new CodeMirror.MergeView(
|
|
|
|
document.querySelector('.codeMirrorMergeContainer'),
|
|
|
|
{
|
|
|
|
allowEditingOriginals: true,
|
2018-03-16 12:49:56 +01:00
|
|
|
connect: 'align',
|
2018-03-21 12:24:52 +01:00
|
|
|
inputStyle: 'contenteditable',
|
2018-03-11 15:59:39 +01:00
|
|
|
lineNumbers: true,
|
|
|
|
lineWrapping: false,
|
|
|
|
origLeft: '',
|
|
|
|
revertButtons: true,
|
|
|
|
value: ''
|
2015-04-09 17:19:31 +02:00
|
|
|
}
|
2018-03-11 15:59:39 +01:00
|
|
|
);
|
|
|
|
mergeView.editor().setOption('styleActiveLine', true);
|
|
|
|
mergeView.editor().setOption('lineNumbers', false);
|
|
|
|
mergeView.leftOriginal().setOption('readOnly', 'nocursor');
|
2015-04-09 17:19:31 +02:00
|
|
|
|
2018-03-21 12:24:52 +01:00
|
|
|
var unfilteredRules = {
|
|
|
|
orig: { doc: mergeView.leftOriginal(), rules: [] },
|
|
|
|
edit: { doc: mergeView.editor(), rules: [] }
|
|
|
|
};
|
|
|
|
|
|
|
|
var cleanEditToken = 0;
|
2018-03-11 15:59:39 +01:00
|
|
|
var cleanEditText = '';
|
2015-02-11 17:34:51 +01:00
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
var differ;
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-21 12:24:52 +01:00
|
|
|
// Borrowed from...
|
|
|
|
// https://github.com/codemirror/CodeMirror/blob/3e1bb5fff682f8f6cbfaef0e56c61d62403d4798/addon/search/search.js#L22
|
|
|
|
// ... and modified as needed.
|
|
|
|
|
|
|
|
var updateOverlay = (function() {
|
|
|
|
var reFilter;
|
|
|
|
var mode = {
|
|
|
|
token: function(stream) {
|
|
|
|
if ( reFilter !== undefined ) {
|
|
|
|
reFilter.lastIndex = stream.pos;
|
|
|
|
var match = reFilter.exec(stream.string);
|
|
|
|
if ( match !== null ) {
|
|
|
|
if ( match.index === stream.pos ) {
|
|
|
|
stream.pos += match[0].length || 1;
|
|
|
|
return 'searching';
|
|
|
|
}
|
|
|
|
stream.pos = match.index;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stream.skipToEnd();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return function(filter) {
|
|
|
|
reFilter = typeof filter === 'string' && filter !== '' ?
|
|
|
|
new RegExp(filter.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi') :
|
|
|
|
undefined;
|
|
|
|
return mode;
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
// Incrementally update text in a CodeMirror editor for best user experience:
|
|
|
|
// - Scroll position preserved
|
|
|
|
// - Minimum amount of text updated
|
|
|
|
|
2018-03-21 12:24:52 +01:00
|
|
|
var rulesToDoc = function(clearHistory) {
|
|
|
|
for ( var key in unfilteredRules ) {
|
|
|
|
if ( unfilteredRules.hasOwnProperty(key) === false ) { continue; }
|
|
|
|
var doc = unfilteredRules[key].doc;
|
|
|
|
var rules = filterRules(key);
|
|
|
|
if ( doc.lineCount() === 1 && doc.getValue() === '' || rules.length === 0 ) {
|
|
|
|
doc.setValue(rules.length !== 0 ? rules.join('\n') : '');
|
2015-02-11 17:49:08 +01:00
|
|
|
continue;
|
|
|
|
}
|
2018-03-21 12:24:52 +01:00
|
|
|
if ( differ === undefined ) { differ = new diff_match_patch(); }
|
|
|
|
var beforeText = doc.getValue();
|
|
|
|
var afterText = rules.join('\n');
|
|
|
|
var diffs = differ.diff_main(beforeText, afterText);
|
|
|
|
doc.startOperation();
|
|
|
|
var i = diffs.length,
|
|
|
|
iedit = beforeText.length;
|
|
|
|
while ( i-- ) {
|
|
|
|
var diff = diffs[i];
|
|
|
|
if ( diff[0] === 0 ) {
|
|
|
|
iedit -= diff[1].length;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
var end = doc.posFromIndex(iedit);
|
|
|
|
if ( diff[0] === 1 ) {
|
|
|
|
doc.replaceRange(diff[1], end, end);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* diff[0] === -1 */
|
|
|
|
iedit -= diff[1].length;
|
|
|
|
var beg = doc.posFromIndex(iedit);
|
|
|
|
doc.replaceRange('', beg, end);
|
2015-02-11 17:49:08 +01:00
|
|
|
}
|
2018-03-21 12:24:52 +01:00
|
|
|
doc.endOperation();
|
2015-02-11 17:34:51 +01:00
|
|
|
}
|
2018-03-21 12:24:52 +01:00
|
|
|
cleanEditText = mergeView.editor().getValue().trim();
|
|
|
|
cleanEditToken = mergeView.editor().changeGeneration();
|
|
|
|
if ( clearHistory ) {
|
|
|
|
mergeView.editor().clearHistory();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
var filterRules = function(key) {
|
|
|
|
var rules = unfilteredRules[key].rules;
|
|
|
|
var filter = uDom('#ruleFilter input').val();
|
|
|
|
if ( filter !== '' ) {
|
|
|
|
rules = rules.slice();
|
|
|
|
var i = rules.length;
|
|
|
|
while ( i-- ) {
|
|
|
|
if ( rules[i].indexOf(filter) === -1 ) {
|
|
|
|
rules.splice(i, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return rules;
|
2018-03-11 15:59:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
var renderRules = (function() {
|
|
|
|
var firstVisit = true;
|
|
|
|
|
|
|
|
return function(details) {
|
|
|
|
details.hnSwitches.sort();
|
|
|
|
details.permanentRules.sort();
|
|
|
|
details.sessionRules.sort();
|
2018-03-21 12:24:52 +01:00
|
|
|
unfilteredRules.orig.rules =
|
|
|
|
details.hnSwitches.concat(details.permanentRules);
|
|
|
|
unfilteredRules.edit.rules =
|
|
|
|
details.hnSwitches.concat(details.sessionRules);
|
|
|
|
rulesToDoc(firstVisit);
|
2018-03-11 15:59:39 +01:00
|
|
|
if ( firstVisit ) {
|
|
|
|
firstVisit = false;
|
|
|
|
mergeView.editor().execCommand('goNextDiff');
|
2015-02-11 17:34:51 +01:00
|
|
|
}
|
2018-03-21 12:24:52 +01:00
|
|
|
onTextChanged(true);
|
2018-03-11 15:59:39 +01:00
|
|
|
};
|
|
|
|
})();
|
2014-12-31 23:26:17 +01:00
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-23 20:05:35 +01:00
|
|
|
var applyDiff = function(permanent, toAdd, toRemove) {
|
2018-03-11 15:59:39 +01:00
|
|
|
messaging.send(
|
|
|
|
'dashboard',
|
|
|
|
{
|
|
|
|
what: 'modifyRuleset',
|
|
|
|
permanent: permanent,
|
|
|
|
toAdd: toAdd,
|
|
|
|
toRemove: toRemove
|
|
|
|
},
|
2018-03-23 20:05:35 +01:00
|
|
|
renderRules
|
2018-03-11 15:59:39 +01:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
// CodeMirror quirk: sometimes fromStart.ch and/or toStart.ch is undefined.
|
|
|
|
// When this happens, use 0.
|
|
|
|
|
|
|
|
mergeView.options.revertChunk = function(
|
|
|
|
mv,
|
|
|
|
from, fromStart, fromEnd,
|
|
|
|
to, toStart, toEnd
|
|
|
|
) {
|
2018-03-16 23:33:50 +01:00
|
|
|
// https://github.com/gorhill/uBlock/issues/3611
|
|
|
|
if ( document.body.getAttribute('dir') === 'rtl' ) {
|
|
|
|
var tmp;
|
|
|
|
tmp = from; from = to; to = tmp;
|
|
|
|
tmp = fromStart; fromStart = toStart; toStart = tmp;
|
|
|
|
tmp = fromEnd; fromEnd = toEnd; toEnd = tmp;
|
|
|
|
}
|
2018-03-11 15:59:39 +01:00
|
|
|
if ( typeof fromStart.ch !== 'number' ) { fromStart.ch = 0; }
|
|
|
|
if ( fromEnd.ch !== 0 ) { fromEnd.line += 1; }
|
|
|
|
var toAdd = from.getRange(
|
|
|
|
{ line: fromStart.line, ch: 0 },
|
|
|
|
{ line: fromEnd.line, ch: 0 }
|
|
|
|
);
|
|
|
|
if ( typeof toStart.ch !== 'number' ) { toStart.ch = 0; }
|
|
|
|
if ( toEnd.ch !== 0 ) { toEnd.line += 1; }
|
|
|
|
var toRemove = to.getRange(
|
|
|
|
{ line: toStart.line, ch: 0 },
|
|
|
|
{ line: toEnd.line, ch: 0 }
|
|
|
|
);
|
2018-03-23 20:05:35 +01:00
|
|
|
applyDiff(from === mv.editor(), toAdd, toRemove);
|
2014-12-31 23:26:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
function handleImportFilePicker() {
|
|
|
|
var fileReaderOnLoadHandler = function() {
|
2018-03-21 12:24:52 +01:00
|
|
|
if ( typeof this.result !== 'string' || this.result === '' ) { return; }
|
2015-04-07 03:26:05 +02:00
|
|
|
// https://github.com/chrisaljoudi/uBlock/issues/757
|
2015-02-10 02:12:37 +01:00
|
|
|
// Support RequestPolicy rule syntax
|
|
|
|
var result = this.result;
|
|
|
|
var matches = /\[origins-to-destinations\]([^\[]+)/.exec(result);
|
|
|
|
if ( matches && matches.length === 2 ) {
|
|
|
|
result = matches[1].trim()
|
|
|
|
.replace(/\|/g, ' ')
|
|
|
|
.replace(/\n/g, ' * noop\n');
|
|
|
|
}
|
2018-03-23 20:05:35 +01:00
|
|
|
applyDiff(false, result, '');
|
2014-12-31 23:26:17 +01:00
|
|
|
};
|
|
|
|
var file = this.files[0];
|
2018-03-11 15:59:39 +01:00
|
|
|
if ( file === undefined || file.name === '' ) { return; }
|
|
|
|
if ( file.type.indexOf('text') !== 0 ) { return; }
|
2014-12-31 23:26:17 +01:00
|
|
|
var fr = new FileReader();
|
|
|
|
fr.onload = fileReaderOnLoadHandler;
|
|
|
|
fr.readAsText(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
var startImportFilePicker = function() {
|
|
|
|
var input = document.getElementById('importFilePicker');
|
|
|
|
// Reset to empty string, this will ensure an change event is properly
|
|
|
|
// triggered if the user pick a file, even if it is the same as the last
|
|
|
|
// one picked.
|
|
|
|
input.value = '';
|
|
|
|
input.click();
|
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
function exportUserRulesToFile() {
|
2015-01-06 18:14:37 +01:00
|
|
|
var filename = vAPI.i18n('rulesDefaultFileName')
|
2016-10-13 19:25:57 +02:00
|
|
|
.replace('{{datetime}}', uBlockDashboard.dateNowToSensibleString())
|
2015-01-06 18:14:37 +01:00
|
|
|
.replace(/ +/g, '_');
|
|
|
|
vAPI.download({
|
2018-03-11 15:59:39 +01:00
|
|
|
url: 'data:text/plain,' + encodeURIComponent(
|
|
|
|
mergeView.leftOriginal().getValue().trim() + '\n'
|
|
|
|
),
|
|
|
|
filename: filename,
|
|
|
|
saveAs: true
|
2014-12-31 23:26:17 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-21 12:24:52 +01:00
|
|
|
var onFilterChanged = (function() {
|
|
|
|
var timer,
|
|
|
|
overlay = null,
|
|
|
|
last = '';
|
2015-02-11 17:34:51 +01:00
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
var process = function() {
|
|
|
|
timer = undefined;
|
2018-03-21 12:24:52 +01:00
|
|
|
if ( mergeView.editor().isClean(cleanEditToken) === false ) { return; }
|
2018-03-21 13:42:21 +01:00
|
|
|
var filter = uDom('#ruleFilter input').val();
|
|
|
|
if ( filter === last ) { return; }
|
|
|
|
last = filter;
|
2018-03-21 12:24:52 +01:00
|
|
|
if ( overlay !== null ) {
|
|
|
|
mergeView.leftOriginal().removeOverlay(overlay);
|
|
|
|
mergeView.editor().removeOverlay(overlay);
|
|
|
|
overlay = null;
|
|
|
|
}
|
|
|
|
if ( filter !== '' ) {
|
|
|
|
overlay = updateOverlay(filter);
|
|
|
|
mergeView.leftOriginal().addOverlay(overlay);
|
|
|
|
mergeView.editor().addOverlay(overlay);
|
|
|
|
}
|
|
|
|
rulesToDoc(true);
|
2018-03-11 15:59:39 +01:00
|
|
|
};
|
2015-02-11 17:34:51 +01:00
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
return function() {
|
|
|
|
if ( timer !== undefined ) { clearTimeout(timer); }
|
2018-03-21 12:24:52 +01:00
|
|
|
timer = vAPI.setTimeout(process, 773);
|
2015-02-11 17:34:51 +01:00
|
|
|
};
|
2018-03-11 15:59:39 +01:00
|
|
|
})();
|
2015-02-11 17:34:51 +01:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-21 12:24:52 +01:00
|
|
|
var onTextChanged = (function() {
|
2018-03-11 15:59:39 +01:00
|
|
|
var timer;
|
|
|
|
|
|
|
|
var process = function(now) {
|
|
|
|
timer = undefined;
|
2018-03-21 12:24:52 +01:00
|
|
|
var isClean = mergeView.editor().isClean(cleanEditToken);
|
2018-03-11 15:59:39 +01:00
|
|
|
var diff = document.getElementById('diff');
|
|
|
|
if (
|
|
|
|
now &&
|
|
|
|
isClean === false &&
|
|
|
|
mergeView.editor().getValue().trim() === cleanEditText
|
|
|
|
) {
|
2018-03-21 12:24:52 +01:00
|
|
|
cleanEditToken = mergeView.editor().changeGeneration();
|
2018-03-11 15:59:39 +01:00
|
|
|
isClean = true;
|
|
|
|
}
|
|
|
|
diff.classList.toggle('editing', isClean === false);
|
|
|
|
diff.classList.toggle('dirty', mergeView.leftChunks().length !== 0);
|
2018-03-21 12:24:52 +01:00
|
|
|
var input = document.querySelector('#ruleFilter input');
|
|
|
|
if ( isClean ) {
|
|
|
|
input.removeAttribute('disabled');
|
|
|
|
CodeMirror.commands.save = undefined;
|
|
|
|
} else {
|
|
|
|
input.setAttribute('disabled', '');
|
|
|
|
CodeMirror.commands.save = editSaveHandler;
|
|
|
|
}
|
2015-02-11 17:34:51 +01:00
|
|
|
};
|
2018-03-11 15:59:39 +01:00
|
|
|
|
|
|
|
return function(now) {
|
|
|
|
if ( timer !== undefined ) { clearTimeout(timer); }
|
|
|
|
timer = now ? process(now) : vAPI.setTimeout(process, 57);
|
|
|
|
};
|
|
|
|
})();
|
2015-02-11 17:34:51 +01:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
var revertAllHandler = function() {
|
|
|
|
var toAdd = [], toRemove = [];
|
|
|
|
var left = mergeView.leftOriginal(),
|
|
|
|
edit = mergeView.editor();
|
|
|
|
for ( var chunk of mergeView.leftChunks() ) {
|
|
|
|
var addedLines = left.getRange(
|
|
|
|
{ line: chunk.origFrom, ch: 0 },
|
|
|
|
{ line: chunk.origTo, ch: 0 }
|
|
|
|
);
|
|
|
|
var removedLines = edit.getRange(
|
|
|
|
{ line: chunk.editFrom, ch: 0 },
|
|
|
|
{ line: chunk.editTo, ch: 0 }
|
|
|
|
);
|
|
|
|
toAdd.push(addedLines.trim());
|
|
|
|
toRemove.push(removedLines.trim());
|
2015-03-12 06:52:27 +01:00
|
|
|
}
|
2018-03-23 20:05:35 +01:00
|
|
|
applyDiff(false, toAdd.join('\n'), toRemove.join('\n'));
|
2015-02-11 17:34:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
var commitAllHandler = function() {
|
|
|
|
var toAdd = [], toRemove = [];
|
|
|
|
var left = mergeView.leftOriginal(),
|
|
|
|
edit = mergeView.editor();
|
|
|
|
for ( var chunk of mergeView.leftChunks() ) {
|
|
|
|
var addedLines = edit.getRange(
|
|
|
|
{ line: chunk.editFrom, ch: 0 },
|
|
|
|
{ line: chunk.editTo, ch: 0 }
|
|
|
|
);
|
|
|
|
var removedLines = left.getRange(
|
|
|
|
{ line: chunk.origFrom, ch: 0 },
|
|
|
|
{ line: chunk.origTo, ch: 0 }
|
|
|
|
);
|
|
|
|
toAdd.push(addedLines.trim());
|
|
|
|
toRemove.push(removedLines.trim());
|
|
|
|
}
|
2018-03-23 20:05:35 +01:00
|
|
|
applyDiff(true, toAdd.join('\n'), toRemove.join('\n'));
|
2015-02-11 17:34:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
var editSaveHandler = function() {
|
|
|
|
var editor = mergeView.editor();
|
|
|
|
var editText = editor.getValue().trim();
|
|
|
|
if ( editText === cleanEditText ) {
|
2018-03-21 12:24:52 +01:00
|
|
|
onTextChanged(true);
|
2018-03-11 15:59:39 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ( differ === undefined ) { differ = new diff_match_patch(); }
|
|
|
|
var toAdd = [], toRemove = [];
|
|
|
|
var diffs = differ.diff_main(cleanEditText, editText);
|
|
|
|
for ( var diff of diffs ) {
|
|
|
|
if ( diff[0] === 1 ) {
|
|
|
|
toAdd.push(diff[1]);
|
|
|
|
} else if ( diff[0] === -1 ) {
|
|
|
|
toRemove.push(diff[1]);
|
|
|
|
}
|
|
|
|
}
|
2018-03-23 20:05:35 +01:00
|
|
|
applyDiff(false, toAdd.join(''), toRemove.join(''));
|
2015-02-11 17:34:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-23 20:05:35 +01:00
|
|
|
self.cloud.onPush = function() {
|
2018-03-11 15:59:39 +01:00
|
|
|
return mergeView.leftOriginal().getValue().trim();
|
2015-08-11 21:29:14 +02:00
|
|
|
};
|
|
|
|
|
2018-03-23 20:05:35 +01:00
|
|
|
self.cloud.onPull = function(data, append) {
|
2018-03-11 15:59:39 +01:00
|
|
|
if ( typeof data !== 'string' ) { return; }
|
|
|
|
applyDiff(
|
|
|
|
false,
|
|
|
|
data,
|
2018-03-23 20:05:35 +01:00
|
|
|
append ? '' : mergeView.editor().getValue().trim()
|
2018-03-11 15:59:39 +01:00
|
|
|
);
|
2015-08-11 21:29:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
messaging.send('dashboard', { what: 'getRules' }, renderRules);
|
|
|
|
|
2015-08-11 21:29:14 +02:00
|
|
|
// Handle user interaction
|
|
|
|
uDom('#importButton').on('click', startImportFilePicker);
|
|
|
|
uDom('#importFilePicker').on('change', handleImportFilePicker);
|
|
|
|
uDom('#exportButton').on('click', exportUserRulesToFile);
|
2018-03-11 15:59:39 +01:00
|
|
|
uDom('#revertButton').on('click', revertAllHandler);
|
|
|
|
uDom('#commitButton').on('click', commitAllHandler);
|
|
|
|
uDom('#editSaveButton').on('click', editSaveHandler);
|
2018-03-21 12:24:52 +01:00
|
|
|
uDom('#ruleFilter input').on('input', onFilterChanged);
|
2015-08-11 21:29:14 +02:00
|
|
|
|
2018-03-11 15:59:39 +01:00
|
|
|
// https://groups.google.com/forum/#!topic/codemirror/UQkTrt078Vs
|
2018-03-21 12:24:52 +01:00
|
|
|
mergeView.editor().on('updateDiff', function() { onTextChanged(); });
|
2014-12-31 23:26:17 +01:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
})();
|
|
|
|
|