;
×
创建新页面
在此填写您的页面标题:
我们当前在Undertale社区维基上拥有211个页面。请在上方输入您的页面名称或点击以下任意标题来开始编写页面!



Undertale社区维基
欢迎来到Undertale社区维基(*`∀´*)ノ亻,如果想要参与条目创建或编辑,请先登录

可在模块:AU信息框/image/doc创建此模块的帮助文档

local p = {}
local b = require("Module:Basic")

function p.getimages(frame)
    local category = "AU"


    local limit = tonumber(frame.args.limit) or 10

    local query = {}
    table.insert(query, "[[Category:" .. category .. "]]")
    table.insert(query, "?头图")
    table.insert(query, "?条目状态")
    query.mainlabel = "title"
    query.limit = limit

    local result = mw.smw.getQueryResult(query)

    local alphabet = {
        A = false,
        B = false,
        C = false,
        D = false,
        E = false,
        F = false,
        G = false,
        H = false,
        I = false,
        J = false,
        K = false,
        L = false,
        M = false,
        N = false,
        O = false,
        P = false,
        Q = false,
        R = false,
        S = false,
        T = false,
        U = false,
        V = false,
        W = false,
        X = false,
        Y = false,
        Z = false
    }

    local output = "<div class=\"row listformat\">"
    local count = 0
    if type(result) == "table" then
        for _, row in ipairs(result["results"]) do
            local image = row["printouts"]["头图"]
            local title = row.fulltext
            if type(image) == "table" then
                image = image[1]
            end

            output = output .. '<div class="col-md-3 p-3 text-white" style="text-align: center; box-sizing: border-box; display: grid; place-items: center;">'

            local first_letter = mw.ustring.sub(title, 1, 1)
            if alphabet[first_letter] == false then
                output = output .. "<span style=\"visibility: hidden;\" id=" .. first_letter .. "></span>"
                alphabet[first_letter] = true
            end

            if image then
                output = output .. "[[file:" .. image .. "|150px|class=auimage|link=" .. title .. "]] <br>"
            end

            output = output .. "<span>" .. "{{Coloredlink|#ffffff|" .. title .. "}}"

            if b.is_include_value("需要补充", row["printouts"]["条目状态"]) then
                output = output .. "<sup style=\"background:#cc8800\">(~)</sup>"
            end
            
            if b.is_include_value("需要修改", row["printouts"]["条目状态"]) then
                output = output .. "<sup style=\"background:#ff0000\">(!)</sup>"
            end

            output = output .. "</span></div>"
            count = count + 1
            if count % 4 == 0 then output = output .. "\n----" end
            if limit > 0 and count >= limit then
                break
            end
        end
    end

    output = output .. "</div>"
    return frame:preprocess(output)
end

return p