𨀈𬧐內容
程單正
程單正
轉𨖅錆邊
隱
調向
張正
𠊝𢷮𧵆低
張偶然
助𢴇
顯示吧入 Hiển thị và Nhập
風𡨸漢喃 Phông chữ Hán Nôm
部𢫈漢喃 Bộ gõ Hán Nôm
工具轉字 Công cụ chuyển tự
𡨸漢喃準 Chữ Hán Nôm chuẩn
榜𡨸漢喃準常用 Bảng chữ Hán Nôm chuẩn Thường dùng
榜𡨸翻音 Bảng chữ Phiên âm
名冊各詞摱憑𡨸漢喃準 Danh sách các từ mượn bằng chữ Hán Nôm chuẩn
向引編輯 Hướng dẫn Biên tập
定樣排曰 Định dạng bài viết
捐𢵰 Quyên góp
衆碎懃伴𢴇扡 Chúng tôi cần bạn giúp đỡ
尋檢
尋檢
交面
造財款
登入
工具個人
造財款
登入
䀡碼源𧵑模庉:Listen
模庉
討論
English
讀
䀡碼源
䀡歷史
工具
工具
轉𨖅錆邊
隱
作務
讀
䀡碼源
䀡歷史
終
各連結𦤾低
𠊝𢷮連關
張特別
通信張
交面
轉𨖅錆邊
隱
←
模庉:Listen
伴空得權𢯢𢷮張尼、爲理由𢖖󠄁:
只仍成員𥪝𡖡
成員通常
㵋得寔現操作尼。
伴吻固体䀡吧抄劄碼源𧵑張尼。
local mFileLink = require('Mô đun:File link') local mTableTools = require('Mô đun:TableTools') local mSideBox = require('Mô đun:Side box') local lang = mw.language.new('en') local p = {} local function formatLength(length) -- Formats a duration in seconds in "(h:)mm:ss" (minutes are zero-padded -- only if there are hours). if not length or length == 0 then return nil end -- Add 0.5 to offset the rounding down local t = lang:getDurationIntervals(length + 0.5, { 'hours', 'minutes', 'seconds' }) local s = t.seconds and string.format('%02d', t.seconds) or '00' local m = t.minutes or 0 local span = mw.html.create('span'):addClass('duration') if t.hours then span :tag('span') :addClass('h') :wikitext(t.hours) :done() :wikitext(':') m = string.format('%02d', m) end span :tag('span') :addClass('min') :wikitext(m) :done() :wikitext(':') :tag('span') :addClass('s') :wikitext(s) :done() return tostring(span) end local function renderRow(filename, title, play, alt, description, start, length, hasImage) -- Renders the HTML for one file description row. if not filename then return nil end length = formatLength(length) length = length and string.format(' (%s)', length) or '' local root = mw.html.create('') root:tag('div') :addClass('haudio') :newline() :tag('div') :addClass('listen-file-header') :wikitext(string.format( '[[:File:%s|%s]]%s', filename, title or '', length )) :done() :newline() :tag('div') :wikitext(play ~= 'no' and mFileLink._main{ file = filename, size = hasImage and '232px' or '215px', alt = alt, start = start } or nil ) :done() :newline() :tag('div') :addClass('description') :wikitext(description) :done() :done() return tostring(root) end local function renderTrackingCategories(isPlain, hasMissing, isEmpty, titleObj) -- Renders all tracking categories produced by the template. -- isPlain, hasMissing and isEmpty are passed through from p._main, -- and the titleObj is only used for testing purposes. local cats = {} local currentTitle = titleObj or mw.title.getCurrentTitle() if currentTitle.namespace == 0 then -- We are in mainspace. if not isEmpty then cats[#cats + 1] = 'Bài viết sử dụng định dạng hAudio' end if hasMissing then cats[#cats + 1] = 'Bài viết có bản mẫu nghe nhìn trống' end end if isPlain then cats[#cats + 1] = 'Bản mẫu nghe nhìn sử dụng tham số hiển thị' end for i, cat in ipairs(cats) do cats[i] = string.format('[[Thể loại:%s]]', cat) end return table.concat(cats) end function p._main(args) -- Organise the arguments by number. local isPlain = args.plain == 'yes' local isEmbedded = args.embed and true local hasImage = not isPlain and not isEmbedded and args.image ~= 'none' local numArgs, missingFiles = {}, {} do local origNumArgs = mTableTools.numData(args) origNumArgs[1] = origNumArgs.other -- Overwrite args.filename1 etc. with args.filename etc. origNumArgs = mTableTools.compressSparseArray(origNumArgs) for i, t in ipairs(origNumArgs) do -- Check if the files exist. local obj = t.filename and mw.title.makeTitle(-2, t.filename) if obj and obj.exists then if t.length == 'yes' or -- Show length if the video height would be less than 150px obj.file.width / obj.file.height > (hasImage and 1.547 or 1.434) then t.length = obj.file.length else t.length = nil end numArgs[#numArgs + 1] = t else missingFiles[#missingFiles + 1] = t.filename or i end end end -- Render warning local hasMissing = #missingFiles ~= 0 local previewWarning = '' if hasMissing then for i, v in ipairs(missingFiles) do missingFiles[i] = type(v) == 'string' and string.format('tập tin bị thiếu "%s"', v) or string.format('tên tập tin trống #%s', v) end previewWarning = string.format( 'Trang sử dụng [[Bản mẫu:Nghe nhìn]] với %s', mw.text.listToText(missingFiles) ) previewWarning = require('Mô đun:If preview')._warning({previewWarning}) end -- Exit early if none exist. if #numArgs == 0 then return previewWarning .. renderTrackingCategories(isPlain, hasMissing, true) end -- Build the arguments for {{side box}} local sbArgs = { metadata = 'no', position = (isPlain or isEmbedded) and 'left' or args.pos, style = args.style, templatestyles = 'Mô đun:Listen/styles.css' } -- Class arguments do local class = { 'listen', 'noprint' } if isPlain then table.insert(class, 'listen-plain') end if isEmbedded then table.insert(class, 'listen-embedded') end if not hasImage then table.insert(class, 'listen-noimage') end if args.pos == 'left' and not isPlain and not isEmbedded then table.insert(class, 'listen-left') elseif args.pos == 'center' then table.insert(class, 'listen-center') end sbArgs.class = table.concat(class, ' ') end -- Image if not isPlain and not isEmbedded then if args.image then sbArgs.image = args.image else local images = { speech = 'Audio-input-microphone.svg', music = 'Gnome-mime-audio-openclipart.svg', default = 'Gnome-mime-sound-openclipart.svg' } sbArgs.image = mFileLink._main{ file = args.type and images[args.type] or images.default, size = '65x50px', location = 'center', link = '', alt = '' } end end -- Text do local header if args.header then header = mw.html.create('div') header:addClass('listen-header') :wikitext(args.header) header = tostring(header) .. '\n' else header = '' end local text = {} for i, t in ipairs(numArgs) do text[#text + 1] = renderRow( t.filename, t.title, t.play, t.alt, t.description, t.start, t.length, hasImage ) if numArgs[i + 1] then text[#text + 1] = '<hr/>' end end sbArgs.text = header .. table.concat(text) end -- Below if not isPlain and not isEmbedded and args.help ~= 'no' then sbArgs.below = string.format( '<hr/><i class="selfreference">Trục trặc khi nghe %s? Xem [[Trợ giúp:Âm thanh|hướng dẫn]].</i>', #numArgs == 1 and 'tập tin âm thanh này' or 'các tập tin âm thanh này' ) end -- Render the side box. local sideBox = mSideBox._main(sbArgs) -- Render the tracking categories. local trackingCategories = renderTrackingCategories(isPlain, hasMissing) return previewWarning .. sideBox .. trackingCategories end function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do if v ~= '' then args[k] = v end end args.position = args.position or args["vị trí"] args.plain = args.plain or args["hiển thị"] args.style = args.style or args["kiểu"] args.type = args.type or args["loại"] args.filename = args.filename or args["tên bài"] args.title = args.title or args["tựa"] args.description = args.description or args["miêu tả"] args.play = args.play or args["chơi"] args.help = args.help or args["trợ giúp"] for i = 2, 10 do args["filename" .. i] = args["filename" .. i] or args["tên bài " .. i] args["title" .. i] = args["title" .. i] or args["tựa " .. i] args["description" .. i] = args["description" .. i] or args["miêu tả " .. i] args["play" .. i] = args["play" .. i] or args["chơi " .. i] end return p._main(args) end return p
板㑄用𥪝張尼:
模庉:Listen/材料
(
䀡碼源
)
𢮿吏
模庉:Listen
。