跳转到内容

模組:Fullurl

本页使用了标题或全文手工转换
被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由SunAfterRain留言 | 贡献2019年8月11日 (日) 02:15 (Sunny00217 已移動頁面 模块:沙盒/Sunny00217/fullurl2模块:Fullurl,不留重新導向)编辑。这可能和当前版本存在着巨大的差异。

local fullurl = {}

function fullurl._getaction(action)
	local actionlist = {
		--[""] = viewpaid,
		--["view"] = viewpaid,
		["edit"] = editpaid,
		--["history"] = historoypaid,
		--["delete"] = deletepaid,
		--["protect"] = protectpaid,
	}
	if actionlist[action] == nil then
		return ""
	end
	return actionlist[action]
end

function fullurl.fullurl(frame)
	if frame == mw.getCurrentFrame() then
        args = frame.args
    else
        args = frame
        if type(args) ~= type({}) then args = {frame} end
    end
	local title = args['title'] or args[1] or tostring(mw.title.getCurrentTitle())
	local text = args['text'] or args[2] or title
	local action = (args['action'] and 'action=' or '') .. (args['action'] or '')
    local viewpaid = ''
    local editpaid = (args['oldid'] and '&oldid=' or '') .. (args['oldid'] or '') ..
                     (args['section'] and '&section=' or '') .. (args['section'] or '') ..
                     (args['summary'] and '&summary=' or '') .. (args['summary'] or '') ..
                     (args['preload'] and '&preload=' or '') .. (args['preload'] or '') .. 
                     (args['preloadtitle'] and '&preloadtitle=' or '') .. (args['preloadtitle'] or '')
    local historypaid = ''
    local deletepaid = ''
    local protectpaid = ''
    local other = args['other'] or ''
    local paid = ((args['action'] == '') and viewpaid or '') .. ((args['action'] == 'view') and viewpaid or '') ..
                 ((args['action'] == 'edit') and editpaid or '') .. 
                 ((args['action'] == 'history') and historypaid or '') .. 
                 ((args['action'] == 'delete') and deletepaid or '') .. 
                 ((args['action'] == 'protect') and protectpaid or '')
    return '<span class="plainlinks">[' .. tostring(mw.uri.fullUrl(title,action .. paid .. other)) .. ' ' .. text .. ']</span>'
end

return fullurl