Аслияб меню рагьизе

Изменения

3001 байт добавлено ,  2 года назад
Хиса-басиялъул хӀакъалъулъ баян гьечӀо
 
--[[ Helper function, replacement for {{coord/display/title}} ]]
function displaytitle (s, notes, globalFrame)
return globalFrame:extensionTag{
local l = "[[Географиялъул координатал|Координатал]]: " .. s
name = 'indicator',
local co = '<span id="coordinates">' .. l .. notes .. '</span>';
content = s .. notes,
return '<span style="font-size: small;">' .. co .. '</span>';
args = { name = '0-coord' }
};
end
 
 
return coordinateSpec, errors
end
 
--[[
splitParam
 
Split the parameter string and convert it into an object.
]]
function splitParam( param )
local out = {}
for pair in mw.text.gsplit( param, '_', true ) do
local keyValue = mw.text.split( pair, ':', true )
if #keyValue == 2 then
out[keyValue[1]] = keyValue[2]
end
end
return out
end
 
end
local geodmshtml = '<span class="geo-dms" title="РазличныеГьаб картыбакІалъул ибатІи-батІиял схемыкартаби длява этого местасхемаби">'
.. '<span class="latitude">' .. coordinateSpec["dms-lat"] .. '</span> '
.. '<span class="longitude">' ..coordinateSpec["dms-long"] .. '</span>'
end
 
local params = splitParam( coordinateSpec.param )
local result = '<span class="plainlinks nourlexpansion">' .. globalFrame:preprocess(
local type = string.gsub( string.lower( params.type or '' ), '%(.+$', '' )
'[//tools.wmflabs.org/geohack/geohack.php?language=ru&pagename={{FULLPAGENAMEE}}&params=' ..
uriComponents .. ' ' .. inner .. ']')
 
local scale
local globe = string.lower(args.globe or '')
if local args.scale =and tonumber(args.scale or~= '30000') then
scale = tonumber( args.scale )
local nogoogle = string.lower(args.nogoogle or '')
else
local noosm = string.lower(args.noosm or '')
local typeScale = {
local yandex = string.lower(args.yandex or '')
adm1st = 1000000,
adm2nd = 300000,
adm3rd = 100000,
airport = 30000,
city = 100000,
country = 10000000,
edu = 10000,
event = 50000,
forest = 50000,
glacier = 50000,
isle = 100000,
landmark = 10000,
mountain = 100000,
pass = 10000,
railwaystation = 10000,
river = 100000,
satellite = 10000000,
waterbody = 100000,
camera = 10000
}
if typeScale[type] then
scale = typeScale[type]
else
scale = 30000
end
end
 
if scale < 2000 ifthen globezoom == '' then18
elseif scale < 5000 then zoom = 17
if nogoogle == '' then
elseif scale < 10000 then zoom = 16
result = result .. '&nbsp;<sup class="geo-google noprint" title="Это место на Картах Google">[//maps.google.com/maps?'
elseif scale < 20000 then zoom = 15
.. 'll=' .. coordinateSpec["dec-lat"] .. ',' .. coordinateSpec["dec-long"]
elseif scale < 40000 then zoom = 14
.. '&q=' .. coordinateSpec["dec-lat"] .. ',' .. coordinateSpec["dec-long"]
elseif scale < 80000 then zoom = 13
.. '&spn=' .. (scale / 1000000) .. ',' .. (scale / 1000000)
elseif scale < 160000 then zoom = 12
.. '&t=h&hl=ru (G)]'
elseif scale < 320000 then zoom = 11
.. '</sup>'
elseif scale < 640000 then zoom = 10
end
else zoom = 9
if noosm == '' then
end
result = result .. '&nbsp;<sup class="geo-osm noprint" title="Это место на карте OpenStreetMap">[http://www.openstreetmap.org/?'
.. 'mlat=' .. coordinateSpec["dec-lat"] .. '&mlon=' .. coordinateSpec["dec-long"]
if scale < 2000 then result = result .. '&zoom=18'
elseif scale < 5000 then result = result .. '&zoom=17'
elseif scale < 10000 then result = result .. '&zoom=16'
elseif scale < 20000 then result = result .. '&zoom=15'
elseif scale < 40000 then result = result .. '&zoom=14'
elseif scale < 80000 then result = result .. '&zoom=13'
elseif scale < 160000 then result = result .. '&zoom=12'
elseif scale < 320000 then result = result .. '&zoom=11'
elseif scale < 640000 then result = result .. '&zoom=10'
else result = result .. '&zoom=9'
end
result = result .. ' (O)]</sup>'
end
 
