vanilla-ujs 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gruntfile.js +1 -1
- data/lib/assets/javascripts/vanilla-ujs/disable.js +13 -0
- data/lib/vanilla/ujs/version.rb +1 -1
- data/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3efdcdcb42fc9931f74e5b9887e4ddbc2ab8d4f2
|
4
|
+
data.tar.gz: 60c452e88b54a83c33abae028822cdc11e73075c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e059b66b63c1986ea2f685badfe4715d4c260819a4d40ede3e347fd65959edf2cd7d0ab4e50ed0e3b357adf4918db8c6f8f1ca6e4faba08e6a4777cc89b6713
|
7
|
+
data.tar.gz: 36f966f29b519e39022cca833da65b7cdb069ac28600bf495f18f21fd95402a529ecf0dc8d2e3e40eca74401b2e786761e06bc897e7e159bdc45e28eb830b09c
|
data/.gitignore
CHANGED
data/Gruntfile.js
CHANGED
@@ -26,8 +26,8 @@ module.exports = function (grunt) {
|
|
26
26
|
src: [
|
27
27
|
'lib/assets/javascripts/vanilla-ujs/polyfills.js',
|
28
28
|
'lib/assets/javascripts/vanilla-ujs/liteajax.js',
|
29
|
-
'lib/assets/javascripts/vanilla-ujs/method.js',
|
30
29
|
'lib/assets/javascripts/vanilla-ujs/confirm.js',
|
30
|
+
'lib/assets/javascripts/vanilla-ujs/method.js',
|
31
31
|
'lib/assets/javascripts/vanilla-ujs/disable.js',
|
32
32
|
'lib/assets/javascripts/vanilla-ujs/csrf.js',
|
33
33
|
'lib/assets/javascripts/vanilla-ujs/form.js',
|
@@ -1,8 +1,21 @@
|
|
1
1
|
document.addEventListener('click', function (event) {
|
2
2
|
var message, element;
|
3
3
|
|
4
|
+
// do not disable on right click. Work on left and middle click
|
5
|
+
if (event.which == 3) {
|
6
|
+
return;
|
7
|
+
}
|
8
|
+
|
4
9
|
element = event.target;
|
5
10
|
|
11
|
+
// do not disable if the element is a submit button and its form has invalid input elements.
|
12
|
+
// since failed validations prevent the form from being submitted, we would lock the form permanently
|
13
|
+
// by disabling the submit button even though the form was never submitted
|
14
|
+
|
15
|
+
if(element.getAttribute("type") === "submit" && element.form.querySelector(":invalid") !== null) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
|
6
19
|
if (matches.call(element, 'a[data-disable-with], button[data-disable-with], input[data-disable-with]')) {
|
7
20
|
message = element.getAttribute('data-disable-with');
|
8
21
|
if(!!element.value){
|
data/lib/vanilla/ujs/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanilla-ujs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Łukasz Jan Niemier
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-11-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|