From d886cdd4ed898df3b2bcbdb5e506cfd9743f9df6 Mon Sep 17 00:00:00 2001 From: lmm214 Date: Mon, 10 Oct 2022 21:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=BD=93=E5=89=8D=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/main.css | 29 +++++++++++------- html/popup.html | 8 ++--- js/oper.js | 78 +++++++++++++++++++++++++++++-------------------- 3 files changed, 68 insertions(+), 47 deletions(-) diff --git a/css/main.css b/css/main.css index 98ccfe5..4cff710 100644 --- a/css/main.css +++ b/css/main.css @@ -12,12 +12,14 @@ button, input, textarea { input:focus::-moz-placeholder ,.common-editor-inputer:focus::-moz-placeholder { color: #d3d3d3 } - +input::placeholder ,.common-editor-inputer::placeholder { + color: #999; +} input:focus::placeholder ,.common-editor-inputer:focus::placeholder { color: #d3d3d3 } .body{ - min-width:350px; + min-width:460px; background-color: #f6f5f4; padding:0 1rem 1rem; font-family: eafont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,STHeiti,WenQuanYi Micro Hei,Helvetica,Arial,sans-serif; @@ -37,7 +39,7 @@ input:focus::placeholder ,.common-editor-inputer:focus::placeholder { border-radius: .5rem; background-color: rgb(255,255,255); margin-top:0.8rem; - padding: 0.8rem; + padding: 0.6rem; transition-property: all; transition-timing-function: cubic-bezier(.4,0,.2,1); transition-duration: .15s; @@ -45,8 +47,6 @@ input:focus::placeholder ,.common-editor-inputer:focus::placeholder { .btns-container{text-align:right;} .common-editor-inputer,input.inputer{ font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace; - margin-top: .25rem; - margin-bottom: .25rem; height: 100%; width: 100%; resize: none; @@ -56,22 +56,29 @@ input:focus::placeholder ,.common-editor-inputer:focus::placeholder { background-color: transparent; font-size: 1rem; min-height: 40px; - max-height: 300px; + max-height: 400px; scrollbar-width: none; + line-height: 1.5rem; } input.inputer{border-bottom: 1px solid #ccc;width:75%;} #saveKey{margin:0;flex:1;} + .common-tools-wrapper { position: relative; display: flex; width: 100%; flex-direction: row; align-items: center; - justify-content: space-between; margin-top: 1rem; + justify-content: space-between; +} +.common-tools-container { + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; } - .confirm-btn { display: inline-flex; cursor: pointer; @@ -99,9 +106,9 @@ input.inputer{border-bottom: 1px solid #ccc;width:75%;} } svg.icon{width:24px;height:24px;} - -#tags svg{opacity: 0.6;} -#tags:hover svg{opacity: 1;cursor: pointer;} +#tags,#getlink{margin-right: .5rem;} +#tags svg,#getlink svg{opacity: 0.6;} +#tags:hover svg,#getlink:hover svg{opacity: 1;cursor: pointer;} #taglist{display: none;} .tag-list { diff --git a/html/popup.html b/html/popup.html index 76fb491..b788cd9 100644 --- a/html/popup.html +++ b/html/popup.html @@ -31,18 +31,18 @@
-
- +
+
+
diff --git a/js/oper.js b/js/oper.js index bc6913e..3babf39 100644 --- a/js/oper.js +++ b/js/oper.js @@ -62,6 +62,16 @@ $(document).on("click",".item-container",function () { var tagHtml = $(this).text()+" " add(tagHtml); }) +$('#getlink').click(function () { + chrome.tabs.getSelected(null, function (tab) { + var linkHtml = " ["+tab.title+"]("+tab.url+") " + if(tab.url){ + add(linkHtml); + }else{ + $.message({message: '获取失败 😂'}) + } + }); +}) function add(str) { var tc = document.getElementById("content"); @@ -107,44 +117,48 @@ function get_info(callback) { //发送操作 $('#content_submit_text').click(function () { - sendText() + var contentVal = $('#content').val() + if(contentVal){ + sendText() + }else{ + $.message({message: '写点什么,再记呗?'}) + } }) function sendText() { get_info(function (info) { if (info.status) { //信息满足了 - $.message({message: '发送中'}) - $("#content_submit_text").attr('disabled','disabled'); + $.message({message: '发送中~~'}) + //$("#content_submit_text").attr('disabled','disabled'); let content = $('#content').val() -$.ajax({ - url:info.apiUrl, - type:"POST", - data:JSON.stringify({'content': content}), - contentType:"application/json;", - dataType:"json", - success: function(result){ - //发送成功 - chrome.storage.sync.set( - { open_action: '', open_content: '' }, - function () { - $.message({ - message: '发送成功!' - }) - $("#content_submit_text").removeAttr('disabled'); - $('#content').val('') - } - ) - }, - error:function(err){//清空open_action(打开时候进行的操作),同时清空open_content - chrome.storage.sync.set( - { open_action: '', open_content: '' }, - function () { - $.message({ - message: '网络问题发送成功!' - }) - } - )}, -}) + $.ajax({ + url:info.apiUrl, + type:"POST", + data:JSON.stringify({'content': content}), + contentType:"application/json;", + dataType:"json", + success: function(result){ + //发送成功 + chrome.storage.sync.set( + { open_action: '', open_content: '' }, + function () { + $.message({ + message: '发送成功!😊' + }) + //$("#content_submit_text").removeAttr('disabled'); + $('#content').val('') + } + ) + },error:function(err){//清空open_action(打开时候进行的操作),同时清空open_content + chrome.storage.sync.set( + { open_action: '', open_content: '' }, + function () { + $.message({ + message: '网络问题,发送失败!😭' + }) + } + )}, + }) } else { $.message({ message: '请先填写好 API 链接'