diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/abstract-log.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/abstract-log.js index 332757a..eb95a7a 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/abstract-log.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/abstract-log.js @@ -96,7 +96,7 @@ return L.Class.extend({ view: L.view.extend({ /** - * View name (for local storage). + * View name (for local storage and downloads). * Must be overridden by a subclass! */ viewName: null, @@ -250,6 +250,10 @@ return L.Class.extend({ return cArr; }, + regexpFilterHighlightFunc: function(match) { + return `${match}`; + }, + setRegexpFilter: function(cArr) { let fPattern = document.getElementById('logFilter').value; if(!fPattern) { @@ -257,12 +261,15 @@ return L.Class.extend({ }; let fArr = []; try { - let regExp = new RegExp(`(${fPattern})`, 'giu'); + let regExp = new RegExp(fPattern, 'giu'); cArr.forEach((e, i) => { if(e[5] !== null && regExp.test(e[5])) { - e[5] = e[5].replace(regExp, '$1'); + if(this.regexpFilterHighlightFunc) { + e[5] = e[5].replace(regExp, this.regexpFilterHighlightFunc); + }; fArr.push(e); }; + regExp.lastIndex = 0; }); } catch(err) { if(err.name === 'SyntaxError') { @@ -338,7 +345,7 @@ return L.Class.extend({ E('div', { 'class': 'log-entries-count' }, `${_('Entries')}: ${logdataArray.length} / ${this.totalLogLines}${levelsStatString}` ), - logTable + logTable, ]); }, diff --git a/packages/19.07/luci-app-ruantiblock_0.9.0-5_all.ipk b/packages/19.07/luci-app-ruantiblock_0.9.0-5_all.ipk index 5007d2f..6ccf48e 100644 Binary files a/packages/19.07/luci-app-ruantiblock_0.9.0-5_all.ipk and b/packages/19.07/luci-app-ruantiblock_0.9.0-5_all.ipk differ