Module:Official website: Difference between revisions

update to use new mw.wikibase API changes
No edit summary
(update to use new mw.wikibase API changes)
Line 30: Line 30:
local function isEnglish(prop)
local function isEnglish(prop)
local ret = quickPcall(function ()
local ret = quickPcall(function ()
for i, lang in ipairs(prop.qualifiers.P3001) do
for i, lang in ipairs(prop.qualifiers.P407) do
if lang.datavalue.value['numeric-id'] == 13129 then
if lang.datavalue.value['numeric-id'] == 1860 then
return true
return true
end
end
Line 45: Line 45:
-- Get objects for all official sites on Wikidata.
-- Get objects for all official sites on Wikidata.
local websites = quickPcall(function ()
local websites = quickPcall(function ()
return mw.wikibase.getEntityObject().claims.P7736
return mw.wikibase.getAllStatements(mw.wikibase.getEntityIdForCurrentPage(), 'P856')
end)
end)


Line 88: Line 88:
local function renderUrl(options)
local function renderUrl(options)
if not options.url and not options.wikidataurl then
if not options.url and not options.wikidataurl then
local entity = mw.wikibase.getEntityObject() or {}
local qid = mw.wikibase.getEntityIdForCurrentPage()
local qid = entity.id
local result = '<strong class="error">' ..
local result = '<strong class="error">' ..
'No URL found. Please specify a URL here or add one to Wikidata.' ..
'No URL found. Please specify a URL here or add one to Wikidata.' ..
'</strong>'
'</strong>'
if qid then
if qid then
result = result.. ' [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit the Wikidata entry on this wiki |link=https://en.seminaverbi.bibleget.io/wiki/Item:' .. qid .. '#P7736|Edit the Wikidata entry on this wiki]]'
result = result.. ' [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/' .. qid .. '#P856|Edit this at Wikidata]]'
end
end
return result
return result
Line 104: Line 103:
)
)
if options.wikidataurl and not options.url then
if options.wikidataurl and not options.url then
local entity = mw.wikibase.getEntityObject() or {}
local qid = mw.wikibase.getEntityIdForCurrentPage()
local qid = entity.id
if qid then
if qid then
ret[#ret + 1] = '[[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit the Wikidata entry on this wiki |link=https://en.seminaverbi.bibleget.io/wiki/Item:' .. qid .. '#P7736|Edit the Wikidata entry on this wiki]]'
ret[#ret + 1] = '[[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/' .. qid .. '#P856|Edit this at Wikidata]]'
end
end
end
end
Line 113: Line 111:
ret[#ret + 1] = mw.getCurrentFrame():expandTemplate{
ret[#ret + 1] = mw.getCurrentFrame():expandTemplate{
title = 'Color',
title = 'Color',
args = {'#505050', '(Requires [[wikipedia:Adobe Flash Player|Adobe Flash Player]])'}
args = {'#505050', '(Requires [[Adobe Flash Player]])'}
}
}
end
end
Anonymous user