コンテンツにスキップ

「利用者:Sta/monobook.js」の版間の差分

削除された内容 追加された内容
m Maintenance: Replacing addOnloadHook with native jQuery (mw:ResourceLoader/Migration_guide_(users)#addOnloadHook - phab:T130879)
m Maintenance: Replacing document.write with mw.loader.load (mw:ResourceLoader/Migration_guide_(users)#Avoid_document.write() - phab:T130879)
 
5行目: 5行目:
//InstaView ([http://en.wikipedia.org/w/index.php?title=User:Pilaf/instaview.js&action=raw&ctype=text/javascript&dontcountme=s page]/[http://en.wikipedia.org/wiki/User:Pilaf/InstaView talk]) - ページを移動しないプレビュー機能<pre>
//InstaView ([http://en.wikipedia.org/w/index.php?title=User:Pilaf/instaview.js&action=raw&ctype=text/javascript&dontcountme=s page]/[http://en.wikipedia.org/wiki/User:Pilaf/InstaView talk]) - ページを移動しないプレビュー機能<pre>
{
{
document.write('<script type="text/javascript" src="http://en.wikipedia.org/w/index.php?title=User:Pilaf/instaview.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/instaview.js&action=raw&ctype=text/javascript');
var instaview_conf = {
var instaview_conf = {
name:'sta'
name:'sta'

2022年5月16日 (月) 14:11時点における最新版

//written by [http://nasounds.web.fc2.com/wp_tool_installer/wp_tool_installer.html wp_tool_installer]
//support<pre>
//end</pre>
//include start<hr>
//InstaView ([http://en.wikipedia.org/w/index.php?title=User:Pilaf/instaview.js&action=raw&ctype=text/javascript&dontcountme=s page]/[http://en.wikipedia.org/wiki/User:Pilaf/InstaView talk]) - ページを移動しないプレビュー機能<pre>
{
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/instaview.js&action=raw&ctype=text/javascript');
var instaview_conf = {
name:'sta'
}
$(function () {
    window.InstaView.conf.user.name = instaview_conf.name;
});
}
//end</pre><hr>
//repackFloatElements () - 連続したfloat要素による[編集]ボタンのレイアウト乱れを解消する。<pre>
{
$(function () {
    var root;
    if (!document.defaultView || !document.defaultView.getComputedStyle) {
        return;
    }
    if (!(root = document.getElementById("content"))) {
        return;
    }

    function findSequentialElements(groups, elms, func) {
        for (var i = 0; i < elms.length; i++) {
            if (!func(elms[i]) ||
                (function () {for (var j = 0; j < groups.length; j++) {for (var k = 0; k < groups[j].length; k++) {if (groups[j][k] == elms[i]) {return true;}}}})()) {
                continue;
            }
            var gn = find_next(elms[i], func, "nextSibling");
            var gp = find_next(elms[i], func, "previousSibling");
            if (gp.length + gn.length > 0) {
                gp.reverse();
                gp.push(elms[i]);
                groups.push(gp.concat(gn));
            }
        }
        return groups;

        function find_next(e, func, direction, group) {
            if (!group) {
                group = [];
            }
            var next = e[direction];
            while (next &&
                (next.nodeType == 8 ||
                next.nodeType == 3 &&
                !next.data.replace(/\s*/, "").length > 0)) {
                next = next[direction];
            }
            if (next && func(next)) {
                group.push(next);
                find_next(next, func, direction, group);
            }
            return group;
        }

    }

    var groups = [];

    function float_check(e) {
        if (e.nodeType != 1) {
            return false;
        }
        return "right" == document.defaultView.getComputedStyle(e, null).getPropertyValue("float");
    }

    if (window.repackFloatElements_find_all_divs) {
        findSequentialElements(groups, root.getElementsByTagName("div"), float_check);
    } else {
        var elms = getElementsByClassName(root, "div", "tright");
        elms = elms.concat(getElementsByClassName(root, "div", "floatright"));
        findSequentialElements(groups, elms, float_check);
    }
    findSequentialElements(groups, root.getElementsByTagName("table"), float_check);
    for (var i = 0; i < groups.length; i++) {
        var div = document.createElement("div");
        div.style.cssFloat = "right";
        div.style.margin = div.style.padding = "0";
        if (window.repackFloatElements_clear_right) {
            div.style.clear = "right";
        }
        groups[i][0].parentNode.insertBefore(div, groups[i][0]);
        div.setAttribute("align", "right");
        for (var j = 0; j < groups[i].length; j++) {
            var e = groups[i][j].parentNode.removeChild(groups[i][j]);
            div.appendChild(e);
            e.style.cssFloat = "none";
        }
    }
});
}
//end</pre><hr>