This commit is contained in:
lmm214
2023-02-25 15:57:37 +08:00
parent fa99456fe0
commit 57fd068ba9
5 changed files with 168 additions and 46 deletions
+2
View File
@@ -1,5 +1,7 @@
## 更新日志
2023.02.26 更改 Memos 可见范围按钮样式。
2023.02.25 修复 v0.11.0 下随机按钮失效。(api amount 失效导致,换用 stats 获取总条数)
![iShot_2023-02-06_19 16 28](https://user-images.githubusercontent.com/1472390/216958098-1f4fab2a-e77c-41bd-8ba3-5786f42744d7.png)
+130
View File
@@ -247,3 +247,133 @@ input.inputer{border-bottom: 1px solid #ccc;width:75%;}
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.\!hidden{
display: none!important;
}
.selector-wrapper {
position: relative;
display: flex;
height: 2rem;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start
}
.selector-wrapper>.current-value-container {
display: flex;
height: 100%;
width: 100%;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-radius: .25rem;
border-width: 1px;
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
padding-left: .5rem;
padding-right: .25rem;
}
.selector-wrapper>.current-value-container>.value-text {
margin-right: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: .875rem
}
.selector-wrapper>.current-value-container>.value-text {
width: calc(100% - 20px)
}
.selector-wrapper>.current-value-container>.lock-text {
margin-right: .25rem;
display: flex;
width: 1rem;
flex-shrink: 0;
flex-direction: row;
align-items: center;
justify-content: center
}
.selector-wrapper>.current-value-container>.arrow-text {
display: flex;
width: 1rem;
flex-shrink: 0;
flex-direction: row;
align-items: center;
justify-content: center
}
.selector-wrapper>.current-value-container>.arrow-text>.icon-img {
height: auto;
width: 1rem;
opacity: .4
}
.selector-wrapper>.items-wrapper {
position: absolute;
bottom: 100%;
left: 0px;
z-index: 1;
margin-top: .25rem;
margin-left: -.5rem;
display: flex;
width: auto;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
overflow-y: auto;
border-radius: .375rem;
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
padding: .25rem;
-ms-overflow-style: none;
scrollbar-width: none
}
.selector-wrapper>.items-wrapper::-webkit-scrollbar {
display: none
}
.selector-wrapper>.items-wrapper {
min-width: calc(100% + 16px);
max-height: 256px;
box-shadow: 0 0 8px #0003
}
.selector-wrapper>.items-wrapper>.item-lock {
display: flex;
width: 100%;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
white-space: nowrap;
border-radius: .25rem;
padding-left: .75rem;
padding-right: .75rem;
font-size: .875rem;
line-height: 2rem
}
.selector-wrapper>.items-wrapper>.item-lock:hover {
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity))
}
.selector-wrapper>.items-wrapper>.item-lock.selected {
--tw-text-opacity: 1;
color: rgb(22 163 74 / var(--tw-text-opacity))
}
.selector-wrapper>.items-wrapper>.tip-text {
padding: .25rem .75rem;
font-size: .875rem;
--tw-text-opacity: 1;
color: rgb(75 85 99 / var(--tw-text-opacity))
}
.selector-wrapper>.selector-disabled {
cursor: not-allowed;
pointer-events: none;
--tw-bg-opacity: 1;
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
--tw-text-opacity: 1;
color: rgb(156 163 175 / var(--tw-text-opacity))
}
+23 -31
View File
@@ -12,13 +12,14 @@ get_info(function (info) {
chrome.storage.sync.set(
{ memo_lock: 'PUBLIC'}
)
$("#lock-now").text("所有人可见")
}
if(memoNow !== "PUBLIC"){
$('#locked').show()
$('#unlock').hide()
}else{
$('#locked').hide()
$('#unlock').show()
if(memoNow == "PUBLIC"){
$("#lock-now").text("所有人可见")
}else if(memoNow == "PRIVATE"){
$("#lock-now").text("仅自己可见")
}else if(memoNow == "PROTECTED"){
$("#lock-now").text("登录用户可见")
}
$('#apiUrl').val(info.apiUrl)
if (info.open_action === 'upload_image') {
@@ -39,6 +40,12 @@ $("textarea[name=text]").blur(function () {
)
})
$("textarea[name=text]").on('keydown', function (ev) {
if (ev.code === 'Enter' && (ev.ctrlKey || ev.metaKey)) {
$('#content_submit_text').click()
}
})
//监听拖拽事件,实现拖拽到窗口上传图片
initDrag()
@@ -216,12 +223,17 @@ $('#tags').click(function () {
})
})
$('#unlock,#locked').click(function () {
get_info(function (info) {
var nowlock = info.memo_lock
var lockDom = '<span class="item-lock'+ (nowlock == 'PUBLIC' ? ' lock-now' : '')+'" data-type="PUBLIC">公开</span><span class="item-lock'+ (nowlock == 'PRIVATE' ? ' lock-now' : '')+'" data-type="PRIVATE">仅自己</span><span class="item-lock'+ (nowlock == 'PROTECTED' ? ' lock-now' : '')+'" data-type="PROTECTED">登录可见</span>'
$("#visibilitylist").html(lockDom).slideToggle(500)
$('#lock').click(function () {
$("#lock-wrapper").toggleClass( "!hidden", 1000 );
})
$(document).on("click",".item-lock",function () {
$("#lock-wrapper").toggleClass( "!hidden", 1000 );
$("#lock-now").text($(this).text())
_this = $(this)[0].dataset.type;
chrome.storage.sync.set(
{memo_lock: _this}
)
})
dayjs.extend(window.dayjs_plugin_relativeTime)
@@ -374,26 +386,6 @@ get_info(function (info) {
})
})
$(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()+" "
add(tagHtml);
+1 -1
View File
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "__MSG_extName__",
"version": "2023.02.25",
"version": "2023.02.26",
"action": {
"default_popup": "popup.html",
"default_icon": "assets/logo_24x24.png",
+11 -13
View File
@@ -68,24 +68,22 @@
<path fill="#666" d="m388 668 306-255 1-1-48-56-305 255h-2z"/>
</svg>
</div>
<div id="unlock" class="mr-5">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024">
<path fill="#666" d="M725 427H299a128 128 0 0 0-128 128v256a128 128 0 0 0 128 128h426a128 128 0 0 0 128-128V555a128 128 0 0 0-128-128zm-426 85h426a43 43 0 0 1 43 43v256a43 43 0 0 1-43 42H299a43 43 0 0 1-43-42V555a43 43 0 0 1 43-43z"/>
<path fill="#666" d="M512 597a85 85 0 1 0 0 171 85 85 0 0 0 0-171zm0-554a213 213 0 0 1 213 213 43 43 0 0 1-85 5v-5a128 128 0 0 0-256-8v221a43 43 0 0 1-85 5V256A213 213 0 0 1 512 43z"/>
</svg>
</div>
<div id="locked" class="mr-5">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024">
<path fill="#666" d="M725 427H299a128 128 0 0 0-128 128v256a128 128 0 0 0 128 128h426a128 128 0 0 0 128-128V555a128 128 0 0 0-128-128zm-426 85h426a43 43 0 0 1 43 43v256a43 43 0 0 1-43 42H299a43 43 0 0 1-43-42V555a43 43 0 0 1 43-43z"/>
<path fill="#666" d="M512 597a85 85 0 1 0 0 171 85 85 0 0 0 0-171zm0-512a213 213 0 0 1 213 204v180a43 43 0 0 1-85 5V299a128 128 0 0 0-256-8v178a43 43 0 0 1-85 5V299A213 213 0 0 1 512 85z"/>
</svg>
</div>
<div id="random" class="mr-5">
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="#666" d="M988.492 718.906L864.168 595.6c-15.686-15.556-41.012-15.454-56.568.232-15.556 15.686-15.452 41.012.232 56.568L922.368 766h-48.812c-115.514 0-222.1-49.978-292.428-137.122-13.874-17.194-39.058-19.88-56.248-6.006-17.192 13.874-19.88 39.056-6.006 56.248C604.464 785.176 733.74 846 873.556 846h44.78L807.832 955.6c-15.684 15.556-15.79 40.882-.232 56.568A39.88 39.88 0 0 0 836.002 1024c10.18 0 20.368-3.864 28.166-11.6l124.324-123.306C1011.39 866.384 1024 836.162 1024 804s-12.61-62.382-35.508-85.094z"/><path fill="#666" d="M988.492 134.906L864.168 11.6c-15.686-15.556-41.012-15.454-56.568.232-15.556 15.686-15.452 41.012.232 56.568L918.336 178h-44.78c-163.332 0-314.542 86.102-394.626 224.702l-16.952 29.342-27.352-47.342C354.544 246.102 203.332 160 40 160c-22.092 0-40 17.908-40 40s17.908 40 40 40c134.852 0 259.522 70.782 325.356 184.724L415.78 512l-50.426 87.276C299.522 713.22 174.852 784 40 784c-22.092 0-40 17.908-40 40s17.908 40 40 40c163.332 0 314.542-86.102 394.626-224.702l61.64-106.684c.224-.374.442-.752.654-1.134l51.28-88.756C614.034 328.782 738.704 258 873.556 258h48.812L807.832 371.6c-15.684 15.556-15.79 40.882-.232 56.568A39.88 39.88 0 0 0 836.002 440c10.18 0 20.368-3.864 28.166-11.6l124.324-123.306C1011.39 282.384 1024 252.162 1024 220s-12.61-62.382-35.508-85.094z"/></svg>
</div>
<div id="search" class="mr-5">
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path d="M689.067 631.467L889.6 832c38.4 38.4-19.2 96-57.6 57.6L631.467 689.067C576 731.733 505.6 757.333 430.933 757.333 249.6 757.333 102.4 610.133 102.4 428.8s147.2-326.4 328.533-326.4 328.534 147.2 328.534 328.533c-2.134 74.667-27.734 145.067-70.4 200.534zm-258.134 44.8c136.534 0 245.334-110.934 245.334-245.334S565.333 183.467 430.933 183.467 183.467 294.4 183.467 430.933 294.4 676.267 430.933 676.267z" fill="#666"/></svg>
</div>
<div class="selector-wrapper visibility-selector ">
<div id="lock" class="current-value-container active false">
<span id="lock-now" class="value-text"></span><span class="arrow-text"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon-img"><polyline points="6 9 12 15 18 9"></polyline></svg></span>
</div>
<div id="lock-wrapper" class="items-wrapper !hidden">
<div class="item-lock" data-type="PRIVATE">仅自己可见</div>
<div class="item-lock" data-type="PROTECTED">登录用户可见</div>
<div class="item-lock" data-type="PUBLIC">所有人可见</div>
</div>
</div>
</div>
<div class="btns-container" type="submit" name="submit" id="submit">
<button id="content_submit_text" class="action-btn confirm-btn">记下<img class="icon-img" src="../assets/logo_24x24.png"></button>
@@ -93,7 +91,7 @@
</div>
<div class="tag-list" id="taglist"></div>
<div class="" id="randomlist"></div>
<div class="visibility-list" id="visibilitylist"></div>
<input type="file" id="inFile" style="display:none;">
<script src="../js/jquery.min.js"></script>
<script src="../js/message.js"></script>