mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-23 15:57:15 +00:00
JavaScript: Use single quotes instead of double quotes for
strings * This avoids escaping of double quotes. * Exceptions: "''" and "'''" * https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Quotes Set "validateQuoteMarks": { "mark": "'", "escape": true } in .jscsrc This tests for single quotes but allows double quotes to avoid escaping. Change-Id: Ibd32a63c4c97a7ef8938c6d2dff83b952cfca43e
This commit is contained in:
parent
0b5c23d42b
commit
3d103f09b5
2
.jscsrc
2
.jscsrc
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"preset": "wikimedia",
|
||||
"validateQuoteMarks": null,
|
||||
"validateQuoteMarks": { "mark": "'", "escape": true },
|
||||
"requireVarDeclFirst": null,
|
||||
"requireMultipleVarDecl": null,
|
||||
"requireCamelCaseOrUpperCaseIdentifiers": null
|
||||
|
|
|
@ -109,7 +109,7 @@ $.wikiEditor.modules.dialogs.config = {
|
|||
if ( typeof arguments.callee.regex === 'undefined' ) {
|
||||
// Cache the regex
|
||||
arguments.callee.regex =
|
||||
new RegExp( "^(" + mw.config.get( 'wgUrlProtocols' ) + "|www\\.)", 'i' );
|
||||
new RegExp( '^(' + mw.config.get( 'wgUrlProtocols' ) + '|www\\.)', 'i' );
|
||||
}
|
||||
return s.match( arguments.callee.regex );
|
||||
}
|
||||
|
@ -421,10 +421,10 @@ $.wikiEditor.modules.dialogs.config = {
|
|||
text = $( '#wikieditor-toolbar-link-int-text' ).val();
|
||||
// check if the tooltips were passed as target or text
|
||||
if ( $( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip-mode' ) ) {
|
||||
target = "";
|
||||
target = '';
|
||||
}
|
||||
if ( $( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip-mode' ) ) {
|
||||
text = "";
|
||||
text = '';
|
||||
}
|
||||
if ( target === '' ) {
|
||||
alert( mw.msg( 'wikieditor-toolbar-tool-link-empty' ) );
|
||||
|
@ -918,9 +918,9 @@ $.wikiEditor.modules.dialogs.config = {
|
|||
}
|
||||
var headerText = mw.msg( 'wikieditor-toolbar-tool-table-example-header' );
|
||||
var normalText = mw.msg( 'wikieditor-toolbar-tool-table-example' );
|
||||
var table = "";
|
||||
var table = '';
|
||||
for ( var r = 0; r < rows + header; r++ ) {
|
||||
table += "|-\n";
|
||||
table += '|-\n';
|
||||
for ( var c = 0; c < cols; c++ ) {
|
||||
var isHeader = ( header && r === 0 );
|
||||
var delim = isHeader ? '!' : '|';
|
||||
|
@ -931,7 +931,7 @@ $.wikiEditor.modules.dialogs.config = {
|
|||
}
|
||||
// Replace trailing space by newline
|
||||
// table[table.length - 1] is read-only
|
||||
table = table.substr( 0, table.length - 1 ) + "\n";
|
||||
table = table.substr( 0, table.length - 1 ) + '\n';
|
||||
}
|
||||
var classes = [];
|
||||
if ( $( '#wikieditor-toolbar-table-wikitable' ).is( ':checked' ) ) {
|
||||
|
@ -947,7 +947,7 @@ $.wikiEditor.modules.dialogs.config = {
|
|||
{
|
||||
type: 'replace',
|
||||
options: {
|
||||
pre: '{|' + classStr + "\n",
|
||||
pre: '{|' + classStr + '\n',
|
||||
peri: table,
|
||||
post: '|}',
|
||||
ownline: true
|
||||
|
|
|
@ -138,9 +138,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "[",
|
||||
pre: '[',
|
||||
periMsg: 'wikieditor-toolbar-tool-xlink-example',
|
||||
post: "]"
|
||||
post: ']'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -152,9 +152,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "[[",
|
||||
pre: '[[',
|
||||
periMsg: 'wikieditor-toolbar-tool-ilink-example',
|
||||
post: "]]"
|
||||
post: ']]'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -168,7 +168,7 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
options: {
|
||||
pre: '[[' + fileNamespace + ':',
|
||||
periMsg: 'wikieditor-toolbar-tool-file-example',
|
||||
post: "|" + mw.config.get( 'wgWikiEditorMagicWords' ).img_thumbnail + "]]"
|
||||
post: '|' + mw.config.get( 'wgWikiEditorMagicWords' ).img_thumbnail + ']]'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -181,9 +181,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "<ref>",
|
||||
pre: '<ref>',
|
||||
periMsg: 'wikieditor-toolbar-tool-reference-example',
|
||||
post: "</ref>"
|
||||
post: '</ref>'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -195,7 +195,7 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "--~~~~"
|
||||
pre: '--~~~~'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
periMsg: 'wikieditor-toolbar-tool-heading-example',
|
||||
post: ' ==',
|
||||
regex: /^(\s*)(={1,6})(.*?)\2(\s*)$/,
|
||||
regexReplace: "$1==$3==$4",
|
||||
regexReplace: '$1==$3==$4',
|
||||
ownline: true
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
periMsg: 'wikieditor-toolbar-tool-heading-example',
|
||||
post: ' ===',
|
||||
regex: /^(\s*)(={1,6})(.*?)\2(\s*)$/,
|
||||
regexReplace: "$1===$3===$4",
|
||||
regexReplace: '$1===$3===$4',
|
||||
ownline: true
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
periMsg: 'wikieditor-toolbar-tool-heading-example',
|
||||
post: ' ====',
|
||||
regex: /^(\s*)(={1,6})(.*?)\2(\s*)$/,
|
||||
regexReplace: "$1====$3====$4",
|
||||
regexReplace: '$1====$3====$4',
|
||||
ownline: true
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
periMsg: 'wikieditor-toolbar-tool-heading-example',
|
||||
post: ' =====',
|
||||
regex: /^(\s*)(={1,6})(.*?)\2(\s*)$/,
|
||||
regexReplace: "$1=====$3=====$4",
|
||||
regexReplace: '$1=====$3=====$4',
|
||||
ownline: true
|
||||
}
|
||||
}
|
||||
|
@ -291,9 +291,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "* ",
|
||||
pre: '* ',
|
||||
periMsg: 'wikieditor-toolbar-tool-ulist-example',
|
||||
post: "",
|
||||
post: '',
|
||||
ownline: true,
|
||||
splitlines: true
|
||||
}
|
||||
|
@ -313,9 +313,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "# ",
|
||||
pre: '# ',
|
||||
periMsg: 'wikieditor-toolbar-tool-olist-example',
|
||||
post: "",
|
||||
post: '',
|
||||
ownline: true,
|
||||
splitlines: true
|
||||
}
|
||||
|
@ -329,9 +329,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "<nowiki>",
|
||||
pre: '<nowiki>',
|
||||
periMsg: 'wikieditor-toolbar-tool-nowiki-example',
|
||||
post: "</nowiki>"
|
||||
post: '</nowiki>'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -343,7 +343,7 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "<br />\n"
|
||||
pre: '<br />\n'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -359,9 +359,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "<big>",
|
||||
pre: '<big>',
|
||||
periMsg: 'wikieditor-toolbar-tool-big-example',
|
||||
post: "</big>"
|
||||
post: '</big>'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -373,9 +373,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "<small>",
|
||||
pre: '<small>',
|
||||
periMsg: 'wikieditor-toolbar-tool-small-example',
|
||||
post: "</small>"
|
||||
post: '</small>'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -387,9 +387,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "<sup>",
|
||||
pre: '<sup>',
|
||||
periMsg: 'wikieditor-toolbar-tool-superscript-example',
|
||||
post: "</sup>"
|
||||
post: '</sup>'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -401,9 +401,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "<sub>",
|
||||
pre: '<sub>',
|
||||
periMsg: 'wikieditor-toolbar-tool-subscript-example',
|
||||
post: "</sub>"
|
||||
post: '</sub>'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "<gallery>\n",
|
||||
pre: '<gallery>\n',
|
||||
periMsg: [
|
||||
'wikieditor-toolbar-tool-gallery-example',
|
||||
fileNamespace
|
||||
],
|
||||
post: "\n</gallery>",
|
||||
post: '\n</gallery>',
|
||||
ownline: true
|
||||
}
|
||||
}
|
||||
|
@ -439,9 +439,9 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
action: {
|
||||
type: 'encapsulate',
|
||||
options: {
|
||||
pre: "{| class=\"wikitable\" border=\"1\"\n|",
|
||||
pre: '{| class="wikitable" border="1"\n|',
|
||||
periMsg: 'wikieditor-toolbar-tool-table-example-old',
|
||||
post: "\n|}",
|
||||
post: '\n|}',
|
||||
ownline: true
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ $.wikiEditor.modules.toolbar.config = {
|
|||
options: {
|
||||
pre: mw.config.get( 'wgWikiEditorMagicWords' ).redirect + ' [[',
|
||||
periMsg: 'wikieditor-toolbar-tool-redirect-example',
|
||||
post: "]]",
|
||||
post: ']]',
|
||||
ownline: true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue