AutoSyncData: Format and sync code
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name NGA优化摸鱼体验插件-自动同步数据
|
||||
// @namespace https://github.com/lifegpc/userscript/tree/master/NGA_BBS_plugins/AutoSyncData
|
||||
// @version 1.0.3
|
||||
// @version 1.0.4
|
||||
// @author lifegpc
|
||||
// @description 通过WebDAV自动同步数据
|
||||
// @license MIT
|
||||
@@ -295,7 +295,7 @@
|
||||
...config,
|
||||
onload: response => {
|
||||
this.buttons.forEach(button => button.$el.removeAttr('disabled'))
|
||||
if (response.status>=200&&response.status<300) {
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
resolve(response)
|
||||
} else {
|
||||
if (method == 'GET' && response.status == 404) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name NGA优化摸鱼体验插件-自动同步数据
|
||||
// @namespace https://github.com/lifegpc/userscript/tree/master/NGA_BBS_plugins/AutoSyncData
|
||||
// @version 1.0.3
|
||||
// @version 1.0.4
|
||||
// @author lifegpc
|
||||
// @description 通过WebDAV自动同步数据
|
||||
// @license MIT
|
||||
@@ -305,12 +305,6 @@
|
||||
url[url.length - 1] !== '/' && (url += '/')
|
||||
const username = this.pluginInputs['username'].val().trim()
|
||||
const password = this.pluginInputs['password'].val().trim()
|
||||
const methodDict = {
|
||||
PROPFIND: 207,
|
||||
GET: 200,
|
||||
PUT: 201,
|
||||
DELETE: 204
|
||||
}
|
||||
this.buttons.forEach(button => button.$el.attr('disabled', true))
|
||||
return new Promise((resolve, reject) => {
|
||||
GM_xmlhttpRequest({
|
||||
@@ -324,7 +318,7 @@
|
||||
...config
|
||||
}).then(response => {
|
||||
this.buttons.forEach(button => button.$el.removeAttr('disabled'))
|
||||
if (response.status === methodDict[method]) {
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
resolve(response)
|
||||
} else {
|
||||
if (method == 'GET' && response.status == 404) {
|
||||
|
||||
Reference in New Issue
Block a user