Module:Favilink: Difference between revisions

Jump to navigation Jump to search
211 bytes added ,  17:09, 31 July 2020
m
no edit summary
(split main favilink to its own main function that cannot be individually called, added modulefavilink that allows direct calling that does not require frame usage)
mNo edit summary
Line 53: Line 53:
local displayname = result[1]['DisplayName'] or name
local displayname = result[1]['DisplayName'] or name
local image = (result[1]['Image'] ~= '' and result[1]['Image']~=nil) and result[1]['Image'] or 'None'
local image = (result[1]['Image'] ~= '' and result[1]['Image']~=nil) and result[1]['Image'] or 'None'
local display = result[1]['Display']
local displaychar = result[1]['DisplayChar'] or '•'
local displaychar = result[1]['DisplayChar'] or '•'


Line 76: Line 77:
end
end


local img
local img = display
if (mw.title.new('File:' .. image).exists == true) then
if string.len(display) > 4 then
  img = '[[File:' .. image .. '|16px|link='..pagelink..']]'
  if string.sub(display, -4) == '.png' then
else
      img = '[[File:' .. display.. '|16px|link='..pagelink..']]'
  img = displaychar
  end
end
end
--if (mw.title.new('File:' .. image).exists == true) then
--  img = '[[File:' .. image .. '|16px|link='..pagelink..']]'
--else
--  img = displaychar
--end




Navigation menu