For the latest updates, send a blank email to our SUBSCRIPTION ADDRESS
HEADLINES | CLASSIFIED | SPORTS | FORUM | BUSINESS | ENTERTAINMENT
Vol. 1, Issue 9
The News Organ of Liberty City
Thursday October 18th, 2001
Seplogo.gif
" Yesterday's News Today "

MediaWiki:Common.js: Difference between revisions

From Liberty Tree
Jump to navigationJump to search
 
(Undo revision 589 by Lazlow (talk))
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
var customizeToolbar = function() {
var customizeToolbar = function() {
 
   
/* TEMPLATE SECTION */
    /* TRANSLATE GROUP */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
        'section': 'main',
'templates': {
        'groups': {
'type': 'booklet', // Can also be 'booklet'
            'translate': {
'label': 'Templates'
                'label': 'Translate' // or use labelMsg for a localized label, see above
// or 'labelMsg': 'section-emoticons-label' for a localized label
            }
}
        }
}
    } );
} );
    /* TRANSLATE GROUP END */
/* TEMPLATE SECTION END */
   
 
    /* LANGUAGES BUTTON */
/* TEMPLATE SECTION ENTRIES */
    $('#wpTextbox1').wikiEditor('addToToolbar', {
// Template:Category
        section: 'main',
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        group: 'translate',
'section': 'templates',
        tools: {
'pages': {
            "languages": {
'category': {
                label: 'Languages',
'layout': 'table',
                type: 'button',
'label': 'Category',
                icon: '//xat.wiki/w/images/2/29/Button_languages.png',
'headings': [
                action: {
{ text: 'Template' },
                    type: 'encapsulate',
{ text: 'Documentation' }
                    options: {
],
                        pre: "<languages/>",
'rows': [
                        post: ""
{
                    }
'name': { html: '{{category|<b>nameofcategory</b>}}' },
                }
'doc': { html: 'In almost all situations the template will be used instead of [[Category:Name]] to avoid the main article along with its translations to be included under the same category.<br /><br />Attributes&#58;<br /><b>langcat</b> - Value <b>yes</b> to create a separate category for each translation of an article (optional).<br /><b>dir</b> - Value <b>3</b> if an article translation resides in the third part of the directory e.g trans/smilies/<b>et</b> (optional).' }
            }
}
        }
]
    });
}
    /* LANGUAGES BUTTON END */
}
   
} );
    /* TRANSLATE BUTTON */
 
    $('#wpTextbox1').wikiEditor('addToToolbar', {
// Template:Gallery
        section: 'main',
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        group: 'translate',
'section': 'templates',
        tools: {
'pages': {
            "translate": {
'gallery': {
                label: 'Translate',
'layout': 'table',
                type: 'button',
'label': 'Gallery',
                icon: '//xat.wiki/w/images/5/5c/Button_translate.png',
'headings': [
                action: {
{ text: 'Template' },
                    type: 'encapsulate',
{ text: 'Documentation' }
                    options: {
],
                        pre: "<translate>",
'rows': [
                        post: "</translate>"
{
                    }
'name': { html: '{{Gallery<br />|<b>https://</b>|1d=<br />|<b>https://</b>|2d=<br />}}' },
                }
'doc': { html: 'Display a gallery of up to 10 images.<br /><br />Attributes&#58;<br /><b>1d-10d</b> - Image descriptions (optional).<br /><b>width</b> - Width of each thumbnail in pixels (optional, defaults to 275).<br /><b>scalable</b> - Value <b>no</b> to prevent images from scaling.' }
            }
}
        }
]
    });
}
    /* TRANSLATE BUTTON END */
}
   
} );
    /* TRANS TEMPLATE BUTTON */
 
    $('#wpTextbox1').wikiEditor('addToToolbar', {
// Template:Img
        section: 'main',
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        group: 'translate',
'section': 'templates',
        tools: {
'pages': {
            "tt": {
'img': {
                label: 'Translatable template',
'layout': 'table',
                type: 'button',
'label': 'Img',
                icon: '//xat.wiki/w/images/f/f6/Button_tt.png',
'headings': [
                action: {
{ text: 'Template' },
                    type: 'encapsulate',
{ text: 'Documentation' }
                    options: {
],
                        pre: "{{ {{tt|trans/",
'rows': [
                        post: "}} }}"
{
                    }
'name': { text: '{{img|image=|description=}}' },
                }
'doc': { html: 'Image thumbnails for external images.<br /><br />Attributes&#58;<br /><b>image</b> - Direct link to an image you&#39re going to use.<br /><b>width</b> - Sets the width of an image thumb in pixels, defaults to 275px and should be kept that way, unless the image is smaller than that.<br /><b>float</b> - Value <b>right</b> or <b>left</b>, defaults to right (optional).<br /><b>description</b> - Short description of the image.<br /><b>link</b> - Where the thumbnail links to, should not be set for regular thumbnails (optional).<br /><b>scalable</b> - Value no to prevent image from scaling.' }
            }
}
        }
]
    });
}
    /* TRANS TEMPLATE BUTTON END */
}
   
} );
    /* TVAR BUTTON */
 
    $('#wpTextbox1').wikiEditor('addToToolbar', {
// Template:Trans
        section: 'main',
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        group: 'translate',
'section': 'templates',
        tools: {
'pages': {
            "tvar": {
'trans': {
                label: 'Variable',
'layout': 'table',
                type: 'button',
'label': 'Translatable templates',
                icon: '//xat.wiki/w/images/e/e4/Button_tvar.png',
'headings': [
                action: {
{ text: '' },
                    type: 'encapsulate',
{ text: '' }
                    options: {
],
                        pre: "<tvar|1>",
'rows': [
                        post: "</>"
{
                    }
'name': { html: '<b>Various</b>' },
                }
'doc': { html: '' }
            }
},
        }
{
    });
'name': { text: '{{ {{tt|Trans/examples}} }}' },
    /* TVAR BUTTON END */
'doc': { html: '&#39== Examples ==&#39' }
   
},
    /* MYLANGUAGE BUTTON */
{
    $('#wpTextbox1').wikiEditor('addToToolbar', {
'name': { text: '{{ {{tt|Trans/newin}} }}' },
        section: 'main',
'doc': { html: '&#39New in&#39' }
        group: 'translate',
},
        tools: {
{
            "tvar": {
'name': { text: '{{ {{tt|Trans/pawns}} }}' },
                label: 'MyLanguage',
'doc': { html: '&#39Limited Pawns&#39' }
                type: 'button',
},
                icon: '//xat.wiki/w/images/8/84/Button_ml.png',
{
                action: {
'name': { text: '{{ {{tt|Trans/smilies}} }}' },
                    type: 'encapsulate',
'doc': { html: '&#39Smilies&#39' }
                    options: {
},
                        pre: "[[<tvar|1>Special:MyLanguage/</>|",
{
                        post: "]]"
'name': { text: '{{ {{tt|Trans/ts}} }}' },
                    }
'doc': { html: '&#39themed smilies&#39' }
                }
},
            }
{
        }
'name': { text: '{{ {{tt|Trans/usage}} }}' },
    });
'doc': { html: '&#39== Usage ==&#39' }
    /* MYLANGUAGE BUTTON END */
},
   
{
    /* REMOVED BUTTONS */
'name': { html: '<b>Hug</b>' },
    /* REMOVED BUTTONS END */
'doc': { html: '' }
   
},
{
'name': { text: '{{ {{tt|Trans/hug}} }}' },
'doc': { html: '<i>Hug description.</i>' }
},
{
'name': { text: '{{ {{tt|Trans/hugm}} }}' },
'doc': { html: '&#39Your message here#optional color code&#39' }
},
{
'name': { html: '<b>Jinx</b>' },
'doc': { html: '' }
},
{
'name': { text: '{{ {{tt|Trans/jinxallnote}} }}' },
'doc': { html: '<i>How much it costs and how often can you send.</i>' }
},
{
'name': { text: '{{ {{tt|Trans/jinxexamples}} }}' },
'doc': { html: '&#39Examples&#39' }
},
{
'name': { text: '{{ {{tt|Trans/jinxgcontrol}} }}' },
'doc': { html: '<i>Configuring jinx using Gcontrol</i>' }
},
{
'name': { text: '{{ {{tt|Trans/jinxnote1}} }}' },
'doc': { html: '<i>Cannot jinx in main chat</i>' }
},
{
'name': { text: '{{ {{tt|Trans/jinxprobability}} }}' },
'doc': { html: '&#39probability%&#39' }
},
{
'name': { text: '{{ {{tt|Trans/jinxtime}} }}' },
'doc': { html: '&#39time in minutes&#39' }
},
{
'name': { text: '{{ {{tt|Trans/jinxusage1}} }}' },
'doc': { html: '&#39To jinx_name the user in private chat only&#39' }
},
{
'name': { text: '{{ {{tt|Trans/jinxusage2}} }}' },
'doc': { html: '&#39To jinx_name the user in main chat&#39' }
},
{
'name': { text: '{{ {{tt|Trans/jinxusagenotes}} }}' },
'doc': { html: '<i>Jinx usage notes</i>' }
},
{
'name': { text: '{{ {{tt|Trans/unjinx}} }}' },
'doc': { html: '<i>Info on unjinxing.</i>' }
},
{
'name': { text: '{{ {{tt|Trans/unjinxmain}} }}' },
'doc': { html: '<i>Info on how to unjinx in main chat.</i>' }
},
{
'name': { text: '{{ {{tt|Trans/unjinxpc}} }}' },
'doc': { html: '<i>Info on how to unjinx in private chat.' }
}
]
}
}
} );
 
