diff --git a/app/js/lang/lang.en.js b/app/js/lang/lang.en.js index 48c12bf6..ca328d8b 100644 --- a/app/js/lang/lang.en.js +++ b/app/js/lang/lang.en.js @@ -37,6 +37,7 @@ var lang = { "lang_manager_def": "Default", "lang_manager_none": "None", "lang_manager_godev": "Open DevCenter of Misskey. We show also an official documents to refer.", + "lang_manager_logout": "Logout", //post/bb-md.js "lang_bbmd_misskey": "TheDesk regards \"@\" as reply, but put other parameter. Unlisted on Mastodon means Home on Misskey.", //post/emoji.js @@ -64,6 +65,7 @@ var lang = { "lang_status_unblock": "Unblock", "lang_status_mute": "Mute", "lang_status_unmute": "Unmute", + "lang_status_redraftTitle": "Delete & redraft", "lang_status_redraft": "Continue to delete & redraft? You lose statuses of this toot. This fanction may contain some bugs. Images of this toot will be deleted on older than Mastodon 2.4.1.", "lang_status_emphas": "'s toots are emphasized. Please reload after this action.", "lang_status_unemphas": "'s toots are not emphasized. Please reload after this action.", diff --git a/app/js/lang/lang.ja.js b/app/js/lang/lang.ja.js index 3891a719..80e70a5f 100644 --- a/app/js/lang/lang.ja.js +++ b/app/js/lang/lang.ja.js @@ -37,6 +37,7 @@ var lang = { "lang_manager_def": "既定", "lang_manager_none": "なし", "lang_manager_godev": "MisskeyのDevセンターに移動します。同時に開かれるドキュメントを参考にログインしてください。", + "lang_manager_logout": "ログアウト", //post/bb-md.js "lang_bbmd_misskey": "TheDeskにおけるMisskeyでは、@を返信として扱いますが、全ての@は消去され別パラメータに入力されます。また、「未収載」を「ホーム」として扱います。", //post/emoji.js @@ -64,6 +65,7 @@ var lang = { "lang_status_unblock": "ブロック解除", "lang_status_mute": "ミュート", "lang_status_unmute": "ミュート解除", + "lang_status_redraftTitle": "削除して再編集", "lang_status_redraft": "削除して再編集しますか?そのトゥートの全てのデータがリセットされます。この機能はベータ版です。画像は~v2.4.1で破棄されます。", "lang_status_emphas": "を強調します。リロードしてください。", "lang_status_unemphas": "を強調解除します。リロードしてください。", diff --git a/app/js/login/manager.js b/app/js/login/manager.js index 872b836e..893b684e 100644 --- a/app/js/login/manager.js +++ b/app/js/login/manager.js @@ -146,114 +146,136 @@ function multiDel(target) { var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); //削除確認ダイアログ - if (confirm(obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm)) { - Object.keys(obj).forEach(function (key) { - var nk = key - 1; - //公開範囲(差分のみ) - if (key >= target) { - var oldvis = localStorage.getItem("vis-memory-" + key); - if (oldvis) { - localStorage.setItem("vis-memory-" + nk, oldvis); + Swal.fire({ + title: lang.lang_manager_logout, + text: obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm, + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: lang.lang_yesno, + cancelButtonText: lang.lang_no + }).then((result) => { + if (result.value) { + Object.keys(obj).forEach(function (key) { + var nk = key - 1; + //公開範囲(差分のみ) + if (key >= target) { + var oldvis = localStorage.getItem("vis-memory-" + key); + if (oldvis) { + localStorage.setItem("vis-memory-" + nk, oldvis); + } + } + //独自ロケール + localStorage.removeItem("home_" + key); + localStorage.removeItem("local_" + key); + localStorage.removeItem("public_" + key); + localStorage.removeItem("notification_" + key); + //アクセストークンとドメイン、プロフ(差分) + if (key > target) { + var olddom = localStorage.getItem("domain_" + key); + localStorage.setItem("domain_" + nk, olddom); + var oldat = localStorage.getItem("acct_" + key + "_at"); + localStorage.setItem("acct_" + nk + "_at", oldat); + localStorage.setItem("name_" + nk, localStorage.getItem("name_" + key)); + localStorage.setItem("user_" + target, localStorage.getItem("user_" + key)); + localStorage.setItem("user-id_" + target, localStorage.getItem("user-id_" + key)); + localStorage.setItem("prof_" + target, localStorage.getItem("prof_" + key)); } - } - //独自ロケール - localStorage.removeItem("home_" + key); - localStorage.removeItem("local_" + key); - localStorage.removeItem("public_" + key); - localStorage.removeItem("notification_" + key); - //アクセストークンとドメイン、プロフ(差分) - if (key > target) { - var olddom = localStorage.getItem("domain_" + key); - localStorage.setItem("domain_" + nk, olddom); - var oldat = localStorage.getItem("acct_" + key + "_at"); - localStorage.setItem("acct_" + nk + "_at", oldat); - localStorage.setItem("name_" + nk, localStorage.getItem("name_" + key)); - localStorage.setItem("user_" + target, localStorage.getItem("user_" + key)); - localStorage.setItem("user-id_" + target, localStorage.getItem("user-id_" + key)); - localStorage.setItem("prof_" + target, localStorage.getItem("prof_" + key)); - } - }); - //とりあえず消す - obj.splice(target, 1); - var json = JSON.stringify(obj); - localStorage.setItem("multi", json); - load(); - //カラムデータコンフリクト - var col = localStorage.getItem("column"); - var oldcols = JSON.parse(col); - var newcols = []; - Object.keys(oldcols).forEach(function (key) { - var nk = key - 1; - var oldcol = oldcols[key]; - if (target < oldcol.domain) { - var newdom = oldcol.domain - 1; - } else { - var newdom = oldcol.domain; - } - var type = oldcol.type; - //消した垢のコラムじゃないときコピー - if (target != oldcol.domain) { - var add = { - domain: newdom, - type: type - }; - newcols.push(add); - } - }); - var json = JSON.stringify(newcols); - localStorage.setItem("column", json); + }); + //とりあえず消す + obj.splice(target, 1); + var json = JSON.stringify(obj); + localStorage.setItem("multi", json); + load(); + //カラムデータコンフリクト + var col = localStorage.getItem("column"); + var oldcols = JSON.parse(col); + var newcols = []; + Object.keys(oldcols).forEach(function (key) { + var nk = key - 1; + var oldcol = oldcols[key]; + if (target < oldcol.domain) { + var newdom = oldcol.domain - 1; + } else { + var newdom = oldcol.domain; + } + var type = oldcol.type; + //消した垢のコラムじゃないときコピー + if (target != oldcol.domain) { + var add = { + domain: newdom, + type: type + }; + newcols.push(add); + } + }); + var json = JSON.stringify(newcols); + localStorage.setItem("column", json); - } + } + }) } function multiDel2(target) { var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); - if (confirm(obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm)) { - obj.splice(target, 1); - var json = JSON.stringify(obj); - localStorage.setItem("multi", json); - Object.keys(obj).forEach(function (key) { - if (key >= target) { - var oldvis = localStorage.getItem("vis-memory-" + key); - if (oldvis) { - var nk = key - 1; - localStorage.setItem("vis-memory-" + nk, oldvis); - } - } - localStorage.removeItem("home_" + key); - localStorage.removeItem("local_" + key); - localStorage.removeItem("public_" + key); - localStorage.removeItem("notification_" + key); - refresh(key); - }); - var col = localStorage.getItem("column"); - if (!col) { - var obj = [{ - domain: 0, - type: 'local' - }]; - localStorage.setItem("card_0", "true"); + Swal.fire({ + title: lang.lang_manager_logout, + text: obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm, + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: lang.lang_yesno, + cancelButtonText: lang.lang_no + }).then((result) => { + if (result.value) { + obj.splice(target, 1); var json = JSON.stringify(obj); - localStorage.setItem("column", json); - } else { - var cobj = JSON.parse(col); - } - Object.keys(cobj).forEach(function (key) { - var column = cobj[key]; - if (column.domain > target) { - var nk = key - 1; - column.domain = nk; - cobj[key] = column; - } else if (column.domain == target) { - localStorage.removeItem("card_" + tlid); - cobj.splice(key, 1); + localStorage.setItem("multi", json); + Object.keys(obj).forEach(function (key) { + if (key >= target) { + var oldvis = localStorage.getItem("vis-memory-" + key); + if (oldvis) { + var nk = key - 1; + localStorage.setItem("vis-memory-" + nk, oldvis); + } + } + localStorage.removeItem("home_" + key); + localStorage.removeItem("local_" + key); + localStorage.removeItem("public_" + key); + localStorage.removeItem("notification_" + key); + refresh(key); + }); + var col = localStorage.getItem("column"); + if (!col) { + var obj = [{ + domain: 0, + type: 'local' + }]; + localStorage.setItem("card_0", "true"); + var json = JSON.stringify(obj); + localStorage.setItem("column", json); + } else { + var cobj = JSON.parse(col); } - }); - var json = JSON.stringify(column); - localStorage.setItem("column", json); - load(); - } + Object.keys(cobj).forEach(function (key) { + var column = cobj[key]; + if (column.domain > target) { + var nk = key - 1; + column.domain = nk; + cobj[key] = column; + } else if (column.domain == target) { + localStorage.removeItem("card_" + tlid); + cobj.splice(key, 1); + } + }); + var json = JSON.stringify(column); + localStorage.setItem("column", json); + load(); + } + }) } //サポートインスタンス diff --git a/app/js/platform/end.js b/app/js/platform/end.js index f81cfa8e..afd1fe2e 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -121,49 +121,54 @@ function playSound() { source.start(0); } onmessage = function (e) { - if (e.data[0] == "details") { - details(e.data[1][0], e.data[1][1]) - } else if (e.data[0] == "udg") { - udg(e.data[1][0], e.data[1][1]) - } else if (e.data[0] == "media") { - media(e.data[1][0], e.data[1][1], e.data[1][2]) - } else if (e.data[0] == "post") { - post("pass") - } else if (e.data[0] == "toastSaved") { - M.toast({ html: lang.lang_img_DLDone + e.data[1][0] + '', displayLength: 5000 }) - } else if (e.data[0] == "toastMute") { - M.toast({ html: escapeHTML(e.data[1]) + lang.lang_parse_mute, displayLength: 2000 }) - } else if (e.data[0] == "toastEmp") { - M.toast({ html: escapeHTML(e.data[1]) + lang.lang_status_emphas, displayLength: 2000 }) - } else if (e.data[0] == "toastUnEmp") { - M.toast({ html: escapeHTML(e.data[1]) + lang.lang_status_unemphas, displayLength: 2000 }) - } else if (e.data[0] == "parseColumn") { - parseColumn() - } else if (e.data[0] == "sortload") { - sortload() - } else if (e.data[0] == "exportSettingsCore") { - exportSettingsCore() - } else if (e.data[0] == "fontList") { - fontList(e.data[1]) - } else if (e.data[0] == "customSoundSave") { - customSoundSave(e.data[1][0], e.data[1][1]) - } else if (e.data[0] == "ctLoadCore") { - ctLoadCore(e.data[1]) - } else if (e.data[0] == "ctLoad") { - ctLoad() - } else if (e.data[0] == "customConnect") { - customConnect(e.data[1]) - } else if (e.data[0] == "clearCustomImport") { - clearCustomImport() - } else if (e.data[0] == "npCore") { - npCore(e.data[1]); - } else if (e.data[0] == "renderMem") { - renderMem(e.data[1][0], e.data[1][1], e.data[1][2]) - } else if (e.data[0] == "updateProg") { - updateProg(e.data[1]); - } else if (e.data[0] == "updateMess") { - updateMess(e.data[1]); - } else if (e.data[0] == "renderAbout") { + if (e.data[0] == "details") { + details(e.data[1][0], e.data[1][1]) + } else if (e.data[0] == "udg") { + udg(e.data[1][0], e.data[1][1]) + } else if (e.data[0] == "media") { + media(e.data[1][0], e.data[1][1], e.data[1][2]) + } else if (e.data[0] == "post") { + post("pass") + } else if (e.data[0] == "toastSaved") { + M.toast({ html: lang.lang_img_DLDone + e.data[1][0] + '', displayLength: 5000 }) + } else if (e.data[0] == "toastMute") { + M.toast({ html: escapeHTML(e.data[1]) + lang.lang_parse_mute, displayLength: 2000 }) + } else if (e.data[0] == "toastEmp") { + M.toast({ html: escapeHTML(e.data[1]) + lang.lang_status_emphas, displayLength: 2000 }) + } else if (e.data[0] == "toastUnEmp") { + M.toast({ html: escapeHTML(e.data[1]) + lang.lang_status_unemphas, displayLength: 2000 }) + } else if (e.data[0] == "parseColumn") { + parseColumn() + } else if (e.data[0] == "sortload") { + sortload() + } else if (e.data[0] == "exportSettingsCore") { + exportSettingsCore() + } else if (e.data[0] == "fontList") { + fontList(e.data[1]) + } else if (e.data[0] == "customSoundSave") { + customSoundSave(e.data[1][0], e.data[1][1]) + } else if (e.data[0] == "ctLoadCore") { + ctLoadCore(e.data[1]) + } else if (e.data[0] == "ctLoad") { + ctLoad() + } else if (e.data[0] == "customConnect") { + customConnect(e.data[1]) + } else if (e.data[0] == "clearCustomImport") { + clearCustomImport() + } else if (e.data[0] == "npCore") { + npCore(e.data[1]); + } else if (e.data[0] == "renderMem") { + renderMem(e.data[1][0], e.data[1][1], e.data[1][2]) + } else if (e.data[0] == "updateProg") { + updateProg(e.data[1]); + } else if (e.data[0] == "updateMess") { + updateMess(e.data[1]); + } else if (e.data[0] == "renderAbout") { renderAbout(e.data[1]); - } + } else if (e.data[0] == "alert") { + Swal.fire({ + type: 'info', + title: e.data[1] + }) + } } \ No newline at end of file diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index a91adc0d..3d77576b 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -195,7 +195,7 @@ ipc.on('langres', function (event, arg) { ipc.on('exportSettingsFile', function (event, savedFiles) { var exp = exportSettingsCore() ipc.send('export', [savedFiles, JSON.stringify(exp)]); - alert("Done.") + postMessage(["alert", "Done"], "*") //cards //lang }); diff --git a/app/js/post/img.js b/app/js/post/img.js index fdbb00c1..1015e1ee 100644 --- a/app/js/post/img.js +++ b/app/js/post/img.js @@ -205,17 +205,27 @@ element.addEventListener("paste", function (e) { // 画像以外がペーストされたときのために、元に戻しておく }); function deleteImage(key) { - if (!confirm(lang.lang_postimg_delete)) { - return false; - } - var media = $("#media").val(); - var arr = media.split(","); - for (var i = 0; i < media.length; i++) { - if (arr[i] == key) { - arr.splice(i, 1); - break; + Swal.fire({ + title: lang.lang_postimg_delete, + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: lang.lang_yesno, + cancelButtonText: lang.lang_no + }).then((result) => { + if (result.value) { + var media = $("#media").val(); + var arr = media.split(","); + for (var i = 0; i < media.length; i++) { + if (arr[i] == key) { + arr.splice(i, 1); + break; + } + } + $("#media").val(arr.join(",")); + $('#preview [data-media=' + key + ']').remove(); } - } - $("#media").val(arr.join(",")); - $('#preview [data-media=' + key + ']').remove(); + }) + } \ No newline at end of file diff --git a/app/js/post/post.js b/app/js/post/post.js index 525f3e00..528902e3 100644 --- a/app/js/post/post.js +++ b/app/js/post/post.js @@ -17,24 +17,6 @@ function post(mode, postvis) { var acct_id = $("#post-acct-sel").val(); localStorage.setItem("last-use", acct_id); var domain = localStorage.getItem("domain_" + acct_id); - if (domain == "theboss.tech") { - if (~str.indexOf("#")) { - if (str.indexOf("#theboss_tech") == "-1") { - if (!confirm(lang.lang_post_tagTL)) { - return false; - } - } - } - } - if (domain == "dtp-mstdn.jp") { - if (~str.indexOf("#")) { - if (str.indexOf("#dtp") == "-1") { - if (!confirm(lang.lang_post_tagTL)) { - return false; - } - } - } - } if (!localStorage.getItem("cw_sentence")) { var cw_sent = 500; } else { @@ -91,22 +73,11 @@ function post(mode, postvis) { } else { var vis = $("#vis").text(); } - if (vis != "inherit" && vis != "local") { toot.visibility = vis; } else if (vis == "local") { toot.status = str + "👁️"; } - //ここに非公開・未収載タグについてwarn - if (domain != "kirishima.cloud" && domain != "imastodon.net") { - if (~str.indexOf("#")) { - if (vis == "local" || vis == "unlisted" || vis == "direct" || vis == "private") { - if (!confirm(lang.lang_post_tagVis)) { - return false; - } - } - } - } if ($("#cw").hasClass("cw-avail")) { var spo = $("#cw-text").val(); cw(); diff --git a/app/js/post/status.js b/app/js/post/status.js index f5fc97eb..f7ccea6c 100644 --- a/app/js/post/status.js +++ b/app/js/post/status.js @@ -253,39 +253,50 @@ function del(id, acct_id) { } //redraft function redraft(id, acct_id) { - if (confirm(lang.lang_status_redraft)) { - show(); - del(id, acct_id); - $("#post-acct-sel").prop("disabled", true); - var medias = $("[toot-id=" + id + "]").attr("data-medias"); - var vismode = $("[toot-id=" + id + "] .vis-data").attr("data-vis"); - vis(vismode); - $("#media").val(medias); - var ct = medias.split(",").length; - $("[toot-id=" + id + "] img.toot-img").each(function (i, elem) { - if (i < ct) { - var url = $(elem).attr("src"); - console.log("Play back image data:" + url); - $('#preview').append(''); + Swal.fire({ + title: lang.lang_status_redraftTitle, + text: lang.lang_status_redraft, + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: lang.lang_yesno, + cancelButtonText: lang.lang_no + }).then((result) => { + if (result.value) { + show(); + del(id, acct_id); + $("#post-acct-sel").prop("disabled", true); + var medias = $("[toot-id=" + id + "]").attr("data-medias"); + var vismode = $("[toot-id=" + id + "] .vis-data").attr("data-vis"); + vis(vismode); + $("#media").val(medias); + var ct = medias.split(",").length; + $("[toot-id=" + id + "] img.toot-img").each(function (i, elem) { + if (i < ct) { + var url = $(elem).attr("src"); + console.log("Play back image data:" + url); + $('#preview').append(''); + } + }); + var html = $("[toot-id=" + id + "] .toot").html(); + html = html.replace(/^
(.+)<\/p>$/, "$1");
+ html = html.replace(/
/, "\n");
+ html = html.replace(/
/, "\n"); + html = html.replace(/<\/p>/, "\n"); + html = html.replace(//g, "$1"); + html = $.strip_tags(html); + localStorage.setItem("nohide", true); + show(); + $("#textarea").val(html); + var cwtxt = $("[toot-id=" + id + "] .cw_text").html(); + if (cwtxt != "") { + cwtxt = $.strip_tags(cwtxt); + cw(); + $("#cw-text").val(cwtxt); } - }); - var html = $("[toot-id=" + id + "] .toot").html(); - html = html.replace(/^
(.+)<\/p>$/, "$1");
- html = html.replace(/
/, "\n");
- html = html.replace(/
/, "\n"); - html = html.replace(/<\/p>/, "\n"); - html = html.replace(//g, "$1"); - html = $.strip_tags(html); - localStorage.setItem("nohide", true); - show(); - $("#textarea").val(html); - var cwtxt = $("[toot-id=" + id + "] .cw_text").html(); - if (cwtxt != "") { - cwtxt = $.strip_tags(cwtxt); - cw(); - $("#cw-text").val(cwtxt); } - } + }) } //ピン留め function pin(id, acct_id) { diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index c1a9ed22..92c5dd89 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -217,10 +217,19 @@ function changelang(lang) { postMessage(["lang", lang], "*") } function exportSettings() { - if (!confirm(lang.lang_setting_exportwarn)) { - return false; - } - postMessage(["exportSettings", ""], "*") + Swal.fire({ + title: lang.lang_setting_exportwarn, + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: lang.lang_yesno, + cancelButtonText: lang.lang_no + }).then((result) => { + if (result.value) { + postMessage(["exportSettings", ""], "*") + } + }) } function exportSettingsCore() { var exp = {}; @@ -283,10 +292,19 @@ function exportSettingsCore() { return exp; } function importSettings() { - if (!confirm(lang.lang_setting_importwarn)) { - return false; - } - postMessage(["importSettings", ""], "*") + Swal.fire({ + title: lang.lang_setting_importwarn, + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#3085d6', + cancelButtonColor: '#d33', + confirmButtonText: lang.lang_yesno, + cancelButtonText: lang.lang_no + }).then((result) => { + if (result.value) { + postMessage(["importSettings", ""], "*") + } + }) } function importSettingsCore(arg) { var obj = JSON.parse(arg); @@ -375,7 +393,10 @@ function importSettingsCore(arg) { } location.href = "index.html"; } else { - alert("Error.") + Swal.fire({ + type: 'error', + title: 'Error' + }) } } function savefolder() { @@ -576,7 +597,10 @@ function customImp() { if (JSON5.parse(json)) { postMessage(["themeJsonCreate", json], "*") } else { - alert("Error") + Swal.fire({ + type: 'error', + title: 'Error' + }) } } function clearCustomImport() { diff --git a/app/js/ui/settings.old.js b/app/js/ui/settings.old.js deleted file mode 100644 index e92fdcc0..00000000 --- a/app/js/ui/settings.old.js +++ /dev/null @@ -1,953 +0,0 @@ -//設定(setting.html)で読む -var envView = new Vue({ - el: '#env-view', - data: {config:envConstruction,value:envValue}, - method: { - settings: function (index) { - return true - } - } -}); - -//設定ボタン押した。 -function settings() { - var dd = $("[name=time]:checked").val(); - var dt = $("[for="+dd+"]").text(); - if (dd != localStorage.getItem("datetype")) { - Materialize.toast(lang.lang_setting_time.replace("{{set}}" ,dt), 3000); - } - localStorage.setItem("datetype", dd); - - var cd = $("[name=theme]:checked").val(); - var ct = $("[for="+cd+"]").html(); - if(cd=="custom" && !$("#custom-sel-sel").val()){ - var theme = localStorage.getItem("theme"); - if (!theme) { - var theme = "white"; - } - $("#" + theme).prop("checked", true); - }else{ - if (cd != localStorage.getItem("theme")) { - Materialize.toast(lang.lang_setting_theme.replace("{{set}}" ,ct), 3000); - } - //テーマはこの場で設定 - themes(cd); - localStorage.setItem("theme", cd); - } - - var nd = $("[name=nsfw]:checked").val(); - var nt = $("[for=n_"+nd+"]").text(); - if (nd != localStorage.getItem("nsfw")) { - Materialize.toast(lang.lang_setting_nsfw.replace("{{set}}" ,nt), 3000); - } - localStorage.setItem("nsfw", nd); - - var cwd = $("[name=cw]:checked").val(); - var cwt = $("[for=c_"+cwd+"]").text(); - if (cwd != localStorage.getItem("cw")) { - Materialize.toast(lang.lang_setting_cw.replace("{{set}}" ,cwt), 3000); - } - localStorage.setItem("cw", cwd); - - var cwtd = $("#cw-text").val(); - if (cwtd != localStorage.getItem("cw-text")) { - Materialize.toast(lang.lang_setting_cwtext.replace("{{set}}" ,cwtd), 3000); - } - localStorage.setItem("cw-text", cwtd); - - var cwsd = $("[name=cws]:checked").val(); - var cwst = $("[for=cws_"+cwsd+"]").text(); - if (cwsd != localStorage.getItem("always-cw")) { - Materialize.toast(lang.lang_setting_cws.replace("{{set}}" ,cwst), 3000); - } - localStorage.setItem("always-cw", cwsd); - - var rpd = $("[name=rp]:checked").val(); - var rpt = $("[for=c_"+cwd+"]").text(); - if (rpd != localStorage.getItem("replyct")) { - Materialize.toast(lang.lang_setting_rp.replace("{{set}}" ,rpt), 3000); - } - localStorage.setItem("replyct", rpd); - - var visd = $("[name=vis]:checked").val(); - var vist = $("[for="+visd+"]").text(); - if (visd != localStorage.getItem("vis")) { - Materialize.toast(lang.lang_setting_vis.replace("{{set}}" ,vist), 3000); - } - localStorage.setItem("vis", visd); - - var popd = $("#popup").val(); - if (popd > 0 && popd != localStorage.getItem("popup")) { - Materialize.toast(lang.lang_setting_popup.replace("{{set}}" ,popd+lang.lang_setting_s), 3000); - } else if (popd != localStorage.getItem("popup")) { - Materialize.toast(lang.lang_setting_popup.replace("{{set}}" ,lang.lang_setting_off), 3000); - } - localStorage.setItem("popup", popd); - - var gifd = $("[name=gif]:checked").val(); - var gift = $("[for=g_"+gifd+"]").text(); - if (gifd != localStorage.getItem("gif")) { - Materialize.toast(lang.lang_setting_gif.replace("{{set}}" ,gift), 3000); - } - localStorage.setItem("gif", gifd); - - var sentd = $("#sentence").val(); - var ltrd = $("#letters").val(); - if (sentd != localStorage.getItem("sentence") || ltrd != localStorage.getItem("letters")) { - Materialize.toast(lang.lang_setting_selt.replace("{{set1}}" ,sentd).replace("{{set2}}" ,ltrd), 3000); - } - localStorage.setItem("sentence", sentd); - localStorage.setItem("letters", ltrd); - - var csentd = $("#cw_sentence").val(); - var cltrd = $("#cw_letters").val(); - if (csentd != localStorage.getItem("cw_sentence") || cltrd != localStorage.getItem("cw_letters")) { - Materialize.toast(lang.lang_setting_autocw.replace("{{set1}}" ,csentd).replace("{{set2}}" ,cltrd), 3000); - } - localStorage.setItem("cw_sentence", csentd); - localStorage.setItem("cw_letters", cltrd); - - var widthd = $("#width").val(); - if (widthd != localStorage.getItem("width")) { - Materialize.toast(lang.lang_setting_width.replace("{{set}}" ,widthd), 3000); - } - localStorage.setItem("width", widthd); - - var fwidthd = $("#fixwidth").val(); - if (fwidthd != localStorage.getItem("fixwidth")) { - Materialize.toast(lang.lang_setting_fixwidth.replace("{{set}}" ,fwidthd), 3000); - } - localStorage.setItem("fixwidth", fwidthd); - - var imgd = $("[name=img]:checked").val(); - var imgt = $("[for=i_"+imgd+"]").text(); - if (imgd != localStorage.getItem("img")) { - Materialize.toast(lang.lang_setting_img.replace("{{set}}" ,imgt), 3000); - } - localStorage.setItem("img", imgd); - - var fontd = $("#font").val(); - if(fontd){ - if (fontd != localStorage.getItem("font")) { - Materialize.toast(lang.lang_setting_font.replace("{{set}}" ,fontd), 3000); - } - localStorage.setItem("font", fontd); - themes(); - }else{ - if(localStorage.getItem("font")){ - localStorage.removeItem("font"); - Materialize.toast(lang.lang_setting_font.replace("{{set}}" ,lang.lang_setting_default), 3000); - themes(); - } - } - - - var sized = $("#size").val(); - if (sized != localStorage.getItem("size")) { - Materialize.toast(lang.lang_setting_size.replace("{{set}}" ,sized), 3000); - } - localStorage.setItem("size", sized); - - var heid = $("#img-height").val(); - if (heid != localStorage.getItem("img-height")) { - Materialize.toast(lang.lang_setting_imgheight.replace("{{set}}" ,heid), 3000); - } - localStorage.setItem("img-height", heid); - - var tckrd = $("[name=ticker]:checked").val(); - var tckrt = $("[for=ticker_"+tckrd+"]").text(); - if (tckrd != localStorage.getItem("ticker_ok")) { - Materialize.toast(lang.lang_setting_ticker.replace("{{set}}" ,tckrt), 3000); - } - localStorage.setItem("ticker_ok", tckrd); - - 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); - - var boxd = $("[name=box]:checked").val(); - var boxt = $("[for=bx_"+boxd+"]").text(); - if (boxd != localStorage.getItem("box")) { - Materialize.toast(lang.lang_setting_boxConfirm.replace("{{set}}" ,boxt), 3000); - } - localStorage.setItem("box", boxd); - - var tagd = $("[name=tag]:checked").val(); - var tagt = $("[for=t_"+tagd+"]").text(); - if (tagd != localStorage.getItem("tag-range")) { - Materialize.toast(lang.lang_setting_tag.replace("{{set}}" ,tagt), 3000); - } - localStorage.setItem("tag-range", tagd); - - var uld = $("[name=ul]:checked").val(); - var ult = $("[for=ul_"+uld+"]").text(); - if (uld != localStorage.getItem("locale")) { - Materialize.toast(lang.lang_setting_ul.replace("{{set}}" ,ult), 3000); - } - localStorage.setItem("locale", uld); - - var ntd = $("[name=notf]:checked").val(); - var ntt = $("[for=ntf_"+ntd+"]").text(); - if (ntd != localStorage.getItem("nativenotf")) { - Materialize.toast(lang.lang_setting_notf.replace("{{set}}" ,ntt), 3000); - } - localStorage.setItem("nativenotf", ntd); - - var qtd = $("[name=quote]:checked").val(); - var qtt = $("[for=q_"+qtd+"]").text(); - if (qtd != localStorage.getItem("quote")) { - Materialize.toast(lang.lang_setting_quote.replace("{{set}}" ,qtt), 3000); - } - localStorage.setItem("quote", qtd); - - var viad = $("[name=via]:checked").val(); - var viat = $("[for=via_"+viad+"]").text(); - if (viad != localStorage.getItem("viashow")) { - Materialize.toast(lang.lang_setting_via.replace("{{set}}" ,viat), 3000); - } - localStorage.setItem("viashow", viad); - - var notfmd = $("[name=notfm]:checked").val(); - var notfmt = $("[for=notfm_"+notfmd+"]").text(); - if (notfmd != localStorage.getItem("setasread")) { - Materialize.toast(lang.lang_setting_setasread.replace("{{set}}" ,notfmt), 3000); - } - localStorage.setItem("setasread", notfmd); - - var movd = $("[name=mov]:checked").val(); - var movt = $("[for=mov_"+movd+"]").text(); - if (movd != localStorage.getItem("mouseover")) { - Materialize.toast(lang.lang_setting_mov.replace("{{set}}" ,movt), 3000); - } - localStorage.setItem("mouseover", movd); - - var maind = $("[name=main]:checked").val(); - var maint = $("[for=mn_"+maind+"]").text(); - if (maind != localStorage.getItem("mainuse")) { - Materialize.toast(lang.lang_setting_main.replace("{{set}}" ,maint), 3000); - } - localStorage.setItem("mainuse", maind); - - var secd = $("[name=sec]:checked").val(); - var sect = $("[for=sec-"+secd+"]").text(); - if (secd != localStorage.getItem("sec")) { - Materialize.toast(lang.lang_setting_sec.replace("{{set}}" ,sect), 3000); - } - localStorage.setItem("sec", secd); -} - -//読み込み時の設定ロード -function load() { - if(localStorage.getItem("imas")){ - $(".imas").removeClass("hide"); - } - if(localStorage.getItem("kirishima")){ - $(".kirishima").removeClass("hide"); - } - 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 ha = localStorage.getItem("ha"); - if (!ha) { - var ha = "false"; - } - $("#ha_" + ha).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); - - var cws = localStorage.getItem("always-cw"); - if (!cws) { - var cws = "no"; - } - $("#cws_" + cws).prop("checked", true); - - var popup = localStorage.getItem("popup"); - if (!popup) { - var popup = "0"; - } - $("#popup").val(popup); - - var box = localStorage.getItem("box"); - if (!box) { - var box = "no"; - } - if(box=="absolute"){ - var box = "abs"; - } - $("#bx_" + box).prop("checked", true); - - var gif = localStorage.getItem("gif"); - if (!gif) { - var gif = "yes"; - } - $("#g_" + gif).prop("checked", true); - - var sent = localStorage.getItem("sentence"); - if (!sent) { - var sent = "500"; - } - $("#sentence").val(sent); - var ltrs = localStorage.getItem("letters"); - if (!ltrs) { - var ltrs = "500"; - } - $("#letters").val(ltrs); - - 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); - - var width = localStorage.getItem("width"); - if (!width) { - var width = "300"; - } - $("#width").val(width); - - var fwidth = localStorage.getItem("fixwidth"); - if (!fwidth) { - var fwidth = "300"; - } - $("#fixwidth").val(fwidth); - - var cwt = localStorage.getItem("cw-text"); - if (!cwt) { - var cwt = ""; - } - $("#cw-text").val(cwt); - - var cws = localStorage.getItem("always-cw"); - if (!cws) { - var cws = "no"; - } - $("#cws_" + cws).prop("checked", true); - - var rps = localStorage.getItem("replyct"); - if (!rps) { - var rps = "hidden"; - } - $("#rp_" + rps).prop("checked", true); - - 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); - - var font = localStorage.getItem("font"); - if (!font) { - var font = ""; - } - $("#font").val(font); - - var size = localStorage.getItem("size"); - if (!size) { - var size = "13"; - } - $("#size").val(size); - - var imh = localStorage.getItem("img-height"); - if (!imh) { - var imh = "200"; - } - $("#img-height").val(imh); - - var ticker = localStorage.getItem("ticker_ok"); - if (!ticker) { - var ticker = "no"; - } - $("#ticker_" + ticker).prop("checked", true); - - var animation = localStorage.getItem("animation"); - if (!animation) { - var animation = "yes"; - } - $("#anime_" + animation).prop("checked", true); - - var tag = localStorage.getItem("tag-range"); - if (!tag) { - var tag = "all"; - } - $("#t_" + tag).prop("checked", true); - - var box = localStorage.getItem("box"); - if (!box) { - var box = "yes"; - } - $("#bx_" + box).prop("checked", true); - - var uld = localStorage.getItem("locale"); - if (!uld) { - var uld = "yes"; - } - $("#ul_" + uld).prop("checked", true); - - var nnd = localStorage.getItem("nativenotf"); - if (!nnd) { - var nnd = "yes"; - } - $("#ntf_" + nnd).prop("checked", true); - - var qt = localStorage.getItem("quote"); - if (!qt) { - var qt = "simple"; - } - $("#q_" + qt).prop("checked", true); - - 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); - - var notfmt = localStorage.getItem("setasread"); - if (!notfmt) { - var notfmt = "yes"; - } - $("#notfm_" + notfmt).prop("checked", true); - - var maint = localStorage.getItem("mainuse"); - if (!maint) { - var maint = "remain"; - } - $("#mn_" + maint).prop("checked", true); - - var sect = localStorage.getItem("sec"); - if (!sect) { - var sect = "nothing"; - } - $("#sec-" + sect).prop("checked", true); - -} - -function climute(){ - //クライアントミュート - var cli = localStorage.getItem("client_mute"); - var obj = JSON.parse(cli); - if(!obj){ - $("#mute-cli").html(lang.lang_setting_nomuting); - }else{ - if(!obj[0]){ - $("#mute-cli").html(lang.lang_setting_nomuting); - return; - } - var templete; - Object.keys(obj).forEach(function(key) { - var cli = obj[key]; - var list = key * 1 + 1; - templete = '