WIP open file for a while
This commit is contained in:
parent
f937019e42
commit
d280fb9af3
122 changed files with 5702 additions and 10 deletions
53
lib/plugin/auto/tview/auto-tview-ftl.js
Normal file
53
lib/plugin/auto/tview/auto-tview-ftl.js
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
function forceLookupTFields(tview) {
|
||||
var keys = Object.keys(tview.tmeta.tfields);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var keyNew = 'FTL_' +forceLookupKeySimple() + '_' + key.substring(key.length/3,key.length/3*2); // no....its; Force template lookup
|
||||
var tfield = tview.tmeta.tfields[key];
|
||||
tview.tmeta.tfields[key] = undefined;
|
||||
tview.tmeta.tfields[keyNew] = tfield;
|
||||
|
||||
var ckeys = Object.keys(tview);
|
||||
for (var ii = 0; ii < ckeys.length; ii++) {
|
||||
var ckey = ckeys[ii];
|
||||
if (ckey === 'tmeta') {
|
||||
continue;
|
||||
}
|
||||
var obj = tview[ckey];
|
||||
if (obj && obj.tfields) {
|
||||
var tfieldsNew = [];
|
||||
for (var iii = 0; iii < obj.tfields.length; iii++) {
|
||||
var tkey = obj.tfields[iii];
|
||||
if (tkey === key) {
|
||||
tfieldsNew.push(keyNew);
|
||||
} else {
|
||||
tfieldsNew.push(tkey);
|
||||
}
|
||||
}
|
||||
obj.tfields = tfieldsNew;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function forceLookupKeySimple() {
|
||||
var low = 100000;
|
||||
var high = 999999;
|
||||
return Math.floor(Math.random() * (high - low + 1) + low).toString(16).toUpperCase();
|
||||
}
|
||||
|
||||
return function AutoTViewFTLPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTViewFTL';
|
||||
ctx.description='Automatic tview tfields key change to force table lookup.';
|
||||
};
|
||||
|
||||
this.fillTView = function(ctx) {
|
||||
forceLookupTFields(ctx.tview);
|
||||
};
|
||||
};
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue