feat: add HTTP status code to error message

Also use default MediaWiki message 'error' instead of self-defined one.
This commit is contained in:
alistair3149 2022-04-19 10:24:49 -04:00
parent 2cd680df50
commit 38a47307d7
No known key found for this signature in database
GPG key ID: 94D081060FD3DD9C
5 changed files with 9 additions and 11 deletions

View file

@ -34,7 +34,7 @@
}
],
"messages": [
"tabberneue-error"
"error"
],
"styles": [
"ext.tabberNeue.less"

View file

@ -6,6 +6,5 @@
"Ciencia Al Poder"
]
},
"tabberneue-desc": "Allows to create tabs within a page. Forked from [https://www.mediawiki.org/wiki/Extension:Tabber Extension:Tabber].",
"tabberneue-error": "Error."
"tabberneue-desc": "Allows to create tabs within a page. Forked from [https://www.mediawiki.org/wiki/Extension:Tabber Extension:Tabber]."
}

View file

@ -4,7 +4,5 @@
"Ciencia Al Poder"
]
},
"tabberneue-desc": "Permite usar pestañas dentro de una página.",
"tabberneue-loading": "Cargando...",
"tabberneue-error": "Error."
"tabberneue-desc": "Permite usar pestañas dentro de una página."
}

View file

@ -4,6 +4,5 @@
"Shirayuki"
]
},
"tabberneue-desc": "{{desc|name=TabberNeue|url=http://www.mediawiki.org/wiki/Extension:TabberNeue}}",
"tabberneue-error": "Error message shown loading tab content"
"tabberneue-desc": "{{desc|name=TabberNeue|url=http://www.mediawiki.org/wiki/Extension:TabberNeue}}"
}

View file

@ -269,9 +269,11 @@ function initTabber( tabber, count ) {
function onLoadEndPage() {
var targetPanel = currentRequest.targetPanel;
if ( xhr.status != 200 ) {
var err = document.createElement( 'div' );
err.setAttribute( 'class', 'tabber__transclusion--error' );
err.appendChild( document.createTextNode( mw.message( 'tabberneue-error' ).text() ) );
var err = document.createElement( 'div' ),
errMsg = mw.message( 'error' ).text() + ': HTTP ' + xhr.status;
err.setAttribute( 'class', 'tabber__transclusion--error error' );
err.appendChild( document.createTextNode( errMsg ) );
targetPanel.textContent = '';
targetPanel.appendChild( err );
} else {