// Template:Shortcut
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'templates',
'pages': {
'shortcut': {
'layout': 'table',
'label': 'Shortcut',
'headings': [
{ text: 'Template' },
{ text: 'Documentation' }
],
'rows': [
{
'name': { text: '{{shortcut}}' },
'doc': { html: 'To display a xat.wiki short link with the same name as the article, all you need to do, is add <b>{{shortcut}}</b> on the very first line of an article. In case you find the name of an article too long and complicated you can create a redirect and define the redirect on an article, e.g <b>{{shortcut|og}}</b> for Owners_Guide, which has og redirecting to it.' }
}
]
}
}
} );
/* TEMPLATE SECTION ENTRIES END */
 
/* TRANSLATE GROUP */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'groups': {
'translate': {
'label': 'Translate' // or use labelMsg for a localized label, see above
}
}
} );
/* TRANSLATE GROUP END */
 
/* LANGUAGES BUTTON */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'translate',
tools: {
"languages": {
label: 'Languages',
type: 'button',
icon: '//util.xat.com/wiki/images/2/29/Button_languages.png',
action: {
type: 'encapsulate',
options: {
pre: "<languages/>",
post: ""
}
}
}
}
});
/* LANGUAGES BUTTON END */
 
/* TRANSLATE BUTTON */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'translate',
tools: {
"translate": {
label: 'Translate',
type: 'button',
icon: '//util.xat.com/wiki/images/5/5c/Button_translate.png',
action: {
type: 'encapsulate',
options: {
pre: "<translate>",
post: "</translate>"
}
}
}
}
});
/* TRANSLATE BUTTON END */
 
