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

This commit is contained in:
lmm214
2023-03-10 22:05:54 +08:00
parent deec1e77a5
commit a39d4b9a2a
3 changed files with 21 additions and 27 deletions
+18 -26
View File
@@ -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: '取消上传'
})
@@ -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)
@@ -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) {
@@ -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 {
@@ -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){
@@ -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){
@@ -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()
@@ -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 () {
@@ -553,7 +545,7 @@ function sendText() {
{ open_action: '', open_content: '',resourceIdList:'' },
function () {
$.message({
message: '网络问题,发送失败!😭(记得点下小锁图标,设置一下状态哦)'
message: '网络问题,发送失败!😭'
})
}
)},