Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function vernotify( first ) {
const hash = location.hash;
if ( hash.startsWith( "#firstload?ver=" ) || hash.startsWith( "#update?ver=" ) ) {
const prefix = hash.match( /\w+/ )[0],
version = hash.match( /[0-9\.]+/ )[0],
msg = ver.Notify( first, prefix, version );
new Notify().Render( "简悦 版本提示", msg );
loadState = { first: true };
if ( hash.startsWith( "#update?ver=" )) {
watch.SendMessage( "version", true );
loadState = { first: true, update: true };
welcomeRender( false, version );
///////////////////////////////////////////////////////////////////////////
// hard code
// option.origins rework
storage.option.origins = storage.option.origins.filter( item => item != "http://sr.ksria.cn/origins/website_list_en.json" && item != "http://sr.ksria.cn/origins/website_list_tw.json" )
if ( storage.option.origins.length > 0 ) {
new Notify().Render( `检测到你曾经修改过第三方适配源,请重新导入,详细说明 <a href="http://ksria.com/simpread/docs/#/站点适配源?id=重新导入">请看这里</a>`, "确认", () => {
tabChange( 3 );
});
}
///////////////////////////////////////////////////////////////////////////
// verify and remove old plugins
ver.VerifyPlugins( storage.option, version ) && storage.Write( () => {
new Notify().Render({ content: `新版升级后,会自动删除一些已失效的插件,详细请看 <a href="http://ksria.com/simpread/welcome/version_${version}.html#badplugins">自定义主题</a>`, state: "holdon" });
}, storage.simpread );
flag != -1 && storage.Writesite( pr.sites, ()=> {
console.log( "current site is ", cur_site, org_site )
watch.SendMessage( "site", true );
new Notify().Render( `当前站点${ flag == 0 ? "更新" : "删除" }成功,请刷新本页。` );
});
};
storage.Write( () => {
console.log( "current user info is ", storage.user )
this.setState({ uid_err : "" });
watch.SendMessage( "option", true );
}, storage.simpread );
}
storage.Writesite( storage.pr.sites, ()=> {
console.log( "current site is ", storage.pr.sites )
watch.SendMessage( "site", true );
new Notify().Render( "已成功切到换到此适配站点,请刷新本页。" );
});
}
storage.Write( () => {
console.log( "current notice is ", storage.notice )
watch.SendMessage( "option", true );
callback && callback();
});
}
storage.Write( () => {
watch.SendMessage( "option", true );
state == "clear" ?
new Notify().Render( "snackbar", "清除成功,此页面需刷新后才能生效!", "刷新 ", ()=>{
location.href = location.origin + location.pathname;
})
: new Notify().Render( 0, "保存成功,页面刷新后生效!" );
});
};
storage.Write( ()=> {
watch.SendMessage( "option", true );
state && new Notify().Render( 0, "保存成功,页面刷新后生效!" );
});
};
writecb() {
watch.SendMessage( "option", true );
}