User:Cacycle/wikEd dev.js: Difference between revisions

Content deleted Content added
0.9.145 pre testing
Maintenance: Remove use of deprecated wgEnableAPI (always true) - mw:RL/MGU
 
(2 intermediate revisions by one other user not shown)
Line 40:
var WED;
var WikEdDiff;
var $;
 
//
Line 2,040 ⟶ 2,039:
 
// parse global-context (MediaWiki) variables into hash (for Greasemonkey)
var globalNames = ['skin', 'wgServer', 'wgTitle', 'wgCanonicalNamespace', 'wgArticlePath', 'wgScript', 'wgScriptPath', 'wgUserName', 'wgCurRevisionId', 'wgContentLanguage', 'wgUserLanguage', 'wgEnableAPI', 'wgPageName', 'wgNamespaceIds', 'wgFormattedNamespaces', 'wgUseAutomaticEditSummaries', 'wgVersion', 'wgPageContentModel'];
if (wikEd.greasemonkey === true) {
globalNames.push('wikEdConfig', 'wikEdText');
Line 3,497 ⟶ 3,496:
if (wikEd.fixRegExTypo !== null) {
wikEd.fixRegExTypo.style.display = 'none';
}
 
// hide buttons if API is not available
if ( (wikEd.wikiGlobals.wgEnableAPI !== true) && (wikEd.wikiGlobals.wgEnableAPI != 'true') ) {
var fixRedirect = document.getElementById('wikEdFixRedirect');
if (fixRedirect !== null) {
fixRedirect.style.display = 'none';
}
}
 
Line 8,548 ⟶ 8,539:
// check for named references defined outside edited section
if (
true
wikEd.wikiGlobals.wgEnableAPI === true ||
wikEd.wikiGlobals.wgEnableAPI === 'true'
) {
 
Line 8,635 ⟶ 8,625:
 
// API request
if ( ( wikEd.wikiGlobals.wgEnableAPI === true || wikEd.wikiGlobals.wgEnableAPI === 'true' ) && livePreview === true ) {
 
// get summary
Line 8,819 ⟶ 8,809:
// collapsible divs (common.js on ru)
if (typeof window.collapsibleDivs === 'function' ) {
window.collapsibleDivs();
}
// collapsible tables (common.js on ru)
if (typeof window.collapsibleTables === 'function' ) {
window.collapsibleTables();
}
 
Line 8,830 ⟶ 8,820:
if ( wikEd.loader === true ) {
if ( $( '.tex' ).length > 0 && window.mw.user.options.get( 'math' ) === '6' ) {
window.mw.loader.using( 'ext.math.mathjax.enabler', function () {
$( '#wikiPreview' ).renderTex();
} );
}
}
/*
 
// load media player modules and activate media elements
if ( wikEd.loader === true ) {
window.mw.loader.using( ['mw.MwEmbedSupport', 'mw.EmbedPlayer'], function() {
var elements = $( '#wikEdPreviewArticle' ).find('video,audio');
if ( elements.length > 0 ) {
elements.embedPlayer();
 
// activate media elements, from mw.PopUpMediaTransform.js, see https://bugzilla.wikimedia.org/show_bug.cgi?id=72675
Line 8,849 ⟶ 8,837:
var thisref = this;
 
window.mw.loader.using( 'mw.MwEmbedSupport', function () {
var $videoContainer = $( $( thisref ).parent().attr( 'videopayload' ) );
window.mw.addDialog( {
'width' : 'auto',
'height' : 'auto',
'title' : window.mw.html.escape( $videoContainer.find('video,audio').attr('data-mwtitle') ),
'content' : $videoContainer,
'close' : function() {
Line 8,875 ⟶ 8,863:
}
else if ( parent.attr( 'data-videopayload' ) ) {
var link = $( this ).attr( 'href' ), title = window.mw.Title.newFromImg( { src: link } );
if ( title && title.getPrefixedDb() !== window.mw.config.get( 'wgPageName' ) ) {
$( this ).attr( 'href', title.getUrl() );
}
}
} );
} );
}
*/
// fire mediawiki hook to apply changes to preview content: <categorytree>, <math>
if ( window.mw !== undefined && window.mw.hook !== undefined && window.mw.hook( 'wikipage.content' ).fire !== undefined ) {
Line 10,879 ⟶ 10,867:
 
// check if api is enabled
if ( ( (wikEd.wikiGlobals.wgEnableAPI !== true) && (wikEd.wikiGlobals.wgEnableAPI != 'true') ) || (wikEd.scriptURL === '') ) {
return;
}