Skip to content

Commit

Permalink
2023.03.10 修复发布后调用最新一条 Memos。
Browse files Browse the repository at this point in the history
  • Loading branch information
lmm214 committed Mar 10, 2023
1 parent deec1e7 commit a39d4b9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Chrome 应用商店:<https://chrome.google.com/webstore/detail/memos-bber/cbhj

## 更新日志

2023.03.10 修复发布后调用最新一条 Memos。

2023.03.09 新增右键发送文本至 Memos 输入框。

![iShot_2023-03-05](https://user-images.githubusercontent.com/1472390/222957393-fc2e933e-b18f-4e69-a8c0-4609f84a0a90.png)
Expand Down
44 changes: 18 additions & 26 deletions js/oper.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ function initDrag() {
obj.ondragleave = function (ev) {
ev.preventDefault()
if (ev.target.className === 'common-editor-inputer') {
console.log('ondragleave' + ev.target.tagName)
$.message({
message: '取消上传'
})
Expand Down Expand Up @@ -159,9 +158,7 @@ function uploadImage(data) {
processData: false,
contentType: false,
dataType: 'json',

success: function (result) {
console.log(result)
if (result.data.id) {
//获取到图片
relistNow.push(result.data.id)
Expand Down Expand Up @@ -224,23 +221,6 @@ $('#opensite').click(function () {
})
})

function getOne(){
get_info(function (info) {
if (info.apiUrl) {
$("#randomlist").html('').hide()
var getUrl = info.apiUrl+'&rowStatus=NORMAL&limit=1'
$.get(getUrl,function(data){
var getData = data.data[0]
randDom(getData)
});
} else {
$.message({
message: '请先填写好 API 链接'
})
}
})
}

$('#tags').click(function () {
get_info(function (info) {
if (info.apiUrl) {
Expand All @@ -252,7 +232,6 @@ $('#tags').click(function () {
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)
});
} else {
Expand Down Expand Up @@ -364,7 +343,6 @@ $('#random').click(function () {
var creatorId = data.data[0].creatorId
var randomUrl1 = info.apiUrl.replace(/api\/memo.*/,'api/memo/stats?creatorId=')+creatorId
$.get(randomUrl1,function(data){
console.log(data.data.length)
let randomNum = Math.floor(Math.random() * (data.data.length)) + 1;
var randomUrl2 = info.apiUrl+'&rowStatus=NORMAL&limit=1&offset='+randomNum
$.get(randomUrl2,function(data){
Expand Down Expand Up @@ -497,7 +475,6 @@ $('#blog_info_edit').click(function () {
$('#blog_info').slideToggle()
})

//发送操作
$('#content_submit_text').click(function () {
var contentVal = $("textarea[name=text]").val()
if(contentVal){
Expand All @@ -507,10 +484,25 @@ $('#content_submit_text').click(function () {
}
})

function getOne(memosId){
get_info(function (info) {
if (info.apiUrl) {
$("#randomlist").html('').hide()
var getUrl = info.apiUrl.replace(/api\/memo(.*)/,'api/memo/'+memosId+'$1')
$.get(getUrl,function(data){
randDom(data.data)
});
} else {
$.message({
message: '请先填写好 API 链接'
})
}
})
}

function sendText() {
get_info(function (info) {
if (info.status) {
//信息满足了
$.message({message: '发送中~~'})
//$("#content_submit_text").attr('disabled','disabled');
let content = $("textarea[name=text]").val()
Expand All @@ -537,7 +529,7 @@ function sendText() {
dataType:"json",
success: function(result){
//发送成功
getOne()
getOne(result.data.id)
chrome.storage.sync.set(
{ open_action: '', open_content: '',resourceIdList:''},
function () {
Expand All @@ -553,7 +545,7 @@ function sendText() {
{ open_action: '', open_content: '',resourceIdList:'' },
function () {
$.message({
message: '网络问题,发送失败!😭(记得点下小锁图标,设置一下状态哦)'
message: '网络问题,发送失败!😭'
})
}
)},
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "__MSG_extName__",
"version": "2023.03.09",
"version": "2023.03.10",
"action": {
"default_popup": "popup.html",
"default_icon": "assets/logo_24x24.png",
Expand Down

0 comments on commit a39d4b9

Please sign in to comment.