From 9623b79197dbc0e382a6c6b3ac2e849690e1d4d5 Mon Sep 17 00:00:00 2001 From: cutls Date: Mon, 7 Sep 2020 16:36:25 +0900 Subject: [PATCH] #317 dropdown menu with library --- app/css/tl.css | 46 +++---------------------- app/js/post/status.js | 6 +++- app/js/tl/parse.js | 61 +++++++++++++-------------------- app/js/ui/post-box.js | 5 --- app/view/make/index.sample.html | 1 - 5 files changed, 33 insertions(+), 86 deletions(-) diff --git a/app/css/tl.css b/app/css/tl.css index ff0b237d..dc1b07a4 100644 --- a/app/css/tl.css +++ b/app/css/tl.css @@ -451,48 +451,12 @@ iframe, .action .fa-quote-right { margin-top: 0.15rem; } -.actct { - color: var(--beforehover); +.contextMenu.dropdown-content { + padding-top: 5px; + overflow-y: hidden; + left: calc(100% - 200px) !important; + width: 200px !important; } -.actct:hover { - color: var(--color); - transition: 0.5s; -} -#contextWrap { - position: fixed; - width: 199vw; - height: 100vh; - z-index: 100; -} -.contextMenu { - position: fixed; - background-color: var(--box); - z-index: 9999; - border-radius: 0.4rem; - padding: 0.4rem; -} -.contextMenu.bottom:before { - content: ''; - position: absolute; - top: 100%; - right: 2rem; - border: 1.2rem solid transparent; - border-top: 1.2rem solid var(--box); -} -.contextMenu.top:before { - content: ''; - position: absolute; - top: -2.3rem; - right: 2rem; - border: 1.5rem solid transparent; - border-bottom: 1.5rem solid var(--box); -} -.contextMenu .btn-flat { - text-transform: none !important; - width: 100%; - text-align: left; -} - .gray { color: var(--gray); } diff --git a/app/js/post/status.js b/app/js/post/status.js index 49e651f5..85a120b3 100644 --- a/app/js/post/status.js +++ b/app/js/post/status.js @@ -680,7 +680,11 @@ function staEx(mode) { }) return } -function toggleAction(elem, ct) { +function toggleAction(id) { + console.log(document.getElementById(id)) + var instance = M.Dropdown.init(document.getElementById(id)); + instance.open() + return var height = ct * 39 + 6 var cont = elem.parents('.cvo').find('.contextMenu') if (cont.hasClass('hide')) { diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 67d99375..15fc668b 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -901,12 +901,10 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { } //日本語じゃない if (toot.language != lang.language && toot.language) { - var trans = `
- ${lang.lang_parse_trans} - -
` + ` } else { var trans = '' } @@ -1132,8 +1130,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
- + Other actions @@ -1146,45 +1144,33 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { ${lang.lang_parse_detail}
-
-
+
+
- -
-
- -
-
- -
-
- -
+ ${trans} -
- -
-
+
  • + ${lang.lang_parse_link} +
  • + ` } @@ -1371,7 +1357,6 @@ function userparse(obj, auth, acct_id, tlid, popup) { } //クライアントダイアログ function client(name) { - $('#contextWrap').addClass('hide') if (name != 'Unknown') { //聞く Swal.fire({ diff --git a/app/js/ui/post-box.js b/app/js/ui/post-box.js index 3ca86b7c..cec48573 100644 --- a/app/js/ui/post-box.js +++ b/app/js/ui/post-box.js @@ -126,11 +126,6 @@ function initPostbox() { localStorage.removeItem('nohide') srcBox('close') }) - $('#contextWrap').click(function (e) { - $('#contextWrap').addClass('hide') - $('.contextMenu').addClass('hide') - $('.act-icon').text('expand_more') - }) $('#textarea,#cw-text').focusout(function (e) { localStorage.setItem('nohide', true) var countup = function () { diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index 82f23afe..5cd8f465 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -123,7 +123,6 @@ -
    @@post-new@@Reaction