Parcourir la source

Prevent multiple errors from displaying at once.

develop
Ben Kurtovic il y a 8 ans
Parent
révision
890ab4c249
2 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. +4
    -0
      src/tfd.js
  2. +3
    -3
      tfdclerk.js

+ 4
- 0
src/tfd.js Voir le fichier

@@ -51,6 +51,7 @@ TFD.prototype._unblock_submit = function(reason) {


TFD.prototype._error = function(msg, extra) { TFD.prototype._error = function(msg, extra) {
var elem = $("<span/>", { var elem = $("<span/>", {
addClass: "tfdclerk-error",
html: "<strong>Error:</strong> " + (extra ? msg + ": " : msg), html: "<strong>Error:</strong> " + (extra ? msg + ": " : msg),
style: "color: #A00;" style: "color: #A00;"
}); });
@@ -76,6 +77,9 @@ TFD.prototype._error = function(msg, extra) {
"persists, you can " + contact.prop("outerHTML") + " or " + "persists, you can " + contact.prop("outerHTML") + " or " +
file_bug.prop("outerHTML") + "." file_bug.prop("outerHTML") + "."
})); }));

if (this.box.find(".tfdclerk-error"))
this.box.find(".tfdclerk-error").remove();
elem.insertAfter(this.box.find("h5")); elem.insertAfter(this.box.find("h5"));
this._block_submit("error"); this._block_submit("error");
}; };


+ 3
- 3
tfdclerk.js Voir le fichier

@@ -50,7 +50,7 @@ var is_tfd_page = function() {
if (is_tfd_page()) { if (is_tfd_page()) {
mw.loader.using(dependencies, function() { mw.loader.using(dependencies, function() {


/* Main script starts here */
/* Main script starts here */


@TFDCLERK_INCLUDE:main.js@ @TFDCLERK_INCLUDE:main.js@
@TFDCLERK_INCLUDE:util.js@ @TFDCLERK_INCLUDE:util.js@
@@ -58,9 +58,9 @@ if (is_tfd_page()) {
@TFDCLERK_INCLUDE:tfd_close.js@ @TFDCLERK_INCLUDE:tfd_close.js@
@TFDCLERK_INCLUDE:tfd_relist.js@ @TFDCLERK_INCLUDE:tfd_relist.js@


$(TFDClerk.install);
$(TFDClerk.install);


/* Main script ends here */
/* Main script ends here */


}); });
} }


Chargement…
Annuler
Enregistrer