「MediaWiki:Minerva.js」:修訂間差異

出自合眾百科 Unitedbook
(建立內容為「→‎这里的任何JavaScript将为使用MinervaNeue皮肤的用户加载:​ →‎Add to MediaWiki:Mobile.js for custom Mobile Menu links for MW-1.34.2 with MobileFrontend and MinervaNeue Just replace span text and href to add links:​ var timer = setInterval(function() { if ($('.menu ul:first').length) { console.log("mobile menu exists"); clearInterval(timer); $('.menu ul:first').after( '<u…」的新頁面
標籤流動版編輯 流動版網頁編輯 進階流動版編輯
 
DC對話 | 貢獻
無編輯摘要
 
(未顯示同一使用者於中間所作的 35 次修訂)
第1行: 第1行:
/* 这里的任何JavaScript将为使用MinervaNeue皮肤的用户加载 */
/* All JavaScript here will be loaded for users of the MinervaNeue skin
 
var timer = setInterval(function() {
/* Add to MediaWiki:Mobile.js for custom Mobile Menu links
    if ($('.menu ul:first').length) {
  for MW-1.34.2 with MobileFrontend and MinervaNeue  
        console.log("mobile menu exists");
  Just replace span text and href to add links */
        clearInterval(timer);
 
        $('.menu ul:first').after(
  var timer = setInterval(function() {
            '<ul class="p-navigation"> \
      if ($('.menu ul:first').length) {
                    <li class="toggle-list-item"> \
          console.log("mobile menu exists");
                    <a class="toggle-list-item__anchor" href="/wiki/合眾百科" \
          clearInterval(timer);
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-bellOutline-base20"> \
          $('.menu ul:first').after(
                    <span class="minerva-icon minerva-icon--infoFilled"></span> \
                '<ul class="level1"> \
                    <span class="toggle-list-item__label">關於我們</span> \
                      <li> \
                    </a> \
                      <a href="#" \
                    </li> \
                            class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-watchlist"> \
                    <li class="toggle-list-item"> \
                      <span>Dropdown Links</span> \
                    <a class="toggle-list-item__anchor" href="/wiki/特殊:最近變更" \
                      </a> \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \
                      </li> \
                    <span class="minerva-icon minerva-icon--history"></span> \
                      <ul class ="level2"> \
                    <span class="toggle-list-item__label">最近變更</span> \
                          <li> \
                    </a> \
                          <a href="/wiki/Link_1" \
                    </li> \
                                class="mw-ui-icon mw-ui-icon-before"> \
                    <li class="toggle-list-item"> \
                          <span>Link 1</span> \
                    <a class="toggle-list-item__anchor" href="/wiki/合眾百科:新手使用指南" \
                          </a> \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-star-base20"> \
                          </li> \
                    <svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#54595d" d="M96 0C43 0 0 43 0 96L0 416c0 53 43 96 96 96l288 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-64c17.7 0 32-14.3 32-32l0-320c0-17.7-14.3-32-32-32L384 0 96 0zm0 384l256 0 0 64L96 448c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16l192 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-192 0c-8.8 0-16-7.2-16-16zm16 48l192 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-192 0c-8.8 0-16-7.2-16-16s7.2-16 16-16z"/></svg> \
                          <li> \
                    <span class="toggle-list-item__label">&nbsp;&nbsp;新手使用指南</span> \
                          <a href="/wiki/Link_2" \
                    </a> \
                                class="mw-ui-icon mw-ui-icon-before"> \
                    </li> \
                          <span>Link 2</span> \
                    <li class="toggle-list-item"> \
                          </a> \
                    <a class="toggle-list-item__anchor" href="/wiki/特殊:貢獻分數" \
                          </li> \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-star-base20"> \
                          <li> \
                    <svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#54595d" d="M160 80c0-26.5 21.5-48 48-48l32 0c26.5 0 48 21.5 48 48l0 352c0 26.5-21.5 48-48 48l-32 0c-26.5 0-48-21.5-48-48l0-352zM0 272c0-26.5 21.5-48 48-48l32 0c26.5 0 48 21.5 48 48l0 160c0 26.5-21.5 48-48 48l-32 0c-26.5 0-48-21.5-48-48L0 272zM368 96l32 0c26.5 0 48 21.5 48 48l0 288c0 26.5-21.5 48-48 48l-32 0c-26.5 0-48-21.5-48-48l0-288c0-26.5 21.5-48 48-48z"/></svg> \
                          <a href="/wiki/Link_3" \
                    <span class="toggle-list-item__label">&nbsp;&nbsp;貢獻分數</span> \
                                class="mw-ui-icon mw-ui-icon-before"> \
                    </a> \
                          <span>Link 3</span> \
                    </li> \
                          </a> \
                    <li class="toggle-list-item"> \
                          </li> \
                    <a class="toggle-list-item__anchor" href="/wiki/特殊:建立新頁面" \
                      </ul> \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-edit-base20"> \
                </ul> \
                    <svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#54595d" d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z"/></svg> \
                <ul> \
                    <span class="toggle-list-item__label">&nbsp;&nbsp;建立新頁面</span> \
                      <li> \
                    </a> \
                      <a href="/wiki/Second_Link" \
                    </li> \
                            class="mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-watchlist"> \
              </ul>'
                      <span>Second Link</span> \
          );
                      </a> \
          $(".menu").find(".level2").hide(); // hide level2 until level1 is clicked
                      </li> \
          $(".level1").click(function(event){  
                </ul>'
              $(this).find(".level2").slideToggle(500);
            );
          }); // if level1 is clicked, dropdown level2
            $(".menu").find(".level2").hide(); // hide level2 until level1 is clicked
    }
            $(".level1").click(function(event){  
}, 100); // check every 100ms
                $(this).find(".level2").slideToggle(500);
*/
            }); // if level1 is clicked, dropdown level2
      }
  }, 100); // check every 100ms

