Commit b728fee9 by 庄欣

完成快速引用插件

parent 349f9b5e
...@@ -143,26 +143,6 @@ var getToday = () => { ...@@ -143,26 +143,6 @@ var getToday = () => {
return dt.getFullYear() + "-" + month + "-" + day; return dt.getFullYear() + "-" + month + "-" + day;
} }
function getWorksIdByBase64(url) {
let pre1 = /\works\/\S*\?/g;
let pre2 = /\works\/\S*\?*/g;
if (url.indexOf("?") > -1) {
worksString = url.match(pre1);
} else {
worksString = url.match(pre2);
}
let worksId = null;
if (worksString !== undefined && worksString !== null && worksString.length > 0) {
worksId = worksString[0].replace("works/", "");
worksId = worksId.replace("?", "");
worksId = this.base64Decode(worksId);
}
this.objectId = worksId;
this.type = TYPE_WORK;
}
window.onload = function () { window.onload = function () {
chrome.runtime.sendMessage({}, function(response) { chrome.runtime.sendMessage({}, function(response) {
ACCESS_TOKEN = response.access_token; ACCESS_TOKEN = response.access_token;
...@@ -170,6 +150,25 @@ window.onload = function () { ...@@ -170,6 +150,25 @@ window.onload = function () {
}); });
} }
function loading() {
var mask = document.createElement("div");
mask.id = "____mask___";
mask.style.zIndex = 9999;
mask.style.width = "100%";
mask.style.height = "100%";
mask.style.position = "fixed";
mask.style.left = 0;
mask.style.top = 0;
mask.style.backgroundColor = "#000000";
mask.style.opacity = "80%";
body.appendChild(mask);
}
function removeLoading() {
var mask = document.getElementById("____mask___");
mask.remove();
}
function goNext() { function goNext() {
var todayInput = document.getElementById("today"); var todayInput = document.getElementById("today");
...@@ -201,6 +200,7 @@ function goNext() { ...@@ -201,6 +200,7 @@ function goNext() {
worksDom.value = getWorksId(); worksDom.value = getWorksId();
var sendBtn = document.getElementById("send") var sendBtn = document.getElementById("send")
sendBtn.onclick = function () { sendBtn.onclick = function () {
loading();
var postData = { var postData = {
"push_time": todayInput.value, "push_time": todayInput.value,
"channel_id": channelDom.value, "channel_id": channelDom.value,
...@@ -217,9 +217,11 @@ function goNext() { ...@@ -217,9 +217,11 @@ function goNext() {
sendData(host + "/works/pushrecord", postData, (res) => { sendData(host + "/works/pushrecord", postData, (res) => {
if (res.code.toString() !== "100001") { if (res.code.toString() !== "100001") {
alert(res.message); alert(res.message);
removeLoading();
return; return;
} }
alert("操作成功"); alert("操作成功");
removeLoading();
prop(); prop();
return ; return ;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment