「モジュール:Location map」の版間の差分

en:Module:Location map 20:16, 27 April 2015‎(UTC)より
template>K-iczn
(モジュール:Location map/sandbox 2015年3月14日 (土) 16:40‎(UTC)より)
template>K-iczn
(en:Module:Location map 20:16, 27 April 2015‎(UTC)より)
216行目: 216行目:
.. ((args.label or mw.title.getCurrentTitle().text) .. ' (' .. map('name') .. ')')
.. ((args.label or mw.title.getCurrentTitle().text) .. ' (' .. map('name') .. ')')
.. '</div>'
.. '</div>'
elseif args.caption == ''  then
elseif args.caption ~= ''  then
retval = retval .. '<div style="font-size:90%;padding-top:3px"></div>'
else
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '| ]]</div>' .. args.caption .. '</div>'
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '| ]]</div>' .. args.caption .. '</div>'
271行目: 269行目:


local function markLabelDiv(label, label_size, label_width, position, background, x, marksize)
local function markLabelDiv(label, label_size, label_width, position, background, x, marksize)
if tonumber(label_size) == 0 then
return mw.html.create('div'):cssText('font-size:0%;position:absolute'):wikitext(label)
end
local builder = mw.html.create('div')
local builder = mw.html.create('div')
:cssText('font-size:' .. label_size .. '%;line-height:110%;position:absolute;width:' .. label_width .. 'em')
:cssText('font-size:' .. label_size .. '%;line-height:110%;position:absolute;width:' .. label_width .. 'em')
326行目: 327行目:
-- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't.
-- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't.
local entity = mw.wikibase.getEntity()
local entity = mw.wikibase.getEntity()
if entity and entity.claims and entity.claims.p625 and entity.claims.p625[0].mainsnak.snaktype == 'value' then
if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then
local value = entity.claims.p625[0].mainsnak.datavalue.value
local value = entity.claims.P625[1].mainsnak.datavalue.value
longitude, latitude = value.longitude, value.latitude
longitude, latitude = value.longitude, value.latitude
end
end
匿名利用者