更多操作
无编辑摘要 |
无编辑摘要 标签:已被回退 |
||
第5行: | 第5行: | ||
} | } | ||
$(document).ready(function() { | |||
// 查找所有以 /index.php? 开头的链接 | |||
$('a[href^="/index.php?"]').each(function() { | |||
var href = $(this).attr('href'); | |||
// 判断链接中是否含有 action=veedit 参数 | |||
if (href.indexOf('action=veedit') !== -1) { | |||
// 通过正则匹配提取 title 参数的值 | |||
var titleMatch = href.match(/(?:\?|&)title=([^&]+)/); | |||
if (titleMatch && titleMatch[1]) { | |||
var title = decodeURIComponent(titleMatch[1]); | |||
// 构造新的短链接形式:/w/veedit/Page_title | |||
var newHref = '/w/veedit/' + encodeURIComponent(title); | |||
$(this).attr('href', newHref); | |||
} | } | ||
} | } | ||
}); | }); | ||
}); | }); |
2025年5月16日 (五) 12:26的版本
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
if (mw.config.get('wgPageName') === '首页'){
importScript( 'MediaWiki:Mainpage.js' );
} else {
}
$(document).ready(function() {
// 查找所有以 /index.php? 开头的链接
$('a[href^="/index.php?"]').each(function() {
var href = $(this).attr('href');
// 判断链接中是否含有 action=veedit 参数
if (href.indexOf('action=veedit') !== -1) {
// 通过正则匹配提取 title 参数的值
var titleMatch = href.match(/(?:\?|&)title=([^&]+)/);
if (titleMatch && titleMatch[1]) {
var title = decodeURIComponent(titleMatch[1]);
// 构造新的短链接形式:/w/veedit/Page_title
var newHref = '/w/veedit/' + encodeURIComponent(title);
$(this).attr('href', newHref);
}
}
});
});