field template fixup for modified templates only
This commit is contained in:
parent
b59980067a
commit
7e556e8d32
@ -269,11 +269,15 @@ function optionsVersion(options) {
|
||||
}
|
||||
options.general.compactTags = false;
|
||||
options.general.compactGlossaries = false;
|
||||
options.anki.fieldTemplates = '{{#if merge}}\n' +
|
||||
optionsFieldTemplates() +
|
||||
'\n{{else}}\n' +
|
||||
options.anki.fieldTemplates +
|
||||
'\n{{/if}}';
|
||||
if (utilStringHashCode(options.anki.fieldTemplates) !== -1895236672) { // a3c8508031a1073629803d0616a2ee416cd3cccc
|
||||
options.anki.fieldTemplates = '{{#if merge}}\n' +
|
||||
optionsFieldTemplates() +
|
||||
'\n{{else}}\n' +
|
||||
options.anki.fieldTemplates +
|
||||
'\n{{/if}}';
|
||||
} else {
|
||||
options.anki.fieldTemplates = optionsFieldTemplates();
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -52,6 +52,21 @@ function utilSetDifference(setA, setB) {
|
||||
);
|
||||
}
|
||||
|
||||
function utilStringHashCode(string) {
|
||||
let hashCode = 0;
|
||||
|
||||
if (string.length === 0) {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
for (let i = 0, charCode = string.charCodeAt(i); i < string.length; i++) {
|
||||
hashCode = ((hashCode << 5) - hashCode) + charCode;
|
||||
hashCode |= 0;
|
||||
}
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
function utilBackend() {
|
||||
return chrome.extension.getBackgroundPage().yomichan_backend;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user