vue dependency update #788

This commit is contained in:
cutls 2022-12-07 23:22:36 +09:00
parent 12163aaa3d
commit 4ef964f539
2 changed files with 297 additions and 294 deletions

View File

@ -1,9 +1,12 @@
//設定(setting.html)で読む //設定(setting.html)で読む
var envView = new Vue({ Vue.createApp({
el: '#envView', data() {
data: { config: envConstruction }, return {
config: envConstruction
}
},
methods: { methods: {
complete: function(i, val) { complete: function (i, val) {
var ls = envView.config[i] var ls = envView.config[i]
let header = ls.text.head let header = ls.text.head
if (!ls.data) { if (!ls.data) {
@ -33,12 +36,11 @@ var envView = new Vue({
return true return true
}, },
}, },
}) }).mount('#envView')
var tlView = new Vue({ Vue.createApp({
el: '#tlView', data() { return { config: tlConstruction } },
data: { config: tlConstruction },
methods: { methods: {
complete: function(i, val) { complete: function (i, val) {
var ls = tlView.config[i] var ls = tlView.config[i]
let header = ls.text.head let header = ls.text.head
if (val) { if (val) {
@ -59,39 +61,40 @@ var tlView = new Vue({
return true return true
}, },
}, },
}) }).mount('#tlView')
var postView = new Vue({ Vue.createApp({
el: '#postView', data() {
data: { return {
config: postConstruction, config: postConstruction,
kirishima: localStorage.getItem('kirishima'), kirishima: localStorage.getItem('kirishima'),
quoters: localStorage.getItem('quoters'), quoters: localStorage.getItem('quoters'),
}, }
methods: { },
complete: function(i, val) { methods: {
var ls = postView.config[i] complete: function (i, val) {
let header = ls.text.head var ls = postView.config[i]
if (val) { let header = ls.text.head
localStorage.setItem(ls.storage, val) if (val) {
localStorage.setItem(ls.storage, val)
} else {
if (!ls.data) {
ls = [ls]
} else { } else {
if (!ls.data) { ls = ls.data
ls = [ls]
} else {
ls = ls.data
}
for (var j = 0; j < ls.length; j++) {
M.toast({ html: 'Complete', displayLength: 3000 })
var id = ls[j].id
var val = $('#' + id).val()
localStorage.setItem(ls[j].storage, val)
}
} }
M.toast({ html: `Updated: ${header}`, displayLength: 3000 }) for (var j = 0; j < ls.length; j++) {
return true M.toast({ html: 'Complete', displayLength: 3000 })
}, var id = ls[j].id
var val = $('#' + id).val()
localStorage.setItem(ls[j].storage, val)
}
}
M.toast({ html: `Updated: ${header}`, displayLength: 3000 })
return true
}, },
}) },
//設定ボタン押した。 }).mount('#postView')
//設定ボタン押した。
function settings() { function settings() {
var fontd = $('#font').val() var fontd = $('#font').val()
if (fontd) { if (fontd) {
@ -225,7 +228,7 @@ function climute() {
return return
} }
var templete var templete
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function (key) {
var cli = obj[key] var cli = obj[key]
var list = key * 1 + 1 var list = key * 1 + 1
templete = templete =
@ -340,18 +343,18 @@ function exportSettings() {
function exportSettingsCore() { function exportSettingsCore() {
var exp = {} var exp = {}
//Accounts //Accounts
var multi = localStorage.getItem('multi') var multi = localStorage.getItem('multi')
var acct = JSON.parse(multi) var acct = JSON.parse(multi)
exp.accts = acct exp.accts = acct
//Columns //Columns
var multi = localStorage.getItem('column') var multi = localStorage.getItem('column')
var column = JSON.parse(multi) var column = JSON.parse(multi)
exp.columns = column exp.columns = column
//Themes //Themes
var config = {} var config = {}
config.theme = localStorage.getItem('theme') config.theme = localStorage.getItem('theme')
//Other configs //Other configs
var max = envView.config.length var max = envView.config.length
for (var i = 0; i < max; i++) { for (var i = 0; i < max; i++) {
var ls = envView.config[i].storage var ls = envView.config[i].storage
@ -370,17 +373,17 @@ function exportSettingsCore() {
//Font //Font
config.font = localStorage.getItem('font') config.font = localStorage.getItem('font')
exp.config = config exp.config = config
//keysc //keysc
exp.ksc = [localStorage.getItem('oks-1'), localStorage.getItem('oks-2'), localStorage.getItem('oks-3')] exp.ksc = [localStorage.getItem('oks-1'), localStorage.getItem('oks-2'), localStorage.getItem('oks-3')]
//climu //climu
var cli = localStorage.getItem('client_mute') var cli = localStorage.getItem('client_mute')
var climu = JSON.parse(cli) var climu = JSON.parse(cli)
exp.clientMute = climu exp.clientMute = climu
//wordmu //wordmu
var wdm = localStorage.getItem('word_mute') var wdm = localStorage.getItem('word_mute')
var wordmu = JSON.parse(wdm) var wordmu = JSON.parse(wdm)
exp.wordMute = wordmu exp.wordMute = wordmu
//spotify //spotify
exp.spotifyArtwork = localStorage.getItem('artwork') exp.spotifyArtwork = localStorage.getItem('artwork')
var content = localStorage.getItem('np-temp') var content = localStorage.getItem('np-temp')
if (content || content == '' || content == 'null') { if (content || content == '' || content == 'null') {
@ -391,7 +394,7 @@ function exportSettingsCore() {
//tags //tags
var tagarr = localStorage.getItem('tag') var tagarr = localStorage.getItem('tag')
var favtag = JSON.parse(tagarr) var favtag = JSON.parse(tagarr)
//plugins //plugins
var plugins = localStorage.getItem('plugins') var plugins = localStorage.getItem('plugins')
var plugin = JSON.parse(plugins) var plugin = JSON.parse(plugins)
exp.plugins = plugin exp.plugins = plugin
@ -482,7 +485,7 @@ function importSettingsCore(obj) {
localStorage.setItem('cwtext', obj.cw) localStorage.setItem('cwtext', obj.cw)
} }
localStorage.setItem('vis', obj.vis) localStorage.setItem('vis', obj.vis)
//End //End
} }
if (obj.ksc[0]) { if (obj.ksc[0]) {
localStorage.setItem('oks-1', obj.ksc[0]) localStorage.setItem('oks-1', obj.ksc[0])
@ -651,297 +654,297 @@ function ctLoad() {
function ctLoadCore(args) { function ctLoadCore(args) {
var template = '' var template = ''
var editTemplate = '' var editTemplate = ''
Object.keys(args).forEach(function(key) { Object.keys(args).forEach(function (key) {
var theme = args[key] var theme = args[key]
var themeid = theme.id var themeid = theme.id
template = template + `<option value="${themeid}">${theme.name}${theme.compatible ? `(${lang.lang_setting_compat})` : ''}</option>` template = template + `<option value="${themeid}">${theme.name}${theme.compatible ? `(${lang.lang_setting_compat})` : ''}</option>`
if (!theme.compatible) editTemplate = editTemplate + `<option value="${themeid}">${theme.name}</option>` if (!theme.compatible) editTemplate = editTemplate + `<option value="${themeid}">${theme.name}</option>`
}) })
$('#custom-sel-sel').html(template) $('#custom-sel-sel').html(template)
editTemplate = '<option value="add_new">' + $('#edit-selector').attr('data-add') + '</option>' + editTemplate editTemplate = '<option value="add_new">' + $('#edit-selector').attr('data-add') + '</option>' + editTemplate
$('#custom-edit-sel').html(editTemplate) $('#custom-edit-sel').html(editTemplate)
$('#custom-sel-sel').val(localStorage.getItem('customtheme-id')) $('#custom-sel-sel').val(localStorage.getItem('customtheme-id'))
$('select').formSelect() $('select').formSelect()
} }
function customSel() { function customSel() {
var id = $('#custom-sel-sel').val() var id = $('#custom-sel-sel').val()
localStorage.setItem('customtheme-id', id) localStorage.setItem('customtheme-id', id)
themes(id) themes(id)
} }
function custom() { function custom() {
var id = $('#custom-edit-sel').val() var id = $('#custom-edit-sel').val()
if (id == 'add_new') { if (id == 'add_new') {
$('#custom_name').val('') $('#custom_name').val('')
$('#custom_desc').val('') $('#custom_desc').val('')
$('#dark').prop('checked', true) $('#dark').prop('checked', true)
$('#custom_json').val('') $('#custom_json').val('')
for (var i = 0; i <= 13; i++) { for (var i = 0; i <= 13; i++) {
if (i >= 4) $(`#use-color_${i}`).prop('checked', false) if (i >= 4) $(`#use-color_${i}`).prop('checked', false)
$('#color-picker' + i + '_value').val('') $('#color-picker' + i + '_value').val('')
} }
$('#delTheme').addClass('disabled') $('#delTheme').addClass('disabled')
} else { } else {
$('#delTheme').removeClass('disabled') $('#delTheme').removeClass('disabled')
postMessage(['themeJsonRequest', id + '.thedesktheme'], '*') postMessage(['themeJsonRequest', id + '.thedesktheme'], '*')
} }
} }
function customConnect(raw) { function customConnect(raw) {
var args = raw[0] var args = raw[0]
$('#custom_name').val(`${args.name} ${args.default ? 'Customed' : ''}`) $('#custom_name').val(`${args.name} ${args.default ? 'Customed' : ''}`)
$('#custom_desc').val(args.default ? 'TheDesk default theme with some changes by user' : args.desc) $('#custom_desc').val(args.default ? 'TheDesk default theme with some changes by user' : args.desc)
$('#' + args.base).prop('checked', true) $('#' + args.base).prop('checked', true)
//Background //Background
$('#color-picker0_value').val(args.primary.background) $('#color-picker0_value').val(args.primary.background)
//Text //Text
$('#color-picker1_value').val(args.primary.text) $('#color-picker1_value').val(args.primary.text)
//Subcolor //Subcolor
$('#color-picker2_value').val(args.primary.subcolor) $('#color-picker2_value').val(args.primary.subcolor)
//Accent //Accent
$('#color-picker3_value').val(args.primary.accent) $('#color-picker3_value').val(args.primary.accent)
let advanced = ['modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared'] let advanced = ['modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
let i = 4 let i = 4
for (tag of advanced) { for (tag of advanced) {
if (args.advanced[tag]) { if (args.advanced[tag]) {
$(`#color-picker${i}_value`).val(args.advanced[tag]) $(`#color-picker${i}_value`).val(args.advanced[tag])
} }
$(`#use-color_${i}`).prop('checked', true) $(`#use-color_${i}`).prop('checked', true)
i++ i++
} }
$('#custom_json').val(raw[1]) $('#custom_json').val(raw[1])
if (args.default) { if (args.default) {
$('#delTheme').addClass('disabled') $('#delTheme').addClass('disabled')
} }
} }
function customImp() { function customImp() {
var json = $('#custom_import').val() var json = $('#custom_import').val()
if (JSON5.parse(json)) { if (JSON5.parse(json)) {
postMessage(['themeJsonCreate', json], '*') postMessage(['themeJsonCreate', json], '*')
} else { } else {
Swal.fire({ Swal.fire({
type: 'error', type: 'error',
title: 'Error', title: 'Error',
}) })
} }
} }
function advanced() { function advanced() {
$('.advanced').toggleClass('hide') $('.advanced').toggleClass('hide')
$('#pickers').toggleClass('advanceTheme') $('#pickers').toggleClass('advanceTheme')
} }
function clearCustomImport() { function clearCustomImport() {
$('#custom_import').val('') $('#custom_import').val('')
} }
function hardwareAcceleration(had) { function hardwareAcceleration(had) {
postMessage(['ha', had], '*') postMessage(['ha', had], '*')
} }
function useragent(val) { function useragent(val) {
postMessage(['ua', val], '*') postMessage(['ua', val], '*')
} }
function frameSet(val) { function frameSet(val) {
postMessage(['frameSet', val], '*') postMessage(['frameSet', val], '*')
} }
function customSound(key) { function customSound(key) {
postMessage(['customSound', key], '*') postMessage(['customSound', key], '*')
} }
function customSoundSave(key, file) { function customSoundSave(key, file) {
localStorage.setItem('custom' + key, file) localStorage.setItem('custom' + key, file)
$(`#c${key}-file`).text(file) $(`#c${key}-file`).text(file)
} }
function pluginLoad() { function pluginLoad() {
$('#plugin-edit-sel').val('add_new') $('#plugin-edit-sel').val('add_new')
$('.plugin_delete').addClass('disabled') $('.plugin_delete').addClass('disabled')
var template = '' var template = ''
var pgns = localStorage.getItem('plugins') var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]') var args = JSON.parse(pgns ? pgns : '[]')
Object.keys(args).forEach(function (key) { Object.keys(args).forEach(function (key) {
var theme = args[key] var theme = args[key]
var themeid = theme.id var themeid = theme.id
template = template + `<option value="${themeid}">${getMeta(theme.content).data.name}</option>` template = template + `<option value="${themeid}">${getMeta(theme.content).data.name}</option>`
}) })
template = '<option value="add_new">' + $('#plugin-selector').attr('data-add') + '</option>' + template template = '<option value="add_new">' + $('#plugin-selector').attr('data-add') + '</option>' + template
$('#plugin-edit-sel').html(template) $('#plugin-edit-sel').html(template)
$('select').formSelect() $('select').formSelect()
} }
function pluginEdit() { function pluginEdit() {
var id = $('#plugin-edit-sel').val() var id = $('#plugin-edit-sel').val()
$('#plugin').attr('data-id', id) $('#plugin').attr('data-id', id)
if (id == 'add_new') { if (id == 'add_new') {
editor.setValue('', -1) editor.setValue('', -1)
$('.plugin_delete').addClass('disabled') $('.plugin_delete').addClass('disabled')
} else { } else {
$('.plugin_delete').removeClass('disabled') $('.plugin_delete').removeClass('disabled')
var pgns = localStorage.getItem('plugins') var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]') var args = JSON.parse(pgns ? pgns : '[]')
Object.keys(args).forEach(function (key) { Object.keys(args).forEach(function (key) {
var plugin = args[key] var plugin = args[key]
var targetId = plugin.id var targetId = plugin.id
if (targetId == id) editor.setValue(plugin.content, -1) if (targetId == id) editor.setValue(plugin.content, -1)
}) })
} }
} }
function completePlugin(comp) { function completePlugin(comp) {
var pgns = localStorage.getItem('plugins') var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]') var args = JSON.parse(pgns ? pgns : '[]')
var id = $('#plugin').attr('data-id') var id = $('#plugin').attr('data-id')
var inputPlugin = editor.getValue() var inputPlugin = editor.getValue()
var meta = getMeta(inputPlugin) var meta = getMeta(inputPlugin)
if (!meta.data) { if (!meta.data) {
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Syntax Error', title: 'Syntax Error',
text: `error on line ${meta.location.start.line}`, text: `error on line ${meta.location.start.line}`,
text: meta, text: meta,
}) })
return false return false
} }
if (!meta.data.name || !meta.data.version || !meta.data.event || !meta.data.author) { if (!meta.data.name || !meta.data.version || !meta.data.event || !meta.data.author) {
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Meta data error', title: 'Meta data error',
title: 'Syntax Error of META DATA', title: 'Syntax Error of META DATA',
}) })
return false return false
} }
if (id == 'add_new') { if (id == 'add_new') {
id = makeCID() id = makeCID()
args.push({ args.push({
id: id, id: id,
content: inputPlugin, content: inputPlugin,
}) })
} else { } else {
Object.keys(args).forEach(function (key) { Object.keys(args).forEach(function (key) {
var plugin = args[key] var plugin = args[key]
var targetId = plugin.id var targetId = plugin.id
if (targetId == id) args[key].content = inputPlugin if (targetId == id) args[key].content = inputPlugin
}) })
} }
var ss = args var ss = args
localStorage.setItem('plugins', JSON.stringify(ss)) localStorage.setItem('plugins', JSON.stringify(ss))
if (comp) return false if (comp) return false
$('#plugin').attr('data-id', 'add_new') $('#plugin').attr('data-id', 'add_new')
editor.setValue('', -1) editor.setValue('', -1)
pluginLoad() pluginLoad()
} }
function testExecTrg() { function testExecTrg() {
var inputPlugin = editor.getValue() var inputPlugin = editor.getValue()
var meta = getMeta(inputPlugin) var meta = getMeta(inputPlugin)
if (meta.location) { if (meta.location) {
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Error', title: 'Error',
text: `error on line ${meta.location.start.line}`, text: `error on line ${meta.location.start.line}`,
text: meta, text: meta,
}) })
return false return false
} }
testExec(inputPlugin) testExec(inputPlugin)
} }
async function deletePlugin() { async function deletePlugin() {
const delIsIt = await Swal.fire({ const delIsIt = await Swal.fire({
title: 'delete', title: 'delete',
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
}) })
if (!delIsIt.isConfirmed) return false if (!delIsIt.isConfirmed) return false
editor.setValue('', -1) editor.setValue('', -1)
var pgns = localStorage.getItem('plugins') var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]') var args = JSON.parse(pgns ? pgns : '[]')
var id = $('#plugin').attr('data-id') var id = $('#plugin').attr('data-id')
$('#plugin').attr('data-id', 'add_new') $('#plugin').attr('data-id', 'add_new')
var ss = [] var ss = []
Object.keys(args).forEach(function (key) { Object.keys(args).forEach(function (key) {
var plugin = args[key] var plugin = args[key]
var targetId = plugin.id var targetId = plugin.id
if (targetId != id) ss.push(plugin) if (targetId != id) ss.push(plugin)
}) })
localStorage.setItem('plugins', JSON.stringify(ss)) localStorage.setItem('plugins', JSON.stringify(ss))
pluginLoad() pluginLoad()
} }
function execEditPlugin() { function execEditPlugin() {
completePlugin(true) completePlugin(true)
var id = $('#plugin').attr('data-id') var id = $('#plugin').attr('data-id')
var inputPlugin = editor.getValue() var inputPlugin = editor.getValue()
var meta = getMeta(inputPlugin).data var meta = getMeta(inputPlugin).data
execPlugin(id, meta.event, { acct_id: 0, id: null }) execPlugin(id, meta.event, { acct_id: 0, id: null })
} }
window.onload = function () { window.onload = function () {
//最初に読む //最初に読む
load() load()
climute() climute()
wordmute() wordmute()
wordemp() wordemp()
checkSpotify() checkSpotify()
voiceSettingLoad() voiceSettingLoad()
oksload() oksload()
ctLoad() ctLoad()
pluginLoad() pluginLoad()
$('body').addClass(localStorage.getItem('platform')) $('body').addClass(localStorage.getItem('platform'))
} }
//設定画面で未読マーカーは要らない //設定画面で未読マーカーは要らない
function asReadEnd() { function asReadEnd() {
postMessage(['asReadComp', ''], '*') postMessage(['asReadComp', ''], '*')
} }
function checkupd() { function checkupd() {
if (localStorage.getItem('winstore') == 'brewcask' || localStorage.getItem('winstore') == 'snapcraft' || localStorage.getItem('winstore') == 'winstore') { if (localStorage.getItem('winstore') == 'brewcask' || localStorage.getItem('winstore') == 'snapcraft' || localStorage.getItem('winstore') == 'winstore') {
var winstore = true var winstore = true
} else { } else {
var winstore = false var winstore = false
} }
var ver = localStorage.getItem('ver') var ver = localStorage.getItem('ver')
var start = 'https://thedesk.top/ver.json' var start = 'https://thedesk.top/ver.json'
fetch(start, { fetch(start, {
method: 'GET', method: 'GET',
}) })
.then(function (response) { .then(function (response) {
if (!response.ok) { if (!response.ok) {
response.text().then(function (text) { response.text().then(function (text) {
setLog(response.url, response.status, text) setLog(response.url, response.status, text)
}) })
} }
return response.json() return response.json()
}) })
.catch(function (error) { .catch(function (error) {
todo(error) todo(error)
setLog(start, 'JSON', error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function (mess) { .then(function (mess) {
console.table(mess) console.table(mess)
if (mess) { if (mess) {
var platform = localStorage.getItem('platform') var platform = localStorage.getItem('platform')
if (platform == 'darwin') { if (platform == 'darwin') {
var newest = mess.desk_mac var newest = mess.desk_mac
} else { } else {
var newest = mess.desk var newest = mess.desk
} }
if (newest == ver) { if (newest == ver) {
Swal.fire({ Swal.fire({
type: 'info', type: 'info',
text: lang.lang_setting_noupd, text: lang.lang_setting_noupd,
html: ver, html: ver,
}) })
} else if (ver.indexOf('beta') != -1 || winstore) { } else if (ver.indexOf('beta') != -1 || winstore) {
Swal.fire({ Swal.fire({
type: 'info', type: 'info',
text: lang.lang_setting_thisisbeta, text: lang.lang_setting_thisisbeta,
html: ver, html: ver,
}) })
} else { } else {
localStorage.removeItem('new-ver-skip') localStorage.removeItem('new-ver-skip')
location.href = 'index.html' location.href = 'index.html'
} }
} }
}) })
} }
function lastFmSet() { function lastFmSet() {
if ($('#lastFmUser').val()) { if ($('#lastFmUser').val()) {
localStorage.setItem('lastFmUser', $('#lastFmUser').val()) localStorage.setItem('lastFmUser', $('#lastFmUser').val())
} else { } else {
localStorage.removeItem('lastFmUser') localStorage.removeItem('lastFmUser')
} }
M.toast({ html: 'Complete: last.fm', displayLength: 3000 }) M.toast({ html: 'Complete: last.fm', displayLength: 3000 })
} }
function stopVideo() { function stopVideo() {
return false return false
} }

View File

@ -41,7 +41,7 @@
<script type="text/javascript" src="../../@@node_base@@/@cutls/materialize-css/dist/js/materialize.js"></script> <script type="text/javascript" src="../../@@node_base@@/@cutls/materialize-css/dist/js/materialize.js"></script>
<script type="text/javascript" src="main.js"></script> <script type="text/javascript" src="main.js"></script>
<script src="../../@@node_base@@/json5/dist/index.min.js"></script> <script src="../../@@node_base@@/json5/dist/index.min.js"></script>
<script src="../../@@node_base@@/vue/dist/vue.min.js"></script> <script src="../../@@node_base@@/vue/dist/vue.global.js"></script>
<script type="text/javascript" src="setting.vue.js"></script> <script type="text/javascript" src="setting.vue.js"></script>
<script type="text/javascript" src="../../@@node_base@@/sweetalert2/dist/sweetalert2.min.js"></script> <script type="text/javascript" src="../../@@node_base@@/sweetalert2/dist/sweetalert2.min.js"></script>
<script> <script>