mirror of
https://github.com/Jonnyan404/memos-bber.git
synced 2026-04-24 19:48:37 +09:00
默认标签公开或自己可见
This commit is contained in:
+4
-8
@@ -140,7 +140,7 @@ input.inputer{border-bottom: 1px solid #ccc;width:75%;}
|
||||
justify-content: flex-start;
|
||||
font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;
|
||||
}
|
||||
.tag-list>.item-container,.visibility-list >.item-lock {
|
||||
.tag-list>.item-container,.visibility-list >.item-lock,.tag-list .hidetag{
|
||||
display: inline-block;
|
||||
background-color: #666;
|
||||
cursor: pointer;
|
||||
@@ -151,6 +151,9 @@ input.inputer{border-bottom: 1px solid #ccc;width:75%;}
|
||||
color: #fff;
|
||||
margin:0 6px 6px 0;
|
||||
}
|
||||
.tag-list .hidetag{padding:0;float:right;}
|
||||
.tag-hide{display: none;}
|
||||
.tag-hide input.inputer{width:40%;font-size:11px;}
|
||||
|
||||
.visibility-list .item-lock.lock-now{
|
||||
background-color:rgb(22,163,74);
|
||||
@@ -167,13 +170,6 @@ input.inputer{border-bottom: 1px solid #ccc;width:75%;}
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.tip{
|
||||
margin-left: 36%;
|
||||
max-width: 640px;
|
||||
|
||||
+71
-37
@@ -1,7 +1,36 @@
|
||||
/**
|
||||
* open_action: 打开这个页面执行的操作
|
||||
* open_text:打开这页面需要复原的输入框的内容
|
||||
*/
|
||||
function get_info(callback) {
|
||||
chrome.storage.sync.get(
|
||||
{
|
||||
apiUrl: '',
|
||||
hidetag: '',
|
||||
showtag: '',
|
||||
memo_lock: '',
|
||||
open_action: '',
|
||||
open_content: '',
|
||||
resourceIdList: []
|
||||
},
|
||||
function (items) {
|
||||
var flag = false
|
||||
var returnObject = {}
|
||||
if (items.apiUrl === '' || items.repo === '') {
|
||||
flag = false
|
||||
} else {
|
||||
flag = true
|
||||
}
|
||||
returnObject.status = flag
|
||||
returnObject.apiUrl = items.apiUrl
|
||||
returnObject.hidetag = items.hidetag
|
||||
returnObject.showtag = items.showtag
|
||||
returnObject.memo_lock = items.memo_lock
|
||||
returnObject.open_content = items.open_content
|
||||
returnObject.open_action = items.open_action
|
||||
returnObject.resourceIdList = items.resourceIdList
|
||||
|
||||
if (callback) callback(returnObject)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
get_info(function (info) {
|
||||
if (info.status) {
|
||||
//已经有绑定信息了,折叠
|
||||
@@ -22,6 +51,8 @@ get_info(function (info) {
|
||||
$("#lock-now").text("登录用户可见")
|
||||
}
|
||||
$('#apiUrl').val(info.apiUrl)
|
||||
$('#hideInput').val(info.hidetag)
|
||||
$('#showInput').val(info.showtag)
|
||||
if (info.open_action === 'upload_image') {
|
||||
//打开的时候就是上传图片
|
||||
uploadImage(info.open_content)
|
||||
@@ -214,6 +245,7 @@ $('#tags').click(function () {
|
||||
$.each(arrData, function(i,obj){
|
||||
tagDom += '<span class="item-container">#'+obj+'</span>'
|
||||
});
|
||||
tagDom += '<svg id="hideTag" class="hidetag" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M78.807 362.435c201.539 314.275 666.962 314.188 868.398-.241 16.056-24.99 13.143-54.241-4.04-62.54-17.244-8.377-40.504 3.854-54.077 24.887-174.484 272.338-577.633 272.41-752.19.195-13.573-21.043-36.874-33.213-54.113-24.837-17.177 8.294-20.06 37.545-3.978 62.536z" fill="#fff"/><path d="M894.72 612.67L787.978 494.386l38.554-34.785 106.742 118.251-38.554 34.816zM635.505 727.51l-49.04-147.123 49.255-16.41 49.054 147.098-49.27 16.435zm-236.18-12.001l-49.568-15.488 43.29-138.48 49.557 15.513-43.28 138.455zM154.49 601.006l-38.743-34.565 95.186-106.732 38.763 34.566-95.206 106.731z" fill="#fff"/></svg>'
|
||||
//console.log(tagDom)
|
||||
$("#taglist").html(tagDom).slideToggle(500)
|
||||
});
|
||||
@@ -225,6 +257,26 @@ $('#tags').click(function () {
|
||||
})
|
||||
})
|
||||
|
||||
$(document).on("click","#hideTag",function () {
|
||||
$('#taghide').slideToggle(500)
|
||||
})
|
||||
|
||||
$('#saveTag').click(function () {
|
||||
// 保存数据
|
||||
chrome.storage.sync.set(
|
||||
{
|
||||
hidetag: $('#hideInput').val(),
|
||||
showtag: $('#showInput').val()
|
||||
},
|
||||
function () {
|
||||
$.message({
|
||||
message: '保存信息成功'
|
||||
})
|
||||
$('#taghide').hide()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
$('#lock').click(function () {
|
||||
$("#lock-wrapper").toggleClass( "!hidden", 1000 );
|
||||
})
|
||||
@@ -294,9 +346,9 @@ $('#random').click(function () {
|
||||
get_info(function (info) {
|
||||
if (info.status) {
|
||||
$("#randomlist").html('').hide()
|
||||
var nowTag = $("textarea[name=text]").val().replace(/#([^\s#]+)/,'$1') ;
|
||||
if( $("#taglist").is(':visible') && nowTag){
|
||||
var tagUrl = info.apiUrl+'&rowStatus=NORMAL&tag='+nowTag
|
||||
var nowTag = $("textarea[name=text]").val().match(/#([^\s#]+)/)
|
||||
if( $("#taglist").is(':visible') && nowTag[1]){
|
||||
var tagUrl = info.apiUrl+'&rowStatus=NORMAL&tag='+nowTag[1]
|
||||
$.get(tagUrl,function(data){
|
||||
let randomNum = Math.floor(Math.random() * (data.data.length));
|
||||
var randomData = data.data[randomNum]
|
||||
@@ -441,35 +493,6 @@ $('#blog_info_edit').click(function () {
|
||||
$('#blog_info').slideToggle()
|
||||
})
|
||||
|
||||
function get_info(callback) {
|
||||
chrome.storage.sync.get(
|
||||
{
|
||||
apiUrl: '',
|
||||
memo_lock: 'Public',
|
||||
open_action: '',
|
||||
open_content: '',
|
||||
resourceIdList: []
|
||||
},
|
||||
function (items) {
|
||||
var flag = false
|
||||
var returnObject = {}
|
||||
if (items.apiUrl === '' || items.repo === '') {
|
||||
flag = false
|
||||
} else {
|
||||
flag = true
|
||||
}
|
||||
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
|
||||
returnObject.resourceIdList = items.resourceIdList
|
||||
|
||||
if (callback) callback(returnObject)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
//发送操作
|
||||
$('#content_submit_text').click(function () {
|
||||
var contentVal = $("textarea[name=text]").val()
|
||||
@@ -487,12 +510,23 @@ function sendText() {
|
||||
$.message({message: '发送中~~'})
|
||||
//$("#content_submit_text").attr('disabled','disabled');
|
||||
let content = $("textarea[name=text]").val()
|
||||
var hideTag = info.hidetag
|
||||
var showTag = info.showtag
|
||||
var nowTag = $("textarea[name=text]").val().match(/(#[^\s#]+)/)
|
||||
var sendvisi = info.memo_lock || ''
|
||||
if(nowTag){
|
||||
if(nowTag[1] == showTag){
|
||||
sendvisi = 'PUBLIC'
|
||||
}else if(nowTag[1] == hideTag){
|
||||
sendvisi = 'PRIVATE'
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
url:info.apiUrl,
|
||||
type:"POST",
|
||||
data:JSON.stringify({
|
||||
'content': content,
|
||||
'visibility': info.memo_lock || '',
|
||||
'visibility': sendvisi,
|
||||
'resourceIdList': info.resourceIdList || [],
|
||||
}),
|
||||
contentType:"application/json;",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "__MSG_extName__",
|
||||
"version": "2023.02.26",
|
||||
"version": "2023.03.05",
|
||||
"action": {
|
||||
"default_popup": "popup.html",
|
||||
"default_icon": "assets/logo_24x24.png",
|
||||
|
||||
+22
@@ -90,6 +90,28 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag-list" id="taglist"></div>
|
||||
<div class="tag-hide" id="taghide">
|
||||
<input
|
||||
id="hideInput"
|
||||
class="inputer"
|
||||
name="hideInput"
|
||||
type="text"
|
||||
value=""
|
||||
maxlength="50"
|
||||
placeholder="默认“仅自己可见”标签名"
|
||||
/>
|
||||
<input
|
||||
id="showInput"
|
||||
class="inputer"
|
||||
name="showInput"
|
||||
type="text"
|
||||
value=""
|
||||
maxlength="50"
|
||||
placeholder="默认“所有人可见”标签名"
|
||||
/>
|
||||
<span id="saveTag" class="action-btn confirm-btn">保存</span>
|
||||
</div>
|
||||
|
||||
<div class="" id="randomlist"></div>
|
||||
|
||||
<input type="file" id="inFile" style="display:none;">
|
||||
|
||||
Reference in New Issue
Block a user