Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Line 142: | Line 142: | ||
pre: '{{', | pre: '{{', | ||
peri:'subst:Filmjr/keys', | peri:'subst:Filmjr/keys', | ||
post:'}}' | post:'}}', | ||
ownline: true | |||
} | } | ||
} | } | ||
Line 152: | Line 153: | ||
pre: '{{', | pre: '{{', | ||
peri: 'Filmjr \r\n|title= \r\n|embid= \r\n|embsv= \r\n|oclc= \r\n|form= \r\n|year= \r\n|up= \r\n|next= \r\n|prev= \r\n|step= \r\n|lang=English \r\n|heldby= \r\n|desc=\r\n', | peri: 'Filmjr \r\n|title= \r\n|embid= \r\n|embsv= \r\n|oclc= \r\n|form= \r\n|year= \r\n|up= \r\n|next= \r\n|prev= \r\n|step= \r\n|lang=English \r\n|heldby= \r\n|desc=\r\n', | ||
post:'}}' | post:'}}', | ||
ownline: true | |||
} | } | ||
} | } |
Revision as of 16:31, 30 November 2021
/* Any JavaScript here will be loaded for all users on every page load. */ var customizeToolbar = function () { /* * * jrtools toolbar * */ $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'jrtools': { //'type': 'booklet', // Can be 'booklet' or 'toolbar' 'type': 'toolbar', 'label': 'JR Tools' // or 'labelMsg': 'section-jrtools-label' for a localized label } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'jrtools', 'groups': { 'inserts': { 'label': '' // or use labelMsg for a localized label, see above } } } ); // strike butt $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'jrtools', group: 'inserts', tools: { "strikethrough": { label: 'Strike', oouiIcon: 'strikethrough', type: 'button', action: { type: 'encapsulate', options: { pre: "<s>", post: "</s>" } } } } }); // def butt $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'jrtools', group: 'inserts', tools: { "defini": { label: 'Definition', oouiIcon: 'highlight', type: 'button', action: { type: 'encapsulate', options: { pre: ";", post: ":" } } } } }); // dropdown $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'jrtools', group: 'inserts', groups: { list: { tools: { templates: { label: 'EV Tags', type: 'select', list: { 'a-button': { label: 'EV Tag Example', action: { type: 'encapsulate', options: { pre: '{{#ev:youtube|id=38j1vMy94TY|urlArgs=start=1653&end=1658&rel=0}}' } } }, 'b-button': { label: 'EV YouTube', action: { type: 'encapsulate', options: { pre: '{{#ev:youtube|id=|urlArgs=start=}}' } } }, 'c-button': { label: 'EV ArchiveOrg', action: { type: 'encapsulate', options: { pre: '{{#ev:archiveorg|id=}}' } } }, 'd-button': { label: 'EV Indiana', action: { type: 'encapsulate', options: { pre: '{{#ev:Indiana|id=xw42nc085}}' } } } } } } } } } ); /* * * tpl booklet * */ $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'filmtpl': { 'type': 'booklet', 'label': 'Tpl' } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'filmtpl', 'pages': { 'one': { 'layout': 'characters', 'label': 'Tpl Options', 'characters': [ { 'label':'Tpl Save and Edit', 'action': { type: 'encapsulate', options: { pre: '{{', peri:'subst:Filmjr/keys', post:'}}', ownline: true } } },{ 'label':'Tpl Print', 'action': { type: 'encapsulate', options: { pre: '{{', peri: 'Filmjr \r\n|title= \r\n|embid= \r\n|embsv= \r\n|oclc= \r\n|form= \r\n|year= \r\n|up= \r\n|next= \r\n|prev= \r\n|step= \r\n|lang=English \r\n|heldby= \r\n|desc=\r\n', post:'}}', ownline: true } } } ] } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'filmtpl', 'pages': { 'ex': { 'layout': 'table', 'label': 'Usage', 'headings': [ { text: 'Label' }, { text: 'Notes' } ], 'rows': [ { 'inpu': { text: 'Tpl Save and Edit' }, 'outpu': { text: 'This will insert a reference to the template markup that will populate after you save. To use, edit the page, save it, and then edit it again. This option is always up to date.' } }, { 'inpu': { text: 'Tpl Print' }, 'outpu': { text: 'Easier, but may not contain all the parameters.' } } ] } } } ); /* * * fa booklet * */ $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': { 'fontaw': { 'type': 'booklet', 'label': 'Icons' } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'fontaw', 'pages': { 'one': { 'layout': 'characters', 'label': 'Films Icons', 'characters': [ '{{#fas:film}}','{{#far:file-video}}','{{#fas:file-video}}','{{#fas:video}}', '{{#fas:tv}}','{{#fas:upload}}','{{#fas:glasses}}','{{#fas:play}}', '{{#fas:stopwatch}}','{{#fas:eye}}',{ 'label':'EFW Logo', 'action': { type: 'encapsulate', options: { pre: '[[File:EphLogoTrans.png|400px]]' } } } ] } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'fontaw', 'pages': { 'two': { 'layout': 'characters', 'label': 'Brand Icons', 'characters': [ '{{#fab:github}}','{{#fab:soundcloud}}','{{#fab:patreon}}','{{#fab:markdown}}', '{{#fab:twitch}}','{{#fab:twitter}}','{{#fab:wikipedia-w}}','{{#fab:vimeo}}', '{{#fab:youtube}}','{{#fab:youtube-square}}','{{#fab:creative-commons}}', '{{#fab:creative-commons-nd}}','{{#fab:creative-commons-zero}}' ] } } } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'fontaw', 'pages': { 'ex': { 'layout': 'table', 'label': 'Examples', 'headings': [ { text: 'input' }, { text: 'output' } ], 'rows': [ { 'inpu': { text: '{{#fas:eye}}' }, 'outpu': { html: 'foo' } }, { 'inpu': { text: '{{#fas:film}}' }, 'outpu': { html: '<svg style="max-width:15px;" class="svg-inline--fa fa-film fa-w-16" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="film" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M488 64h-8v20c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12V64H96v20c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12V64h-8C10.7 64 0 74.7 0 88v336c0 13.3 10.7 24 24 24h8v-20c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v20h320v-20c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v20h8c13.3 0 24-10.7 24-24V88c0-13.3-10.7-24-24-24zM96 372c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12H44c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm272 208c0 6.6-5.4 12-12 12H156c-6.6 0-12-5.4-12-12v-96c0-6.6 5.4-12 12-12h200c6.6 0 12 5.4 12 12v96zm0-168c0 6.6-5.4 12-12 12H156c-6.6 0-12-5.4-12-12v-96c0-6.6 5.4-12 12-12h200c6.6 0 12 5.4 12 12v96zm112 152c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40zm0-96c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40z"></path></svg>' } }, { 'inpu': { text: 'EFW Logo' }, 'outpu': { html: '<img src="http://ephemeralfilm.info/images/thumb/5/5a/EphLogoTrans.png/85px-EphLogoTrans.png">' } } ] } } } ); }; /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { mw.loader.using( 'user.options' ).then( function () { // This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]]) if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) { $.when( mw.loader.using( 'ext.wikiEditor' ), $.ready ).then( customizeToolbar ); } } ); }