dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mediawiki.action.edit.preview: Disable if there is no #wpTextbox1
[lhc/web/wiklou.git]
/
resources
/
src
/
mediawiki.action
/
mediawiki.action.edit.preview.js
diff --git
a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js
index
e4ccf2b
..
84bde7d
100644
(file)
--- a/
resources/src/mediawiki.action/mediawiki.action.edit.preview.js
+++ b/
resources/src/mediawiki.action/mediawiki.action.edit.preview.js
@@
-109,7
+109,7
@@
}
request = api.post( postData );
request.done( function ( response ) {
}
request = api.post( postData );
request.done( function ( response ) {
- var li, newList, $
nex
t, $parent, $list;
+ var li, newList, $
conten
t, $parent, $list;
if ( response.parse.modules ) {
mw.loader.load( response.parse.modules.concat(
response.parse.modulescripts,
if ( response.parse.modules ) {
mw.loader.load( response.parse.modules.concat(
response.parse.modulescripts,
@@
-163,23
+163,16
@@
}
if ( response.parse.text['*'] ) {
}
if ( response.parse.text['*'] ) {
- $next = $wikiPreview.next();
- // If there is no next node, use parent instead.
- // Only query parent if needed, false otherwise.
- $parent = !$next.length && $wikiPreview.parent();
-
- $wikiPreview
+ $content = $wikiPreview.children( '.mw-content-ltr,.mw-content-rtl' );
+ $content
.detach()
.html( response.parse.text['*'] );
.detach()
.html( response.parse.text['*'] );
- mw.hook( 'wikipage.content' ).fire( $
wikiPreview
);
+ mw.hook( 'wikipage.content' ).fire( $
content
);
// Reattach
// Reattach
- if ( $parent ) {
- $parent.append( $wikiPreview );
- } else {
- $next.before( $wikiPreview );
- }
+ $wikiPreview.append( $content );
+
$wikiPreview.show();
}
$wikiPreview.show();
}
@@
-212,7
+205,8
@@
$( function () {
// Do not enable on user .js/.css pages, as there's no sane way of "previewing"
// the scripts or styles without reloading the page.
$( function () {
// Do not enable on user .js/.css pages, as there's no sane way of "previewing"
// the scripts or styles without reloading the page.
- if ( $( '#mw-userjsyoucanpreview' ).length || $( '#mw-usercssyoucanpreview' ).length ) {
+ // Do not enable for ProofreadPage Index page editors, which have no textbox
+ if ( $( '#mw-userjsyoucanpreview' ).length || $( '#mw-usercssyoucanpreview' ).length || $( '#wpTextbox1' ).length === 0 ) {
return;
}
return;
}
@@
-245,6
+239,7
@@
if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) {
$( '#wikiPreview' ).after(
$( '<div>' )
if ( !document.getElementById( 'wikiDiff' ) && document.getElementById( 'wikiPreview' ) ) {
$( '#wikiPreview' ).after(
$( '<div>' )
+ .hide()
.attr( 'id', 'wikiDiff' )
.html( '<table class="diff"><col class="diff-marker"/><col class="diff-content"/>' +
'<col class="diff-marker"/><col class="diff-content"/><tbody/></table>' )
.attr( 'id', 'wikiDiff' )
.html( '<table class="diff"><col class="diff-marker"/><col class="diff-content"/>' +
'<col class="diff-marker"/><col class="diff-content"/><tbody/></table>' )