Difference between revisions of "User:Aemony/common.js"
From PCGamingWiki, the wiki about fixing PC games
m (test) |
m (t) |
||
Line 5: | Line 5: | ||
// Check if we're editing a page. | // Check if we're editing a page. | ||
if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) { | if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) { | ||
− | |||
− | |||
// Add a hook handler. | // Add a hook handler. | ||
Line 1,037: | Line 1,035: | ||
}); | }); | ||
}); | }); | ||
− | |||
} | } |
Revision as of 09:04, 5 September 2022
console.log("User:Aemony/common.js executing..."); console.log("-- Link: https://pcgamingwiki.com/wiki/User:Aemony/common.js"); // Check if we're editing a page. if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) { // Add a hook handler. mw.hook('wikiEditor.toolbarReady').add(function($textarea) { // Removes the 'file' tool (the Image-icon) as this makes use of [[File:]] and not the preferred {{Image|}} template. $textarea.wikiEditor('removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'file' }); // Removes the 'reference' tool as using the templates are the preferred way of referencing stuff $textarea.wikiEditor('removeFromToolbar', { 'section': 'main', 'group': 'insert', 'tool': 'reference' }); // Removes the 'redirect' tool as it have been moved to the search group $textarea.wikiEditor('removeFromToolbar', { 'section': 'advanced', 'group': 'insert', 'tool': 'redirect' }); // Adds a custom Image icon to the insert group $textarea.wikiEditor('addToToolbar', { 'section': 'main', 'group': 'insert', 'tools': { 'smile': { label: 'Image', type: 'button', icon: '/w/load.php?modules=oojs-ui.styles.icons-media&image=image&format=rasterized&lang=en&skin=overclocked', action: { type: 'encapsulate', options: { pre: "{{Image|", peri: "File.png|Caption", post: "}}", ownline: true } } } } }); // Adds a custom Redirect icon to the search group $textarea.wikiEditor('addToToolbar', { 'section': 'advanced', 'group': 'search', 'tools': { 'redirect': { label: 'Redirect', type: 'button', icon: '/w/load.php?modules=oojs-ui.styles.icons-content&image=articleRedirect&format=rasterized&lang=en&skin=overclocked', action: { type: 'encapsulate', options: { pre: "#REDIRECT [[", peri: "Target page name", post: "]]", ownline: true } } } } }); // Adds custom byttons to the advanced > insert group $textarea.wikiEditor('addToToolbar', { 'section': 'advanced', 'group': 'insert', 'tools': { 'fixbox': { label: 'Fixbox', type: 'button', icon: '//images.pcgamingwiki.com/d/d8/Editor_Icon_-_Fixbox.svg', action: { type: 'encapsulate', options: { pre: "{{Fixbox|description=", peri: "Name", post: "|ref=<ref>Reference</ref>|fix=\n}}", ownline: true } } } } }); // Adds custom templates in a new group to the right of the advanced > insert group $textarea.wikiEditor('addToToolbar', { 'section': 'advanced', 'groups': { 'insert-sections': { 'label': '', 'tools': { 'availabilityrow': { label: 'Availability row', type: 'button', icon: '//images.pcgamingwiki.com/6/67/Editor_Icon_-_Availability_Table_Row.svg', action: { type: 'encapsulate', options: { pre: "{{Availability/row| ", peri: "store", post: " | id | DRM | notes | Key | OS }}", ownline: true } } }, 'dlcrow': { label: 'DLC row', type: 'button', icon: '//images.pcgamingwiki.com/9/9f/Editor_Icon_-_DLCrow.svg', action: { type: 'encapsulate', options: { pre: "{{DLC/row| ", peri: "Name", post: " | notes | OS }}", ownline: true } } }, 'gamedataconfigrow': { label: 'Game data row - config', type: 'button', icon: '//images.pcgamingwiki.com/0/0c/Editor_Icon_-_Game_Data_Row.svg', action: { type: 'encapsulate', options: { pre: "{{Game data/config|", peri: "System", post: "|Path}}", ownline: true } } }, 'gamedatasavesrow': { label: 'Game data row - saves', type: 'button', icon: '//images.pcgamingwiki.com/0/0c/Editor_Icon_-_Game_Data_Row.svg', action: { type: 'encapsulate', options: { pre: "{{Game data/saves|", peri: "System", post: "|Path}}", ownline: true } } }, 'langrow': { label: 'Language row', type: 'button', icon: '//images.pcgamingwiki.com/2/22/Editor_Icon_-_Localizations.svg', action: { type: 'encapsulate', options: { pre: "{{L10n/switch \n |language = ", post: "\n |interface = true\n |audio = \n |subtitles = \n |notes = \n |fan = \n |ref = \n}}", ownline: true } } } } } } }); // Adds custom templates in a new group to the right of the advanced > insert-sections group $textarea.wikiEditor('addToToolbar', { 'section': 'advanced', 'groups': { 'main-templates': { 'label': '', 'tools': { 'reftemplates': { label: 'Reference', type: 'select', list: { 'refuser': { label: 'Checked by user', action: { type: 'encapsulate', options: { pre: "<ref>{{Refcheck|user=" + (wgUserName ? wgUserName : "User") + "|date=" + TodaysDateUTC + "|comment=Comment (optional)}}</ref>" } } }, 'refurl': { label: 'URL', action: { type: 'encapsulate', options: { pre: "<ref>{{Refurl|url=|title=|date=" + TodaysDateUTC + "}}</ref>" } } }, 'refsnippet': { label: 'Snippet from URL', action: { type: 'encapsulate', options: { pre: "<ref>{{Refurl|url=|title=|date=" + TodaysDateUTC + "|snippet=}}</ref>" } } }, 'cn': { label: 'Citation needed', action: { type: 'encapsulate', options: { pre: "{{cn|date=" + TodaysDateUTC + "|reason=}}" } } }, 'dubious': { label: 'Dubious', action: { type: 'encapsulate', options: { pre: "{{dubious|date=" + TodaysDateUTC + "|reason=}}" } } }, 'note': { label: 'Note', action: { type: 'encapsulate', options: { pre: "{{note|", peri: "The content of the note here.", post: "}}" } } } } }, 'termsection': { label: 'Term', type: 'select', list: { 'categorygeneral': { label: 'General:', }, 'drm': { label: '· DRM', action: { type: 'encapsulate', options: { pre: "{{Term|DRM}}" } } }, 'fmv': { label: '· FMV (full motion video)', action: { type: 'encapsulate', options: { pre: "{{Term|FMV}}" } } }, 'categoryvr': { label: 'VR:', }, 'hmd': { label: '· HMD (head-mounted display)', action: { type: 'encapsulate', options: { pre: "{{Term|HMD}}" } } }, 'categorygraphics': { label: 'Graphics:', }, 'sdr': { label: '· SDR', action: { type: 'encapsulate', options: { pre: "{{Term|SDR}}" } } }, 'hdr': { label: '· HDR (modern HDR)', action: { type: 'encapsulate', options: { pre: "{{Term|HDR}}" } } }, 'hdrr': { label: '· HDR Rendering ("old-school HDR")', action: { type: 'encapsulate', options: { pre: "{{Term|HDR Rendering}}" } } }, 'categoryscaling': { label: 'Scaling:', }, 'horplus': { label: '· Hor+', action: { type: 'encapsulate', options: { pre: "{{Term|Hor+}}" } } }, 'vertminus': { label: '· Vert-', action: { type: 'encapsulate', options: { pre: "{{Term|Vert-}}" } } }, 'letterbox': { label: '· Letterbox', action: { type: 'encapsulate', options: { pre: "{{Term|Letterbox}}" } } }, 'pillarbox': { label: '· Pillarbox', action: { type: 'encapsulate', options: { pre: "{{Term|Pillarbox}}" } } }, 'anamorphic': { label: '· Anamorphic', action: { type: 'encapsulate', options: { pre: "{{Term|Anamorphic}}" } } }, 'pixelbased': { label: '· Pixel-based', action: { type: 'encapsulate', options: { pre: "{{Term|Pixel-based}}" } } }, 'pixelperfect': { label: '· Pixel-perfect / integer scaling', action: { type: 'encapsulate', options: { pre: "{{Term|Pixel-perfect}}" } } }, 'stretch': { label: '· Stretch', action: { type: 'encapsulate', options: { pre: "{{Term|Stretch}}" } } }, 'noscaling': { label: '· No scaling', action: { type: 'encapsulate', options: { pre: "{{Term|No scaling}}" } } }, 'nearestneighbor': { label: '· Nearest-neighbor (algorithm)', action: { type: 'encapsulate', options: { pre: "{{Term|Nearest-neighbor}}" } } } } }, 'filepath': { label: 'Path', type: 'select', list: { 'categorygeneral': { label: 'General:', }, 'pathgame': { label: '· Path to game', action: { type: 'encapsulate', options: { pre: "{{P|game}}" } } }, 'pathlocalized': { label: '· Localized folder or file name', action: { type: 'encapsulate', options: { pre: "{{LocalizedPath|", peri: "Folder or file name", post: "}}" } } }, 'pathuid': { label: '· User ID', action: { type: 'encapsulate', options: { pre: "{{P|uid}}" } } }, 'pathsteam': { label: '· Steam install folder', action: { type: 'encapsulate', options: { pre: "{{P|steam}}" } } }, 'pathubisoftconnect': { label: '· Ubisoft Connect install folder', action: { type: 'encapsulate', options: { pre: "{{P|ubisoftconnect}}" } } }, 'categorywindowsdisk': { label: 'Windows (disk):', }, 'pathuserprofile': { label: '· %USERPROFILE%', action: { type: 'encapsulate', options: { pre: "{{P|userprofile}}" } } }, 'pathuserprofiledocuments': { label: '· %USERPROFILE%\\Documents', action: { type: 'encapsulate', options: { pre: "{{P|userprofile\\Documents}}" } } }, 'pathappdata': { label: '· AppData\\Roaming (%APPDATA%)', action: { type: 'encapsulate', options: { pre: "{{P|appdata}}" } } }, 'pathlocalappdata': { label: '· AppData\\Local (%LOCALAPPDATA%)', action: { type: 'encapsulate', options: { pre: "{{P|localappdata}}" } } }, 'pathlocallowappdata': { label: '· AppData\\LocalLow', action: { type: 'encapsulate', options: { pre: "{{P|userprofile\\appdata\\locallow}}" } } }, 'pathpublic': { label: '· %PUBLIC%', action: { type: 'encapsulate', options: { pre: "{{P|public}}" } } }, 'pathprogramdata': { label: '· %PROGRAMDATA%', action: { type: 'encapsulate', options: { pre: "{{P|programdata}}" } } }, 'pathwindir': { label: '· %WINDIR%', action: { type: 'encapsulate', options: { pre: "{{P|windir}}" } } }, 'categorywindowsregistry': { label: 'Windows (registry):', }, 'pathhkcu': { label: '· HKEY_CURRENT_USER', action: { type: 'encapsulate', options: { pre: "{{P|hkcu}}" } } }, 'pathhklm': { label: '· HKEY_LOCAL_MACHINE', action: { type: 'encapsulate', options: { pre: "{{P|hklm}}" } } }, 'pathwow64': { label: '· Wow6432Node', action: { type: 'encapsulate', options: { pre: "{{P|wow64}}" } } }, 'categoryosx': { label: 'OS X:', }, 'pathosxhome': { label: '· Home folder (osx)', action: { type: 'encapsulate', options: { pre: "{{P|osxhome}}" } } }, 'categorylinux': { label: 'Linux:', }, 'pathlinuxhome': { label: '· Home folder (linux)', action: { type: 'encapsulate', options: { pre: "{{P|linuxhome}}" } } }, 'pathlinuxxdgdatahome': { label: '· XDG data home', action: { type: 'encapsulate', options: { pre: "{{P|xdgdatahome}}" } } }, 'pathxdgconfighome': { label: '· XDG config home', action: { type: 'encapsulate', options: { pre: "{{P|xdgconfighome}}" } } } } }, 'seesection': { label: 'See...', type: 'select', list: { 'categoryvideo': { label: 'Video:', }, 'widescreen': { label: '· Widescreen resolution', action: { type: 'encapsulate', options: { pre: "See [[#Widescreen resolution|Widescreen resolution]]." } } }, 'multimonitor': { label: '· Multi-monitor', action: { type: 'encapsulate', options: { pre: "See [[#Multi-monitor|Multi-monitor]]." } } }, 'ultrawidescreen': { label: '· Ultra-widescreen', action: { type: 'encapsulate', options: { pre: "See [[#Ultra-widescreen|Ultra-widescreen]]." } } }, '4kultrahd': { label: '· 4K Ultra HD', action: { type: 'encapsulate', options: { pre: "See [[#4K Ultra HD|4K Ultra HD]]." } } }, 'fieldofview': { label: '· Field of view (FOV)', action: { type: 'encapsulate', options: { pre: "See [[#Field of view (FOV)|Field of view (FOV)]]." } } }, 'windowed': { label: '· Windowed', action: { type: 'encapsulate', options: { pre: "See [[#Windowed|Windowed]]." } } }, 'borderless': { label: '· Borderless fullscreen windowed', action: { type: 'encapsulate', options: { pre: "See [[#Borderless fullscreen windowed|Borderless fullscreen windowed]]." } } }, 'anisotropic': { label: '· Anisotropic filtering (AF)', action: { type: 'encapsulate', options: { pre: "See [[#Anisotropic filtering (AF)|Anisotropic filtering (AF)]]." } } }, 'antialiasing': { label: '· Anti-aliasing (AA)', action: { type: 'encapsulate', options: { pre: "See [[#Anti-aliasing (AA)|Anti-aliasing (AA)]]." } } }, 'vsync': { label: '· Vertical sync (Vsync)', action: { type: 'encapsulate', options: { pre: "See [[#Vertical sync (Vsync)|Vertical sync (Vsync)]]." } } }, 'highframe': { label: '· High frame rate', action: { type: 'encapsulate', options: { pre: "See [[#High frame rate|High frame rate]]." } } }, 'hdr': { label: '· High dynamic range display (HDR)', action: { type: 'encapsulate', options: { pre: "See [[#High dynamic range display (HDR)|High dynamic range display (HDR)]]." } } }, 'raytracing': { label: '· Ray tracing', action: { type: 'encapsulate', options: { pre: "See [[#Ray tracing|Ray tracing]]." } } }, 'colorblind': { label: '· Color blind mode', action: { type: 'encapsulate', options: { pre: "See [[#Color blind mode|Color blind mode]]." } } }, 'categoryinput': { label: 'Input:', }, 'remapping': { label: '· Remapping', action: { type: 'encapsulate', options: { pre: "See [[#Remapping|Remapping]]." } } }, 'mouseaccel': { label: '· Mouse acceleration', action: { type: 'encapsulate', options: { pre: "See [[#Mouse acceleration|Mouse acceleration]]." } } }, 'controllersupport': { label: '· Controller support', action: { type: 'encapsulate', options: { pre: "See [[#Controller support|Controller support]]." } } }, 'controllerremap': { label: '· Controller remapping', action: { type: 'encapsulate', options: { pre: "See [[#Controller remapping|Controller remapping]]." } } }, 'touchscreen': { label: '· Touchscreen optimised', action: { type: 'encapsulate', options: { pre: "See [[#Touchscreen|Touchscreen]]." } } }, 'categoryvr': { label: 'VR:', }, 'oculus': { label: '· Oculus Rift', action: { type: 'encapsulate', options: { pre: "See [[#Oculus Rift|Oculus Rift]]." } } } } } } } } }); // Adds custom controls to the toolbar $textarea.wikiEditor('addToToolbar', { sections: { 'section-templates': { type: 'toolbar', label: 'Sections', groups: { templates: { 'label': '', 'tools': { 'introduction': { label: 'Introduction', type: 'button', icon: '//images.pcgamingwiki.com/4/40/Editor_Icon_-_Introduction.svg', action: { type: 'encapsulate', options: { pre: "{{Introduction\n|introduction = ", post: "\n\n|release history = \n\n|current state = \n}}", ownline: true } } }, 'dlc': { label: 'DLC', type: 'button', icon: '//images.pcgamingwiki.com/3/38/Editor_Icon_-_DLCtable.svg', action: { type: 'encapsulate', options: { pre: "{{DLC|\n", peri: "{{DLC/row| Name | notes | OS }}", post: "\n}}", ownline: true } } }, 'cloud': { label: 'Cloud syncing', type: 'button', icon: '//images.pcgamingwiki.com/b/bc/Editor_Icon_-_Cloud_Sync.svg', action: { type: 'encapsulate', options: { pre: "===[[Glossary:Save game cloud syncing|Save game cloud syncing]]===\n{{Save game cloud syncing \n|discord = \n|discord notes = \n|epic games launcher = \n|epic games launcher notes = \n|gog galaxy = \n|gog galaxy notes = \n|origin = \n|origin notes = \n|steam cloud = \n|steam cloud notes = \n|ubisoft connect = \n|ubisoft connect notes = \n|xbox cloud = \n|xbox cloud notes = \n}}", ownline: true } } }, 'vrtable': { label: 'VR', type: 'button', icon: '//images.pcgamingwiki.com/3/3c/Editor_Icon_-_VR.svg', action: { type: 'encapsulate', options: { pre: "==VR support==\n{{VR support\n|gg3d name = \n|native 3d gg3d award = \n|nvidia 3d vision gg3d award = \n|tridef 3d gg3d award = \n|iz3d gg3d award = \n|native 3d = \n|native 3d notes = \n|nvidia 3d vision = \n|nvidia 3d vision notes = \n|tridef 3d = \n|tridef 3d notes = \n|iz3d = \n|iz3d notes = \n|vr only = \n|vorpx = \n|vorpx modes = \n|vorpx notes = \n|htc vive = \n|htc vive notes = \n|oculus rift = \n|oculus rift notes = \n|osvr = \n|osvr notes = \n|windows mixed reality = \n|windows mixed reality notes = \n|keyboard-mouse = \n|keyboard-mouse notes = \n|3rd space gaming vest = \n|3rd space gaming vest notes = \n|novint falcon = \n|novint falcon notes = \n|trackir = \n|trackir notes = \n|tobii eye tracking = \n|tobii eye tracking notes = \n|play area seated = \n|play area seated notes = \n|play area standing = \n|play area standing notes = \n|play area room-scale = \n|play area room-scale notes = \n}}", ownline: true } } }, 'apitable': { label: 'API', type: 'button', icon: '//images.pcgamingwiki.com/c/cb/Editor_Icon_-_API.svg', action: { type: 'encapsulate', options: { pre: "===API===\n{{API\n|direct3d versions = \n|direct3d notes = \n|directdraw versions = \n|directdraw notes = \n|wing = \n|wing notes = \n|opengl versions = \n|opengl notes = \n|glide versions = \n|glide notes = \n|software mode = \n|software mode notes = \n|mantle support = \n|mantle support notes = \n|metal support = \n|metal support notes = \n|vulkan versions = \n|vulkan notes = \n|dos modes = \n|dos modes notes = \n|shader model versions = \n|shader model notes = \n|windows 32-bit exe = unknown\n|windows 64-bit exe = unknown\n|windows arm app = unknown\n|windows exe notes = \n|mac os x powerpc app = \n|macos intel 32-bit app = unknown\n|macos intel 64-bit app = unknown\n|macos arm app = unknown\n|macos app notes = \n|linux 32-bit executable= unknown\n|linux 64-bit executable= unknown\n|linux arm app = unknown\n|linux executable notes = \n}}", ownline: true } } }, 'middlewaretable': { label: 'Middleware', type: 'button', icon: '//images.pcgamingwiki.com/c/c2/Editor_Icon_-_Middleware.svg', action: { type: 'encapsulate', options: { pre: "===Middleware===\n{{Middleware\n|physics = \n|physics notes = \n|audio = \n|audio notes = \n|interface = \n|interface notes = \n|input = \n|input notes = \n|cutscenes = \n|cutscenes notes = \n|multiplayer = \n|multiplayer notes= \n|anticheat = \n|anticheat notes = \n}}", ownline: true } } }, 'sysreq': { label: 'System requirements', type: 'button', icon: '//images.pcgamingwiki.com/4/4b/Editor_Icon_-_System_Requirements.svg', action: { type: 'encapsulate', options: { pre: "{{System requirements\n|OSfamily = ", peri: "System", post: "\n|minOS = \n|minCPU = \n|minRAM = \n|minHD = \n|minGPU = \n\n|recOS = \n|recCPU = \n|recRAM = \n|recHD = \n|recGPU = \n}}", ownline: true } } }, 'infoboxdrop': { label: 'Infobox row', type: 'select', list: { 'infoboxdeveloper': { label: 'Developer', action: { type: 'encapsulate', options: { pre: "{{Infobox game/row/developer|", post: "}}", ownline: true } } }, 'infoboxporter': { label: 'Porter', action: { type: 'encapsulate', options: { pre: "{{Infobox game/row/porter|", post: "|OS}}", ownline: true } } }, 'infoboxpublisher': { label: 'Publisher', action: { type: 'encapsulate', options: { pre: "{{Infobox game/row/publisher|", post: "}}", ownline: true } } }, 'infoboxengine': { label: 'Engine', action: { type: 'encapsulate', options: { pre: "{{Infobox game/row/engine|", post: "}}", ownline: true } } }, 'infoboxdatewindows': { label: 'Windows release date', action: { type: 'encapsulate', options: { pre: "{{Infobox game/row/date|Windows|", peri: "Month dd, yyyy", post: "}}", ownline: true } } }, 'infoboxdateosx': { label: 'OS X release date', action: { type: 'encapsulate', options: { pre: "{{Infobox game/row/date|OS X|", peri: "Month dd, yyyy", post: "}}", ownline: true } } }, 'infoboxdatelinux': { label: 'Linux release date', action: { type: 'encapsulate', options: { pre: "{{Infobox game/row/date|Linux|", peri: "Month dd, yyyy", post: "}}", ownline: true } } }, 'infoboxreception': { label: 'Reception rows', action: { type: 'encapsulate', options: { post: "|reception = \n{{Infobox game/row/reception|Metacritic|link|rating}}\n{{Infobox game/row/reception|OpenCritic|link|rating}}\n{{Infobox game/row/reception|IGDB|link|rating}}", ownline: true } } }, 'infobox taxonomy': { label: 'Taxonomy rows', action: { type: 'encapsulate', options: { post: "|taxonomy = \n{{Infobox game/row/taxonomy/monetization | }}\n{{Infobox game/row/taxonomy/microtransactions | }}\n{{Infobox game/row/taxonomy/modes | }}\n{{Infobox game/row/taxonomy/pacing | }}\n{{Infobox game/row/taxonomy/perspectives | }}\n{{Infobox game/row/taxonomy/controls | }}\n{{Infobox game/row/taxonomy/genres | }}\n{{Infobox game/row/taxonomy/sports | }}\n{{Infobox game/row/taxonomy/vehicles | }}\n{{Infobox game/row/taxonomy/art styles | }}\n{{Infobox game/row/taxonomy/themes | }}\n{{Infobox game/row/taxonomy/series | }}", ownline: true } } } } } } } } } } }); /* Adds fade out on mouse out for the dropdown menus */ $('div.tool-select > div.menu > div').mouseleave(function() { $(this).fadeOut(); }); }); }