编辑“︁
Module:Key
”︁
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
-- This module implements {{key press}}. local kbdPrefix = '<kbd class=' .. '"keyboard-key nowrap" ' .. 'style="border: 1px solid var(--border-color-base,#aaa); ' .. -- The following is an expansion of {{border-radius|2px}} '-moz-border-radius: 2px; -webkit-border-radius: 2px; border-radius: 2px; ' .. -- The following is an expansion of {{box-shadow|1px|2px|2px|#ddd}} '-moz-box-shadow: 1px 2px 2px var(--border-color-muted,#ddd); -webkit-box-shadow: 1px 2px 2px var(--border-color-muted,#ddd); box-shadow: 1px 2px 2px var(--border-color-muted,#ddd); ' .. 'background-color: var(--background-color-neutral-subtle,#f9f9f9); ' .. -- The following is an expansion of {{linear-gradient|top|#eee, #f9f9f9, #eee}} 'background-image: -moz-linear-gradient(top, var(--background-color-neutral,#eee), var(--background-color-neutral-subtle,#f9f9f9), var(--background-color-neutral,#eee)); background-image: -o-linear-gradient(top, var(--background-color-neutral,#eee), var(--background-color-neutral-subtle,#f9f9f9), var(--background-color-neutral,#eee)); background-image: -webkit-linear-gradient(top, var(--background-color-neutral,#eee), var(--background-color-neutral-subtle,#f9f9f9), var(--background-color-neutral,#eee)); background-image: linear-gradient(to bottom, var(--background-color-neutral,#eee), var(--background-color-neutral-subtle,#f9f9f9), var(--background-color-neutral,#eee)); ' .. 'padding: 0.1em 0.3em; ' .. 'font-family: inherit; ' .. 'color: inherit;'.. 'font-size: 0.85em;">' local kbdSuffix = '</kbd>' local keyText = { ['caps lock'] = '⇪ Caps Lock', ['[[caps lock]]'] = '⇪ [[大寫鎖定|Caps Lock]]', ['shift'] = '⇧ Shift', ['[[shift key|shift]]'] = '⇧ [[换档键|Shift]]', ['enter'] = '↵ Enter', ['[[enter key|enter]]'] = '↵ [[回車鍵|Enter]]', ['cmd'] = '⌘ Cmd', ['[[command key|cmd]]'] = '⌘ [[Command键|Cmd]]', ['command'] = '⌘ Command', ['[[command key|command]]'] = '⌘ [[Command键|Command]]', ['opt'] = '⌥ Opt', ['[[option key|opt]]'] = '⌥ [[Option键|Opt]]', ['option'] = '⌥ Option', ['[[option key|option]]'] = '⌥ [[Option键|Option]]', ['tab'] = 'Tab ↹', ['[[tab key|tab]]'] = '[[製表鍵|Tab]] ↹', ['backspace'] = '← Backspace', ['[[backspace]]'] = '← [[后退键|ackspace]]', ['win'] = '⊞ Win', ['[[windows key|win]]'] = '⊞ [[Windows键|Win]]', ['menu'] = '≣ Menu', ['[[menu key|menu]]'] = '≣ [[菜单键|Menu]]', ['up'] = '↑', ['[[arrow keys|up]]'] = '[[方向键|↑]]', ['down'] = '↓', ['[[arrow keys|down]]'] = '[[方向键|↓]]', ['left'] = '←', ['[[arrow keys|left]]'] = '[[方向键|←]]', ['right'] = '→', ['[[arrow keys|right]]'] = '[[方向键|→]]', ['asterisk'] = '*', ['hash'] = '#', ['[[#]]'] = '[[井号|#]]', ['colon'] = ':', ['[[:]]'] = '[[冒号|:]]', ['pipe'] = '|', ['[[|]]'] = '[[豎線||]]', ['semicolon'] = ';', ['[[;]]'] = '[[分号|;]]', ['equals'] = '=', -- Left & right analog sticks. ['l up'] = 'L↑', ['l down'] = 'L↓', ['l left'] = 'L←', ['l right'] = 'L→', ['l ne'] = 'L↗', ['l se'] = 'L↘', ['l nw'] = 'L↖', ['l sw'] = 'L↙', ['r up'] = 'R↑', ['r down'] = 'R↓', ['r left'] = 'R←', ['r right'] = 'R→', ['r ne'] = 'R↗', ['r se'] = 'R↘', ['r nw'] = 'R↖', ['r sw'] = 'R↙', -- PlayStation. ['ex'] = '×', ['circle'] = '○', ['square'] = '□', ['triangle'] = '△', -- Nintendo 64 and GameCube. ['c up'] = 'C↑', ['c down'] = 'C↓', ['c left'] = 'C←', ['c right'] = 'C→', ['c ne'] = 'C↗', ['c se'] = 'C↘', ['c nw'] = 'C↖', ['c sw'] = 'C↙', } local keyAlias = { -- ['alternate name for key (alias)'] = 'name for key used in key table' ['[[cmd key|cmd]]'] = '[[command键|cmd]]', ['[[cmd key|command]]'] = '[[command键|command]]', ['[[opt key|opt]]'] = '[[option键|opt]]', ['[[option key]]'] = '[[option键|option]]', ['[[opt key|option]]'] = '[[option键|option]]', ['[[win key|win]]'] = '[[windows键|win]]', ['*'] = 'asterisk', ['#'] = 'hash', [':'] = 'colon', [';'] = 'semicolon', ['l-up'] = 'l up', ['l-down'] = 'l down', ['l-left'] = 'l left', ['l-right'] = 'l right', ['l-ne'] = 'l ne', ['l-se'] = 'l se', ['l-nw'] = 'l nw', ['l-sw'] = 'l sw', ['r-up'] = 'r up', ['r-down'] = 'r down', ['r-left'] = 'r left', ['r-right'] = 'r right', ['r-ne'] = 'r ne', ['r-se'] = 'r se', ['r-nw'] = 'r nw', ['r-sw'] = 'r sw', ['ps x'] = 'ex', ['ps c'] = 'circle', ['ps s'] = 'square', ['ps t'] = 'triangle', ['c-up'] = 'c up', ['c-down'] = 'c down', ['c-left'] = 'c left', ['c-right'] = 'c right', ['c-ne'] = 'c ne', ['c-se'] = 'c se', ['c-nw'] = 'c nw', ['c-sw'] = 'c sw', } local Collection = {} Collection.__index = Collection do function Collection:add(item) if item ~= nil then self.n = self.n + 1 self[self.n] = item end end function Collection:join(sep) return table.concat(self, sep) end function Collection:sort(comp) table.sort(self, comp) end function Collection.new() return setmetatable({n = 0}, Collection) end end local function keyPress(args) local chainNames = { 'chain first', 'chain second', 'chain third', 'chain fourth', 'chain fifth', 'chain sixth', 'chain seventh', 'chain eighth', 'chain ninth', } local result = Collection.new() local chainDefault = args.chain or '+' for i, id in ipairs(args) do if i > 1 then result:add(args[chainNames[i - 1]] or chainDefault) end local lc = id:lower() local text = keyText[lc] or keyText[keyAlias[lc]] or id result:add(kbdPrefix .. text .. kbdSuffix) end return result:join() end local function keypress(frame) -- Called by "{{key press|...}}". -- Using the template doubles the post‐expand include size. return keyPress(frame:getParent().args) end local function press(frame) -- Called by "{{#invoke:key|press|...}}". return keyPress(frame.args) end return { keypress = keypress, press = press, }
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
模块
讨论
English
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息