Module:Sandbox/Jackmcbarn: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
smuggle state
Jackmcbarn (talk | contribs)
m Reverted edits by Jackmcbarn (talk) to last version by Le Deluge
Tags: Replaced Rollback
 
(77 intermediate revisions by 2 users not shown)
Line 1:
local getTarget = require('Module:Redirect').getTarget
local p = {}
 
local function pagetype(nsText)
return nsText == '' and 'articles' or (mw.ustring.lower(nsText) .. ' pages')
end
 
function p.main(frame)
local oldClockcurrentTitle = osmw.clocktitle.getCurrentTitle()
local target = getTarget(currentTitle)
mw.loadData('Module:Sandbox/Jackmcbarn/slow')
if os.clock() - oldClock > 0.001target then
local currentNsText, targetNsText = currentTitle.nsText, mw.title.new(target).nsText
return 'this is the first time this module was called on this page, time is ' .. os.clock() - oldClock
if currentNsText ~= targetNsText then
else
return string.format('[[:Category:Cross-namespace redirects from %s]][[:Category:Cross-namespace redirects to %s]]', pagetype(currentNsText), pagetype(targetNsText))
return 'this module has previously been called on this page, time is ' .. os.clock() - oldClock
end
end
return '[[:Category:Pages incorrectly tagged as cross-namespace redirects]]'
end