MediaWiki:Gadget-mobileNav.js:修订间差异
imported>=海豚= 创建页面,内容为“→MobileNav.js by User:NHJR: (function ($, mw) { //加载内链脚本 function loadScript(scriptPath){ var pageTitle = encodeURIComponent(scriptPath); mw…” |
小 →top:bad link repair, replaced: hmoegirl.com → hmoegirl.info (3) |
||
| (未显示另一用户的1个中间版本) | |||
| 第8行: | 第8行: | ||
function loadScript(scriptPath){ | function loadScript(scriptPath){ | ||
var pageTitle = encodeURIComponent(scriptPath); | var pageTitle = encodeURIComponent(scriptPath); | ||
mw.loader.load("https://www.hmoegirl. | mw.loader.load("https://www.hmoegirl.info/index.php?title=" + pageTitle + "&action=raw&ctype=text/javascript"); | ||
} | |||
//是否为移动版 | |||
var isMobile = window.location.href.indexOf("m.hmoegirl.info") != -1; | |||
function mobile(onMobile){ | |||
if(isMobile){ | |||
onMobile(); | |||
} | |||
} | |||
function desktop(onDesktop){ | |||
if(!isMobile){ | |||
onDesktop(); | |||
} | |||
} | } | ||
| 第14行: | 第29行: | ||
function addNavbox(){ | function addNavbox(){ | ||
var pageName = mw.config.get("wgPageName"); | var pageName = mw.config.get("wgPageName"); | ||
$.get("https://m.hmoegirl. | $.get("https://m.hmoegirl.info/api.php",{action:"parse",page:pageName,format:"json"},function(data,status){ | ||
if(status == "success"){ | if(status == "success"){ | ||
var desktopView = $($.parseJSON(data.replace("\"*\"","\"data\"")).parse.text.data); | var desktopView = $($.parseJSON(data.replace("\"*\"","\"data\"")).parse.text.data); | ||