User:Irokez-t/Vg.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at User:Irokez-t/Vg. |
var block = document.getElementById ('editpage-specialchars');
function VectorGrafist() {
if(typeof $ != "undefined" && typeof $.fn.wikiEditor!="undefined") {
$(document).ready(
function() {
$("#wpTextbox1").wikiEditor(
"addToToolbar", {
"sections": {
"VectorGrafist": {
"type": "toolbar",
"label": "VectorGrafist"
}
}
}
);
$('#wpTextbox1').wikiEditor(
"addToToolbar", {
"section": "VectorGrafist",
"groups": {
"templatesVectorGrafistUsual": {
"label": "Usual templates:"
}
}
}
);
$("#wpTextbox1").wikiEditor(
"addToToolbar", {
"section": "VectorGrafist",
"group": "templatesVectorGrafistUsual",
"tools": {
"VectorGrafistSelectTemplate": {
label: "Select a template from the list",
type: "select",
list: {
"VectorGrafistUsual-selectTemplate-complete" : {
label: "{"+"{vva}}",
action: {type:"encapsulate", options: {pre: "{"+"{vva|}}\n"}}
},
"VectorGrafistUsual-selectTemplate-rename" : {
label: "{"+"{Rename}}",
action: {type:"encapsulate", options: {pre: "{"+"{Rename |1= |2= |3= |user= }}\n"}}
},
"VectorGrafistUsual-selectTemplate-convert svg" : {
label: "{"+"{Convert to SVG}}",
action: {type:"encapsulate", options: {pre: "{"+"{Convert to SVG|}}\n"}}
},
"VectorGrafistUsual-selectTemplate-convert png" : {
label: "{"+"{Convert to PNG}}",
action: {type:"encapsulate", options: {pre: "{"+"{Convert to PNG|1=}}\n"}}
}
,
"VectorGrafistUsual-selectTemplate-bva" : {
label: "{"+"{Bitmap version available}}",
action: {type:"encapsulate", options: {pre: "{"+"{Bitmap version available|}}\n"}}
}
}
}
}
}
);
$('#wpTextbox1').wikiEditor(
"addToToolbar", {
"section": "VectorGrafist",
"groups": {
"templatesVectorGrafistPrograms": {
"label": "Programs:"
}
}
}
);
$("#wpTextbox1").wikiEditor(
"addToToolbar", {
"section": "VectorGrafist",
"group": "templatesVectorGrafistPrograms",
"tools": {
"VectorGrafistSelectTemplate": {
label: "Select a program from the list",
type: "select",
list: {
"VectorGrafistPrograms-selectTemplate-Adobe|o" : {
label: "Adobe",
action: {type:"encapsulate", options: {pre: "{"+"{Adobe}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Bin2svg" : {
label: "Bin2svg",
action: {type:"encapsulate", options: {pre: "{"+"{Bin2svg}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-CorelDraw" : {
label: "CorelDraw",
action: {type:"encapsulate", options: {pre: "{"+"{CorelDraw}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-created with Dia" : {
label: "Dia",
action: {type:"encapsulate", options: {pre: "{"+"{created with Dia}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-ElCompLib" : {
label: "ElCompLib",
action: {type:"encapsulate", options: {pre: "{"+"{ElCompLib}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Fig2SVG" : {
label: "Fig2SVG",
action: {type:"encapsulate", options: {pre: "{"+"{Fig2SVG}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Gnuplot" : {
label: "Gnuplot",
action: {type:"encapsulate", options: {pre: "{"+"{Gnuplot}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-HandSVG" : {
label: "HandSVG",
action: {type:"encapsulate", options: {pre: "{"+"{HandSVG}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Inkscape" : {
label: "Inkscape",
action: {type:"encapsulate", options: {pre: "{"+"{Inkscape}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Inkscape-hand" : {
label: "Inkscape, edited by hand",
action: {type:"encapsulate", options: {pre: "{"+"{Inkscape-hand}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Metapost" : {
label: "Metapost",
action: {type:"encapsulate", options: {pre: "{"+"{Metapost}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Sodipodi" : {
label: "Sodipodi",
action: {type:"encapsulate", options: {pre: "{"+"{Sodipodi}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Scribus" : {
label: "Scribus",
action: {type:"encapsulate", options: {pre: "{"+"{Scribus}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Created with Text Editor" : {
label: "Text Editor",
action: {type:"encapsulate", options: {pre: "{"+"{Created with Text Editor}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Image generation" : {
label: "Image generation",
action: {type:"encapsulate", options: {pre: "{"+"{Image generation}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Created with Vim" : {
label: "Vim",
action: {type:"encapsulate", options: {pre: "{"+"{Created with Vim}}\n"}}
},
"VectorGrafistPrograms-selectTemplate-Extracted_with_Inkscape" : {
label: "Extracted with Inkscape",
action: {type:"encapsulate", options: {pre: "{"+"{Extracted_with_Inkscape}}\n"}}
}
}
}
}
}
);
$('#wpTextbox1').wikiEditor(
"addToToolbar", {
"section": "VectorGrafist",
"groups": {
"templatesVectorGrafistOther": {
"label": "Other templates:"
}
}
}
);
$("#wpTextbox1").wikiEditor(
"addToToolbar", {
"section": "VectorGrafist",
"group": "templatesVectorGrafistOther",
"tools": {
"VectorGrafistSelectTemplate": {
label: "Select a template from the list",
type: "select",
list: {
"VectorGrafistOther-selectTemplate-Animated SVG" : {
label: "{"+"{Animated SVG}}",
action: {type:"encapsulate", options: {pre: "{"+"{Animated SVG||B|C}}\n"}}
},
"VectorGrafistOther-selectTemplate-scripted SVG" : {
label: "{"+"{scripted SVG}}",
action: {type:"encapsulate", options: {pre: "{"+"{scripted SVG}}\n"}}
},
"VectorGrafistOther-selectTemplate-Vector wip" : {
label: "{"+"{Vector wip}}",
action: {type:"encapsulate", options: {pre: "{"+"{Vector wip|1=~~"+"~|time=~~"+"~~"+"~}}\n"}}
},
"VectorGrafistOther-selectTemplate-BadSVG" : {
label: "{"+"{BadSVG}}",
action: {type:"encapsulate", options: {pre: "{"+"{BadSVG}}\n"}}
},
"VectorGrafistOther-selectTemplate-TracedSVG" : {
label: "{"+"{TracedSVG}}",
action: {type:"encapsulate", options: {pre: "{"+"{TracedSVG}}\n"}}
},
"VectorGrafistOther-selectTemplate-Path text SVG" : {
label: "{"+"{Path text SVG}}",
action: {type:"encapsulate", options: {pre: "{"+"{Path text SVG}}\n"}}
},
"VectorGrafistOther-selectTemplate-Technically replaced" : {
label: "{"+"{Technically replaced}}",
action: {type:"encapsulate", options: {pre: "{"+"{Technically replaced}}\n"}}
}
}
}
}
}
);
//g
var addOldToolbarButton = function() {
var $toolbar = $( '#gadget-toolbar' );
if ( !$toolbar.length ) {
$toolbar = $( '#toolbar' );
}
$( '<div>' )
.addClass( 'mw-toolbar-editbutton' )
.attr( 'id', 'mw-editbutton-gadget-wikilinker' )
.attr( 'alt', 'Вики-ссыльщик' )
.attr( 'title', 'Вики-ссыльщик — подбирает вики-ссылку для выделенного слова или словосочетания' )
.css( 'background-image', 'url(//upload.wikimedia.org/wikipedia/commons/a/ad/Wikilinker_toolbar.png) ' )
.appendTo( $toolbar )
.on( 'click', WikiLinker );
};
var addNewToolbarButton = function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'VectorGrafist',
'group': 'templatesVectorGrafistGraphicLab',
'tools': {
'VectorGrafistSelectTemplate': {
label: 'made in Grafik Lab',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/e/e7/Crystal_Clear_app_gimp_%28vector%29.svg',
action: {type:'encapsulate, options: {pre: "{"+"{Graphic Lab|<!--language code-->|image}}\n"',
execute: function() {
VectorGrafistSelectTemplate();
}
}
}
}
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'VectorGrafist',
'group': 'templatesVectorGrafistCode',
'tools': {
'VectorGrafistSelectTemplate': {
label: 'The source code of this SVG is valid',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/1a/Valid_SVG_1.1_%28green%29.svg',
action: {type:'encapsulate, options: {pre: "{"+"{validSVG|o}}\n"',
execute: function() {
VectorGrafistSelectTemplate();
}
}
}
}
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'VectorGrafist',
'group': 'templatesVectorGrafistCode',
'tools': {
'VectorGrafistSelectTemplate': {
label: 'The source code of this SVG is invalid',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/6/65/Invalid_SVG_1.1_%28red%29.svg',
action: {type:'encapsulate, options: {pre: "{"+"{InvalidSVG}}\n"',
execute: function() {
VectorGrafistSelectTemplate();
}
}
}
}
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'VectorGrafist',
'group': 'templatesVectorGrafistFrom',
'tools': {
'VectorGrafistSelectTemplate': {
label: 'This image includes elements that have been taken or adapted from this:',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/27/SVG_in_SVG.svg',
action: {type:'encapsulate, options: {pre: "{"+"{InvalidSVG}}\n"',
execute: function() {
VectorGrafistSelectTemplate();
}
}
}
}
});
};
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
importScript( '//ru.wikipedia.org/wiki/MediaWiki:Stemmer.js' );
mw.loader.using( [ 'user.options', 'jquery.textSelection' ], function () {
if ( mw.user.options.get( 'usebetatoolbar' ) === 1 ) {
if ( mw.user.options.get( 'showtoolbar' ) === 1 ) {
$.when(
mw.loader.using( ['ext.wikiEditor', 'schema.Edit'] ),
$.ready
).then( addNewToolbarButton );
}
} else {
}
});
}
// Toolbar buttons
var add,ldToolbarButton = function() {
var $toolbar = $( '#gadget-toolbar' );
if ( !$toolbar.length ) {
$toolbar = $( '#toolbar' );
}
$( '<div>' )
.addClass( 'mw-toolbar-editbutton' )
.attr( 'id', 'mw-editbutton-gadget-wikilinker' )
.attr( 'alt', 'Вики-ссыльщик' )
.attr( 'title', 'Вики-ссыльщик — подбирает вики-ссылку для выделенного слова или словосочетания' )
.css( 'background-image', 'url(//upload.wikimedia.org/wikipedia/commons/a/ad/Wikilinker_toolbar.png) ' )
.appendTo( $toolbar )
.on( 'click', WikiLinker );
};
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
importScript( 'MediaWiki:Stemmer.js' );
mw.loader.using( [ 'user.options', 'jquery.textSelection' ], function () {
if ( mw.user.options.get( 'usebetatoolbar' ) === 1 ) {
if ( mw.user.options.get( 'showtoolbar' ) === 1 ) {
$.when(
mw.loader.using( ['ext.wikiEditor', 'schema.Edit'] ),
$.ready
).then( addNewToolbarButton );
}
} else {
mw.loader.using( 'mediawiki.toolbar', function() {
$( addOldToolbarButton );
} );
}
} );
}
} // function()
); // $(document).ready(
} // if(typeof $
} // function playWithToolbar()
$(VectorGrafist);