set input type=number when relevent
authorRaphaël Jakse <raphael.trivabble@jakse.fr>
Mon, 13 Jul 2020 13:51:20 +0000 (15:51 +0200)
committerRaphaël Jakse <raphael.trivabble@jakse.fr>
Mon, 13 Jul 2020 13:53:45 +0000 (15:53 +0200)
public/alert.css
public/alert.js
public/trivabble.js

index 2b4c470c0844bfd8d8ec1469a56b49bc6a11b4bf..26ab33900ebffd6a5a9a80708bee1051de1abc1d 100644 (file)
@@ -35,7 +35,7 @@
     padding:1ex
 }
 
-.alert input[type=text], .alert input[type=password] {
+.alert input[type=text], .alert input[type=number], .alert input[type=password] {
    border-radius:none;
    box-sizing:border-box;
    min-height:1.5rem;
index 234d76c8a467fbedc34a6f3877553c3706b59a16..2dc78d62a280c5e169bef7046250b89385872a13 100644 (file)
 
     global.myAlert.l10n = _;
 
-    global.myPrompt = function (msg, callback, defaultText) {
+    global.myPrompt = function (msg, callback, defaultText, options) {
         if (!divAlert) {
             prepare();
         }
 
         divAlertContent.textContent = msg;
         divAlertInput.style.display = "";
-        divAlertInput.firstChild.value = defaultText || "";
+        alertInput.value = defaultText || "";
+        alertInput.type = (options && options.type) || "text";
         divAlertConfirm.style.display = "none";
         divAlertButton.style.display = "none";
         divAlertCallback = callback;
index 42884f6060999b659df28e369429525794f8137b..a10be57229e8abe68085498209ee39484c019bf8 100644 (file)
                                         }]);
                                     }
                                 },
-                                row.lastChild.firstChild.textContent
+                                row.lastChild.firstChild.textContent,
+                                {type: "number"}
                             );
                         };
                     }
                                         }]);
                                     }
                                 },
-                                row.lastChild.firstChild.textContent
+                                row.lastChild.firstChild.textContent,
+                                {type: "number"}
                             );
                         };
                     }