diff --git a/README.md b/README.md
index 54d805e..9a24114 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,7 @@
+## 更新日志
+
+2022.10.24 添加 visiblity 发送设置。
+
## 说明
Chrome 应用商店:
diff --git a/css/main.css b/css/main.css
index 4cff710..3ae7242 100644
--- a/css/main.css
+++ b/css/main.css
@@ -107,11 +107,13 @@ input.inputer{border-bottom: 1px solid #ccc;width:75%;}
svg.icon{width:24px;height:24px;}
#tags,#getlink{margin-right: .5rem;}
-#tags svg,#getlink svg{opacity: 0.6;}
-#tags:hover svg,#getlink:hover svg{opacity: 1;cursor: pointer;}
+#tags svg,#getlink svg,#locked svg,#unlock svg{opacity: 0.6;}
+#tags:hover svg,#getlink:hover svg,#locked:hover svg,#unlock:hover svg{opacity: 1;cursor: pointer;}
-#taglist{display: none;}
-.tag-list {
+#locked{display: none;}
+
+#taglist,#visibilitylist{display: none;}
+.tag-list,.visibility-list {
margin-top: .5rem;
max-height: 13rem;
flex-direction: column;
@@ -119,7 +121,7 @@ svg.icon{width:24px;height:24px;}
justify-content: flex-start;
font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;
}
-.tag-list>.item-container {
+.tag-list>.item-container,.visibility-list >.item-lock {
display: inline-block;
background-color: #666;
cursor: pointer;
@@ -131,6 +133,9 @@ svg.icon{width:24px;height:24px;}
margin:0 6px 6px 0;
}
+.visibility-list .item-lock.lock-now{
+ background-color:rgb(22,163,74);
+}
#blog_info_edit{
position: absolute;
right: 1rem;
@@ -143,6 +148,13 @@ svg.icon{width:24px;height:24px;}
justify-content: center;
}
+
+
+
+
+
+
+
.tip{
margin-left: 36%;
max-width: 640px;
diff --git a/js/oper.js b/js/oper.js
index 8737a51..18ddd11 100644
--- a/js/oper.js
+++ b/js/oper.js
@@ -37,7 +37,6 @@ $('#saveKey').click(function () {
})
$('#tags').click(function () {
- //add("要出入的文本");
get_info(function (info) {
if (info.status) {
var tagUrl = info.apiUrl.replace(/api\/memo/,'api/tag')
@@ -57,6 +56,32 @@ $('#tags').click(function () {
}
})
})
+$('#unlock,#locked').click(function () {
+ get_info(function (info) {
+ var nowlock = info.memo_lock
+ var lockDom = '公开仅自己登录可见'
+ $("#visibilitylist").html(lockDom).slideToggle(500)
+ })
+})
+$(document).on("click",".item-lock",function () {
+ _this = $(this)[0].dataset.type
+ if(_this !== "PUBLIC"){
+ $('#locked').show()
+ $('#unlock').hide()
+ }else{
+ $('#locked').hide()
+ $('#unlock').show()
+ }
+ chrome.storage.sync.set(
+ {memo_lock: _this},
+ function () {
+ $.message({
+ message: '设置成功,当前为: '+ _this
+ })
+ $('#visibilitylist').hide()
+ }
+ )
+})
$(document).on("click",".item-container",function () {
var tagHtml = $(this).text()+" "
@@ -96,6 +121,7 @@ function get_info(callback) {
chrome.storage.sync.get(
{
apiUrl: '',
+ memo_lock: 'Public',
open_action: '',
open_content: ''
},
@@ -109,6 +135,7 @@ function get_info(callback) {
}
returnObject.status = flag
returnObject.apiUrl = items.apiUrl
+ returnObject.memo_lock = items.memo_lock
returnObject.open_content = items.open_content
returnObject.open_action = items.open_action
if (callback) callback(returnObject)
@@ -129,13 +156,17 @@ function sendText() {
get_info(function (info) {
if (info.status) {
//信息满足了
+ console.log(info.memo_lock)
$.message({message: '发送中~~'})
//$("#content_submit_text").attr('disabled','disabled');
let content = $('#content').val()
$.ajax({
url:info.apiUrl,
type:"POST",
- data:JSON.stringify({'content': content}),
+ data:JSON.stringify({
+ 'content': content,
+ 'visibility': info.memo_lock
+ }),
contentType:"application/json;",
dataType:"json",
success: function(result){
diff --git a/manifest.json b/manifest.json
index 9305ee3..9fd53d6 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "__MSG_extName__",
- "version": "2022.10.12",
+ "version": "2022.10.24",
"action": {
"default_popup": "popup.html",
"default_icon": "assets/logo_24x24.png",
diff --git a/popup.html b/popup.html
index b788cd9..0a7b458 100644
--- a/popup.html
+++ b/popup.html
@@ -12,7 +12,6 @@
MEMOS
-
-
-
-
-
-
+
+
+
+