Module:Sandbox/BrandonXLF/user space

This module contains Lua functions used in the User:BrandonXLF user space.

Module:Sandbox/BrandonXLF/user space

local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.variables(frame)
	local args = getArgs(frame)
	local i = 1

	local out = '<h2>Variables</h2>Optionally, add any of the <code>code snippets</code> below to the JS file you installed the script in (eg. your [[Special:MyPage/common.js|common.js]] file) to change the settings for this script. For best compatibility, put them above the code that is used to load the script.<ul>'

	args['v1'] = (args['v'] or args['v1'])
	args['d1'] = (args['d'] or args['d1'])
	args['e1'] = (args['e'] or args['e1'])

	while args['v' .. i] do
		local var = '<code>window.' .. args['v' .. i] .. ' =' .. (args['e' .. i] and ' ' .. args['e' .. i] or '') .. ';</code>'
		var = var .. (args['d' .. i] and ' – ' .. args['d' .. i] or '')
		out = out .. '<li>' .. var .. '</li>'
		i = i + 1 
	end

	return out .. '</ul>'
end

function p.sandboxStatus(frame)
	local args = getArgs(frame)
	local title = mw.title.new(args[1])
	
	if not title.exists then
		return '<span style="background-color:darkred;height:10px;width:10px;display:inline-block;"></span>'
	end
	
	if title:getContent() == (args[2] or '') then
		return '<span style="background-color:green;height:10px;width:10px;display:inline-block;"></span>'
	end
	
	return '<span style="background-color:red;height:10px;width:10px;display:inline-block;"></span>'
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.