於 2025年4月6日 (日) 18:57 的最新修訂

/* All JavaScript here will be loaded for users of the MinervaNeue skin
var timer = setInterval(function() {
     if ($('.menu ul:first').length) {
         console.log("mobile menu exists");
         clearInterval(timer);
         $('.menu ul:first').after(
             '<ul class="p-navigation"> \
                    <li class="toggle-list-item"> \
                    <a class="toggle-list-item__anchor" href="/wiki/合眾百科" \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-bellOutline-base20"> \
                    <span class="minerva-icon minerva-icon--infoFilled"></span> \
                    <span class="toggle-list-item__label">關於我們</span> \
                    </a> \
                    </li> \
                    <li class="toggle-list-item"> \
                    <a class="toggle-list-item__anchor" href="/wiki/特殊:最近變更" \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-mf-expand mw-ui-icon-small"> \
                    <span class="minerva-icon minerva-icon--history"></span> \
                    <span class="toggle-list-item__label">最近變更</span> \
                    </a> \
                    </li> \
                    <li class="toggle-list-item"> \
                    <a class="toggle-list-item__anchor" href="/wiki/合眾百科:新手使用指南" \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-star-base20"> \
                    <svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#54595d" d="M96 0C43 0 0 43 0 96L0 416c0 53 43 96 96 96l288 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-64c17.7 0 32-14.3 32-32l0-320c0-17.7-14.3-32-32-32L384 0 96 0zm0 384l256 0 0 64L96 448c-17.7 0-32-14.3-32-32s14.3-32 32-32zm32-240c0-8.8 7.2-16 16-16l192 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-192 0c-8.8 0-16-7.2-16-16zm16 48l192 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-192 0c-8.8 0-16-7.2-16-16s7.2-16 16-16z"/></svg> \
                    <span class="toggle-list-item__label">&nbsp;&nbsp;新手使用指南</span> \
                    </a> \
                    </li> \
                    <li class="toggle-list-item"> \
                    <a class="toggle-list-item__anchor" href="/wiki/特殊:貢獻分數" \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-star-base20"> \
                    <svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#54595d" d="M160 80c0-26.5 21.5-48 48-48l32 0c26.5 0 48 21.5 48 48l0 352c0 26.5-21.5 48-48 48l-32 0c-26.5 0-48-21.5-48-48l0-352zM0 272c0-26.5 21.5-48 48-48l32 0c26.5 0 48 21.5 48 48l0 160c0 26.5-21.5 48-48 48l-32 0c-26.5 0-48-21.5-48-48L0 272zM368 96l32 0c26.5 0 48 21.5 48 48l0 288c0 26.5-21.5 48-48 48l-32 0c-26.5 0-48-21.5-48-48l0-288c0-26.5 21.5-48 48-48z"/></svg> \
                    <span class="toggle-list-item__label">&nbsp;&nbsp;貢獻分數</span> \
                    </a> \
                    </li> \
                    <li class="toggle-list-item"> \
                    <a class="toggle-list-item__anchor" href="/wiki/特殊:建立新頁面" \
                    class="mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-edit-base20"> \
                    <svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#54595d" d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z"/></svg> \
                    <span class="toggle-list-item__label">&nbsp;&nbsp;建立新頁面</span> \
                    </a> \
                    </li> \
               </ul>'
          );
          $(".menu").find(".level2").hide(); // hide level2 until level1 is clicked
          $(".level1").click(function(event){ 
               $(this).find(".level2").slideToggle(500);
          }); // if level1 is clicked, dropdown level2
     }
}, 100); // check every 100ms
*/