Przejdź do zawartości
Menu główne
Menu główne
przypnij
ukryj
Nawigacja
Strona główna
Ostatnie zmiany
Losowa strona
Pomoc z MediaWiki
Forum
Strona Główna forum
Tygodnik
Strona główna gazety
Kolejopedia
Galeria
Programy
Administrator
Jak stworzyć artykuł na Kolejopedii
Kontakt
Aktualności
Strona główna aktualności
Wydarzenia
Dobry Artykuł Lato 2025
Kolejopedia
Szukaj
Szukaj
Wygląd
Zaloguj się
Narzędzia osobiste
Zaloguj się
Strony dla anonimowych edytorów
dowiedz się więcej
Edycje
Dyskusja
Edytujesz
Szablon:Generator głównych
Szablon
Dyskusja
polski
Czytaj
Edytuj
Wyświetl historię
Narzędzia
Narzędzia
przypnij
ukryj
Działania
Czytaj
Edytuj
Wyświetl historię
Ogólne
Linkujące
Zmiany w linkowanych
Strony specjalne
Informacje o tej stronie
Wygląd
przypnij
ukryj
Uwaga:
Nie jesteś zalogowany. Jeśli wykonasz jakąkolwiek zmianę, Twój adres IP będzie widoczny publicznie. Jeśli
zalogujesz się
lub
utworzysz konto
, Twoje zmiany zostaną przypisane do konta, wraz z innymi korzyściami.
Filtr antyspamowy.
Nie
wpisuj tu nic!
local tools = require('Moduł:Narzędzia') local p = {} function sanitizeOrElse(text, alt) if text ~= nil then return mw.text.nowiki(text) else return alt end end function allowOnly(value, allowed, alt) local sanitized = mw.text.trim(sanitizeOrElse(value, alt)) for k, v in ipairs(allowed) do if v == sanitized then return sanitized end end return alt end function makeShowStatus(value) local final = allowOnly(value, {"desktoponly", "mobileonly"}, '') if final == "desktoponly" then return {desktoponly=true, mobileonly=false, duplicateDesktoponly=false, duplicateMobileonly=false} elseif final == "mobileonly" then return {desktoponly=false, mobileonly=true, duplicateDesktoponly=false, duplicateMobileonly=false} else return {desktoponly=false, mobileonly=false, duplicateDesktoponly=false, duplicateMobileonly=false} end end function showStatusToString(stat) local val = "" if stat["desktoponly"] or stat["duplicateDesktoponly"] then val = val .. "desktoponly " end if stat["mobileonly"] or stat["duplicateMobileonly"] then val = val .. "mobileonly" end return mw.text.trim(val) end function getShowStatusForPlatform(stat, platform) if platform == "desktop" then return stat.desktoponly or stat.duplicateDesktoponly elseif platform == "mobile" then return stat.mobileonly or stat.duplicateMobileonly end end function willEverBeUsed(cur) return not ((getShowStatusForPlatform(cur.showstatus, "desktop") == getShowStatusForPlatform(cur.showstatus, "mobile")) and (getShowStatusForPlatform(cur.showstatus, "desktop") == true)) end function makeElementTable(args, num) local cur = {} if args['ptytułszablon' .. num] ~= nil then cur['title'] = '{{' .. mw.text.nowiki(args['ptytułszablon' .. num]) .. '}}' else cur['title'] = sanitizeOrElse(args['ptytuł' .. num], 'Nie podano tytułu') end cur['text'] = sanitizeOrElse(args['panel' .. num], '') cur['num'] = num cur['showstatus'] = makeShowStatus(args["pwarunki" .. num]) cur['icon'] = sanitizeOrElse(args['pikona' .. num], '') cur['iconlink'] = sanitizeOrElse(args["pikonalink" .. num], '') cur['titlelink'] = sanitizeOrElse(args["plink" .. num], '') return cur end -- robi listę elementów wg kolumn, ignoruje - i puste function makeElementList(args) -- kolumny local first = {} local second = {} local curLeft, curRight = 0, 0 for i = 1, 50 do if args['panel' .. i] ~= nil then if args['panel' .. i] == '-' or args['panel' .. i] == '' then else local cur = makeElementTable(args, i) if i % 2 == 1 then table.insert(first, cur) curLeft, curRight = 0, 0 else cur.showstatus.duplicateDesktoponly = true if willEverBeUsed(cur) then table.insert(second, cur) curRight = curRight + 1 end local cur2 = makeElementTable(args, i) cur2.showstatus.duplicateMobileonly = true if willEverBeUsed(cur2) then table.insert(first, cur2) curLeft = curLeft + 1 end end end else break end end if curRight > 0 then local maxSecond = table.maxn(second) for i = 0, (curRight - 1) do second[maxSecond-i].showstatus.duplicateDesktoponly = false end end if curLeft > 0 then local maxFirst = table.maxn(first) for i = 0, (curLeft - 1) do table.remove(first, maxFirst-i) end end return first, second end function makePanel(tab) local panelname = tab["title"] local titlelink = tab["titlelink"] local template = tab["text"] local mobiledesktop = showStatusToString(tab["showstatus"]) local icon = tab["icon"] local iconlink = tab["iconlink"] local id = "panel-" .. tab["num"] .. "-" .. mw.text.encode(panelname) local wikitext = "{{User:Polskacafe/panel|" .. panelname .. "|{{" .. template .. "}}|ikona=" .. icon .. "|link=" .. iconlink .. "|tytuł link=" .. titlelink .. "}}" local panel = mw.html.create("div") :addClass("glowna-panel") :attr("id", id) :wikitext(wikitext) if (mobiledesktop ~= nil) then panel = panel:addClass(mobiledesktop) end return panel:done() end function makeColumn(elements) column = mw.html.create("div") :addClass("glowna-kolumna") for k,v in ipairs(elements) do local elem = makePanel(v) column = column:node(elem) end return column:done() end function makeAll(args) local first, second = makeElementList(args) local mainList = mw.html.create("div") :addClass("glowna-lista") :node(makeColumn(first)) :node(makeColumn(second)) :done() return mainList end function p.kolumny(frame) local args = tools.getArgs(frame) -- argumenty szablonu to jest local mainList = makeAll(args) return frame:preprocess(tostring(mainList)) end return p
Opis zmian:
Wszelki wkład na Kolejopedia może być edytowany, zmieniany lub usunięty przez innych użytkowników. Jeśli nie chcesz, żeby Twój tekst był dowolnie zmieniany przez każdego i rozpowszechniany bez ograniczeń, nie umieszczaj go tutaj.
Zapisując swoją edycję, oświadczasz, że ten tekst jest Twoim dziełem lub pochodzi z materiałów dostępnych na warunkach
domeny publicznej
lub kompatybilnych (zobacz także
Kolejopedia:Prawa autorskie
).
PROSZĘ NIE WPROWADZAĆ MATERIAŁÓW CHRONIONYCH PRAWEM AUTORSKIM BEZ POZWOLENIA WŁAŚCICIELA!
Anuluj
Pomoc w edycji
(otwiera się w nowym oknie)
Szablon użyty w tym artykule:
Użytkownik:Polskacafe/panel
(
edytuj
)