Module:Random slideshow/sandbox: Difference between revisions

Content deleted Content added
fix
Sync with N−3 version by Frietjes 14:50, 10 March 2021
Line 38:
local randomiseArgs = { ['t'] = galleryLines }
local sortedLines = nonRandom and galleryLines or randomModule.main('array', randomiseArgs)
for i = 1, #sortedLines do
-- insert a switcher-label span just after the first pipe (which has already been escaped as {{!}} instead the | character)
sortedLines[i] = sortedLines[i]:gsub(
"%{%{%!%}%}",
'{{!}}<span class="switcher-label" style="display:none"><span class="randomSlideshow-sr-only">Image ' .. tostring(i) .. '</span></span>',
1)
end
local galleryContent = table.concat(sortedLines, '\n')
local output = '<div class="' .. containerClassName .. '" style="max-width:' .. normaliseCssMeasurement(maxWidth) .. '; margin:-4em auto;"><div class="nomobile"><!--intentionally empty on desktop, and is not present on mobile website (outside template namesapce)--></div>{{#tag:gallery|' .. galleryContent .. '|mode=slideshow|class=switcher-container}}</div>'
return output
end
Line 183 ⟶ 176:
end
 
p._main = function(args, transclude, extraClassNamecontainerClassName)
if not args[1] then
return error(linked and 'No page specified' or 'No page specified', 0)
end
local lines = transclude and makeTranscludedGalleryLinesTables(args) or makeGalleryLinesTable(args)
localreturn classNamesmakeOutput(lines, =args.width or '100%', containerClassName or 'randomSlideshow-container', isDeclined(args.random))
if extraClassName then classNames = classNames .. ' ' .. extraClassName end
return makeOutput(lines, args.width or '100%', classNames, isDeclined(args.random))
end
 
Line 198 ⟶ 189:
local args = cleanupArgs(parentArgs)
local output = p._main(args, false)
return frame:extensionTag{ name='templatestyles', args = { src='Module:Random slideshow/sandbox/styles.css'} }
.. frame:preprocess(output)
end
Line 207 ⟶ 198:
local args = cleanupArgs(parentArgs)
local output = p._main(args, true)
return frame:extensionTag{ name='templatestyles', args = { src='Module:Random slideshow/sandbox/styles.css'} }
.. frame:preprocess(output)
end