local maplinkArgs = {
if yandex ~= '' then
['latitude'] = coordinateSpec['dec-lat'],
result = result .. '&nbsp;<sup class="geo-yandex noprint" title="Это место на Яндекс.Картах">[//maps.yandex.ru/'
.. ['?ll=longitude'] ..= coordinateSpec["'dec-long"'] .. ',' .. coordinateSpec["dec-lat"]
['zoom'] = zoom,
.. '&pt=' .. coordinateSpec["dec-long"] .. ',' .. coordinateSpec["dec-lat"]
['text'] = coordinateSpec["dms-lat"] .. ' ' .. coordinateSpec["dms-long"],
.. '&spn=' .. (scale / 1000000)
['title'] = mw.title.getCurrentTitle().text
.. '&l=' .. 'sat,skl'
}
.. ' (Я)]</sup>'
 
end
-- if args['name'] and args['name'] ~= '' then
-- maplinkArgs['text'] = args['name']
-- end
if args['title'] and args['title'] ~= '' then
maplinkArgs['title'] = args['title']
end
 
local maplinkMarkerSymbol = 'star'
local markerSymbols = {
adm1st = 'city',
adm2nd = 'city',
adm3rd = 'city',
airport = 'airport',
city = 'city',
country = 'city',
edu = 'college',
forest = 'park-alt',
glacier = 'mountain',
mountain = 'mountain',
pass = 'mountain',
railwaystation = 'rail',
river = 'water',
satellite = 'rocket',
waterbody = 'water',
camera = 'attraction'
}
if markerSymbols[type] then
maplinkMarkerSymbol = markerSymbols[type]
end
 
local maplinkContent = [[ {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
]] .. coordinateSpec['dec-long'] .. [[,
]] .. coordinateSpec['dec-lat'] .. [[
]
},
"properties": {
"title": "]] .. maplinkArgs['title'] .. [[",
"marker-symbol": "]] .. maplinkMarkerSymbol .. [[",
"marker-color": "#3366cc"
}
} ]];
local entityId = mw.wikibase.getEntityIdForCurrentPage()
if entityId then
maplinkContent = maplinkContent .. [[, {
"type": "ExternalData",
"service": "geoline",
"ids": "]] .. mw.wikibase.getEntityIdForCurrentPage() .. [[",
"properties": {
"stroke": "#FF9999"
}
}, {
"type": "ExternalData",
"service": "geoshape",
"ids": "]] .. mw.wikibase.getEntityIdForCurrentPage() .. [[",
"properties": {
"fill": "#FF0000",
"fill-opacity": 0.1,
"stroke": "#FF9999"
}
} ]]
end
 
local globe = string.lower( args.globe or '' )
 
local result = '<span class="coordinates plainlinks nourlexpansion" data-param="' .. coordinateSpec.param .. '">'
if globe == '' or globe == 'earth' then
result = result .. globalFrame:extensionTag{
name = 'maplink',
content = '[' .. maplinkContent .. ']',
args = maplinkArgs
}
else
-- FIXME [[phab:T151138]]
result = result .. globalFrame:preprocess(
'[//tools.wmflabs.org/geohack/geohack.php?language=ru&pagename={{FULLPAGENAMEE}}&params=' ..
uriComponents .. ' ' .. inner .. ']' )
end
 
-- external links
local nogoogle = string.lower( args.nogoogle or '' )
local noosm = string.lower( args.noosm or '' )
local noyandex = string.lower( args.noyandex or '' )
 
if globe == '' then
if nogoogle == '' or noosm == '' or noyandex == '' then
result = result .. '<sup class="geo-services noprint">'
if nogoogle == '' then
result = result .. '<span class="geo-google" title="Гьаб бакІ Google картаялда">[//maps.google.com/maps?'
.. 'll=' .. coordinateSpec["dec-lat"] .. ',' .. coordinateSpec["dec-long"]
.. '&q=' .. coordinateSpec["dec-lat"] .. ',' .. coordinateSpec["dec-long"]
.. '&spn=' .. (scale / 1000000) .. ',' .. (scale / 1000000)
.. '&t=h&hl=ru '
.. '<span>G</span>]</span>'
end
if noyandex == '' then
result = result .. '<span class="geo-yandex" title="Гьаб бакІ Яндекс.Картаялда">[//yandex.ru/maps/'
.. '?ll=' .. coordinateSpec["dec-long"] .. ',' .. coordinateSpec["dec-lat"]
.. '&pt=' .. coordinateSpec["dec-long"] .. ',' .. coordinateSpec["dec-lat"]
.. '&spn=' .. (scale / 1000000) .. ',' .. (scale / 1000000)
.. '&l=' .. 'sat,skl '
.. '<span>Я</span>]</span>'
end
if noosm == '' then
result = result .. '<span class="geo-osm" title="Гьаб бакІ OpenStreetMap картаялда">[http://www.openstreetmap.org/?'
.. 'mlat=' .. coordinateSpec["dec-lat"] .. '&mlon=' .. coordinateSpec["dec-long"]
.. '&zoom=' .. zoom .. ' '
.. '<span>O</span>]</span>'
end
result = result .. '</sup>'
end
end
if string.find( Display, 'title' ) ~= nil or Display == 't' or
Display == 'it' or Display == 'ti' then
text = text .. displaytitle(contents, Notes, frame)
end
return text
5757

правок