Изменения

fix
Строка 15: Строка 15:     
local stylesheetLink = 'Module:Coordinates/styles.css'
 
local stylesheetLink = 'Module:Coordinates/styles.css'
math_mod = require( "Module:Math" );
+
local math_mod = require( "Module:Math" );
globalFrame = nil
     −
coordinates = {};
+
local coordinates = {};
    
local globe_list = '||earth|mercury|venus|moon|mars|phobos|deimos|ganymede|callisto|io|europa|mimas|enceladus|tethys|dione|rhea|titan|hyperion|iapetus|phoebe|miranda|ariel|umbriel|titania|oberon|triton|pluto|charon|ceres|vesta|'
 
local globe_list = '||earth|mercury|venus|moon|mars|phobos|deimos|ganymede|callisto|io|europa|mimas|enceladus|tethys|dione|rhea|titan|hyperion|iapetus|phoebe|miranda|ariel|umbriel|titania|oberon|triton|pluto|charon|ceres|vesta|'
   −
local Dispay = '';
+
local Display = '';
    
--[[ Helper function, replacement for {{coord/display/title}} ]]
 
--[[ Helper function, replacement for {{coord/display/title}} ]]
function displaytitle (s, notes, globalFrame)
+
function displaytitle (s, notes)
return globalFrame:extensionTag{
+
return mw.getCurrentFrame():extensionTag{
 
name = 'indicator',
 
name = 'indicator',
 
content = s .. notes,
 
content = s .. notes,
Строка 408: Строка 407:  
local noosm = string.lower( args.noosm or '' )
 
local noosm = string.lower( args.noosm or '' )
 
local noyandex = string.lower( args.noyandex or '' )
 
local noyandex = string.lower( args.noyandex or '' )
 +
local pageNameUri = mw.title.getCurrentTitle():partialUrl()
    
if globe == 'earth' then
 
if globe == 'earth' then
result = result .. '<span title="Показать карту">' .. globalFrame:extensionTag{
+
result = result .. '<span title="Показать карту">' .. mw.getCurrentFrame():extensionTag{
 
name = 'maplink',
 
name = 'maplink',
 
content = '[' .. maplinkContent .. ']',
 
content = '[' .. maplinkContent .. ']',
Строка 418: Строка 418:  
result = result .. '<sup class="geo-services noprint">'
 
result = result .. '<sup class="geo-services noprint">'
 
 
result = result .. globalFrame:preprocess(
+
result = result .. '<span class="geo-geohack" title="Карты и инструменты на GeoHack">' ..
'<span class="geo-geohack" title="Карты и инструменты на GeoHack">' ..
+
'[https://geohack.toolforge.org/geohack.php?language=ru&pagename=' .. pageNameUri .. '&params=' ..
'[https://geohack.toolforge.org/geohack.php?language=ru&pagename={{FULLPAGENAMEE}}&params=' ..
+
uriComponents .. ' ' .. '<span>H</span>]</span>'
uriComponents .. ' ' .. '<span>H</span>]</span>' )
   
 
 
if nogoogle == '' then
 
if nogoogle == '' then
result = result .. '<span class="geo-google" title="Это место на «Картах Google»">[//maps.google.com/maps?'
+
result = result .. '<span class="geo-google" title="Это место на «Картах Google»">[https://maps.google.com/maps?'
 
.. 'll=' ..  coordinateSpec["dec-lat"] .. ',' .. coordinateSpec["dec-long"]
 
.. 'll=' ..  coordinateSpec["dec-lat"] .. ',' .. coordinateSpec["dec-long"]
 
.. '&q=' ..  coordinateSpec["dec-lat"] .. ',' .. coordinateSpec["dec-long"]
 
.. '&q=' ..  coordinateSpec["dec-lat"] .. ',' .. coordinateSpec["dec-long"]
Строка 432: Строка 431:  
end
 
end
 
if noyandex == '' then
 
if noyandex == '' then
result = result .. '<span class="geo-yandex" title="Это место на «Яндекс.Картах»">[//yandex.ru/maps/'
+
result = result .. '<span class="geo-yandex" title="Это место на «Яндекс.Картах»">[https://yandex.ru/maps/'
 
.. '?ll=' .. coordinateSpec["dec-long"] .. ',' .. coordinateSpec["dec-lat"]
 
.. '?ll=' .. coordinateSpec["dec-long"] .. ',' .. coordinateSpec["dec-lat"]
 
.. '&pt=' .. coordinateSpec["dec-long"] .. ',' .. coordinateSpec["dec-lat"]
 
.. '&pt=' .. coordinateSpec["dec-long"] .. ',' .. coordinateSpec["dec-lat"]
Строка 449: Строка 448:  
else
 
else
 
-- FIXME [[phab:T151138]]
 
-- FIXME [[phab:T151138]]
result = result .. globalFrame:preprocess(
+
result = result .. '[https://geohack.toolforge.org/geohack.php?language=ru&pagename=' .. pageNameUri .. '&params=' ..
'[//geohack.toolforge.org/geohack.php?language=ru&pagename={{FULLPAGENAMEE}}&params=' ..
+
uriComponents .. ' ' .. inner .. ']'
uriComponents .. ' ' .. inner .. ']' )
   
if globe == 'moon' or globe == 'mars' and nogoogle == '' then
 
if globe == 'moon' or globe == 'mars' and nogoogle == '' then
result = result .. '<sup class="geo-services noprint"><span class="geo-google" title="Это место на «Картах Google»">[//www.google.com/' .. globe
+
result = result .. '<sup class="geo-services noprint"><span class="geo-google" title="Это место на «Картах Google»">[https://www.google.com/' .. globe
 
.. '/#lat=' ..  coordinateSpec["dec-lat"] .. '&lon=' .. coordinateSpec["dec-long"]
 
.. '/#lat=' ..  coordinateSpec["dec-lat"] .. '&lon=' .. coordinateSpec["dec-long"]
 
.. '&zoom=7'
 
.. '&zoom=7'
Строка 812: Строка 810:  
]]
 
]]
 
function coordinates.coord(frame)
 
function coordinates.coord(frame)
globalFrame = frame
   
local args = frame.args
 
local args = frame.args
 
if args[1] == nil then
 
if args[1] == nil then
Строка 839: Строка 836:  
if string.find( Display, 'title' ) ~= nil then
 
if string.find( Display, 'title' ) ~= nil then
 
displaytitle_ = true
 
displaytitle_ = true
text = text .. displaytitle(contents, Notes, frame)
+
text = text .. displaytitle(contents, Notes)
 
end
 
end
 
return text
 
return text
Анонимный участник