imported>=海豚= |
imported>Irukaza |
(未显示2个用户的63个中间版本) |
第1行: |
第1行: |
| <noinclude>Only for {{tl|萌百页面嵌入}}</noinclude> | | <noinclude>Only for {{tl|萌百页面嵌入}}</noinclude> |
| <includeonly> | | <includeonly> |
| <style> | | <script> |
| /* <pre> */
| | const jsonp = (() => { |
| body {background-image:url(https://www.hmoegirl.com/images/e/ef/%E7%AE%B1%E5%AD%90%E9%87%8C%E7%9A%84%E8%90%8C%E7%99%BE%E5%A8%98_.png);background-size:650px;}
| | let incrementCallbackKey = 0 |
| #moe a {color: #00AF89;}
| | |
| #moe a.new {color: #BA0000!important;}
| | return function jsonp(config) { |
| #moe a.external {color: #36b!important;}
| | return new Promise((resolve, reject) => { |
| #moe a.mw-collapsible-text {color: #3366cc!important;}
| | const scriptTag = document.createElement('script') |
| #moe .heimu a, a .heimu {color: #00AF89!important;}
| | const requestUrl = config.url + '?' + new URLSearchParams({ |
| #moe .colormu {background-color: rgba(37,37,37,0.1)!important;}
| | ...config.params, |
| .skin-vector #moe table {box-shadow: 0 1px 3px rgb(0 0 0 / 12%), 0 1px 2px rgb(0 0 0 / 24%);border-radius: 4px;overflow: hidden;}
| | callback: '___jsonpCallback' + ++incrementCallbackKey, |
| #moe .infotemplatebox {box-shadow: none!important;}
| | }).toString() |
| .mw-editmoegirl {display:block!important;}
| |
| #ca-ve-edit,#ca-editTopSection .mw-editsection {display: none !important;}
| |
| #moe .bilibili-toggle {display: none !important;}
| |
| #moe .bilibili-title {padding: .2em 2em .2em 1em !important;}
| |
| #moe li.gallerybox {display: inline-block;width: 100%; height: auto;}
| |
| #moe .reference> a {color: #36b!important;}
| |
| #moe .mw-cite-backlink> a {color: #36b!important;}
| |
| #moe pre {display: none!important;}
| |
| .stickyHeading .section-container { | |
| position: relative;
| |
| }
| |
| .stickyHeading .section-container h2 { /* 防止误伤目录中的h2 */ | |
| position: sticky;
| |
| top: 0;
| |
| z-index: 50;
| |
| }
| |
| .skin-vector .stickyHeading .section-container h2 { | |
| background-color: rgb(246, 246, 246);
| |
| }
| |
| .skin-minerva .stickyHeading .section-container h2 {
| |
| background-color: #fff;
| |
| }
| |
| .stickyHeading .section-container .documentation h2,
| |
| #Wikiplus-Quickedit-Preview-Output .stickyHeading .section-container h2 {
| |
| position: static;
| |
| background-color: transparent;
| |
| } | |
| .collapseHeading .sec-hide { | |
| display: none !important;
| |
| }
| |
| .collapseHeading .section-container h2 {
| |
| cursor: pointer;
| |
| }
| |
| .collapseHeading .mw-ui-icon {
| |
| line-height: 1.5;
| |
| margin-left: -0.8em;
| |
| }
| |
|
| |
|
| /* </pre> */
| | scriptTag.src = requestUrl |
| </style>
| | window['___jsonpCallback' + incrementCallbackKey] = resolve |
| | scriptTag.onload = () => scriptTag.remove() |
| | scriptTag.onerror = () => reject(new Error('jsonp request error')) |
| | document.body.appendChild(scriptTag) |
| | setTimeout(() => reject(new Error('jsonp request timeout')), 1_200) |
| | }) |
| | } |
| | })() |
|
| |
|
| <script>
| | jsonp({ |
| window.RLQ = window.RLQ || [];
| | url: 'https://zh.moegirl.org/api.php', |
| window.RLQ.push(function() {
| | params: { |
| var div = document.getElementById('moe');
| | action: 'parse', |
| div.innerHTML = div.innerHTML
| | format: 'json', |
| .replace(/ 提取(.*)失败/g,'唔啊~~发生了什么(╯°Д°)╯嵌入时好像混进了奇怪的数据,要坏掉啦QAQ___ 这通常是由于网络不稳定导致的,请<a href="?action=purge" title="清除本页缓存">点此重新获取</a>');
| | page:document.body.querySelector('#moe').dataset.pagename |
| if ( mw.config.get( 'wgNamespaceNumber' ) === 0) {
| | } |
| var div = document.getElementById('moe');
| | }) |
| div.innerHTML = div.innerHTML
| | .then(data => { |
| .replace(/ 萌娘百科欢迎您参与完善本条目/g,'H萌娘欢迎您参与完善本条目')
| | if (data.error) { |
| .replace(/并查找相关资料。萌娘百科祝您在本站度过愉快的时光。/g,'并查找相关资料。注意这是一个萌百的自动嵌入页面,世界观可能与本站不同。H萌娘祝您在本站度过愉快的时光!')
| | throw new Error(data.error.info) |
| .replace(/并查找相关资料哦。/g,'并查找相关资料哦。<br />注意这是一个萌百的自动嵌入页面,世界观可能与本站不同。H萌娘祝您在本站度过愉快的时光!')
| | } else { |
| .replace(/萌娘百科不是新闻的搜集处/g,'H萌娘不是新闻的搜集处')
| | document.body.querySelector('#moe').innerHTML = data.parse.text['*'] |
| .replace(/萌娘百科提醒您/g,'H萌娘提醒您')
| |
| .replace(/此条目或需要大幅度整改/g,'此条目可能需要大幅度整改')
| |
| .replace(/若您清楚改善现状的方法/g,' 注意这是一个萌百的自动嵌入页面,世界观可能与本站不同。如果您清楚改善现状的方法')
| |
| .replace(/萌娘百科郑重提示/g,'H萌娘郑重提示')
| |
| .replace(/非特殊情况下请不要将此模板用在人物条目中(.*)。/g,'')
| |
| .replace(/提示:本页面/g,' 各位绅士注意:本条目')
| |
| .replace(/不适合未满15岁的读者/g,'不够色情')
| |
| .replace(/页面可能包含/g,'页面只包含')
| |
| .replace(/阅读时有可能产生轻微不适感/g,'阅读时没让人产生不适感')
| |
| .replace(/请确信自己已满当地法律许可年龄且心智成熟后再来阅览/g,'最好陪同自己的孩子一起来阅览')
| |
| .replace(/另请编辑者注意:勿滥用此模板/g,'另请编辑者注意:本页面急待调整以适应本站的年龄段');
| |
| window.setTimeout(function() {
| |
| document.querySelector("#ca-edit.collapsible a").textContent='添加本地化差异';
| |
| },350);
| |
| }
| |
| if ( mw.config.get( 'wgPageName' ) === 'Poro脸' ){ | |
| var div = document.getElementById('moe');
| |
| div.innerHTML = div.innerHTML
| |
| .replace(/img.moegirl.org.cn\/common\/4\/43\/Wga0119-cut.jpg/g,'www.hmoegirl.com\/images\/a\/aa\/Wga0119.jpg')
| |
| .replace(/(特别是后入式!)/g,'(特别是后入时!)')
| |
| .replace(/都会展现这幅表情。/g,'都会展现这幅表情。<br />翻了不下500张图,终于找到这两张没露点的,我容易吗?顺带一提这幅图其实');
| |
| } | |
| if( (ns.includes( nsid ) || nsid % 2 === 1) ){
| |
| window.setTimeout(function() {
| |
| document.querySelector("#ca-edit a").textContent='编辑本地讨论';
| |
| document.querySelector("#ca-editmoegirl a").textContent=' 去萌娘百科讨论';
| |
| },350);
| |
| } | | } |
| const nsid = mw.config.get( 'wgNamespaceNumber' ),
| | }) |
| pagename = mw.config.get('wgPageName'),
| |
| contentModel = mw.config.get( 'wgPageContentModel' ),
| |
| skin = mw.config.get('skin'),
| |
| gadgets = mw.gadgets || {},
| |
| stickyHeading = gadgets.stickyHeading || {},
| |
| ns = stickyHeading.namespace || [],
| |
| mode = stickyHeading.mode,
| |
| collapse = (stickyHeading.collapse !== false);
| |
| if ( contentModel == 'wikitext' &&
| |
| ((skin == 'vector' && mode != 'mobile') || (skin == 'minerva' && mode != 'desktop')) ) {
| |
| mw.hook( 'wikipage.content' ).add(function( $content ) {
| |
| console.log('Hook: wikipage.content, 开始添加粘性章节标题');
| |
| $content.addClass( 'stickyHeading' );
| |
| const headings = $content.find( '.mw-parser-output > h2' );
| |
| headings.toArray().reverse().forEach(function(ele) {
| |
| $('<div>').addClass( 'section-container' ).insertBefore(ele)
| |
| .append( $(ele).nextAll( ':not(.section-container, #toc)' ).add(ele) );
| |
| });
| |
| if (!collapse || skin == 'minerva') { return; }
| |
| $content.addClass( 'collapseHeading' );
| |
| const icon = $('<i class="mw-ui-icon-before mw-ui-icon-small mw-ui-icon mw-ui-icon-collapse"></i>');
| |
| headings.prepend( icon ).on('click', function(e) {
| |
| if ( $(e.target).is('a') ) { return; }
| |
| const self = $(this);
| |
| self.nextAll().toggleClass( 'sec-hide' );
| |
| self.children().first().toggleClass( 'mw-ui-icon-collapse mw-ui-icon-expand' );
| |
| });
| |
| });
| |
| }
| |
| }); | |
| </script> | | </script> |
| </includeonly> | | </includeonly> |