"ഘടകം:Slippymap/sandbox" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
No edit summary |
No edit summary |
||
വരി 2: | വരി 2: | ||
function p.slippymap(frame) | function p.slippymap(frame) | ||
-- Get arguments from the template | -- Get arguments from the template | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local lat = args["lat"] or "0" -- Default latitude | local lat = args["lat"] or "0" -- Default latitude | ||
local lon = args["lon"] or "0" -- Default longitude | local lon = args["lon"] or "0" -- Default longitude | ||
local height = args["height"] or "400px" -- Default height | |||
local width = args["width"] or "100%" -- Default width | |||
local zoom = args["zoom"] or "13" -- Default zoom level | |||
local text = args["text"] or "Marker" -- Default marker text | local text = args["text"] or "Marker" -- Default marker text | ||
local logo = args["logo"] or "File:63rd_state_kalolsavam_logo.png" -- Default logo image (complete URL) | local logo = args["logo"] or "https://schoolwiki.in/File:63rd_state_kalolsavam_logo.png" -- Default logo image (complete URL) | ||
-- Ensure lat and lon are numeric | -- Ensure lat and lon are numeric | ||
lat = tonumber(lat) or 0 | lat = tonumber(lat) or 0 | ||
lon = tonumber(lon) or 0 | lon = tonumber(lon) or 0 | ||
zoom = tonumber(zoom) or 13 | |||
-- Kartographer map rendering | -- Kartographer map rendering | ||
local mapHtml = mw.html.create("div") | local mapHtml = mw.html.create("div") | ||
mapHtml:addClass("kartographer-map") | mapHtml:addClass("kartographer-map") | ||
mapHtml:attr("style", "width: | mapHtml:attr("style", "width: " .. width .. "; height: " .. height .. ";") | ||
mapHtml:wikitext('{{#invoke:Kartographer|map|' .. lat .. ',' .. lon .. '|zoom= | |||
-- Add Kartographer map invocation | |||
mapHtml:wikitext('{{#invoke:Kartographer|map|' .. lat .. ',' .. lon .. '|zoom=' .. zoom .. '|markers=' .. lat .. ',' .. lon .. '|' .. text .. '}}') | |||
-- Logo as an image | -- Logo as an image |
18:22, 6 ജനുവരി 2025-നു നിലവിലുണ്ടായിരുന്ന രൂപം
ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:Slippymap/sandbox/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്
local p = {} function p.slippymap(frame) -- Get arguments from the template local args = frame:getParent().args local lat = args["lat"] or "0" -- Default latitude local lon = args["lon"] or "0" -- Default longitude local height = args["height"] or "400px" -- Default height local width = args["width"] or "100%" -- Default width local zoom = args["zoom"] or "13" -- Default zoom level local text = args["text"] or "Marker" -- Default marker text local logo = args["logo"] or "https://schoolwiki.in/File:63rd_state_kalolsavam_logo.png" -- Default logo image (complete URL) -- Ensure lat and lon are numeric lat = tonumber(lat) or 0 lon = tonumber(lon) or 0 zoom = tonumber(zoom) or 13 -- Kartographer map rendering local mapHtml = mw.html.create("div") mapHtml:addClass("kartographer-map") mapHtml:attr("style", "width: " .. width .. "; height: " .. height .. ";") -- Add Kartographer map invocation mapHtml:wikitext('{{#invoke:Kartographer|map|' .. lat .. ',' .. lon .. '|zoom=' .. zoom .. '|markers=' .. lat .. ',' .. lon .. '|' .. text .. '}}') -- Logo as an image local logoHtml = mw.html.create("div") logoHtml:addClass("logo") logoHtml:attr("style", "position: absolute; bottom: 10px; left: 10px;") logoHtml:wikitext('[[File:' .. logo .. '|100px|link=]]') -- Return the map and logo HTML return tostring(mapHtml) .. tostring(logoHtml) end return p