User:ReisuDesign/common.js
Appearance
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Customization
const config = mw.config.values;
const dev = window.dev = window.dev || {};
dev.BD_FullFilePatrol = true;
dev.betterFandom = {
patrolOnDelete: true, // sysop only, as it reads on the tin
noThanks: true, // remove Extension:Thanks bloat
customInsert: true, // add a dropdown on the source editor toolbar for on-demand preloads and simple inserts
originalPreview: true, // display original img in image overlay instead of webm
categoryMedia: true, // replace broken audio and video files in Category: namespace
specialFilesRevamp: true, // fix broken ogg and video files in Special:UnusedFiles, Special:NewFiles and add caption with link to file page
sectionEditor: true, // replace section editor anchors with custom toggles to display an in-page editor of the selected section, all without any page loading
cmTOC: true, // display a Table of Contents on the page tools on top left while in sorce editor for ease of navigation
};
// Better Topnav configuration
(window.dev = window.dev || {}).betterTopNav = {
// "true" will default to 25 results, any integer can be used, but no more than 50 is recommended due to latency concerns
results: true,
// allows the search bar to be horizontally resized
resize: true,
// set the user menu to an on-hover popup
hovermenu: true,
// customize the tools dropdown and icons, "true" will keep the items in the default dropdown but will add the theme toggle as an icon too.
/// alternatively an array like the following can be used to fully customize the elements in the dropdown as desired.
/// the "link" and "text" properties are required. the "icon" property will show the element as an icon next to the dropdown.
/// the used array will be logged in the browser console for ease of reference and customization
tools: [
{
'link': '/wiki/Special:RecentChanges',
'text': 'Recent Changes',
'icon': '<svg class=\"wds-icon wds-icon-small\"><use xlink:href=\"#wds-icons-activity-small\"></use></svg>'
},
{
// Theme switch requires 'track' and 'class' for the default functionality to activate
'track': 'theme-switch-'+{dark:'light', light:'dark'}[mw.user.options.values.theme],
'class': 'wiki-tools__theme-switch',
'link': '#',
'text': {dark:'Light', light:'Dark'}[mw.user.options.values.theme]+' Theme',
'icon': '<svg class=\"wds-icon wds-icon-small\"><use xlink:href=\"#wds-icons-'+{dark:'sun', light:'moon'}[mw.user.options.values.theme]+'-small\"></use></svg>'
},
{
'link': '/wiki/Special:Upload',
'text': 'Upload New File'
},
{
'link': '/wiki/Special:SpecialPages',
'text': 'Special Pages'
}
]
};
// config for PageCreator
window.pageCreatorConfig = {
namespaces: [0, 10, 8, 828],
useUsernameAndLinks: true,
useAvatar: false,
useTimestamp: true,
useUTC: false,
useTimeago: true
};
importArticles({
type: 'script',
articles: [
'u:dev:MediaWiki:LastEdited/code.js',
'u:dev:MediaWiki:AjaxBatchDelete.js',
'u:dev:MediaWiki:MoreDropdown/code.js',
'u:dev:MediaWiki:View_Source/code.js',
'u:dev:MediaWiki:Standard Edit Summary/code.js',
'u:dev:MediaWiki:EditConflictAlert/code.js',
'u:dev:MediaWiki:QuickDiff/code.js',
'u:dev:MediaWiki:MassRename/code.js',
'u:dev:MediaWiki:MassNullEdit/code.js',
'u:dev:MediaWiki:MassPatrol/code.js',
'u:dev:MediaWiki:StickySummary.js',
'u:dev:MediaWiki:PurgeButton.js',
'u:dev:MediaWiki:RedirectManagement/code.js',
'u:dev:MediaWiki:EditcountTab.js',
'u:dev:MediaWiki:LinkPreview/code.js',
'u:dev:MediaWiki:MassTableTracking.js',
'u:dev:MediaWiki:UserProfilePopup.js',
'u:dev:MediaWiki:View_Raw/code.js',
'u:dev:MediaWiki:BetterTopNav.js',
'u:dev:MediaWiki:TemplateWizard.js',
'u:dev:MediaWiki:MobilePreview.js',
'u:dev:MediaWiki:PageCreator/code2.js',
]
});
// betterFandom.customInsert preloads
mw.hook('dev.BF_customInsert').fire([
// Template inserts
{
button:'Base Preload',
insert: '<includeonly>%+%</includeonly><noinclude>{{Documentation|type=Preload|content={{Preload Text}}}}</noinclude>',
replaceAll: true,
namespace: 10
},
{
button:'Invoke Preload',
insert: '<includeonly>{{#invoke:|main}}</includeonly><noinclude>{{Documentation}}</noinclude>',
replaceAll: true,
namespace: 10
},
// Module inserts
{
button:'Preload',
insert: 'local p = {}\nlocal lib = require(\'Module:Feature\')\n\nfunction p.main(frame)\n local args = require(\'Module:Arguments\').getArgs(frame)\n \n return p._main(args)\nend\n\nfunction p._main(args)\n \nend\n\nreturn p',
replaceAll: true,
namespace: 828
},
// File insterts
{
button:'File Redirect',
namespace: 6,
insert: '#REDIRECT [[File:{{%safesubst%#replace:{{%safesubst%#replace:{{%subst%#replace:{{%subst%#titleparts:{{%subst%PAGENAME}}}}|: | }}|" | }}|/|_}}]]\n\n[[Category:Redirect Pages]]',
replaceAll: true
},
{
button:'Placeholder',
insert: '{{Placeholder Image%+%}}',
namespace: 6
},
{
button:'Other',
namespace: 6,
nested: [
{
button:'User Image',
insert: '[[Category:User Profile Images]]',
replaceAll: true,
namespace: 6
},
{
button:'Mail',
insert: '==Summary==\n{{File|Mail Screenshots}}\n\n==Licensing==\n{{Fairuse}}',
replaceAll: true,
namespace: 6
},
{
button:'General Cat Only',
insert: '==Summary==\n{{File|%+%}}\n\n==Licensing==\n{{Fairuse}}',
replaceAll: true,
namespace: 6
},
{
button:'General File',
insert: '==Summary==\n{{File\n|categories = \n|featuring = \n|neighbors = \n|soundtracks = \n|caption = \n|sourcelink1 = \n|sourcelabel1 = \n|sourcelink2 = \n|sourcelabel2 = \n|sourcelink3 = \n|sourcelabel3 = \n|artistlink = \n|artist = \n|lang = \n|date = \n|gallery = \n|description = \n|transcription = \n|alt = \n|annotations = \n}}\n\n==Licensing==\n{{Fairuse}}',
replaceAll: true,
namespace: 6
},
],
},
]);
// Custom Scripts
var lp = config.wgContentLanguage=='en' ? '' : 'en:'; // add en: prefix in non-en wikis for proper load
importScriptPage(lp+'User:Mikevoir/BetterFandom.js', 'community'); // [[w:c:community:User:Mikevoir/BetterFandom.js]]
importScriptPage(lp+'User:Mikevoir/TimeParser.js', 'community'); // [[w:c:community:User:Mikevoir/TimeParser.js]]
importScriptPage(lp+'User:Kuhlau/CopyTitle.js', 'genshin-impact'); // [[w:c:genshin-impact:User:Kuhlau/CopyTitle.js]]
if (config.wgNamespaceNumber == 14) {importScriptPage(lp+'User:Mikevoir/UnusedFiles.js', 'community');} // [[w:c:community:User:Mikevoir/UnusedFiles.js]]
window.dev = window.dev || {};
(window.dev = window.dev || {}).betterFandom
window.dev.editSummaries = {
css: '#stdSummaries { ... }',
select: 'User:ReinDevildom/Stdsummaries'
};
window.PurgeButtonText = 'purge';