MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
两次刷新稳定session 标签:手工回退 |
移除syncLoginState,统一认证扩展已正常工作 |
||
| 第7行: | 第7行: | ||
fetch( MAIN_SITE + '/api/auth/cookie-logout', { method: 'POST', credentials: 'include' } ) | fetch( MAIN_SITE + '/api/auth/cookie-logout', { method: 'POST', credentials: 'include' } ) | ||
.finally( function() { window.location.href = WIKI_BASE + '/wiki/首页'; } ); | .finally( function() { window.location.href = WIKI_BASE + '/wiki/首页'; } ); | ||
} | } | ||
| 第26行: | 第15行: | ||
doLogout(); | doLogout(); | ||
return false; | return false; | ||
} ); | } ); | ||
} | } | ||
| 第63行: | 第42行: | ||
mw.loader.using( 'mediawiki.util' ).done( function() { | mw.loader.using( 'mediawiki.util' ).done( function() { | ||
$( document ).ready( function() { | $( document ).ready( function() { | ||
setupLogout(); | setupLogout(); | ||
interceptLoginButton(); | interceptLoginButton(); | ||
2026年4月15日 (三) 12:42的版本
( function () {
'use strict';
var MAIN_SITE = 'https://www.dolshipmaker.vip';
var WIKI_BASE = 'https://wiki.dolshipmaker.vip';
function doLogout() {
fetch( MAIN_SITE + '/api/auth/cookie-logout', { method: 'POST', credentials: 'include' } )
.finally( function() { window.location.href = WIKI_BASE + '/wiki/首页'; } );
}
function setupLogout() {
$( document ).on( 'click', '[href*="action=logout"], [href*="UserLogout"], [data-mw-logouturl]', function(e) {
e.preventDefault();
e.stopImmediatePropagation();
doLogout();
return false;
} );
}
function interceptLoginButton() {
$( document ).on( 'click', 'a[href*="Special:UserLogin"], a[href*="action=login"]', function(e) {
e.preventDefault();
window.location.href = MAIN_SITE + '/login.html?redirect=' + encodeURIComponent( window.location.href );
} );
}
function interceptRegisterButton() {
$( document ).on( 'click', 'a[href*="Special:CreateAccount"], a[href*="action=createaccount"]', function(e) {
e.preventDefault();
window.location.href = MAIN_SITE + '/register.html?redirect=' + encodeURIComponent( window.location.href );
} );
}
function interceptEditForAnon() {
if ( mw.config.get( 'wgUserId' ) !== 0 ) return;
$( document ).on( 'click', 'a[href*="action=edit"], a[href*="veaction=edit"]', function(e) {
e.preventDefault();
window.location.href = MAIN_SITE + '/login.html?redirect=' + encodeURIComponent( window.location.href );
} );
}
mw.loader.using( 'mediawiki.util' ).done( function() {
$( document ).ready( function() {
setupLogout();
interceptLoginButton();
interceptRegisterButton();
interceptEditForAnon();
} );
} );
}() );