打开/关闭菜单
Toggle preferences menu
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

MediaWiki:Common.js:修订间差异

MediaWiki界面页面
无编辑摘要
无编辑摘要
 
(未显示同一用户的65个中间版本)
第1行: 第1行:
mw.loader.load( '/w/index.php?title=MediaWiki:Prowordviewer.js&action=raw&ctype=text/javascript' );
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
//基本函数
//基本函数
第5行: 第4行:
             $("#"+id).fadeIn(time)
             $("#"+id).fadeIn(time)
         }
         }
 
MathJax = {
//插入外部图片
  tex: {
function thumbImage(){
    inlineMath: [['$', '$'], ['\\(', '\\)']]
console.log('container_width')
  },
var container_width = $("#external-image").width()
  loader: {load: ['[tex]/mhchem']},
var img = $("#external-image>p>img")
};
img.width(container_width)
mw.loader.getScript( 'https://cdn.bootcss.com/mathjax/3.0.5/es5/tex-mml-chtml.js' )
}
try{
div = document.getElementById("external-image")
console.log('container_width1')
div.onload = thumbImage()
console.log('container_width')
}catch(err){
console.log(err)
}
 
 
 
 
//获取最新页面
var weburl = "https://www.medforest.cn/medf"
//latestpages
      function oldest_page(test){
    div = document.getElementById("latestpages")
    if(div==null){
    console.log("asdsasdasdsaddsadasdsadas")
    return false
    }
        var titleList = []
        $.ajax(
            {
                url: weburl+"/api.php?action=query&format=json&list=recentchanges&utf8=1&rcnamespace=0&rctype=edit%7Cnew%7Clog%7Ccategorize&rctoponly=1",
                method: "post",
                async: true,
                beforeSend: function (xhr) {
                    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                },
                success: function (data) {
                    var data1 = data.query.recentchanges
                    for (var i = 0; i < data1.length; i++) {
                        var name = data1[i].title
                        var time = data1[i].timestamp
                        var list1 = []
                        var reg = RegExp(/\/all/gi)
                        if(name=="首页"){
                          var c =0
                        }else if(name.match(reg)){
                        var c =0
                        }else{
                            list1.push(name)
                            console.log(name)
                        }
                        list1.push(time)
                        titleList.push(list1)
                    }
                  for(var key=0;key<11;key++) {
                            (function(key) {
                                setTimeout( function timer() {
                                    insertEntries(titleList[key], 1, key, "latestpages")
                                }, key*100 );
                            })(key);
                            }
                }
            })
        console.log(titleList)
    }
function insertEntries(titles,number,i,domid){
            if(titles.length ==1){
                return false
            }
            var word = titles[0]
            var time = titles[1]
            var origin_div = document.getElementById(domid)
            console.log(titles.length)
            var div2 = document.createElement("div");
            div2.className = "latestwords_con"
            div2.id = domid+"-"+i
            div2.style = "display:none"
            console.log(titles)
            // var parser = get_parser_output(titles[i][0])
            var div2html = '<a href="/dic/'+word+'"><h3 style="margin-bottom:-1px;style=margin-top:7px;margin-left:7px">'+word+'</h3></a>'
            div2html += '<p style="margin-top:1px;;margin-left:10px"><font size="2px" color="gray">'+ time + '</font></a>'
            div2.innerHTML = div2html
            console.log( '<a href="/dic/"+word+"><h3>"+word+"</h3></a>"')
            origin_div.appendChild(div2)
            fadeIn(domid + "-"+i,"normal")
        }
    div = document.getElementById("latestpages")
div.onload = oldest_page()
 
//latestproenglishpages
      function oldest_page2(test){
    div = document.getElementById("latestproenglishpages")
    if(div==null){
    console.log("asdsasdasdsaddsadasdsadas")
    return false
    }
        var titleList = []
        $.ajax(
            {
                url: weburl+"/api.php?action=query&format=json&list=recentchanges&rcdir=older&rcnamespace=3006&rclimit=20",
                method: "post",
                async: true,
                beforeSend: function (xhr) {
                    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                },
                success: function (data) {
                    var data1 = data.query.recentchanges
                    for (var i = 0; i < data1.length; i++) {
                        var name = data1[i].title
                        var time = data1[i].timestamp
                        var list1 = []
                        var reg = RegExp(/\/all/gi)
                        if(name=="首页"){
                          var c =0
                        }else if(name.match(reg)){
                        var c =0
                        }else{
                            list1.push(name)
                            console.log(name)
                        }
                        list1.push(time)
                        titleList.push(list1)
                    }
                    for(var key=0;key<10;key++) {
                            (function(key) {
                                setTimeout( function timer() {
                                    insertEntries(titleList[key], 1, key, "latestproenglishpages")
                                }, key*100 );
                            })(key);
                            }
                 
                }
            })
        console.log(titleList)
    }
 
    div = document.getElementById("latestproenglishpages")
div.onload = oldest_page2()

2023年8月10日 (四) 15:49的最新版本

/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
//基本函数
function fadeIn(id,time){
            $("#"+id).fadeIn(time)
        }
MathJax = {
  tex: {
    inlineMath: [['$', '$'], ['\\(', '\\)']]
  },
  loader: {load: ['[tex]/mhchem']},
};
mw.loader.getScript( 'https://cdn.bootcss.com/mathjax/3.0.5/es5/tex-mml-chtml.js' )