update 2025-01-21 16:24:29
This commit is contained in:
parent
9993c22199
commit
689f45330f
|
@ -15,6 +15,11 @@ const sharktaikogif = function() {
|
||||||
'c2hhcmstdGFpa28uZ2lm'
|
'c2hhcmstdGFpa28uZ2lm'
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
const less_24_10 = !form.RichListValue;
|
||||||
|
|
||||||
|
const pr7558_merged = false;
|
||||||
|
const pr7574_merged = false;
|
||||||
|
|
||||||
const monospacefonts = [
|
const monospacefonts = [
|
||||||
'"Cascadia Code"',
|
'"Cascadia Code"',
|
||||||
'"Cascadia Mono"',
|
'"Cascadia Mono"',
|
||||||
|
@ -235,6 +240,29 @@ const tls_client_fingerprints = [
|
||||||
];
|
];
|
||||||
|
|
||||||
/* Prototype */
|
/* Prototype */
|
||||||
|
const CBIDynamicList = form.DynamicList.extend({
|
||||||
|
__name__: 'CBI.DynamicList',
|
||||||
|
|
||||||
|
renderWidget(section_id, option_index, cfgvalue) {
|
||||||
|
const value = (cfgvalue != null) ? cfgvalue : this.default;
|
||||||
|
const choices = this.transformChoices();
|
||||||
|
const items = L.toArray(value);
|
||||||
|
|
||||||
|
const widget = new UIDynamicList(items, choices, {
|
||||||
|
id: this.cbid(section_id),
|
||||||
|
sort: this.keylist,
|
||||||
|
allowduplicates: this.allowduplicates,
|
||||||
|
optional: this.optional || this.rmempty,
|
||||||
|
datatype: this.datatype,
|
||||||
|
placeholder: this.placeholder,
|
||||||
|
validate: L.bind(this.validate, this, section_id),
|
||||||
|
disabled: (this.readonly != null) ? this.readonly : this.map.readonly
|
||||||
|
});
|
||||||
|
|
||||||
|
return widget.render();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const CBIGenValue = form.Value.extend({
|
const CBIGenValue = form.Value.extend({
|
||||||
__name__: 'CBI.GenValue',
|
__name__: 'CBI.GenValue',
|
||||||
|
|
||||||
|
@ -268,7 +296,7 @@ const CBIStaticList = form.DynamicList.extend({
|
||||||
__name__: 'CBI.StaticList',
|
__name__: 'CBI.StaticList',
|
||||||
|
|
||||||
renderWidget(/* ... */) {
|
renderWidget(/* ... */) {
|
||||||
let El = form.DynamicList.prototype.renderWidget.apply(this, arguments);
|
let El = ((less_24_10 || !pr7558_merged) ? CBIDynamicList : form.DynamicList).prototype.renderWidget.apply(this, arguments);
|
||||||
|
|
||||||
El.querySelector('.add-item ul > li[data-value="-"]')?.remove();
|
El.querySelector('.add-item ul > li[data-value="-"]')?.remove();
|
||||||
|
|
||||||
|
@ -278,14 +306,45 @@ const CBIStaticList = form.DynamicList.extend({
|
||||||
|
|
||||||
const CBITextValue = form.TextValue.extend({
|
const CBITextValue = form.TextValue.extend({
|
||||||
renderWidget(/* ... */) {
|
renderWidget(/* ... */) {
|
||||||
|
if (pr7574_merged)
|
||||||
|
this.monospace = monospacefonts.join(',');
|
||||||
|
|
||||||
let frameEl = form.TextValue.prototype.renderWidget.apply(this, arguments);
|
let frameEl = form.TextValue.prototype.renderWidget.apply(this, arguments);
|
||||||
|
|
||||||
|
if (!pr7574_merged)
|
||||||
frameEl.querySelector('textarea').style.fontFamily = monospacefonts.join(',');
|
frameEl.querySelector('textarea').style.fontFamily = monospacefonts.join(',');
|
||||||
|
|
||||||
return frameEl;
|
return frameEl;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const UIDynamicList = ui.DynamicList.extend({
|
||||||
|
addItem(dl, value, text, flash) {
|
||||||
|
if (this.options.allowduplicates) {
|
||||||
|
const new_item = E('div', { 'class': flash ? 'item flash' : 'item', 'tabindex': 0, 'draggable': !less_24_10 }, [
|
||||||
|
E('span', {}, [ text ?? value ]),
|
||||||
|
E('input', {
|
||||||
|
'type': 'hidden',
|
||||||
|
'name': this.options.name,
|
||||||
|
'value': value })]);
|
||||||
|
|
||||||
|
const ai = dl.querySelector('.add-item');
|
||||||
|
ai.parentNode.insertBefore(new_item, ai);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.DynamicList.prototype.addItem.call(this, dl, value, text, flash);
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDropdownChange(ev) {
|
||||||
|
ui.DynamicList.prototype.handleDropdownChange.call(this, ev);
|
||||||
|
|
||||||
|
if (this.options.allowduplicates) {
|
||||||
|
const sbVal = ev.detail.value;
|
||||||
|
sbVal?.element.removeAttribute('unselectable');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/* Method */
|
/* Method */
|
||||||
// thanks to homeproxy
|
// thanks to homeproxy
|
||||||
function calcStringMD5(e) {
|
function calcStringMD5(e) {
|
||||||
|
@ -1067,6 +1126,9 @@ return baseclass.extend({
|
||||||
/* Member */
|
/* Member */
|
||||||
rulesetdoc,
|
rulesetdoc,
|
||||||
sharktaikogif,
|
sharktaikogif,
|
||||||
|
less_24_10,
|
||||||
|
pr7558_merged,
|
||||||
|
pr7574_merged,
|
||||||
monospacefonts,
|
monospacefonts,
|
||||||
dashrepos,
|
dashrepos,
|
||||||
dashrepos_urlparams,
|
dashrepos_urlparams,
|
||||||
|
@ -1088,6 +1150,7 @@ return baseclass.extend({
|
||||||
tls_client_fingerprints,
|
tls_client_fingerprints,
|
||||||
|
|
||||||
/* Prototype */
|
/* Prototype */
|
||||||
|
DynamicList: CBIDynamicList,
|
||||||
GenValue: CBIGenValue,
|
GenValue: CBIGenValue,
|
||||||
ListValue: CBIListValue,
|
ListValue: CBIListValue,
|
||||||
StaticList: CBIStaticList,
|
StaticList: CBIStaticList,
|
||||||
|
|
|
@ -392,7 +392,7 @@ function renderPayload(s, total, uciconfig) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
o = s.option(form.DynamicList, prefix + 'fused', _('Factor') + ' ++',
|
o = s.option((hm.less_24_10 || !hm.pr7558_merged) ? hm.DynamicList : form.DynamicList, prefix + 'fused', _('Factor') + ' ++',
|
||||||
_('Content will not be verified, Please make sure you enter it correctly.'));
|
_('Content will not be verified, Please make sure you enter it correctly.'));
|
||||||
extenbox[n].forEach((type) => {
|
extenbox[n].forEach((type) => {
|
||||||
o.depends(Object.fromEntries([['type', type], [prefix + 'type', /.+/]]));
|
o.depends(Object.fromEntries([['type', type], [prefix + 'type', /.+/]]));
|
||||||
|
|
|
@ -168,7 +168,6 @@ return view.extend({
|
||||||
const res_ver_geoip = data[7];
|
const res_ver_geoip = data[7];
|
||||||
const res_ver_geosite = data[8];
|
const res_ver_geosite = data[8];
|
||||||
|
|
||||||
const less_24_10 = !form.RichListValue;
|
|
||||||
const dashboard_repo = uci.get(data[0], 'api', 'dashboard_repo');
|
const dashboard_repo = uci.get(data[0], 'api', 'dashboard_repo');
|
||||||
|
|
||||||
let m, s, o, ss, so;
|
let m, s, o, ss, so;
|
||||||
|
@ -473,7 +472,7 @@ return view.extend({
|
||||||
}
|
}
|
||||||
so.default = 'system';
|
so.default = 'system';
|
||||||
so.rmempty = false;
|
so.rmempty = false;
|
||||||
if (less_24_10)
|
if (hm.less_24_10)
|
||||||
so.onchange = function(ev, section_id, value) {
|
so.onchange = function(ev, section_id, value) {
|
||||||
var desc = ev.target.nextSibling;
|
var desc = ev.target.nextSibling;
|
||||||
if (value === 'mixed')
|
if (value === 'mixed')
|
||||||
|
|
Loading…
Reference in New Issue