芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/public_html/wp-content/plugins/litespeed-cache/assets/js/component.cdn.js
/** * CDN module * @author Hai Zheng */ class CDNMapping extends React.Component { constructor(props) { super(props); this.state = { list: props.list, }; this.onChange = this.onChange.bind(this); this.delRow = this.delRow.bind(this); this.addNew = this.addNew.bind(this); } onChange(e, index) { const target = e.currentTarget; const value = target.dataset.hasOwnProperty('value') ? Boolean(target.dataset.value * 1) : target.value; const list = this.state.list; list[index][target.dataset.type] = value; this.setState({ list: list, }); } delRow(index) { const data = this.state.list; data.splice(index, 1); this.setState({ list: data }); } addNew() { const list = this.state.list; list.push({ url: '' }); this.setState({ list: list }); } render() { return (
{this.state.list.map((item, i) => (
))}
{litespeed_data['lang']['add_cdn_mapping_row']}
); } } // { url: '', inc_img: true, inc_css: false, inc_js: false, filetype: [ '.aac', '.eot', ... ] } class CDNMappingBlock extends React.Component { constructor(props) { super(props); this.onChange = this.onChange.bind(this); this.delRow = this.delRow.bind(this); } onChange(e) { this.props.onChange(e, this.props.index); } delRow() { this.props.delRow(this.props.index); } render() { const name_prefix = litespeed_data['ids']['cdn_mapping']; const item = this.props.item; const filetype = item.filetype ? (Array.isArray(item.filetype) ? item.filetype.join('\n') : item.filetype) : ''; return (
{litespeed_data['lang']['cdn_mapping_url']}
{litespeed_data['lang']['cdn_mapping_inc_img']}
{litespeed_data['lang']['on']}
{litespeed_data['lang']['off']}
{litespeed_data['lang']['cdn_mapping_inc_css']}
{litespeed_data['lang']['on']}
{litespeed_data['lang']['off']}
{litespeed_data['lang']['cdn_mapping_inc_js']}
{litespeed_data['lang']['on']}
{litespeed_data['lang']['off']}
{litespeed_data['lang']['cdn_mapping_filetype']}
{litespeed_data['lang']['cdn_mapping_remove']}
); } }