"ഘടകം:Slippymap/sandbox" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
ദൃശ്യരൂപം
No edit summary |
No edit summary |
||
| വരി 40: | വരി 40: | ||
properties = { | properties = { | ||
title = options.text or "Marker", -- Title for the popup | title = options.text or "Marker", -- Title for the popup | ||
icon = { | |||
iconUrl = "//schoolwiki.in/images/5/5f/63rd_state_kalolsavam_logo.png", -- Path to the image file | |||
iconSize = { 50, 50 }, -- Width and height of the icon | |||
iconAnchor = { 25, 50 }, -- Anchor point (center bottom of the icon) | |||
popupAnchor = { 0, -50 }, -- Popup anchor position | |||
}, | |||
}, | }, | ||
}, | }, | ||
17:46, 6 ജനുവരി 2025-നു നിലവിലുണ്ടായിരുന്ന രൂപം
ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:Slippymap/sandbox/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്
local p = {}
-- Cleans input of excessive whitespace typically added by linebreaks and spaces
local function clean(input)
return input and #input > 0 and mw.text.trim(input) or nil
end
function p.slippymap(frame)
local args = (frame:getParent() or frame).args
-- Set map options with default values
local options = {}
options.latitude = tonumber(clean(args.lat)) or 51.3432699
options.longitude = tonumber(clean(args.lon)) or 0.52700328
options.height = tonumber(clean(args.height)) or 400
options.zoom = tonumber(clean(args.zoom)) or 12
options.align = clean(args.alignment) or "center"
options.text = clean(args.text)
if clean(args.width) == "full" then
options.width = "full"
elseif args.width then
options.width = tonumber(clean(args.width)) or 400
else
options.width = 400
end
-- Handle marker display
local content = nil
if clean(args.marker) ~= "no" then
content = mw.text.jsonEncode({
type = "FeatureCollection",
features = {
{
type = "Feature",
geometry = {
type = "Point",
coordinates = { options.longitude, options.latitude },
},
properties = {
title = options.text or "Marker", -- Title for the popup
icon = {
iconUrl = "//schoolwiki.in/images/5/5f/63rd_state_kalolsavam_logo.png", -- Path to the image file
iconSize = { 50, 50 }, -- Width and height of the icon
iconAnchor = { 25, 50 }, -- Anchor point (center bottom of the icon)
popupAnchor = { 0, -50 }, -- Popup anchor position
},
},
},
},
})
end
-- Return the mapframe tag
return frame:extensionTag {
name = "mapframe",
content = content,
args = {
latitude = options.latitude,
longitude = options.longitude,
height = options.height,
width = options.width,
zoom = options.zoom,
align = options.align,
},
}
end
return p