AiScript
This commit is contained in:
parent
46bc9474a0
commit
4fbe7218e6
|
@ -1,4 +1,5 @@
|
||||||
const { AiScript, parse, values, utils } = require('@syuilo/aiscript')
|
const { AiScript, parse, values, utils } = require('@syuilo/aiscript')
|
||||||
|
global.sanitizeHtml = require('sanitize-html')
|
||||||
global.asValue = values
|
global.asValue = values
|
||||||
global.AiScript = AiScript
|
global.AiScript = AiScript
|
||||||
global.asParse = parse
|
global.asParse = parse
|
||||||
|
|
|
@ -668,3 +668,12 @@ button {
|
||||||
color: white;
|
color: white;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
.pluginNex {
|
||||||
|
width: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.pluginNex span {
|
||||||
|
font-size: 2rem;
|
||||||
|
position: relative;
|
||||||
|
top: -4px;
|
||||||
|
}
|
|
@ -237,7 +237,6 @@ iframe,
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
background-color: var(--bg);
|
|
||||||
}
|
}
|
||||||
.additional {
|
.additional {
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
|
|
|
@ -47,8 +47,15 @@ function ck() {
|
||||||
multiSelector(false)
|
multiSelector(false)
|
||||||
verck(ver, jp)
|
verck(ver, jp)
|
||||||
$('.stw').show()
|
$('.stw').show()
|
||||||
if (localStorage.getItem('tips')) {
|
let tipsName = localStorage.getItem('tips')
|
||||||
tips(localStorage.getItem('tips'))
|
const matchCID = /custom:([abcdef0-9]{8}-[abcdef0-9]{4}-4[abcdef0-9]{3}-[abcdef0-9]{4}-[abcdef0-9]{12})/
|
||||||
|
if (tipsName) {
|
||||||
|
if(tipsName.match(matchCID)) {
|
||||||
|
const id = tipsName.match(matchCID)[1]
|
||||||
|
tips('custom', id)
|
||||||
|
} else {
|
||||||
|
tips(tipsName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$('#something-wrong img').attr('src', '../../img/thinking.svg')
|
$('#something-wrong img').attr('src', '../../img/thinking.svg')
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,11 @@ function getPlugin() {
|
||||||
const json = localStorage.getItem('plugins')
|
const json = localStorage.getItem('plugins')
|
||||||
let ret = {
|
let ret = {
|
||||||
buttonOnPostbox: [],
|
buttonOnPostbox: [],
|
||||||
buttonOnToot: []
|
buttonOnToot: [],
|
||||||
|
buttonOnBottom: [],
|
||||||
|
init: [],
|
||||||
|
tips: [],
|
||||||
|
none: []
|
||||||
}
|
}
|
||||||
if (!json) return ret
|
if (!json) return ret
|
||||||
const plugins = JSON.parse(json)
|
const plugins = JSON.parse(json)
|
||||||
|
@ -13,6 +17,25 @@ function getPlugin() {
|
||||||
if (!meta) continue
|
if (!meta) continue
|
||||||
const type = meta.event
|
const type = meta.event
|
||||||
ret[type] ? ret[type].push(plugin) : ret[type] = [plugin]
|
ret[type] ? ret[type].push(plugin) : ret[type] = [plugin]
|
||||||
|
if (type === 'buttonOnToot') continue
|
||||||
|
if (type === 'tips') {
|
||||||
|
if (meta.interval) {
|
||||||
|
const matchCID = /custom:([abcdef0-9]{8}-[abcdef0-9]{4}-4[abcdef0-9]{3}-[abcdef0-9]{4}-[abcdef0-9]{12})/
|
||||||
|
setInterval(function () {
|
||||||
|
const tipsName = localStorage.getItem('tips')
|
||||||
|
if (tipsName.match(matchCID)) {
|
||||||
|
const id = tipsName.match(matchCID)[1]
|
||||||
|
if (id === plugin.id) if (location.href.split('/').pop() === 'index.html') execPlugin(id, 'tips', null)
|
||||||
|
}
|
||||||
|
|
||||||
|
}, meta.interval)
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const shortcut = meta.shortcut
|
||||||
|
$(window).keydown(function (e) {
|
||||||
|
if (e.keyCode === shortcut && e.altKey) execPlugin(plugin.id, type)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
@ -36,35 +59,23 @@ function initPlugin() {
|
||||||
asCommon['TheDesk:css'] = asValue.FN_NATIVE((z) => {
|
asCommon['TheDesk:css'] = asValue.FN_NATIVE((z) => {
|
||||||
$(escapeHTML(z[0].value)).css(escapeHTML(z[1].value), escapeHTML(z[2].value))
|
$(escapeHTML(z[0].value)).css(escapeHTML(z[1].value), escapeHTML(z[2].value))
|
||||||
})
|
})
|
||||||
asCommon['TheDesk:api'] = asValue.FN_NATIVE(async (z) => {
|
asCommon['TheDesk:openLink'] = asValue.FN_NATIVE((z) => {
|
||||||
try {
|
postMessage(['openUrl', z[0].value], '*')
|
||||||
if (!getMeta(exe).apiGet && z[0].value == "GET") return asUtil.jsToVal(false)
|
|
||||||
if (!getMeta(exe).apiPost && (z[0].value == "POST" || z[0].value == "DELETE" || z[0].value == "PUT")) return asUtil.jsToVal(false)
|
|
||||||
const domain = localStorage.getItem(`domain_${z[3].value}`)
|
|
||||||
const at = localStorage.getItem(`acct_${z[3].value}_at`)
|
|
||||||
const start = `https://${domain}/api/${z[1].value}`
|
|
||||||
const q = {
|
|
||||||
method: z[0].value,
|
|
||||||
headers: {
|
|
||||||
'content-type': 'application/json',
|
|
||||||
Authorization:
|
|
||||||
`Bearer ${at}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (z[2]) q.body = z[2].value
|
|
||||||
const promise = await fetch(start, q)
|
|
||||||
const json = await promise.json()
|
|
||||||
return asUtil.jsToVal(json)
|
|
||||||
} catch (e) {
|
|
||||||
return asUtil.jsToVal(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
const { buttonOnPostbox, init } = plugins
|
|
||||||
|
const { buttonOnPostbox, init, buttonOnBottom, tips } = plugins
|
||||||
for (let target of buttonOnPostbox) {
|
for (let target of buttonOnPostbox) {
|
||||||
const meta = getMeta(target.content)
|
const meta = getMeta(target.content)
|
||||||
$('#dropdown2').append(`<li><a onclick="execPlugin('${target.id}','buttonOnPostbox', null);">${escapeHTML(meta.name)}</a></li>`)
|
$('#dropdown2').append(`<li><a onclick="execPlugin('${target.id}','buttonOnPostbox', null);">${escapeHTML(meta.name)}</a></li>`)
|
||||||
}
|
}
|
||||||
|
for (let target of buttonOnBottom) {
|
||||||
|
const meta = getMeta(target.content)
|
||||||
|
$('#group .btnsgroup').append(`<a onclick="execPlugin('${target.id}','buttonOnBottom', null);" class="nex waves-effect pluginNex"><span title="${escapeHTML(meta.name)}">${escapeHTML(meta.name).substr(0, 1)}</span></a>`)
|
||||||
|
}
|
||||||
|
for (let target of tips) {
|
||||||
|
const meta = getMeta(target.content)
|
||||||
|
$('#tips-menu .btnsgroup').append(`<a onclick="tips('custom', '${target.id}')" class="nex waves-effect pluginNex"><span title="${escapeHTML(meta.name)}">${escapeHTML(meta.name).substr(0, 1)}</span></a>`)
|
||||||
|
}
|
||||||
for (let target of init) {
|
for (let target of init) {
|
||||||
const as = new AiScript(asCommon)
|
const as = new AiScript(asCommon)
|
||||||
const meta = getMeta(target.content)
|
const meta = getMeta(target.content)
|
||||||
|
@ -103,10 +114,21 @@ async function execPlugin(id, source, args) {
|
||||||
`Bearer ${at}`
|
`Bearer ${at}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const json = await promise.json()
|
let json = await promise.json()
|
||||||
common.TOOT = asUtil.jsToVal(json)
|
common.TOOT = asUtil.jsToVal(json)
|
||||||
common['TheDesk:changeText'] = asValue.FN_NATIVE((z) => {
|
common['TheDesk:changeText'] = asValue.FN_NATIVE((z) => {
|
||||||
if (getMeta(exe).dangerHtml) $(`[unique-id=${args.id}] .toot`).html(z[0].value)
|
const v = sanitizeHtml(z[0].value,
|
||||||
|
{
|
||||||
|
allowedTags: ['p', 'br', 'a', 'span'],
|
||||||
|
allowedAttributes: {
|
||||||
|
'a': ['href', 'class', 'rel', 'target'],
|
||||||
|
'span': [],
|
||||||
|
'p': [],
|
||||||
|
'br': [],
|
||||||
|
}
|
||||||
|
}).replace(/href="javascript:/, 'href="').replace(/href='javascript:/, 'href="').replace(/href=javascript:/, 'href="')
|
||||||
|
json.content = v
|
||||||
|
if (getMeta(exe).dangerHtml) $(`[unique-id=${args.id}] .toot`).html(parse([json], null, null, null, null, null, null, true))
|
||||||
})
|
})
|
||||||
} else if (source == 'buttonOnPostbox') {
|
} else if (source == 'buttonOnPostbox') {
|
||||||
const postDt = post(null, false, true)
|
const postDt = post(null, false, true)
|
||||||
|
@ -131,10 +153,66 @@ async function execPlugin(id, source, args) {
|
||||||
common['TheDesk:postExec'] = asValue.FN_NATIVE(() => {
|
common['TheDesk:postExec'] = asValue.FN_NATIVE(() => {
|
||||||
if (getMeta(exe).apiPost) post()
|
if (getMeta(exe).apiPost) post()
|
||||||
})
|
})
|
||||||
|
} else if (source == 'tips') {
|
||||||
|
common['TheDesk:refreshTipsView'] = asValue.FN_NATIVE((z) => {
|
||||||
|
const v = sanitizeHtml(z[0].value,
|
||||||
|
{
|
||||||
|
allowedTags: ['p', 'br', 'a', 'span', 'img'],
|
||||||
|
allowedAttributes: {
|
||||||
|
'a': ['href', 'class', 'rel', 'target', 'style'],
|
||||||
|
'span': ['style'],
|
||||||
|
'p': ['style'],
|
||||||
|
'br': [],
|
||||||
|
'img': ['src', 'style']
|
||||||
|
}
|
||||||
|
}).replace(/href="javascript:/, 'href="').replace(/href='javascript:/, 'href="').replace(/href=javascript:/, 'href="')
|
||||||
|
if (getMeta(exe).dangerHtml) $('#tips-text').html(v)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
common['TheDesk:console'] = asValue.FN_NATIVE((z) => {
|
common['TheDesk:console'] = asValue.FN_NATIVE((z) => {
|
||||||
console.log(z[0].value)
|
console.log(z[0].value)
|
||||||
})
|
})
|
||||||
|
common['TheDesk:api'] = asValue.FN_NATIVE(async (z) => {
|
||||||
|
try {
|
||||||
|
if (!getMeta(exe).apiGet && z[0].value == "GET") return asUtil.jsToVal(null)
|
||||||
|
if (!getMeta(exe).apiPost && (z[0].value == "POST" || z[0].value == "DELETE" || z[0].value == "PUT")) return asUtil.jsToVal(null)
|
||||||
|
const domain = localStorage.getItem(`domain_${z[3].value}`)
|
||||||
|
const at = localStorage.getItem(`acct_${z[3].value}_at`)
|
||||||
|
const start = `https://${domain}/api/${z[1].value}`
|
||||||
|
const q = {
|
||||||
|
method: z[0].value,
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
Authorization:
|
||||||
|
`Bearer ${at}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (z[2]) q.body = z[2].value
|
||||||
|
const promise = await fetch(start, q)
|
||||||
|
const json = await promise.json()
|
||||||
|
return asUtil.jsToVal(json)
|
||||||
|
} catch (e) {
|
||||||
|
return asUtil.jsToVal(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
common['TheDesk:getRequest'] = asValue.FN_NATIVE(async (z) => {
|
||||||
|
try {
|
||||||
|
if (!getMeta(exe).apiGet) return asUtil.jsToVal(null)
|
||||||
|
const start = `https://${z[0].value}`
|
||||||
|
const promise = await fetch(start)
|
||||||
|
let json = null
|
||||||
|
if (z[1].value) {
|
||||||
|
json = await promise.json()
|
||||||
|
} else {
|
||||||
|
json = await promise.text()
|
||||||
|
}
|
||||||
|
return asUtil.jsToVal(json)
|
||||||
|
} catch (e) {
|
||||||
|
return asUtil.jsToVal(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
const as = new AiScript(common)
|
const as = new AiScript(common)
|
||||||
if (exe) as.exec(asParse(exe))
|
if (exe) as.exec(asParse(exe))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//オブジェクトパーサー(トゥート)
|
//オブジェクトパーサー(トゥート)
|
||||||
function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||||
var splitter = new GraphemeSplitter()
|
var splitter = new GraphemeSplitter()
|
||||||
var templete = ''
|
var templete = ''
|
||||||
if (obj[0]) {
|
if (obj[0]) {
|
||||||
|
@ -194,7 +194,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
}
|
}
|
||||||
var local = []
|
var local = []
|
||||||
var times = []
|
var times = []
|
||||||
Object.keys(obj).forEach(function (key) {
|
let content
|
||||||
|
for(let key in obj){
|
||||||
var domain = localStorage.getItem('domain_' + acct_id)
|
var domain = localStorage.getItem('domain_' + acct_id)
|
||||||
var toot = obj[key]
|
var toot = obj[key]
|
||||||
if (type == 'dm') {
|
if (type == 'dm') {
|
||||||
|
@ -463,9 +464,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toot.content == '') {
|
if (toot.content == '') {
|
||||||
var content = ' '
|
content = ' '
|
||||||
} else {
|
} else {
|
||||||
var content = toot.content
|
content = toot.content
|
||||||
}
|
}
|
||||||
if (content) {
|
if (content) {
|
||||||
var id = toot.id
|
var id = toot.id
|
||||||
|
@ -536,7 +537,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
(sent < ct && $.mb_strlen($.strip_tags(content)) > 5) ||
|
(sent < ct && $.mb_strlen($.strip_tags(content)) > 5) ||
|
||||||
($.mb_strlen($.strip_tags(content)) > ltr && $.mb_strlen($.strip_tags(content)) > 5)
|
($.mb_strlen($.strip_tags(content)) > ltr && $.mb_strlen($.strip_tags(content)) > 5)
|
||||||
) {
|
) {
|
||||||
var content = `<span class="gray">${lang.lang_parse_fulltext}</span><br>` + content
|
content = `<span class="gray">${lang.lang_parse_fulltext}</span><br>` + content
|
||||||
var spoil = `<span class="cw_long">${$.mb_substr(
|
var spoil = `<span class="cw_long">${$.mb_substr(
|
||||||
$.strip_tags(content),
|
$.strip_tags(content),
|
||||||
0,
|
0,
|
||||||
|
@ -1177,7 +1178,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
if (onlyContent) return content
|
||||||
if (mix == 'mix') {
|
if (mix == 'mix') {
|
||||||
return [templete, local, times]
|
return [templete, local, times]
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,7 +19,7 @@ function bottomReverse() {
|
||||||
localStorage.setItem('reverse', 'true')
|
localStorage.setItem('reverse', 'true')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function tips(mode) {
|
function tips(mode, custom) {
|
||||||
postMessage(['sendSinmpleIpc', 'endmem'], '*')
|
postMessage(['sendSinmpleIpc', 'endmem'], '*')
|
||||||
clearInterval(clockint)
|
clearInterval(clockint)
|
||||||
clearInterval(spotStart)
|
clearInterval(spotStart)
|
||||||
|
@ -57,6 +57,10 @@ function tips(mode) {
|
||||||
tipsToggle()
|
tipsToggle()
|
||||||
localStorage.setItem('tips', 'itunes')
|
localStorage.setItem('tips', 'itunes')
|
||||||
itunestips()
|
itunestips()
|
||||||
|
} else if (mode == 'custom') {
|
||||||
|
tipsToggle()
|
||||||
|
localStorage.setItem('tips', `custom:${custom}`)
|
||||||
|
execPlugin(custom, 'tips', null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//メモリ
|
//メモリ
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
"json5": "^2.1.3",
|
"json5": "^2.1.3",
|
||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
"materialize-css": "git://github.com/cutls/materialize#v1-dev",
|
"materialize-css": "git://github.com/cutls/materialize#v1-dev",
|
||||||
|
"sanitize-html": "^2.3.0",
|
||||||
"sumchecker": "^3.0.1",
|
"sumchecker": "^3.0.1",
|
||||||
"sweetalert2": "^10.10.0",
|
"sweetalert2": "^10.10.0",
|
||||||
"system-font-families": "^0.4.1",
|
"system-font-families": "^0.4.1",
|
||||||
|
|
104
app/yarn.lock
104
app/yarn.lock
|
@ -1241,6 +1241,11 @@ color-name@~1.1.4:
|
||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
|
||||||
|
colorette@^1.2.1:
|
||||||
|
version "1.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b"
|
||||||
|
integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==
|
||||||
|
|
||||||
colors@^1.3.3:
|
colors@^1.3.3:
|
||||||
version "1.4.0"
|
version "1.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
|
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
|
||||||
|
@ -1459,6 +1464,11 @@ deep-is@^0.1.3:
|
||||||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
||||||
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
|
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
|
||||||
|
|
||||||
|
deepmerge@^4.2.2:
|
||||||
|
version "4.2.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
|
||||||
|
integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==
|
||||||
|
|
||||||
defaults@^1.0.3:
|
defaults@^1.0.3:
|
||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
|
resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
|
||||||
|
@ -1563,6 +1573,15 @@ doctrine@^3.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
esutils "^2.0.2"
|
esutils "^2.0.2"
|
||||||
|
|
||||||
|
dom-serializer@^1.0.1:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.2.0.tgz#3433d9136aeb3c627981daa385fc7f32d27c48f1"
|
||||||
|
integrity sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA==
|
||||||
|
dependencies:
|
||||||
|
domelementtype "^2.0.1"
|
||||||
|
domhandler "^4.0.0"
|
||||||
|
entities "^2.0.0"
|
||||||
|
|
||||||
dom-walk@^0.1.0:
|
dom-walk@^0.1.0:
|
||||||
version "0.1.1"
|
version "0.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
|
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
|
||||||
|
@ -1573,6 +1592,27 @@ domain-browser@^1.2.0:
|
||||||
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
|
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"
|
||||||
integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==
|
integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==
|
||||||
|
|
||||||
|
domelementtype@^2.0.1, domelementtype@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.1.0.tgz#a851c080a6d1c3d94344aed151d99f669edf585e"
|
||||||
|
integrity sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w==
|
||||||
|
|
||||||
|
domhandler@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.0.0.tgz#01ea7821de996d85f69029e81fa873c21833098e"
|
||||||
|
integrity sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==
|
||||||
|
dependencies:
|
||||||
|
domelementtype "^2.1.0"
|
||||||
|
|
||||||
|
domutils@^2.4.4:
|
||||||
|
version "2.4.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.4.4.tgz#282739c4b150d022d34699797369aad8d19bbbd3"
|
||||||
|
integrity sha512-jBC0vOsECI4OMdD0GC9mGn7NXPLb+Qt6KW1YDQzeQYRUFKmNG8lh7mO5HiELfr+lLQE7loDVI4QcAxV80HS+RA==
|
||||||
|
dependencies:
|
||||||
|
dom-serializer "^1.0.1"
|
||||||
|
domelementtype "^2.0.1"
|
||||||
|
domhandler "^4.0.0"
|
||||||
|
|
||||||
dot-prop@^5.2.0:
|
dot-prop@^5.2.0:
|
||||||
version "5.2.0"
|
version "5.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.2.0.tgz#c34ecc29556dc45f1f4c22697b6f4904e0cc4fcb"
|
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.2.0.tgz#c34ecc29556dc45f1f4c22697b6f4904e0cc4fcb"
|
||||||
|
@ -1729,6 +1769,11 @@ enquirer@^2.3.5:
|
||||||
dependencies:
|
dependencies:
|
||||||
ansi-colors "^4.1.1"
|
ansi-colors "^4.1.1"
|
||||||
|
|
||||||
|
entities@^2.0.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5"
|
||||||
|
integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==
|
||||||
|
|
||||||
env-paths@^2.2.0:
|
env-paths@^2.2.0:
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43"
|
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43"
|
||||||
|
@ -1801,6 +1846,11 @@ escape-string-regexp@^2.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344"
|
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344"
|
||||||
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==
|
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==
|
||||||
|
|
||||||
|
escape-string-regexp@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
|
||||||
|
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
|
||||||
|
|
||||||
eslint-scope@^5.1.1:
|
eslint-scope@^5.1.1:
|
||||||
version "5.1.1"
|
version "5.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
|
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
|
||||||
|
@ -2398,6 +2448,16 @@ htmlescape@^1.1.0:
|
||||||
resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351"
|
resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351"
|
||||||
integrity sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=
|
integrity sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=
|
||||||
|
|
||||||
|
htmlparser2@^6.0.0:
|
||||||
|
version "6.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-6.0.0.tgz#c2da005030390908ca4c91e5629e418e0665ac01"
|
||||||
|
integrity sha512-numTQtDZMoh78zJpaNdJ9MXb2cv5G3jwUoe3dMQODubZvLoGvTE/Ofp6sHvH8OGKcN/8A47pGLi/k58xHP/Tfw==
|
||||||
|
dependencies:
|
||||||
|
domelementtype "^2.0.1"
|
||||||
|
domhandler "^4.0.0"
|
||||||
|
domutils "^2.4.4"
|
||||||
|
entities "^2.0.0"
|
||||||
|
|
||||||
http-cache-semantics@^4.0.0:
|
http-cache-semantics@^4.0.0:
|
||||||
version "4.0.3"
|
version "4.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz#495704773277eeef6e43f9ab2c2c7d259dda25c5"
|
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz#495704773277eeef6e43f9ab2c2c7d259dda25c5"
|
||||||
|
@ -2648,6 +2708,11 @@ is-plain-obj@^1.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
|
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
|
||||||
integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4=
|
integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4=
|
||||||
|
|
||||||
|
is-plain-object@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344"
|
||||||
|
integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==
|
||||||
|
|
||||||
is-regex@^1.0.4:
|
is-regex@^1.0.4:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
|
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
|
||||||
|
@ -2850,6 +2915,11 @@ keyv@^4.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
json-buffer "3.0.1"
|
json-buffer "3.0.1"
|
||||||
|
|
||||||
|
klona@^2.0.3:
|
||||||
|
version "2.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/klona/-/klona-2.0.4.tgz#7bb1e3affb0cb8624547ef7e8f6708ea2e39dfc0"
|
||||||
|
integrity sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA==
|
||||||
|
|
||||||
labeled-stream-splicer@^2.0.0:
|
labeled-stream-splicer@^2.0.0:
|
||||||
version "2.0.2"
|
version "2.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz#42a41a16abcd46fd046306cf4f2c3576fffb1c21"
|
resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz#42a41a16abcd46fd046306cf4f2c3576fffb1c21"
|
||||||
|
@ -3139,6 +3209,11 @@ mute-stream@0.0.8:
|
||||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
|
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
|
||||||
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==
|
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==
|
||||||
|
|
||||||
|
nanoid@^3.1.20:
|
||||||
|
version "3.1.20"
|
||||||
|
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788"
|
||||||
|
integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==
|
||||||
|
|
||||||
natural-compare@^1.4.0:
|
natural-compare@^1.4.0:
|
||||||
version "1.4.0"
|
version "1.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
||||||
|
@ -3461,6 +3536,11 @@ parse-headers@^2.0.0:
|
||||||
for-each "^0.3.3"
|
for-each "^0.3.3"
|
||||||
string.prototype.trim "^1.1.2"
|
string.prototype.trim "^1.1.2"
|
||||||
|
|
||||||
|
parse-srcset@^1.0.2:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/parse-srcset/-/parse-srcset-1.0.2.tgz#f2bd221f6cc970a938d88556abc589caaaa2bde1"
|
||||||
|
integrity sha1-8r0iH2zJcKk42IVWq8WJyqqiveE=
|
||||||
|
|
||||||
path-browserify@^1.0.0:
|
path-browserify@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
|
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
|
||||||
|
@ -3544,6 +3624,15 @@ pngjs@^3.0.0, pngjs@^3.3.3:
|
||||||
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f"
|
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f"
|
||||||
integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==
|
integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==
|
||||||
|
|
||||||
|
postcss@^8.0.2:
|
||||||
|
version "8.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.2.3.tgz#14ed1294850c99661761d9cb68863718eb75690d"
|
||||||
|
integrity sha512-tdmNCCmxJEsLZNj810qlj8QbvnUNKFL9A5doV+uHrGGK/YNKWEslrytnHDWr9M/GgGjfUFwXCRbxd/b6IoRBXQ==
|
||||||
|
dependencies:
|
||||||
|
colorette "^1.2.1"
|
||||||
|
nanoid "^3.1.20"
|
||||||
|
source-map "^0.6.1"
|
||||||
|
|
||||||
prelude-ls@^1.2.1:
|
prelude-ls@^1.2.1:
|
||||||
version "1.2.1"
|
version "1.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
|
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
|
||||||
|
@ -3910,6 +3999,19 @@ sanitize-filename@^1.6.2, sanitize-filename@^1.6.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
truncate-utf8-bytes "^1.0.0"
|
truncate-utf8-bytes "^1.0.0"
|
||||||
|
|
||||||
|
sanitize-html@^2.3.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-2.3.0.tgz#78c1a386a68369f27964e84526b7deb00f035d59"
|
||||||
|
integrity sha512-JAsbaKskfxR+ZhEnqO/T3c2dKalVDA6sXIgy/27TatIUzOPO/zWr1r8Ykzp1cwJx1j+DPMQF5ifvhniixRWYDA==
|
||||||
|
dependencies:
|
||||||
|
deepmerge "^4.2.2"
|
||||||
|
escape-string-regexp "^4.0.0"
|
||||||
|
htmlparser2 "^6.0.0"
|
||||||
|
is-plain-object "^5.0.0"
|
||||||
|
klona "^2.0.3"
|
||||||
|
parse-srcset "^1.0.2"
|
||||||
|
postcss "^8.0.2"
|
||||||
|
|
||||||
sax@>=0.6.0, sax@^1.2.4:
|
sax@>=0.6.0, sax@^1.2.4:
|
||||||
version "1.2.4"
|
version "1.2.4"
|
||||||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
|
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
|
||||||
|
@ -4032,7 +4134,7 @@ source-map-support@^0.5.19:
|
||||||
buffer-from "^1.0.0"
|
buffer-from "^1.0.0"
|
||||||
source-map "^0.6.0"
|
source-map "^0.6.0"
|
||||||
|
|
||||||
source-map@^0.6.0:
|
source-map@^0.6.0, source-map@^0.6.1:
|
||||||
version "0.6.1"
|
version "0.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||||
|
|
80
plugin.md
80
plugin.md
|
@ -5,35 +5,54 @@
|
||||||
[AiScript の書き方](https://github.com/syuilo/aiscript/blob/master/docs/get-started.md)
|
[AiScript の書き方](https://github.com/syuilo/aiscript/blob/master/docs/get-started.md)
|
||||||
|
|
||||||
## メタデータ
|
## メタデータ
|
||||||
|
|
||||||
```
|
```
|
||||||
### {
|
### {
|
||||||
|
manifest: 1
|
||||||
name: "マイ・ファースト・プラグイン"
|
name: "マイ・ファースト・プラグイン"
|
||||||
version: 1
|
version: 1
|
||||||
event: "buttonOnPostbox"
|
event: "buttonOnPostbox"
|
||||||
author: "Cutls P"
|
author: "Cutls P"
|
||||||
apiGet: "no"(例)
|
apiGet: no
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
これを冒頭に入れます。
|
これを冒頭に入れます。
|
||||||
* version
|
|
||||||
|
**AiScriptのbooleanはyesかnoです**
|
||||||
|
|
||||||
|
- manifest
|
||||||
|
1 を指定してください。無ければ 1 とみなします。
|
||||||
|
- version
|
||||||
数字でも文字列でも好きに使ってください。TheDesk 側では全く参照しません。
|
数字でも文字列でも好きに使ってください。TheDesk 側では全く参照しません。
|
||||||
* dangerHtml: yes|no
|
- dangerHtml: boolean
|
||||||
`TheDesk:changeText`にアクセスするために必要です。
|
`TheDesk:changeText`にアクセスするために必要です。
|
||||||
* apiGetl: yes|no
|
- apiGet: boolean
|
||||||
`TheDesk:api`にGETメソッドでアクセスするときに必要です。
|
`TheDesk:api`または`TheDesk:getRequest`に GET メソッドでアクセスするときに必要です。
|
||||||
* apiPost: yes|no
|
- apiPost: boolean
|
||||||
`TheDesk:api`に POST/PUT/DELETE メソッドでアクセスするときや、`postExec`を実行するときに必要です。
|
`TheDesk:api`に POST/PUT/DELETE メソッドでアクセスするときや、`postExec`を実行するときに必要です。
|
||||||
|
- shortcut: number
|
||||||
|
Alt+{number の keycode}で発火できるようにします。[キーコード一覧](https://shanabrian.com/web/javascript/keycode.php)
|
||||||
|
`event`が`init`, `buttonOnBottom`, `buttonOnPostbox`, `none`のときにのみ有効です。
|
||||||
|
- interval: number
|
||||||
|
`event`が`tips`のとき、更新間隔をミリ秒で指定します。
|
||||||
|
|
||||||
### event
|
### event
|
||||||
|
|
||||||
event に設定できるもの
|
event に設定できるもの
|
||||||
|
|
||||||
* `buttonOnPostbox`
|
- `buttonOnPostbox`
|
||||||
投稿フォームの…(90° 回転)で出てくるメニュー内に表示されます
|
投稿フォームの…(90° 回転)で出てくるメニュー内に表示されます
|
||||||
* `buttonOnToot`
|
- `buttonOnToot`
|
||||||
トゥートの詳細メニューに表示されます
|
トゥートの詳細メニューに表示されます
|
||||||
* `init`
|
- `init`
|
||||||
起動時(なるべく早い段階で)
|
起動時(なるべく早い段階で)
|
||||||
|
- `buttonOnBottom`
|
||||||
|
メニューボタン(画面下部)の右に追加されます。
|
||||||
|
- `tips`
|
||||||
|
TheDesk Tipsに追加します。
|
||||||
|
- `none`
|
||||||
|
明示しません。ショートカットでのみ発火します。
|
||||||
|
|
||||||
追加予定…
|
追加予定…
|
||||||
|
|
||||||
|
@ -41,89 +60,112 @@ eventに設定できるもの
|
||||||
|
|
||||||
### buttonOnToot のとき
|
### buttonOnToot のとき
|
||||||
|
|
||||||
* DATA
|
- DATA
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
id: "トゥートのID文字列",
|
id: "トゥートのID文字列",
|
||||||
acct_id: "アカウントのTheDesk内部ID"
|
acct_id: "アカウントのTheDesk内部ID"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
* TOOT
|
|
||||||
|
- TOOT
|
||||||
|
|
||||||
トゥートの API を叩いた時と同じオブジェクトが返ります。なお、プラグインが実行されてから取得します。
|
トゥートの API を叩いた時と同じオブジェクトが返ります。なお、プラグインが実行されてから取得します。
|
||||||
プラグインの実行ボタン押下から実行までの時間差はこれによるものです。
|
プラグインの実行ボタン押下から実行までの時間差はこれによるものです。
|
||||||
|
|
||||||
### buttonOnPostbox のとき
|
### buttonOnPostbox のとき
|
||||||
|
|
||||||
* POST
|
- POST
|
||||||
投稿するときのオブジェクトがそのまま入りますが、`TheDeskAcctId`という TheDesk が内部で扱うアカウントの ID(string)が入ったプロパティが追加されます。
|
投稿するときのオブジェクトがそのまま入りますが、`TheDeskAcctId`という TheDesk が内部で扱うアカウントの ID(string)が入ったプロパティが追加されます。
|
||||||
* ACCT_ID
|
- ACCT_ID
|
||||||
TheDesk が内部で扱うアカウントの ID(string)
|
TheDesk が内部で扱うアカウントの ID(string)
|
||||||
|
|
||||||
|
|
||||||
## 関数
|
## 関数
|
||||||
|
|
||||||
### TheDesk:dialog(title: string, text: string, type?: string)
|
### TheDesk:dialog(title: string, text: string, type?: string)
|
||||||
|
|
||||||
type のデフォルトは'info'で、他に'error','question','success'などがある
|
type のデフォルトは'info'で、他に'error','question','success'などがある
|
||||||
|
|
||||||
### TheDesk:confirm(title: string, text: string, type?: string)
|
### TheDesk:confirm(title: string, text: string, type?: string)
|
||||||
|
|
||||||
type のデフォルトは'info'で、他に'error','question','success'などがある
|
type のデフォルトは'info'で、他に'error','question','success'などがある
|
||||||
返り値は boolean(true|false)
|
返り値は boolean(true|false)
|
||||||
|
|
||||||
### TheDesk:css(query: string, attr: string, val: string)
|
### TheDesk:css(query: string, attr: string, val: string)
|
||||||
|
|
||||||
jQuery の`$(query).css(attr, val)`に相当
|
jQuery の`$(query).css(attr, val)`に相当
|
||||||
|
|
||||||
### TheDesk:api(method: 'GET'|'POST'|'PUT'|'DELETE', endpoint: string, body: string, acct_id: string)
|
### TheDesk:openLink(url: string)
|
||||||
bodyにもstringを投げてください。
|
|
||||||
|
リンクを無確認で開きます。
|
||||||
|
|
||||||
|
### TheDesk:api(method: 'GET'|'POST'|'PUT'|'DELETE', endpoint: string, body: string | null, acct_id: string)
|
||||||
|
|
||||||
endpoint は`v1`から書いてください。(`v1/accounts...`)
|
endpoint は`v1`から書いてください。(`v1/accounts...`)
|
||||||
|
|
||||||
返り値は json のオブジェクト。
|
返り値は json のオブジェクト。
|
||||||
|
|
||||||
|
### TheDesk:getRequest(endpoint: string, json: boolean)
|
||||||
|
|
||||||
|
endpoint は`https://` を省いて書いてください。(HTTPSにリクエストを限定するため)
|
||||||
|
返り値は`json`がtrueなら json のオブジェクト。falseならstring(テキストとして処理)
|
||||||
|
|
||||||
### TheDesk:changeText(body: string)
|
### TheDesk:changeText(body: string)
|
||||||
|
|
||||||
`buttonOnToot`で使用可能
|
`buttonOnToot`で使用可能
|
||||||
|
|
||||||
該当トゥート(や他タイムラインの同一トゥート)のテキストを書き換えます。
|
該当トゥート(や他タイムラインの同一トゥート)のテキストを書き換えます。
|
||||||
`dangerHtml`を true にしてください。
|
`dangerHtml`を true にしてください。
|
||||||
HTML を引数にすることに留意してください。
|
HTML を引数にすることに留意してください。
|
||||||
|
|
||||||
|
p, span, br, a タグを利用できます。また、a タグには'href', 'class', 'rel', 'target'属性以外を入れることはできず、
|
||||||
|
href の最初が javascript:で始まるものも利用できません。
|
||||||
|
|
||||||
### TheDesk:postText(text: string)
|
### TheDesk:postText(text: string)
|
||||||
|
|
||||||
`buttonOnPostbox`で使用可能
|
`buttonOnPostbox`で使用可能
|
||||||
|
|
||||||
トゥートボックスの中身を書き換えます。
|
トゥートボックスの中身を書き換えます。
|
||||||
|
|
||||||
### TheDesk:postCW(force: boolean, text: string)
|
### TheDesk:postCW(force: boolean, text: string)
|
||||||
|
|
||||||
`buttonOnPostbox`で使用可能
|
`buttonOnPostbox`で使用可能
|
||||||
|
|
||||||
CW を切り替えます。force はデフォルトで false で、true にするとオンに、false にするとトグルになります。
|
CW を切り替えます。force はデフォルトで false で、true にするとオンに、false にするとトグルになります。
|
||||||
text には警告文を入れます。
|
text には警告文を入れます。
|
||||||
|
|
||||||
### TheDesk:postNSFW(force: boolean)
|
### TheDesk:postNSFW(force: boolean)
|
||||||
|
|
||||||
`buttonOnPostbox`で使用可能
|
`buttonOnPostbox`で使用可能
|
||||||
|
|
||||||
NSFW を切り替えます。force はデフォルトで false で、true にするとオンに、false にするとトグルになります。
|
NSFW を切り替えます。force はデフォルトで false で、true にするとオンに、false にするとトグルになります。
|
||||||
|
|
||||||
### TheDesk:postVis(vis: 'public'|'unlisted'|'private'|'direct')
|
### TheDesk:postVis(vis: 'public'|'unlisted'|'private'|'direct')
|
||||||
|
|
||||||
`buttonOnPostbox`で使用可能
|
`buttonOnPostbox`で使用可能
|
||||||
|
|
||||||
公開範囲を変更します。
|
公開範囲を変更します。
|
||||||
|
|
||||||
### TheDesk:postNSFW(force: postClearbox)
|
### TheDesk:postClearbox(force: boolean)
|
||||||
|
|
||||||
`buttonOnPostbox`で使用可能
|
`buttonOnPostbox`で使用可能
|
||||||
|
|
||||||
投稿ボックスをクリアします。
|
投稿ボックスをクリアします。
|
||||||
|
|
||||||
### TheDesk:postExec()
|
### TheDesk:postExec()
|
||||||
|
|
||||||
`buttonOnPostbox`で使用可能
|
`buttonOnPostbox`で使用可能
|
||||||
|
|
||||||
`apiPost`を true にしてください。
|
`apiPost`を true にしてください。
|
||||||
トゥートボタンを押したのと同じ挙動をします。
|
トゥートボタンを押したのと同じ挙動をします。
|
||||||
|
|
||||||
|
|
||||||
## 実例
|
## 実例
|
||||||
|
|
||||||
### 1
|
### 1
|
||||||
|
|
||||||
https://misskey.io/@syuilo/pages/bebeyo を TheDesk で使用できるようにするためには…(勝手に改造)
|
https://misskey.io/@syuilo/pages/bebeyo を TheDesk で使用できるようにするためには…(勝手に改造)
|
||||||
|
|
||||||
```
|
```
|
||||||
### {
|
### {
|
||||||
name: "ベベヨ"
|
name: "ベベヨ"
|
||||||
|
@ -154,10 +196,10 @@ do()
|
||||||
最初のメタデータを追加します。
|
最初のメタデータを追加します。
|
||||||
また、do 関数の最下部の`TheDesk:postText(text)`で、TheDesk の投稿ボックスに結果を挿入しています。
|
また、do 関数の最下部の`TheDesk:postText(text)`で、TheDesk の投稿ボックスに結果を挿入しています。
|
||||||
|
|
||||||
|
|
||||||
### 2
|
### 2
|
||||||
|
|
||||||
Cat にするやつ(ユーザーがいちいち押さないと変換されないし、タグごと変わってしまうのであまりよくない)
|
Cat にするやつ(ユーザーがいちいち押さないと変換されないし、タグごと変わってしまうのであまりよくない)
|
||||||
|
|
||||||
```
|
```
|
||||||
### {
|
### {
|
||||||
name: "nyaize"
|
name: "nyaize"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user