Изменения

за неимением общего Module:Navbar для упрощения поддержки переведём шестерёнку на основу Шаблон:Tnavbar-view
Строка 176: Строка 176:     
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
Строка 184: Строка 184:  
styleratio = require('Module:Color contrast')._styleratio
 
styleratio = require('Module:Color contrast')._styleratio
 
end
 
end
local gearColor = ''
   
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 '')
if styleratio{gearStyleBlack} < styleratio{gearStyleWhite} then
+
local gear = currentFrame:expandTemplate{
gearColor = ' white'
+
title = 'Tnavbar-view',
end
+
args = {
local gear = string.format(
+
args.name,
'[[Файл:Wikipedia interwiki section gear icon%s.svg|14px|Просмотр этого шаблона|link=Шаблон:%s|alt=⛭]]',
+
fontcolor = (styleratio{gearStyleBlack} < styleratio{gearStyleWhite}) and 'white',
gearColor, args.name
+
}
)
+
}
 
 
 
--- Gear creation
 
--- Gear creation
Анонимный участник