You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/02/29 17:42:34 UTC
[whimsy.git] [1/1] Commit 62d6226: go native
Commit 62d6226fa405f67d6a5c2b6e30061efcad63487f:
go native
Branch: refs/heads/master
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>
------------------------------------------------------------
www/test/vhost-generator.cgi | ++++++++ -----
------------------------------------------------------------
25 changes: 15 additions, 10 deletions.
------------------------------------------------------------
diff --git a/www/test/vhost-generator.cgi b/www/test/vhost-generator.cgi
index e4d7eb0..d67fc90 100755
--- a/www/test/vhost-generator.cgi
+++ b/www/test/vhost-generator.cgi
@@ -1,6 +1,6 @@
#!/usr/bin/ruby1.9.1
-require 'wunderbar/jquery'
+require 'wunderbar'
# response to form requests
if ENV['REQUEST_METHOD'].upcase == 'POST'
@@ -56,14 +56,19 @@ _html do
end
_script %{
- $('input').on('input', function() {
- if ($('input').is(function () {return this.matches(':invalid')})) {
- console.log('disabled');
- $('input[type=submit]').prop('disabled', true);
- } else {
- console.log('enabled');
- $('input[type=submit]').prop('disabled', false);
- }
- });
+ var inputs = Array.prototype.slice.call(document.querySelectorAll("input"));
+ var submit = document.querySelector("input[type=submit]");
+
+ inputs.forEach(function(input) {
+ input.addEventListener("input", function() {
+ if (inputs.some(function(input) {
+ return input.matches(":invalid")
+ })) {
+ submit.disabled = true
+ } else {
+ submit.disabled = false
+ }
+ })
+ })
}
end