MediaWiki:Common.js
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
// 确保一定生效
setTimeout(function(){
// 模板按钮的click事件初始化
Array.from(document.getElementsByClassName('template-btn-container')).forEach(function(element) {
element.addEventListener('click', function(e) {
e.stopPropagation();
var temp = this, link = this.getAttribute('data-link') || '';
if(link.indexOf('http:') || link.indexOf('https:')){
window.open(link, '_blank');
}else{
window.ope
n('http://10.160.16.71:6690/index.php/' + link, '_blank');
}
});
});
console.log('js init~')
}, 300)