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}
|
||||
onClick={props.onClick}
|
||||
disabled={props.disabled}
|
||||
data-category={props['data-category']}
|
||||
data-index={props['data-index']}
|
||||
/>
|
||||
<div class={scopedCss.labelContainer}>
|
||||
<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 newCats = Object.keys(that.state.catToOrderedMods).reduce((acc, cat) => {
|
||||
|
||||
if (cat !== tCat) {
|
||||
if (cat !== targetConf.category) {
|
||||
acc[cat] = oldCats[cat];
|
||||
} else {
|
||||
acc[cat] = oldCats[cat].map(
|
||||
(conf, index) => tIndex === index
|
||||
(conf, index) => targetIndex === index
|
||||
? Object.assign({}, conf, {value: !conf.value})
|
||||
: conf
|
||||
);
|
||||
|
@ -103,7 +101,8 @@ export default function getMain(theState) {
|
|||
|
||||
const modsHandlers = {
|
||||
onChange: linkEvent(this, this.handleModChange),
|
||||
onClick: linkEvent(this, this.handleModCheck),
|
||||
//onClick: linkEvent(this, this.handleModCheck),
|
||||
onClick: (...args) => this.handleModCheck(this, ...args),
|
||||
};
|
||||
|
||||
return createElement(TabPanel, {
|
||||
|
|
|
@ -11,7 +11,13 @@ export default function getModList(theState) {
|
|||
<ol onChange={props.onChange}>
|
||||
{
|
||||
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]}
|
||||
</InfoLi>)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user