From fcd302ed9861649e07942e30d894ea62e4f0d3c6 Mon Sep 17 00:00:00 2001 From: mtsgi Date: Fri, 3 May 2019 02:58:15 +0900 Subject: [PATCH] Add Custom Contextmenus and GUI for Fusen Function [0.2.0] --- index.html | 6 ++++- system.js | 59 +++++++++++++++++++++++++++++++++++++----- system/theme/theme-default.css | 18 +++++++++---- 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 3a0ed09..b9b4d10 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ - + @@ -88,6 +88,10 @@ 壁紙の設定 プロセス管理 吸い寄せる + ふせんを追加する + +
+
diff --git a/system.js b/system.js index 753e8b9..8d9f859 100644 --- a/system.js +++ b/system.js @@ -264,6 +264,19 @@ function kit() { $("#kit-contextgroup-elem").show(); } $( "#kit-context-elem" ).text( _ptelem.prop("tagName").toLowerCase() + "要素" ); + + $("#kit-contextgroup-custom").hide(); + if( _ptelem.attr("data-kit-contextid") ){ + $("#kit-contextgroup-custom").show().html('
'); + $("#kit-context-custom").text(_ptelem.attr("data-kit-contextid")); + for( let i in KWS.context[_ptelem.attr("data-kit-contextid")]){ + $("#kit-contextgroup-custom").append(" " + KWS.context[_ptelem.attr("data-kit-contextid")][i].label +""); + $("#kit-context-" + _ptelem.attr("data-kit-contextid") + "-" + i).on("click", () => { + KWS.context[_ptelem.attr("data-kit-contextid")][i].function(); + $("#kit-context").fadeOut(300); + }); + } + } if( _ptelem[0].id ) $( "#kit-context-elem" ).append( "#" + _ptelem[0].id ); $( "#kit-context-size" ).text( _ptelem[0].clientWidth + "✕" + _ptelem[0].clientHeight ); $("#kit-context").toggle().css("left", S.mouseX).css("top", S.mouseY); @@ -285,7 +298,6 @@ function kit() { $("#kit-context a").on("click", function(){ $("#kit-context").fadeOut(300); }); - $("#kit-context-vacuum").on("click", function(){ for( let i in process ){ KWS.vacuum( S.mouseX, S.mouseY ); @@ -294,6 +306,10 @@ function kit() { $(".window").css("transition", "none"); }, 500); }); + $("#kit-context-fusen").on("click", function(){ + KWS.fusen.add(""); + }); + $("section").on("click", function(){ $("#kit-context").fadeOut(300); @@ -904,7 +920,7 @@ const KWS = new function(){ .removeClass("windowmaximize"); $("footer").show(); $("#kit-header-fullscreen").hide().off(); - KWS.resize( _pid, KWS.fullscreen.prevWidth, "auto" ); + KWS.resize( _pid, KWS.fullscreen.prevWidth, KWS.fullscreen.prevHeight ); KWS.fullscreen.pid = null; KWS.fullscreen.prevWidth = null; KWS.fullscreen.prevHeight = null; @@ -963,9 +979,12 @@ const KWS = new function(){ this.add = function(_text){ KWS.fusen.list[KWS.fusen.fid] = String(_text); - $("#desktop-"+currentDesktop).append("
"+_text+"
"); - $("#kit-f"+KWS.fusen.fid).css("left", Number(KWS.fusen.fid)*20 + 20).pep({ - elementsWithInteraction: ".winc, .ui-resizable-handle", + $("#desktop-"+currentDesktop).append("
"); + $("#kit-f"+KWS.fusen.fid).css({ + "left": Number(KWS.fusen.fid)*40 + 20, + "top": Number(KWS.fusen.fid)*10 + 100, + }).pep({ + elementsWithInteraction: ".kit-fusen-textarea", useCSSTranslation: false, disableSelect: false, shouldEase: true, @@ -977,6 +996,11 @@ const KWS = new function(){ $(this.el).css("ui-opacity", "1.0"); } }) + $(".kit-fusen-textarea").off().on("change",function(){ + Notification.push($(this).attr("data-fid"), $(this).val(), "debug"); + KWS.fusen.list[$(this).attr("data-fid")] = $(this).val(); + localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list )); + }); localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list )); KWS.fusen.fid++; } @@ -984,7 +1008,30 @@ const KWS = new function(){ this.remove = function(_fid){ delete KWS.fusen.list[_fid]; localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list )); - $("#kit-f"+KWS.fusen.fid).remove(); + $("#kit-f"+_fid).remove(); + } + } + + this.addCustomContext = function( _elem, _contextid, _obj ){ + KWS.context[_contextid] = _obj; + } + + this.context = { + "fusen" : { + "delete" : { + "label" : "ふせんを削除", + "icon" : "fa-trash-alt", + "function" : function(){ + KWS.fusen.remove( S.selectedElement.attr("data-fid") ); + } + }, + "copy" : { + "label" : "ふせんを複製", + "icon" : "fa-copy", + "function" : function(){ + KWS.fusen.add( KWS.fusen.list[S.selectedElement.attr("data-fid")] ); + } + } } } } diff --git a/system/theme/theme-default.css b/system/theme/theme-default.css index 0a8c829..7998c45 100644 --- a/system/theme/theme-default.css +++ b/system/theme/theme-default.css @@ -809,7 +809,7 @@ h3{ padding: 0px 5px; border-bottom: 1px solid #a0a0a0; } -#kit-context-text, #kit-context-desktop{ +#kit-context-text, #kit-context-desktop, #kit-context-custom{ color: #a0a0a0; font-size: 15px; padding: 4px 5px; @@ -956,14 +956,22 @@ h3{ .kit-fusen{ background: rgba(255,250,220,.9); width: 200px; - padding: 4px;KWS. + padding: 4px; margin: 8px; - box-sizing: border-box; border-radius: 6px; - box-shadow:inset 0 1px 1px 0 rgba(0,0,0,.5), 0 1px 4px 0 rgba(0,0,0,.5); + box-shadow:0 1px 4px 0 rgba(0,0,0,.5); position: absolute; bottom: 20px; - height: 60px; + height: 55px; +} +.kit-fusen-textarea{ + cursor:url(../cursor-3.png), text; + font-family: 'Noto Sans JP', sans-serif; + position: absolute; + width: 180px; + background: transparent; + border: none; + resize: none; } @keyframes activeAnim{ -- 2.11.0