你现在正在访问的是萌娘百科用于保存和管理图片、音频等媒体文件的子项目萌娘共享,想要回到萌娘百科,请使用浏览器上的返回按钮、或点击这里
“User:サンムル/js/linksToImage.js”的版本间的差异
小 |
小 |
||
第6行: | 第6行: | ||
$.ajax({ | $.ajax({ | ||
url: 'https://zh.moegirl.org.cn/' + mw.config.get('wgPageName'), | url: 'https://zh.moegirl.org.cn/' + mw.config.get('wgPageName'), | ||
− | |||
− | |||
− | |||
success: function(data) { | success: function(data) { | ||
let links = $('div#mw-imagepage-section-linkstoimage', $(data)); | let links = $('div#mw-imagepage-section-linkstoimage', $(data)); | ||
第17行: | 第14行: | ||
$(nolinks).replaceWith($('<p />').html('获取链入错误:' + $('<font color="red" />').text(msg))) | $(nolinks).replaceWith($('<p />').html('获取链入错误:' + $('<font color="red" />').text(msg))) | ||
}, | }, | ||
− | dataType: 'html' | + | dataType: 'html', |
+ | crossDomain: true | ||
}); | }); | ||
}) | }) |
2021年1月27日 (三) 20:36的版本
'use strict'; $(function() { if (mw.config.get('wgNamespaceNumber') !== 6) return; // 非File名称空间。 let nolinks = $("div#mw-imagepage-nolinkstoimage"); if (nolinks.length !== 0) $.ajax({ url: 'https://zh.moegirl.org.cn/' + mw.config.get('wgPageName'), success: function(data) { let links = $('div#mw-imagepage-section-linkstoimage', $(data)); if (links.length !== 0) $(nolinks).replaceWith(links); }, error: function(XHR, msg, e) { $(nolinks).replaceWith($('<p />').html('获取链入错误:' + $('<font color="red" />').text(msg))) }, dataType: 'html', crossDomain: true }); })