MediaWiki:Common.js/Toolbox.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
m shorten desc |
|||
Line 1: | Line 1: | ||
//<source lang="javascript"> |
|||
// Changes to the toolbox, such as new buttons when editing. |
|||
var sourcetext_type = { |
var sourcetext_type = { |
||
'text': 'Text', |
'text': 'Text', |
||
Line 125: | Line 122: | ||
$(document).ready( function() { |
$(document).ready( function() { |
||
var edit = $ |
var edit = $( '#wpTextbox1' ); |
||
var source_list = { |
var source_list = { |
||
'label': 'Text Type', |
'label': 'Text Type', |
||
Line 147: | Line 144: | ||
'action': { 'type': 'encapsulate', 'options': { pre: '<source lang="'+ source + '">', 'post': '</source>', ownline: true } } |
'action': { 'type': 'encapsulate', 'options': { pre: '<source lang="'+ source + '">', 'post': '</source>', ownline: true } } |
||
}; |
}; |
||
} |
|||
if( typeof $edit.wikiEditor !== 'function' ) { |
|||
return; |
|||
} |
} |
||
Line 184: | Line 185: | ||
delete source_list; |
delete source_list; |
||
}); |
}); |
||
//</source> |
Revision as of 00:56, 25 February 2011
var sourcetext_type = {
'text': 'Text',
'abap': 'ABAP',
'actionscript': 'ActionScript',
'ada': 'Ada',
'apache': 'Apache',
'applescript': 'AppleScript',
'asm': 'ASM',
'asp': 'Active Server Pages',
'autoit': 'AutoIt',
'bash': 'Bash',
'basic4gl': 'Basic4GL',
'bf': 'Brainfuck',
'blitzbasic': 'Blitz BASIC',
'bnf': 'Backus-Naur Form',
'c': 'C',
'c_mac': 'C (Mac)',
'caddcl': 'AutoCAD DCL',
'cadlisp': 'AutoLISP',
'cfdg': 'CFDG',
'cfm': 'ColdFusion',
'cil': 'Common Intermediate Language',
'cobol': 'COBOL',
'cpp-qt': 'C++ (Qt toolkit)',
'cpp': 'C++',
'csharp': 'C#',
'css': 'Cascading Style Sheets',
'd': 'D',
'delphi': 'Delphi',
'diff': 'Diff',
'div': 'DIV',
'dos': 'DOS batch file',
'dot': 'DOT',
'eiffel': 'Eiffel',
'fortran': 'Fortran',
'freebasic': 'FreeBASIC',
'genero': 'Genero',
'gettext': 'i18n',
'glsl': 'OpenGL Shading Language',
'gml': 'Game Maker Language',
'gnuplot': 'gnuplot',
'groovy': 'Groovy',
'haskell': 'Haskell',
'hq9plus': 'HQ9+',
'html4strict': 'HTML',
'idl': 'Uno IDL',
'ini': 'INI',
'inno': 'Inno',
'intercal': 'INTERCAL',
'io': 'Io',
'java5': 'Java 5.0',
'java': 'Java',
'javascript': 'JavaScript',
'kixtart': 'KiXtart',
'klonec': 'Klone C',
'klonecpp': 'Klone C++',
'latex': 'LaTeX',
'lisp': 'Lisp',
'lolcode': 'LOLCODE',
'lotusscript': 'LotusScript',
'lua': 'Lua',
'm68k': 'Motorola 68000 Assembler',
'make': 'make',
'matlab': 'MATLAB M',
'mirc': 'mIRC scripting language',
'mxml': 'MXML',
'mpasm': 'Microchip Assembler',
'mysql': 'MySQL',
'nsis': 'Nullsoft Scriptable Install System',
'objc': 'Objective-C',
'ocaml-brief': 'OCaml Brief',
'ocaml': 'OCaml',
'oobas': 'OpenOffice Basic',
'oracle8': 'Oracle 8 SQL',
'oracle11': 'Oracle 11 SQL',
'pascal': 'Pascal',
'per': 'per',
'perl': 'Perl',
'php-brief': 'PHP Brief',
'php': 'PHP',
'pixelbender': 'Pixel Bender',
'plsql': 'PL/SQL',
'povray': 'Persistence of Vision Raytracer',
'powershell': 'Windows PowerShell',
'progress': 'OpenEdge ABL',
'prolog': 'Prolog',
'providex': 'ProvideX',
'python': 'Python',
'qbasic': 'QBasic/QuickBASIC',
'rails': 'Rails',
'reg': 'Windows Registry',
'robots': 'robots.txt',
'ruby': 'Ruby',
'rsplus': 'R/S+',
'sas': 'SAS',
'scala': 'Scala',
'scheme': 'Scheme',
'scilab': 'Scilab',
'sdlbasic': 'SdlBasic',
'smalltalk': 'Smalltalk',
'smarty': 'Smarty',
'sql': 'SQL',
'tcl': 'Tcl',
'teraterm': 'Tera Term',
'thinbasic': 'thinBasic',
'tsql': 'Transact-SQL',
'typoscript': 'TypoScript',
'vbnet': 'Visual Basic .NET',
'vb': 'Visual Basic',
'verilog': 'Verilog',
'vhdl': 'VHDL',
'vim': 'Vimscript',
'visualfoxpro': 'Visual FoxPro',
'visualprolog': 'Visual Prolog',
'whitespace': 'Whitespace',
'winbatch': 'Winbatch',
'xml': 'XML',
'xorg_conf': 'Xorg.conf',
'xpp': 'X++',
'z80': 'ZiLOG Z80 Assembler'
};
$(document).ready( function() {
var edit = $( '#wpTextbox1' );
var source_list = {
'label': 'Text Type',
'type': 'select',
'list': {}
};
source_list.list['teletype'] = {
'label': 'teletype',
'action': { 'type': 'encapsulate', 'options': { 'pre': '<tt>', 'peri': 'text', 'post': '</tt>' } }
};
source_list.list['code'] = {
'label': 'inline code',
'action': { 'type': 'encapsulate', 'options': { 'pre': '<code>', 'peri': 'text', 'post': '</code>' } }
};
for (var source in sourcetext_type) {
if ( !sourcetext_type.hasOwnProperty(source) ) {
continue;
}
source_list.list[source] = {
'label': sourcetext_type[source],
'action': { 'type': 'encapsulate', 'options': { pre: '<source lang="'+ source + '">', 'post': '</source>', ownline: true } }
};
}
if( typeof $edit.wikiEditor !== 'function' ) {
return;
}
edit.wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'format',
'tools': {
'underline': {
label: 'underline',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/8/8b/Button_underline_he.png',
action: {
type: 'encapsulate',
options: { pre: "<u>", peri: "text", post: "</u>" }
}
},
'strikethrough': {
label: 'strikeout',
type: 'button',
icon: 'http://upload.wikimedia.org/wikipedia/commons/6/6d/Vector_strikeout.png',
action: {
type: 'encapsulate',
options: { pre: "<s>", peri: "text", post: "</s>" }
}
}
}
});
edit.wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'heading',
'tools': {
'text-type': source_list
}
});
delete sourcetext_type;
delete source_list;
});