-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* style: 🎨 run prettier * style: 🎨 update prettier configs * fix: edit section summary (#105) * chore: formats * fix: page protection notify * fix: close #129 * fix: fix #105 again * chore: update APIs & preference.about * fix: quickEdit/isEditable * fix: missing global.InPageEdit * v14.1.9-alpha.2 * v14.1.9-rc.0 * minor fix * minor fix * update README
- Loading branch information
1 parent
4fe84d0
commit 9fdae59
Showing
40 changed files
with
6,567 additions
and
5,571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
/** | ||
* @method getDir | ||
* @return {String} 插件CDN的URL路径,结尾没有/ | ||
* | ||
* | ||
* @description 注意,如果您想自己自己托管InPageEdit,_dir可以直接返回您的URL | ||
* 例如 const _dir = https://yourdomain.com/inpageedit | ||
*/ | ||
function getDir() { | ||
var thisScript = document.currentScript.src; | ||
var thisUrl = thisScript.split('/'); | ||
var thisScript = document.currentScript.src | ||
var thisUrl = thisScript.split('/') | ||
// 理论上入口文件位于 /dist/*.js | ||
// 因此删掉最后两位路径 | ||
thisUrl.pop(); | ||
thisUrl.pop(); | ||
thisUrl = thisUrl.join('/'); | ||
return thisUrl; | ||
thisUrl.pop() | ||
thisUrl.pop() | ||
thisUrl = thisUrl.join('/') | ||
return thisUrl | ||
} | ||
|
||
/** | ||
* @constant {String} _dir CDN URL | ||
*/ | ||
const _dir = getDir(); | ||
const _dir = getDir() | ||
|
||
module.exports = _dir; | ||
module.exports = _dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
var mwApi = new mw.Api(); | ||
var mwApi = new mw.Api() | ||
|
||
var getUserInfo = function () { | ||
/** | ||
* @description 获取用户权限信息 | ||
*/ | ||
* @description 获取用户权限信息 | ||
*/ | ||
mwApi.getUserInfo().then( | ||
data => { | ||
console.info('[InPageEdit] 成功获取用户权限信息'); | ||
mw.config.set('wgUserRights', data.rights); | ||
(data) => { | ||
console.info('[InPageEdit] 成功获取用户权限信息') | ||
mw.config.set('wgUserRights', data.rights) | ||
}, | ||
error => { | ||
console.warn('[InPageEdit] 警告:无法获取用户权限信息', error); | ||
mw.config.set('wgUserRights', []); | ||
(error) => { | ||
console.warn('[InPageEdit] 警告:无法获取用户权限信息', error) | ||
mw.config.set('wgUserRights', []) | ||
} | ||
); | ||
) | ||
|
||
/** | ||
* @description 获取封禁状态 | ||
*/ | ||
if (mw.config.get('wgUserName') !== null) { | ||
mwApi.get({ | ||
action: 'query', | ||
list: 'users', | ||
usprop: 'blockinfo', | ||
ususers: mw.config.get('wgUserName') | ||
}).then(data => { | ||
if (data.query.users[0].blockid) { | ||
mw.config.set('wgUserIsBlocked', true); | ||
} else { | ||
mw.config.set('wgUserIsBlocked', false); | ||
} | ||
}); | ||
mwApi | ||
.get({ | ||
action: 'query', | ||
list: 'users', | ||
usprop: 'blockinfo', | ||
ususers: mw.config.get('wgUserName'), | ||
}) | ||
.then((data) => { | ||
if (data.query.users[0].blockid) { | ||
mw.config.set('wgUserIsBlocked', true) | ||
} else { | ||
mw.config.set('wgUserIsBlocked', false) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
module.exports = { | ||
getUserInfo | ||
} | ||
getUserInfo, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.