/* TRANS TEMPLATE BUTTON */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'translate',
tools: {
"tt": {
label: 'Translatable template',
type: 'button',
icon: '//util.xat.com/wiki/images/f/f6/Button_tt.png',
action: {
type: 'encapsulate',
options: {
pre: "{{ {{tt|trans/",
post: "}} }}"
}
}
}
}
});
/* TRANS TEMPLATE BUTTON END */
 
/* TVAR BUTTON */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'translate',
tools: {
"tvar": {
label: 'Variable',
type: 'button',
icon: '//util.xat.com/wiki/images/e/e4/Button_tvar.png',
action: {
type: 'encapsulate',
options: {
pre: "<tvar|1>",
post: "</>"
}
}
}
}
});
/* TVAR BUTTON END */
 
/* MYLANGUAGE BUTTON */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'main',
group: 'translate',
tools: {
"tvar": {
label: 'MyLanguage',
type: 'button',
icon: '//util.xat.com/wiki/images/8/84/Button_ml.png',
action: {
type: 'encapsulate',
options: {
pre: "[[<tvar|1>Special:MyLanguage/</>|",
post: "]]"
}
}
}
}
});
/* MYLANGUAGE BUTTON END */
 
/* REMOVED BUTTONS */
/* Remove Search & Replace */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'insert',
'tool': 'file'
});
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'insert',
'tool': 'reference'
});
/* REMOVED BUTTONS END */
 
};
};
 
   
/* TOOLBAR CONFIG */
/* TOOLBAR CONFIG */
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
mw.loader.using( 'user.options', function () {
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]])
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
$.when(
mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
).then( customizeToolbar );
}
}
} );
} );
}
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );
/* TOOLBAR CONFIG END */

