"ഘടകം:Slippymap/sandbox" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

242 ബൈറ്റുകൾ നീക്കംചെയ്തിരിക്കുന്നു ,  തിങ്കളാഴ്ച്ച 18:34-നു്
തിരുത്തലിനു സംഗ്രഹമില്ല
No edit summary
No edit summary
 
(ഒരേ ഉപയോക്താവ് ചെയ്ത ഇടയ്ക്കുള്ള 15 നാൾപ്പതിപ്പുകൾ പ്രദർശിപ്പിക്കുന്നില്ല)
വരി 1: വരി 1:
local DEFAULT_FRAME_WIDTH = "270"
local DEFAULT_FRAME_HEIGHT = "200"
local DEFAULT_ZOOM = 10
-- Trim whitespace from arguments
function trimArgs(argsTable)
    local cleanArgs = {}
    for key, val in pairs(argsTable) do
        if type(val) == 'string' then
            val = val:match('^%s*(.-)%s*$')
            if val ~= '' then
                cleanArgs[key] = val
            end
        else
            cleanArgs[key] = val
        end
    end
    return cleanArgs
end
-- Main function to generate map
local p = {}
local p = {}


-- Function to clean input values by trimming spaces and handling nil values
-- This will display the map based on provided coordinates
local function clean(input)
p.main = function(frame)
return input and mw.text.trim(input) or nil
    local parent = frame.getParent(frame)
end
    local parentArgs = parent.args
    local config = trimArgs(parentArgs)


function p.slippymap(frame)
    -- Extract coordinates (if provided)
local args = (frame:getParent() or frame).args
    local coords = config.coordinates or config.coord


-- Map configuration options
    if not coords then
local options = {
        return ''  -- Return an empty string if no coordinates are provided
latitude = tonumber(clean(args.lat)) or 51.3432699,
    end
longitude = tonumber(clean(args.lon)) or 0.52700328,
height = tonumber(clean(args.height)) or 400,
width = clean(args.width) == "full" and "full" or tonumber(clean(args.width)) or 400,
zoom = tonumber(clean(args.zoom)) or 12,
align = clean(args.alignment) or "center",
text = clean(args.text) or "Custom Marker",
}


-- GeoJSON content for the marker with a custom image
    -- Configure mapframe arguments
local content = mw.text.jsonEncode({
    local args = {}
type = "FeatureCollection",
    args.display = "inline"
features = {
    args.frame = "yes"
{
    args.plain = "yes"
type = "Feature",
    args["frame-width"] = config["frame-width"] or DEFAULT_FRAME_WIDTH
geometry = {
    args["frame-height"] = config["frame-height"] or DEFAULT_FRAME_HEIGHT
type = "Point",
    args.zoom = config.zoom or DEFAULT_ZOOM
coordinates = { options.longitude, options.latitude },
    args["frame-coord"] = coords
},
properties = {
title = options.text,
icon = {
iconUrl = "//schoolwiki.in/images/5/5f/63rd_state_kalolsavam_logo.png", -- Custom image URL
iconSize = { 50, 50 }, -- Size of the marker icon
iconAnchor = { 25, 50 }, -- Position of the icon's anchor point
popupAnchor = { 0, -50 }, -- Popup position relative to the marker
},
},
},
},
})


-- Generate the mapframe tag with marker and options
    -- Return the mapframe code as a string
return frame:extensionTag {
    return frame:preprocess('{{#mapframe:' .. mw.uri.encodeArgs(args) .. '}}')
name = "mapframe",
content = content,
args = {
latitude = options.latitude,
longitude = options.longitude,
height = options.height,
width = options.width,
zoom = options.zoom,
align = options.align,
},
}
end
end


return p
return p
"https://schoolwiki.in/പ്രത്യേകം:മൊബൈൽവ്യത്യാസം/2624361...2624391" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്