mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-09-23 10:21:31 +00:00
Should be possible to disable the Math preview
Bug: T334261 Change-Id: I46e7641d22f4c17ba318a106a62518e4ca3e3c55
This commit is contained in:
parent
7f8a359a84
commit
b99c3800d0
|
@ -27,7 +27,8 @@
|
|||
"MediaWiki\\Extension\\Math\\WikiTexVC\\MMLmappings\\Util\\MMLComparator": "tests/phpunit/unit/WikiTexVC/MMLComparator.php"
|
||||
},
|
||||
"DefaultUserOptions": {
|
||||
"math": "mathml"
|
||||
"math": "mathml",
|
||||
"math-popups": "1"
|
||||
},
|
||||
"ExtensionMessagesFiles": {
|
||||
"MathAlias": "Math.alias.php",
|
||||
|
@ -216,8 +217,12 @@
|
|||
"ext.math.popup": {
|
||||
"es6": true,
|
||||
"packageFiles": "ext.math.popup.js",
|
||||
"messages": [
|
||||
"popups-settings-option-math",
|
||||
"popups-settings-option-math-description"
|
||||
],
|
||||
"dependencies": [
|
||||
"mediawiki.api"
|
||||
"mediawiki.ForeignApi"
|
||||
]
|
||||
},
|
||||
"mw.widgets.MathWbEntitySelector": {
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
]
|
||||
},
|
||||
"math-desc": "Render mathematical formulas between <code><math></code> ... <code></math></code> tags",
|
||||
"popups-settings-option-math": "Math",
|
||||
"popups-settings-option-math-description": "Explain mathematical formulae.",
|
||||
"popups-settings-option-math-tooltip": "Explain mathematical formulae on hover.",
|
||||
"math-visualeditor-mwchemdialog-title": "Chemical formula",
|
||||
"math-visualeditor-mwlatexcontextitem-quickedit": "Quick edit",
|
||||
"math-visualeditor-mwlatexdialog-card-formula": "Formula",
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
]
|
||||
},
|
||||
"math-desc": "{{desc|name=Math|url=https://www.mediawiki.org/wiki/Extension:Math}}",
|
||||
"popups-settings-option-math": "Page previews setting dialog for math previews.",
|
||||
"popups-settings-option-math-description": "Describe the functionality of the math preview in a dialog for anonymous users.",
|
||||
"popups-settings-option-math-tooltip": "Describe the functionality of the math preview on Special:Preferences page.",
|
||||
"math-visualeditor-mwchemdialog-title": "Title for the dialog to edit <nowiki><chem></nowiki> formula blocks.",
|
||||
"math-visualeditor-mwlatexcontextitem-quickedit": "Label for the quick edit button in the math context item",
|
||||
"math-visualeditor-mwlatexdialog-card-formula": "Label for the generic formula card of the dialog for mathematics, chemistry, etc.\n{{Identical|Formula}}",
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
"root": true,
|
||||
"extends": [
|
||||
"wikimedia/client-es5",
|
||||
"wikimedia/client-es6",
|
||||
"wikimedia/jquery",
|
||||
"wikimedia/mediawiki"
|
||||
],
|
||||
"rules": {
|
||||
"max-len": "off"
|
||||
"max-len": "off",
|
||||
"no-var": "warn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,12 +42,17 @@
|
|||
}
|
||||
}
|
||||
);
|
||||
module.exports = {
|
||||
|
||||
const mathDisabledByUser = mw.user.isNamed() && mw.user.options.get( 'math-popups' ) !== '1';
|
||||
const selector = '.mwe-math-element[data-qid] img';
|
||||
const mathAppliesToThisPage = document.querySelectorAll( selector ).length > 0;
|
||||
|
||||
module.exports = !mathAppliesToThisPage || mathDisabledByUser ? null : {
|
||||
type: previewType,
|
||||
selector: '.mwe-math-element[data-qid] img',
|
||||
selector,
|
||||
gateway: {
|
||||
fetch: fetch,
|
||||
fetchPreviewForTitle: fetchPreviewForTitle
|
||||
fetch,
|
||||
fetchPreviewForTitle
|
||||
}
|
||||
};
|
||||
}() );
|
||||
|
|
|
@ -45,5 +45,12 @@ class PreferencesHooksHandler implements
|
|||
'label' => ' ',
|
||||
'section' => 'rendering/math',
|
||||
];
|
||||
|
||||
$preferences['math-popups'] = [
|
||||
'type' => 'toggle',
|
||||
'label-message' => 'popups-settings-option-math-tooltip',
|
||||
'section' => 'rendering/math',
|
||||
'help-message' => 'popups-settings-option-math-tooltip-description'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue