Bureaucrats, Check users, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, Widget editors
1,655
edits
(add chromium support) |
m (hm) |
||
(19 intermediate revisions by 3 users not shown) | |||
Line 108: | Line 108: | ||
title = title, | title = title, | ||
lore = lore, | lore = lore, | ||
enchanted = enchanted | enchanted = enchanted, | ||
link = link | |||
} | } | ||
} | } | ||
Line 125: | Line 126: | ||
autoScale = settings.autoscale, | autoScale = settings.autoscale, | ||
image = (settings.image and getImage(settings.image)) | image = (settings.image and getImage(settings.image)) | ||
or (settings.spriteSheet and getSpriteSheet(settings.spriteSheet)) | -- or (settings.spriteSheet and getSpriteSheet(settings.spriteSheet)) | ||
} | } | ||
Line 170: | Line 171: | ||
self:setPosition(self.__source.ids[itemName].pos) | self:setPosition(self.__source.ids[itemName].pos) | ||
if self.__source.ids[itemName].spriteSheet then | if self.__source.ids[itemName].spriteSheet then | ||
local newSettings = require(types[self.__source.ids[itemName].spriteSheet]).settings | |||
self.__settings.classname = newSettings.classname | |||
self.__settings.size = newSettings.size | |||
self.__settings.tiles = newSettings.sheetsize / newSettings.size | |||
self.__settings.scale = newSettings.scale | |||
self.__settings.autoScale = newSettings.autoscale | |||
end | end | ||
end | end | ||
Line 179: | Line 185: | ||
self:setPosition(self.__source.ids[item].pos) | self:setPosition(self.__source.ids[item].pos) | ||
if self.__source.ids[item].spriteSheet then | if self.__source.ids[item].spriteSheet then | ||
local newSettings = require(types[self.__source.ids[item].spriteSheet]).settings | |||
self.__settings.classname = newSettings.classname | |||
self.__settings.size = newSettings.size | |||
self.__settings.tiles = newSettings.sheetsize / newSettings.size | |||
self.__settings.scale = newSettings.scale | |||
self.__settings.autoScale = newSettings.autoscale | |||
end | end | ||
else | else | ||
Line 279: | Line 290: | ||
local source = self.__source | local source = self.__source | ||
sprite:addClass(source.settings.classname) | sprite:addClass(self.__settings.classname or source.settings.classname) | ||
if self.__settings.hideTooltip ~= true then | if self.__settings.hideTooltip ~= true then | ||
Line 291: | Line 302: | ||
end | end | ||
if self.__settings.enchanted then | if self.__settings.enchanted == "true" then | ||
sprite:addClass("enchanted") | sprite:addClass("enchanted") | ||
end | end | ||
Line 297: | Line 308: | ||
local styles = self:calculateStyles() | local styles = self:calculateStyles() | ||
sprite:cssText( styles ) | sprite:cssText( styles ) | ||
sprite:attr(" | |||
if self.__settings.link then | |||
sprite = html:tag("span") | |||
local link = self.__settings.link | |||
if link:sub ( 1,1 ) == '[' then | |||
local parentDiv = mw.html.create("a"):attr("href",link:sub ( 2,#link-1 )) | |||
elseif link:sub ( 1,1 ) == '#' then | |||
local section_id = self.__source.ids[itemName].section | |||
for index, tab in pairs(self.__source.sections) do | |||
if tab.id == section_id then | |||
local parentDiv = mw.html.create("a"):attr("href","/" .. tab.name .. "/" .. link:sub ( 2,#link )) | |||
end | |||
end | |||
elseif string.match(link, "%#") then | |||
local parentDiv = mw.html.create("a"):attr("href","/" .. link) | |||
else | |||
local parentDiv = mw.html.create("a"):attr("href","/#" .. link) | |||
end | |||
parentDiv:node(sprite) | |||
return parentDiv | |||
end | |||
return sprite | return sprite |
edits