console.log( "===== simpread option labs load =====" ) import {storage} from 'storage'; import * as run from 'runtime'; import * as ss from 'stylesheet'; import {browser} from 'browser'; import * as msg from 'message'; import * as watch from 'watch'; import Button from 'button'; class Card extends React.Component { static defaultProps = { plugin : {}, }; static propTypes = { plugin : React.PropTypes.object, }; update() { run.Install( this.props.plugin.id, undefined, result => { if ( result ) { if ( this.props.plugin.version != result.version ) { storage.plugins[this.props.plugin.id] = result; this.props.onChange( "update" ); } else { new Notify().Render( "当前插件为最新版,无需更新。" ); } } else new Notify().Render( 2, "更新失败,请稍后再试。" ); }); } delete() { new Notify().Render({ mode:"snackbar", content: "是否删除当前插件?", action: "确认", cancel: "取消", callback: type => { if ( type == "cancel" ) return; delete storage.plugins[ this.props.plugin.id ]; storage.option.plugins = Object.keys( storage.plugins ); this.props.onChange( "delete" ); }}); } enable() { this.props.plugin.enable = this.props.plugin.enable == undefined || this.props.plugin.enable ? false : true; this.props.onChange( "enable" ); } addmore() { browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.new_tab, { url: "https://simpread.ksria.cn/plugins/details/" + this.props.plugin.id })); } render() { const enable = this.props.plugin.enable == undefined || this.props.plugin.enable ? true : false; return ( by { this.props.plugin.user.name } { this.props.plugin.name }