Home
Random
Log in
Settings
About Brighter Shores Wiki
Disclaimers
Search
Editing
Module:Chat options
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- <pre> local p = {} local hasc = require('Module:Paramtest').has_content local tooltips = require('Module:Tooltip') function p.main(frame) local args = frame:getParent().args local items = {} local i = 1 while hasc(args[i]) do local item = mw.text.trim(args[i]) local key local tooltip if item:lower() == 'any' or item == '~' then key = '~' tooltip = '[Any option]' else -- Match first case-insensitive, alphanumeric character, "#", or "?" key = item:match('^[?A-Za-z0-9#]') if key == '?' then key = '#' end if key then tooltip = mw.text.trim(mw.ustring.sub(item, 2)) end end table.insert(items, { key, tooltip }) i = i + 1 end return p.render(items) end function p.render(items) local k,t,vals,tooltip_table tooltip_table = mw.html.create('table') -- Create tooltip table local c_options_arr = {} for i,v in ipairs(items) do k = mw.text.trim(v[1]) -- Chat option key value t = mw.text.trim(v[2]) -- Chat option text --- --- Chat options list --- vals = mw.html.create('span') -- Create chat options number vals:wikitext(k) -- Set text to the key value if hasc(t) then -- If it has text to display vals:addClass('chat-options-underline') -- Underline it :attr('title', t) -- Add hover title attrib with text end table.insert(c_options_arr, tostring(vals)) --- --- Chat options tooltip --- tooltip_table :tag('tr') :tag('td'):wikitext('\'\'\''..k..'\'\'\''):done() :tag('td'):wikitext(t):done() :done() end -- Create chat options container local c_options_container = mw.html.create('span') :addClass('chat-options') :wikitext('(<i title="Chat options">[[File:Talk small icon.png|17px|alt=Talk to|link=]]</i> ') :wikitext(table.concat(c_options_arr, '•')) -- Concat chat option numbers with hovers :wikitext(')') c_options_container = tostring(c_options_container) -- Create chat options tooltip local name = 'c_option-' .. mw.hash.hashValue('md5', c_options_container) local c_tooltip_button = tooltips._span({ name = name, alt = '\'\'\'…\'\'\'' }) :addClass('chat-options-dialogue') local c_tooltip_container = tooltips._div({ name = name, hasarrow = true, limitwidth = true, content = tostring(tooltip_table) }):css('padding', '0') c_tooltip_button = tostring(c_tooltip_button) c_tooltip_container = tostring(c_tooltip_container) return c_options_container .. c_tooltip_button .. c_tooltip_container end return p
Summary:
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see
Brighter Shores:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Templates used on this page:
Template:Chat options
(
edit
)
Template:Chat options/doc
(
edit
)
Template:DependencyList
(
edit
)
Template:Documentation
(
edit
)
Template:Extension DPL
(
edit
)
Template:No documentation
(
edit
)
Template:PageType
(
edit
)
Module:Array
(
edit
)
Module:Chat options
(
edit
)
Module:Chat options/doc
(
edit
)
Module:DPLlua
(
edit
)
Module:DependencyList
(
edit
)
Module:Documentation
(
edit
)
Module:Paramtest
(
edit
)
Module:Tooltip
(
edit
)
Module:Yesno
(
view source
) (semi-protected)
This page is a member of a hidden category:
Category:Pages using DynamicPageList3 parser function