mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
Replace data-attrs to arguments in data flow
This commit is contained in:
parent
adcab0ba97
commit
2581078ccf
|
@ -123,8 +123,6 @@ export default function getInfoLi() {
|
||||||
id={iddy}
|
id={iddy}
|
||||||
onClick={props.onClick}
|
onClick={props.onClick}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
data-category={props['data-category']}
|
|
||||||
data-index={props['data-index']}
|
|
||||||
/>
|
/>
|
||||||
<div class={scopedCss.labelContainer}>
|
<div class={scopedCss.labelContainer}>
|
||||||
<label for={iddy} dangerouslySetInnerHTML={{__html: props.conf.label}}></label>
|
<label for={iddy} dangerouslySetInnerHTML={{__html: props.conf.label}}></label>
|
||||||
|
|
|
@ -62,18 +62,16 @@ export default function getMain(theState) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleModCheck(that, event) {
|
handleModCheck(that, {targetConf, targetIndex}) {
|
||||||
|
|
||||||
const checkbox = event.target;
|
|
||||||
const [tCat, tIndex] = [checkbox.dataset.category, parseInt(checkbox.dataset.index)];
|
|
||||||
const oldCats = that.state.catToOrderedMods;
|
const oldCats = that.state.catToOrderedMods;
|
||||||
const newCats = Object.keys(that.state.catToOrderedMods).reduce((acc, cat) => {
|
const newCats = Object.keys(that.state.catToOrderedMods).reduce((acc, cat) => {
|
||||||
|
|
||||||
if (cat !== tCat) {
|
if (cat !== targetConf.category) {
|
||||||
acc[cat] = oldCats[cat];
|
acc[cat] = oldCats[cat];
|
||||||
} else {
|
} else {
|
||||||
acc[cat] = oldCats[cat].map(
|
acc[cat] = oldCats[cat].map(
|
||||||
(conf, index) => tIndex === index
|
(conf, index) => targetIndex === index
|
||||||
? Object.assign({}, conf, {value: !conf.value})
|
? Object.assign({}, conf, {value: !conf.value})
|
||||||
: conf
|
: conf
|
||||||
);
|
);
|
||||||
|
@ -103,7 +101,8 @@ export default function getMain(theState) {
|
||||||
|
|
||||||
const modsHandlers = {
|
const modsHandlers = {
|
||||||
onChange: linkEvent(this, this.handleModChange),
|
onChange: linkEvent(this, this.handleModChange),
|
||||||
onClick: linkEvent(this, this.handleModCheck),
|
//onClick: linkEvent(this, this.handleModCheck),
|
||||||
|
onClick: (...args) => this.handleModCheck(this, ...args),
|
||||||
};
|
};
|
||||||
|
|
||||||
return createElement(TabPanel, {
|
return createElement(TabPanel, {
|
||||||
|
|
|
@ -11,7 +11,13 @@ export default function getModList(theState) {
|
||||||
<ol onChange={props.onChange}>
|
<ol onChange={props.onChange}>
|
||||||
{
|
{
|
||||||
props.orderedConfigs.map((conf, index) => (
|
props.orderedConfigs.map((conf, index) => (
|
||||||
<InfoLi conf={conf} type='checkbox' checked={conf.value} key={index} data-category={conf.category} data-index={index} onClick={props.onClick}>
|
<InfoLi
|
||||||
|
conf={conf}
|
||||||
|
type='checkbox'
|
||||||
|
checked={conf.value}
|
||||||
|
key={index}
|
||||||
|
onClick={() => props.onClick({targetConf: conf, targetIndex: index})}
|
||||||
|
>
|
||||||
{props.childrenOfMod && props.childrenOfMod[conf.key]}
|
{props.childrenOfMod && props.childrenOfMod[conf.key]}
|
||||||
</InfoLi>)
|
</InfoLi>)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user