Изменения
Перейти к навигации
Перейти к поиску
Строка 176:
Строка 176:
− +
− +
Строка 184:
Строка 184:
− local gearColor = ''
− if styleratio{gearStyleBlack} < styleratio{gearStyleWhite} then +
− gearColor = ' white'+
− end+
− local gear = string.format(+
− '[[Файл:Wikipedia interwiki section gear icon%s.svg|14px|Просмотр этого шаблона|link=Шаблон:%s|alt=⛭]]',+
− gearColor, args.name +
− ) +
за неимением общего Module:Navbar для упрощения поддержки переведём шестерёнку на основу Шаблон:Tnavbar-view
local function renderNavBar(titleCell, args)
local function renderNavBar(titleCell, args)
local currentFrame = mw.getCurrentFrame()
if args.navbar ~= 'off' and args.navbar ~= 'plain'
if args.navbar ~= 'off' and args.navbar ~= 'plain'
and (args.name or not mw.getCurrentFrame():getParent():getTitle():gsub('/песочница$', '') == 'Шаблон:Навигационная таблица') then
and (args.name or not currentFrame:getParent():getTitle():gsub('/песочница$', '') == 'Шаблон:Навигационная таблица') then
-- Check color contrast of the gear icon
-- Check color contrast of the gear icon
styleratio = require('Module:Color contrast')._styleratio
styleratio = require('Module:Color contrast')._styleratio
end
end
local contrastStyle = args.titlestyle or args.basestyle
local contrastStyle = args.titlestyle or args.basestyle
local gearStyleBlack = (contrastStyle and mw.text.unstripNoWiki(contrastStyle) .. '; color:#666;' or '')
local gearStyleBlack = (contrastStyle and mw.text.unstripNoWiki(contrastStyle) .. '; color:#666;' or '')
local gearStyleWhite = (contrastStyle and mw.text.unstripNoWiki(contrastStyle) .. '; color:#fff;' or '')
local gearStyleWhite = (contrastStyle and mw.text.unstripNoWiki(contrastStyle) .. '; color:#fff;' or '')
local gear = currentFrame:expandTemplate{
title = 'Tnavbar-view',
args = {
args.name,
fontcolor = (styleratio{gearStyleBlack} < styleratio{gearStyleWhite}) and 'white',
}
}
--- Gear creation
--- Gear creation