Latest revision as of 20:04, 4 February 2025

var customizeToolbar = function() {
    
    /* TRANSLATE GROUP */
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'groups': {
            'translate': {
                'label': 'Translate' // or use labelMsg for a localized label, see above
            }
        }
    } );
    /* TRANSLATE GROUP END */
    
    /* LANGUAGES BUTTON */
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'main',
        group: 'translate',
        tools: {
            "languages": {
                label: 'Languages',
                type: 'button',
                icon: '//xat.wiki/w/images/2/29/Button_languages.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "<languages/>",
                        post: ""
                    }
                }
            }
        }
    });
    /* LANGUAGES BUTTON END */
    
    /* TRANSLATE BUTTON */
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'main',
        group: 'translate',
        tools: {
            "translate": {
                label: 'Translate',
                type: 'button',
                icon: '//xat.wiki/w/images/5/5c/Button_translate.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "<translate>",
                        post: "</translate>"
                    }
                }
            }
        }
    });
    /* TRANSLATE BUTTON END */
    
    /* TRANS TEMPLATE BUTTON */
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'main',
        group: 'translate',
        tools: {
            "tt": {
                label: 'Translatable template',
                type: 'button',
                icon: '//xat.wiki/w/images/f/f6/Button_tt.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "{{ {{tt|trans/",
                        post: "}} }}"
                    }
                }
            }
        }
    });
    /* TRANS TEMPLATE BUTTON END */
    
    /* TVAR BUTTON */
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'main',
        group: 'translate',
        tools: {
            "tvar": {
                label: 'Variable',
                type: 'button',
                icon: '//xat.wiki/w/images/e/e4/Button_tvar.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "<tvar|1>",
                        post: "</>"
                    }
                }
            }
        }
    });
    /* TVAR BUTTON END */
    
    /* MYLANGUAGE BUTTON */
    $('#wpTextbox1').wikiEditor('addToToolbar', {
        section: 'main',
        group: 'translate',
        tools: {
            "tvar": {
                label: 'MyLanguage',
                type: 'button',
                icon: '//xat.wiki/w/images/8/84/Button_ml.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: "[[<tvar|1>Special:MyLanguage/</>|",
                        post: "]]"
                    }
                }
            }
        }
    });
    /* MYLANGUAGE BUTTON END */
    
    /* REMOVED BUTTONS */
    /* REMOVED BUTTONS END */
    
};
    
/* TOOLBAR CONFIG */
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
/* 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 );
		}
	} );
}