2018-01-28 23:22:43 +11:00
|
|
|
//設定(setting.html)で読む
|
|
|
|
//設定ボタン押した。
|
|
|
|
function settings() {
|
|
|
|
var dd = $("[name=time]:checked").val();
|
2018-02-24 03:02:44 +11:00
|
|
|
var dt = $("[for="+dd+"]").text();
|
|
|
|
if (dd != localStorage.getItem("datetype")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_time.replace("{{set}}" ,dt), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("datetype", dd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var cd = $("[name=theme]:checked").val();
|
2018-07-07 03:51:48 +10:00
|
|
|
var ct = $("[for="+cd+"]").html();
|
2018-01-28 23:22:43 +11:00
|
|
|
if (cd != localStorage.getItem("theme")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_theme.replace("{{set}}" ,ct), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
//テーマはこの場で設定
|
|
|
|
themes(cd);
|
|
|
|
localStorage.setItem("theme", cd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var nd = $("[name=nsfw]:checked").val();
|
2018-02-24 03:02:44 +11:00
|
|
|
var nt = $("[for=n_"+nd+"]").text();
|
2018-01-28 23:22:43 +11:00
|
|
|
if (nd != localStorage.getItem("nsfw")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_nsfw.replace("{{set}}" ,nt), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("nsfw", nd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var cwd = $("[name=cw]:checked").val();
|
2018-02-24 03:02:44 +11:00
|
|
|
var cwt = $("[for=c_"+cwd+"]").text();
|
2018-01-28 23:22:43 +11:00
|
|
|
if (cwd != localStorage.getItem("cw")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_cw.replace("{{set}}" ,cwt), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("cw", cwd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var cwtd = $("#cw-text").val();
|
|
|
|
if (cwtd != localStorage.getItem("cw-text")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_cwtext.replace("{{set}}" ,cwtd), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("cw-text", cwtd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2018-08-05 13:36:23 +10:00
|
|
|
var cwsd = $("[name=cws]:checked").val();
|
|
|
|
var cwst = $("[for=cws_"+cwsd+"]").text();
|
|
|
|
if (cwsd != localStorage.getItem("always-cw")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_cws.replace("{{set}}" ,cwst), 3000);
|
2018-08-05 13:36:23 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("always-cw", cwsd);
|
|
|
|
|
2018-09-06 02:47:27 +10:00
|
|
|
var rpd = $("[name=rp]:checked").val();
|
|
|
|
var rpt = $("[for=c_"+cwd+"]").text();
|
|
|
|
if (rpd != localStorage.getItem("replyct")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_rp.replace("{{set}}" ,rpt), 3000);
|
2018-09-06 02:47:27 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("replyct", rpd);
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var visd = $("[name=vis]:checked").val();
|
2018-02-24 03:02:44 +11:00
|
|
|
var vist = $("[for="+visd+"]").text();
|
2018-01-28 23:22:43 +11:00
|
|
|
if (visd != localStorage.getItem("vis")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_vis.replace("{{set}}" ,vist), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("vis", visd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var popd = $("#popup").val();
|
|
|
|
if (popd > 0 && popd != localStorage.getItem("popup")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_popup.replace("{{set}}" ,popd+lang.lang_setting_s), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
} else if (popd != localStorage.getItem("popup")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_popup.replace("{{set}}" ,lang.lang_setting_off), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("popup", popd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2018-02-18 18:29:06 +11:00
|
|
|
var gifd = $("[name=gif]:checked").val();
|
2018-02-24 03:02:44 +11:00
|
|
|
var gift = $("[for=g_"+gifd+"]").text();
|
2018-02-18 18:29:06 +11:00
|
|
|
if (gifd != localStorage.getItem("gif")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_gif.replace("{{set}}" ,gift), 3000);
|
2018-02-18 18:29:06 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("gif", gifd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var sentd = $("#sentence").val();
|
2018-02-24 03:02:44 +11:00
|
|
|
var ltrd = $("#letters").val();
|
|
|
|
if (sentd != localStorage.getItem("sentence") || ltrd != localStorage.getItem("letters")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_selt.replace("{{set1}}" ,sentd).replace("{{set2}}" ,ltrd), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("sentence", sentd);
|
2018-02-24 03:02:44 +11:00
|
|
|
localStorage.setItem("letters", ltrd);
|
|
|
|
|
2018-08-23 03:29:39 +10:00
|
|
|
var csentd = $("#cw_sentence").val();
|
|
|
|
var cltrd = $("#cw_letters").val();
|
2018-09-06 02:47:27 +10:00
|
|
|
if (csentd != localStorage.getItem("cw_sentence") || cltrd != localStorage.getItem("cw_letters")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_autocw.replace("{{set1}}" ,csentd).replace("{{set2}}" ,cltrd), 3000);
|
2018-08-23 03:29:39 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("cw_sentence", csentd);
|
|
|
|
localStorage.setItem("cw_letters", cltrd);
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var widthd = $("#width").val();
|
|
|
|
if (widthd != localStorage.getItem("width")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_width.replace("{{set}}" ,widthd), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("width", widthd);
|
2018-02-24 03:02:44 +11:00
|
|
|
|
2019-02-27 03:51:37 +11:00
|
|
|
var fwidthd = $("#fixwidth").val();
|
|
|
|
if (fwidthd != localStorage.getItem("fixwidth")) {
|
|
|
|
Materialize.toast(lang.lang_setting_fixwidth.replace("{{set}}" ,fwidthd), 3000);
|
|
|
|
}
|
|
|
|
localStorage.setItem("fixwidth", fwidthd);
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var imgd = $("[name=img]:checked").val();
|
2018-02-24 03:02:44 +11:00
|
|
|
var imgt = $("[for=i_"+imgd+"]").text();
|
2018-01-28 23:22:43 +11:00
|
|
|
if (imgd != localStorage.getItem("img")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_img.replace("{{set}}" ,imgt), 3000);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2018-03-11 01:22:59 +11:00
|
|
|
localStorage.setItem("img", imgd);
|
|
|
|
|
2018-07-05 11:26:07 +10:00
|
|
|
var fontd = $("#font").val();
|
|
|
|
if(fontd){
|
|
|
|
if (fontd != localStorage.getItem("font")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_font.replace("{{set}}" ,fontd), 3000);
|
2018-07-05 11:26:07 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("font", fontd);
|
|
|
|
themes();
|
|
|
|
}else{
|
2018-07-07 03:51:48 +10:00
|
|
|
if(localStorage.getItem("font")){
|
|
|
|
localStorage.removeItem("font");
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_font.replace("{{set}}" ,lang.lang_setting_default), 3000);
|
2018-07-07 03:51:48 +10:00
|
|
|
themes();
|
|
|
|
}
|
2018-07-05 11:26:07 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-18 03:44:03 +11:00
|
|
|
var sized = $("#size").val();
|
|
|
|
if (sized != localStorage.getItem("size")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_size.replace("{{set}}" ,sized), 3000);
|
2018-02-18 03:44:03 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("size", sized);
|
2018-03-11 01:22:59 +11:00
|
|
|
|
|
|
|
var heid = $("#img-height").val();
|
|
|
|
if (heid != localStorage.getItem("img-height")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_imgheight.replace("{{set}}" ,heid), 3000);
|
2018-03-11 01:22:59 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("img-height", heid);
|
|
|
|
|
2018-12-09 05:46:01 +11:00
|
|
|
var tckrd = $("[name=ticker]:checked").val();
|
|
|
|
var tckrt = $("[for=ticker_"+tckrd+"]").text();
|
|
|
|
if (tckrd != localStorage.getItem("ticker_ok")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_ticker.replace("{{set}}" ,tckrt), 3000);
|
2018-12-09 05:46:01 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("ticker_ok", tckrd);
|
|
|
|
|
2019-03-06 19:08:48 +11:00
|
|
|
var animed = $("[name=anime]:checked").val();
|
|
|
|
var animet = $("[for=anime_"+animed+"]").text();
|
|
|
|
if (animed != localStorage.getItem("animation")) {
|
|
|
|
Materialize.toast(lang.lang_setting_animation.replace("{{set}}" ,animet), 3000);
|
|
|
|
}
|
|
|
|
localStorage.setItem("animation", animed);
|
|
|
|
|
2018-08-05 13:36:23 +10:00
|
|
|
var boxd = $("[name=box]:checked").val();
|
|
|
|
var boxt = $("[for=bx_"+boxd+"]").text();
|
|
|
|
if (boxd != localStorage.getItem("box")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_boxConfirm.replace("{{set}}" ,boxt), 3000);
|
2018-08-05 13:36:23 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("box", boxd);
|
|
|
|
|
2018-03-14 05:31:31 +11:00
|
|
|
var tagd = $("[name=tag]:checked").val();
|
|
|
|
var tagt = $("[for=t_"+tagd+"]").text();
|
|
|
|
if (tagd != localStorage.getItem("tag-range")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_tag.replace("{{set}}" ,tagt), 3000);
|
2018-03-14 05:31:31 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("tag-range", tagd);
|
2018-03-27 13:39:35 +11:00
|
|
|
|
|
|
|
var uld = $("[name=ul]:checked").val();
|
|
|
|
var ult = $("[for=ul_"+uld+"]").text();
|
|
|
|
if (uld != localStorage.getItem("locale")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_ul.replace("{{set}}" ,ult), 3000);
|
2018-03-27 13:39:35 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("locale", uld);
|
2018-03-31 13:39:06 +11:00
|
|
|
|
|
|
|
var ntd = $("[name=notf]:checked").val();
|
|
|
|
var ntt = $("[for=ntf_"+ntd+"]").text();
|
|
|
|
if (ntd != localStorage.getItem("nativenotf")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_notf.replace("{{set}}" ,ntt), 3000);
|
2018-03-31 13:39:06 +11:00
|
|
|
}
|
|
|
|
localStorage.setItem("nativenotf", ntd);
|
2018-04-07 14:31:09 +10:00
|
|
|
|
|
|
|
var qtd = $("[name=quote]:checked").val();
|
|
|
|
var qtt = $("[for=q_"+qtd+"]").text();
|
|
|
|
if (qtd != localStorage.getItem("quote")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_quote.replace("{{set}}" ,qtt), 3000);
|
2018-04-07 14:31:09 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("quote", qtd);
|
2018-05-02 14:14:03 +10:00
|
|
|
|
|
|
|
var viad = $("[name=via]:checked").val();
|
|
|
|
var viat = $("[for=via_"+viad+"]").text();
|
|
|
|
if (viad != localStorage.getItem("viashow")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_via.replace("{{set}}" ,viat), 3000);
|
2018-05-02 14:14:03 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("viashow", viad);
|
|
|
|
|
2018-08-17 03:21:40 +10:00
|
|
|
var notfmd = $("[name=notfm]:checked").val();
|
|
|
|
var notfmt = $("[for=notfm_"+notfmd+"]").text();
|
|
|
|
if (notfmd != localStorage.getItem("setasread")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_setasread.replace("{{set}}" ,notfmt), 3000);
|
2018-08-17 03:21:40 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("setasread", notfmd);
|
|
|
|
|
2018-05-02 14:14:03 +10:00
|
|
|
var movd = $("[name=mov]:checked").val();
|
|
|
|
var movt = $("[for=mov_"+movd+"]").text();
|
|
|
|
if (movd != localStorage.getItem("mouseover")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_mov.replace("{{set}}" ,movt), 3000);
|
2018-05-02 14:14:03 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("mouseover", movd);
|
|
|
|
|
2018-05-20 16:17:10 +10:00
|
|
|
var maind = $("[name=main]:checked").val();
|
|
|
|
var maint = $("[for=mn_"+maind+"]").text();
|
|
|
|
if (maind != localStorage.getItem("mainuse")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_main.replace("{{set}}" ,maint), 3000);
|
2018-05-20 16:17:10 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("mainuse", maind);
|
2018-09-17 21:55:00 +10:00
|
|
|
|
|
|
|
var secd = $("[name=sec]:checked").val();
|
|
|
|
var sect = $("[for=sec-"+secd+"]").text();
|
|
|
|
if (secd != localStorage.getItem("sec")) {
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_sec.replace("{{set}}" ,sect), 3000);
|
2018-09-17 21:55:00 +10:00
|
|
|
}
|
|
|
|
localStorage.setItem("sec", secd);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
//読み込み時の設定ロード
|
|
|
|
function load() {
|
2018-07-07 03:51:48 +10:00
|
|
|
if(localStorage.getItem("imas")){
|
2018-04-16 23:58:14 +10:00
|
|
|
$(".imas").removeClass("hide");
|
|
|
|
}
|
2018-07-30 03:35:29 +10:00
|
|
|
if(localStorage.getItem("kirishima")){
|
|
|
|
$(".kirishima").removeClass("hide");
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
var prof = localStorage.getItem("prof");
|
|
|
|
$("#my-prof").attr("src", prof);
|
|
|
|
var datetype = localStorage.getItem("datetype");
|
|
|
|
if (!datetype) {
|
|
|
|
var datetype = "absolute";
|
|
|
|
}
|
|
|
|
$("#" + datetype).prop("checked", true);
|
|
|
|
|
|
|
|
var theme = localStorage.getItem("theme");
|
|
|
|
if (!theme) {
|
|
|
|
var theme = "white";
|
|
|
|
}
|
|
|
|
$("#" + theme).prop("checked", true);
|
|
|
|
|
|
|
|
var nsfw = localStorage.getItem("nsfw");
|
|
|
|
if (!nsfw) {
|
|
|
|
var nsfw = "yes";
|
|
|
|
}
|
|
|
|
$("#n_" + nsfw).prop("checked", true);
|
|
|
|
|
|
|
|
var cw = localStorage.getItem("cw");
|
|
|
|
if (!cw) {
|
|
|
|
var cw = "yes";
|
|
|
|
}
|
|
|
|
$("#c_" + cw).prop("checked", true);
|
|
|
|
|
2018-08-05 13:36:23 +10:00
|
|
|
var cws = localStorage.getItem("always-cw");
|
|
|
|
if (!cws) {
|
|
|
|
var cws = "no";
|
|
|
|
}
|
|
|
|
$("#cws_" + cws).prop("checked", true);
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var popup = localStorage.getItem("popup");
|
|
|
|
if (!popup) {
|
|
|
|
var popup = "0";
|
|
|
|
}
|
|
|
|
$("#popup").val(popup);
|
|
|
|
|
|
|
|
var box = localStorage.getItem("box");
|
|
|
|
if (!box) {
|
|
|
|
var box = "no";
|
|
|
|
}
|
2018-08-05 13:36:23 +10:00
|
|
|
if(box=="absolute"){
|
|
|
|
var box = "abs";
|
|
|
|
}
|
|
|
|
$("#bx_" + box).prop("checked", true);
|
2018-01-28 23:22:43 +11:00
|
|
|
|
2018-02-18 18:29:06 +11:00
|
|
|
var gif = localStorage.getItem("gif");
|
|
|
|
if (!gif) {
|
|
|
|
var gif = "yes";
|
|
|
|
}
|
|
|
|
$("#g_" + gif).prop("checked", true);
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var sent = localStorage.getItem("sentence");
|
|
|
|
if (!sent) {
|
|
|
|
var sent = "500";
|
|
|
|
}
|
|
|
|
$("#sentence").val(sent);
|
2018-02-24 03:02:44 +11:00
|
|
|
var ltrs = localStorage.getItem("letters");
|
|
|
|
if (!ltrs) {
|
|
|
|
var ltrs = "500";
|
|
|
|
}
|
|
|
|
$("#letters").val(ltrs);
|
2018-01-28 23:22:43 +11:00
|
|
|
|
2018-08-23 03:29:39 +10:00
|
|
|
var csent = localStorage.getItem("cw_sentence");
|
|
|
|
if (!csent) {
|
|
|
|
var csent = "500";
|
|
|
|
}
|
|
|
|
$("#cw_sentence").val(csent);
|
|
|
|
var cltrs = localStorage.getItem("cw_letters");
|
|
|
|
if (!cltrs) {
|
|
|
|
var cltrs = "500";
|
|
|
|
}
|
|
|
|
$("#cw_letters").val(cltrs);
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var width = localStorage.getItem("width");
|
|
|
|
if (!width) {
|
|
|
|
var width = "300";
|
|
|
|
}
|
|
|
|
$("#width").val(width);
|
|
|
|
|
2019-02-27 03:51:37 +11:00
|
|
|
var fwidth = localStorage.getItem("fixwidth");
|
|
|
|
if (!fwidth) {
|
|
|
|
var fwidth = "0";
|
|
|
|
}
|
|
|
|
$("#fixwidth").val(fwidth);
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var cwt = localStorage.getItem("cw-text");
|
|
|
|
if (!cwt) {
|
|
|
|
var cwt = "";
|
|
|
|
}
|
|
|
|
$("#cw-text").val(cwt);
|
|
|
|
|
2018-08-05 13:36:23 +10:00
|
|
|
var cws = localStorage.getItem("always-cw");
|
|
|
|
if (!cws) {
|
|
|
|
var cws = "no";
|
|
|
|
}
|
|
|
|
$("#cws_" + cws).prop("checked", true);
|
|
|
|
|
2018-09-06 02:47:27 +10:00
|
|
|
var rps = localStorage.getItem("replyct");
|
|
|
|
if (!rps) {
|
|
|
|
var rps = "hidden";
|
|
|
|
}
|
|
|
|
$("#rp_" + rps).prop("checked", true);
|
|
|
|
|
2018-01-28 23:22:43 +11:00
|
|
|
var vis = localStorage.getItem("vis");
|
|
|
|
if (!vis) {
|
|
|
|
var vis = "public";
|
|
|
|
}
|
|
|
|
$("#" + vis).prop("checked", true);
|
|
|
|
|
|
|
|
var img = localStorage.getItem("img");
|
|
|
|
if (!img) {
|
|
|
|
var img = "no-act";
|
|
|
|
}
|
|
|
|
$("#i_" + img).prop("checked", true);
|
2018-07-05 11:26:07 +10:00
|
|
|
|
|
|
|
var font = localStorage.getItem("font");
|
|
|
|
if (!font) {
|
|
|
|
var font = "";
|
|
|
|
}
|
|
|
|
$("#font").val(font);
|
2018-02-18 03:44:03 +11:00
|
|
|
|
|
|
|
var size = localStorage.getItem("size");
|
|
|
|
if (!size) {
|
2018-03-21 16:36:02 +11:00
|
|
|
var size = "13";
|
2018-02-18 03:44:03 +11:00
|
|
|
}
|
|
|
|
$("#size").val(size);
|
|
|
|
|
2018-03-11 01:22:59 +11:00
|
|
|
var imh = localStorage.getItem("img-height");
|
|
|
|
if (!imh) {
|
|
|
|
var imh = "200";
|
|
|
|
}
|
|
|
|
$("#img-height").val(imh);
|
2018-03-14 05:31:31 +11:00
|
|
|
|
2019-02-27 03:51:37 +11:00
|
|
|
var ticker = localStorage.getItem("ticker_ok");
|
2018-12-09 05:46:01 +11:00
|
|
|
if (!ticker) {
|
|
|
|
var ticker = "no";
|
|
|
|
}
|
|
|
|
$("#ticker_" + ticker).prop("checked", true);
|
|
|
|
|
2019-03-06 19:08:48 +11:00
|
|
|
var animation = localStorage.getItem("animation");
|
|
|
|
if (!animation) {
|
|
|
|
var animation = "yes";
|
|
|
|
}
|
|
|
|
$("#anime_" + animation).prop("checked", true);
|
|
|
|
|
2018-03-14 05:31:31 +11:00
|
|
|
var tag = localStorage.getItem("tag-range");
|
|
|
|
if (!tag) {
|
|
|
|
var tag = "all";
|
|
|
|
}
|
|
|
|
$("#t_" + tag).prop("checked", true);
|
2018-03-27 13:39:35 +11:00
|
|
|
|
2018-08-05 13:36:23 +10:00
|
|
|
var box = localStorage.getItem("box");
|
|
|
|
if (!box) {
|
|
|
|
var box = "yes";
|
|
|
|
}
|
|
|
|
$("#bx_" + box).prop("checked", true);
|
|
|
|
|
2018-03-27 13:39:35 +11:00
|
|
|
var uld = localStorage.getItem("locale");
|
|
|
|
if (!uld) {
|
|
|
|
var uld = "yes";
|
|
|
|
}
|
|
|
|
$("#ul_" + uld).prop("checked", true);
|
2018-03-31 13:39:06 +11:00
|
|
|
|
|
|
|
var nnd = localStorage.getItem("nativenotf");
|
|
|
|
if (!nnd) {
|
|
|
|
var nnd = "yes";
|
|
|
|
}
|
|
|
|
$("#ntf_" + nnd).prop("checked", true);
|
2018-04-07 14:31:09 +10:00
|
|
|
|
|
|
|
var qt = localStorage.getItem("quote");
|
|
|
|
if (!qt) {
|
|
|
|
var qt = "simple";
|
|
|
|
}
|
|
|
|
$("#q_" + qt).prop("checked", true);
|
2018-05-02 14:14:03 +10:00
|
|
|
|
|
|
|
var viat = localStorage.getItem("viashow");
|
|
|
|
if (!viat) {
|
|
|
|
var viat = "hide";
|
|
|
|
}
|
|
|
|
$("#via_" + viat).prop("checked", true);
|
|
|
|
|
|
|
|
var movt = localStorage.getItem("mouseover");
|
|
|
|
if (!movt) {
|
|
|
|
var movt = "no";
|
|
|
|
}
|
|
|
|
$("#mov_" + movt).prop("checked", true);
|
2018-05-20 16:17:10 +10:00
|
|
|
|
2018-08-17 03:21:40 +10:00
|
|
|
var notfmt = localStorage.getItem("setasread");
|
|
|
|
if (!notfmt) {
|
|
|
|
var notfmt = "yes";
|
|
|
|
}
|
|
|
|
$("#notfm_" + notfmt).prop("checked", true);
|
|
|
|
|
2018-05-20 16:17:10 +10:00
|
|
|
var maint = localStorage.getItem("mainuse");
|
|
|
|
if (!maint) {
|
|
|
|
var maint = "remain";
|
|
|
|
}
|
|
|
|
$("#mn_" + maint).prop("checked", true);
|
2018-09-17 21:55:00 +10:00
|
|
|
|
|
|
|
var sect = localStorage.getItem("sec");
|
|
|
|
if (!sect) {
|
|
|
|
var sect = "nothing";
|
|
|
|
}
|
|
|
|
$("#sec-" + sect).prop("checked", true);
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
//最初に読む
|
2018-03-11 01:22:59 +11:00
|
|
|
load();
|
|
|
|
climute();
|
|
|
|
wordmute();
|
|
|
|
wordemp();
|
2018-03-15 06:42:48 +11:00
|
|
|
checkSpotify();
|
2018-07-22 23:03:46 +10:00
|
|
|
voiceSettingLoad();
|
2018-06-12 01:44:28 +10:00
|
|
|
oksload();
|
2019-01-27 01:27:35 +11:00
|
|
|
npprovider();
|
2018-03-11 01:22:59 +11:00
|
|
|
function climute(){
|
|
|
|
//クライアントミュート
|
|
|
|
var cli = localStorage.getItem("client_mute");
|
|
|
|
var obj = JSON.parse(cli);
|
|
|
|
if(!obj){
|
2019-01-26 14:24:26 +11:00
|
|
|
$("#mute-cli").html(lang.lang_setting_nomuting);
|
2018-03-11 01:22:59 +11:00
|
|
|
}else{
|
|
|
|
if(!obj[0]){
|
2019-01-26 14:24:26 +11:00
|
|
|
$("#mute-cli").html(lang.lang_setting_nomuting);
|
2018-03-11 01:22:59 +11:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
var templete;
|
|
|
|
Object.keys(obj).forEach(function(key) {
|
|
|
|
var cli = obj[key];
|
|
|
|
var list = key * 1 + 1;
|
|
|
|
templete = '<div class="acct" id="acct_' + key + '">' + list +
|
|
|
|
'.' +
|
|
|
|
cli + '<button class="btn waves-effect red disTar" onclick="cliMuteDel(' +
|
2019-01-26 14:24:26 +11:00
|
|
|
key + ')">'+lang.lang_del+'</button><br></div>';
|
2018-03-11 01:22:59 +11:00
|
|
|
$("#mute-cli").append(templete);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function cliMuteDel(key){
|
|
|
|
var cli = localStorage.getItem("client_mute");
|
|
|
|
var obj = JSON.parse(cli);
|
|
|
|
obj.splice(key, 1);
|
|
|
|
var json = JSON.stringify(obj);
|
|
|
|
localStorage.setItem("client_mute", json);
|
|
|
|
mute();
|
|
|
|
}
|
|
|
|
|
|
|
|
function wordmute(){
|
|
|
|
var word = localStorage.getItem("word_mute");
|
|
|
|
var obj = JSON.parse(word);
|
|
|
|
$('#wordmute').material_chip({
|
|
|
|
data: obj,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function wordmuteSave(){
|
|
|
|
var word=$('#wordmute').material_chip('data');
|
|
|
|
var json = JSON.stringify(word);
|
|
|
|
localStorage.setItem("word_mute", json);
|
|
|
|
}
|
|
|
|
|
|
|
|
function wordemp(){
|
|
|
|
var word = localStorage.getItem("word_emp");
|
|
|
|
var obj = JSON.parse(word);
|
|
|
|
$('#wordemp').material_chip({
|
|
|
|
data: obj,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function wordempSave(){
|
|
|
|
var word=$('#wordemp').material_chip('data');
|
|
|
|
var json = JSON.stringify(word);
|
|
|
|
localStorage.setItem("word_emp", json);
|
2018-05-26 05:00:04 +10:00
|
|
|
}
|
|
|
|
function notftest(){
|
2018-08-05 02:26:34 +10:00
|
|
|
var electron = require("electron");
|
2018-05-26 05:00:04 +10:00
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
var os = electron.remote.process.platform;
|
|
|
|
var options = {
|
2019-01-26 14:24:26 +11:00
|
|
|
body: lang.lang_setting_notftest+'('+lang.lang_setting_notftestprof+')',
|
2018-05-26 05:00:04 +10:00
|
|
|
icon: localStorage.getItem("prof_0")
|
|
|
|
};
|
|
|
|
if(os=="darwin"){
|
2019-01-26 14:24:26 +11:00
|
|
|
var n = new Notification('TheDesk'+lang.lang_setting_notftest, options);
|
2018-05-26 05:00:04 +10:00
|
|
|
}else{
|
2019-01-26 14:24:26 +11:00
|
|
|
ipc.send('native-notf', ['TheDesk'+lang.lang_setting_notftest,lang.lang_setting_notftest+'('+lang.lang_setting_notftestprof+')',localStorage.getItem('prof_0'),"",""]);
|
2018-05-26 05:00:04 +10:00
|
|
|
}
|
|
|
|
|
2018-06-12 01:44:28 +10:00
|
|
|
}
|
|
|
|
function oks(no){
|
|
|
|
var txt=$("#oks-"+no).val();
|
|
|
|
localStorage.setItem("oks-"+no, txt);
|
2019-01-26 14:24:26 +11:00
|
|
|
Materialize.toast(lang.lang_setting_ksref, 3000);
|
2018-06-12 01:44:28 +10:00
|
|
|
}
|
|
|
|
function oksload(){
|
|
|
|
if(localStorage.getItem("oks-1")){$("#oks-1").val(localStorage.getItem("oks-1"))}
|
|
|
|
if(localStorage.getItem("oks-2")){$("#oks-2").val(localStorage.getItem("oks-2"))}
|
|
|
|
if(localStorage.getItem("oks-3")){$("#oks-3").val(localStorage.getItem("oks-3"))}
|
2018-08-05 02:26:34 +10:00
|
|
|
}
|
2018-09-12 02:49:41 +10:00
|
|
|
function changelang(lang){
|
|
|
|
var electron = require("electron");
|
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
ipc.send('lang',lang);
|
|
|
|
ipc.on('langres', function (event, arg) {
|
|
|
|
location.href="../"+lang+"/setting.html"
|
|
|
|
});
|
|
|
|
}
|
2018-08-05 02:26:34 +10:00
|
|
|
function exportSettings(){
|
2019-01-26 14:24:26 +11:00
|
|
|
if(!confirm(lang.lang_setting_exportwarn)){
|
2018-08-05 02:26:34 +10:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
var electron = require("electron");
|
|
|
|
var remote=electron.remote;
|
|
|
|
var dialog=remote.dialog;
|
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
dialog.showSaveDialog(null, {
|
|
|
|
title: 'Export',
|
|
|
|
properties: ['openFile', 'createDirectory'],
|
|
|
|
defaultPath: "export.thedeskconfig"
|
|
|
|
}, (savedFiles) => {
|
|
|
|
console.log(savedFiles);
|
|
|
|
if(!savedFiles){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
var exp={};
|
|
|
|
//Accounts
|
|
|
|
var multi = localStorage.getItem("multi");
|
|
|
|
var acct = JSON.parse(multi);
|
|
|
|
exp.accts=acct;
|
|
|
|
//Columns
|
|
|
|
var multi = localStorage.getItem("column");
|
|
|
|
var column = JSON.parse(multi);
|
|
|
|
exp.columns=column;
|
|
|
|
//Themes
|
|
|
|
exp.theme=localStorage.getItem("theme");
|
|
|
|
//Min width
|
|
|
|
exp.minwidth=localStorage.getItem("width");
|
|
|
|
//Font
|
|
|
|
exp.font=localStorage.getItem("font");
|
|
|
|
exp.size=localStorage.getItem("size");
|
|
|
|
//Img height
|
|
|
|
exp.imgheight=localStorage.getItem("img-height");
|
|
|
|
//Main
|
|
|
|
exp.mainuse=localStorage.getItem("mainuse");
|
|
|
|
//CW text
|
|
|
|
exp.cw=localStorage.getItem("cw-text");
|
|
|
|
//vis
|
|
|
|
exp.vis=localStorage.getItem("vis");
|
|
|
|
//keysc
|
|
|
|
exp.ksc=[
|
|
|
|
localStorage.getItem("oks-1"),
|
|
|
|
localStorage.getItem("oks-2"),
|
|
|
|
localStorage.getItem("oks-3")
|
|
|
|
];
|
|
|
|
//climu
|
|
|
|
var cli = localStorage.getItem("client_mute");
|
|
|
|
var climu = JSON.parse(cli);
|
|
|
|
exp.clientMute=climu;
|
|
|
|
//wordmu
|
|
|
|
var wdm = localStorage.getItem("word_mute");
|
|
|
|
var wordmu = JSON.parse(wdm);
|
|
|
|
exp.wordMute=wordmu;
|
|
|
|
//spotify
|
|
|
|
exp.spotifyArtwork=localStorage.getItem("artwork")
|
2018-08-29 20:17:34 +10:00
|
|
|
var content=localStorage.getItem("np-temp");
|
|
|
|
if(content || content=="" || content=="null"){
|
|
|
|
exp.spotifyTemplete=content;
|
|
|
|
}else{
|
|
|
|
exp.spotifyTemplete=null;
|
|
|
|
}
|
2018-08-05 02:26:34 +10:00
|
|
|
//tags
|
|
|
|
var tagarr = localStorage.getItem("tag");
|
|
|
|
var favtag = JSON.parse(tagarr);
|
|
|
|
exp.favoriteTags=favtag;
|
|
|
|
console.log(exp);
|
|
|
|
ipc.send('export', [savedFiles,JSON.stringify(exp)]);
|
|
|
|
alert("Done.")
|
|
|
|
//cards
|
|
|
|
//lang
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function importSettings(){
|
2019-01-26 14:24:26 +11:00
|
|
|
if(!confirm(lang.lang_setting_importwarn)){
|
2018-08-05 02:26:34 +10:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
var electron = require("electron");
|
|
|
|
var remote=electron.remote;
|
|
|
|
var dialog=remote.dialog;
|
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
dialog.showOpenDialog(null, {
|
|
|
|
title: 'Import',
|
|
|
|
properties: ['openFile'],
|
|
|
|
filters: [
|
|
|
|
{name: 'TheDesk Config', extensions: ['thedeskconfig']},
|
|
|
|
]
|
|
|
|
}, (fileNames) => {
|
|
|
|
console.log(fileNames);
|
|
|
|
if(!fileNames){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
ipc.send('import', fileNames[0]);
|
|
|
|
ipc.on('config', function (event, arg) {
|
|
|
|
var obj = JSON.parse(arg);
|
|
|
|
if(obj){
|
|
|
|
localStorage.clear();
|
|
|
|
localStorage.setItem("multi",JSON.stringify(obj.accts));
|
|
|
|
for(var key=0;key<obj.accts.length;key++){
|
|
|
|
var acct=obj.accts[key];
|
|
|
|
localStorage.setItem("name_" + key, acct.name);
|
|
|
|
localStorage.setItem("user_" + key, acct.user);
|
|
|
|
localStorage.setItem("user-id_" + key, acct.id);
|
|
|
|
localStorage.setItem("prof_" + key, acct.prof);
|
|
|
|
localStorage.setItem("domain_" + key, acct.domain);
|
|
|
|
localStorage.setItem("acct_"+ key + "_at", acct.at);
|
|
|
|
}
|
|
|
|
localStorage.setItem("column",JSON.stringify(obj.columns));
|
|
|
|
localStorage.setItem("theme",obj.theme);
|
|
|
|
if(obj.width){
|
|
|
|
console.log(obj.width)
|
|
|
|
localStorage.setItem("width",obj.width);
|
|
|
|
}
|
|
|
|
if(obj.font){
|
|
|
|
localStorage.setItem("font",obj.font);
|
|
|
|
}
|
|
|
|
if(obj.size){
|
|
|
|
localStorage.setItem("size",obj.size);
|
|
|
|
}
|
|
|
|
themes(obj.theme);
|
|
|
|
if(obj.imgheight){
|
|
|
|
localStorage.setItem("img-height",obj.imgheight);
|
|
|
|
}
|
|
|
|
localStorage.setItem("mainuse",obj.mainuse);
|
|
|
|
if(obj.cw){
|
|
|
|
localStorage.setItem("cwtext",obj.cw);
|
|
|
|
}
|
|
|
|
localStorage.setItem("vis",obj.vis);
|
|
|
|
if(obj.ksc[0]){
|
|
|
|
localStorage.setItem("oks-1",obj.ksc[0]);
|
|
|
|
}
|
|
|
|
if(obj.ksc[1]){
|
|
|
|
localStorage.setItem("oks-2",obj.ksc[1]);
|
|
|
|
}
|
|
|
|
if(obj.ksc[2]){
|
|
|
|
localStorage.setItem("oks-3",obj.ksc[2]);
|
|
|
|
}
|
|
|
|
if(obj.clientMute){
|
|
|
|
localStorage.setItem("client_mute",JSON.stringify(obj.clientMute));
|
|
|
|
}
|
|
|
|
if(obj.wordMute){
|
|
|
|
localStorage.setItem("word_mute",JSON.stringify(obj.wordMute));
|
|
|
|
}
|
|
|
|
if(obj.favoriteTags){
|
|
|
|
localStorage.setItem("tag",JSON.stringify(obj.favoriteTags));
|
|
|
|
}
|
2018-08-29 20:17:34 +10:00
|
|
|
|
2018-08-05 02:26:34 +10:00
|
|
|
localStorage.setItem("np-temp",obj.spotifyTemplete);
|
|
|
|
for(var i=0;i<obj.columns.length;i++){
|
|
|
|
localStorage.setItem("card_" + i,"true");
|
|
|
|
localStorage.removeItem("catch_" + i);
|
|
|
|
}
|
|
|
|
location.href="language.html";
|
|
|
|
}else{
|
|
|
|
alert("Error.")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
//cards
|
|
|
|
//lang
|
|
|
|
});
|
2018-09-06 02:47:27 +10:00
|
|
|
}
|
|
|
|
function savefolder(){
|
|
|
|
var electron = require("electron");
|
|
|
|
var remote=electron.remote;
|
|
|
|
var dialog=remote.dialog;
|
|
|
|
dialog.showOpenDialog(null, {
|
|
|
|
title: 'Save folder',
|
|
|
|
properties: ['openDirectory'],
|
|
|
|
}, (fileNames) => {
|
|
|
|
localStorage.setItem("savefolder",fileNames[0]);
|
|
|
|
});
|
2018-12-09 05:46:01 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
function font(){
|
|
|
|
var electron = require("electron");
|
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
ipc.send('fonts', []);
|
|
|
|
ipc.on('font-list', function (event, arg) {
|
|
|
|
$("#fonts").removeClass("hide");
|
|
|
|
for( var i=0; i<arg.length; i++) {
|
|
|
|
var font=arg[i];
|
|
|
|
$("#fonts").append('<div class="font pointer" style="font-family:'+font.family+'" onclick="insertFont(\''+font.family+'\')">'+font.family+"</div>")
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function insertFont(name){
|
|
|
|
$("#font").val(name);
|
2018-03-11 01:22:59 +11:00
|
|
|
}
|