From d1041d959bbe7cbc443ec46cc19b3a8b21cbd1a4 Mon Sep 17 00:00:00 2001 From: TJ Date: Sun, 8 May 2016 12:24:16 +0530 Subject: [PATCH] nesting selectors for better readability and removing unused code --- less/_checkboxes.less | 85 +++++++++++++------------------------------ less/_radios.less | 9 ----- scripts/material.js | 4 -- 3 files changed, 25 insertions(+), 73 deletions(-) diff --git a/less/_checkboxes.less b/less/_checkboxes.less index 3c3cd2de..9c45fc3e 100644 --- a/less/_checkboxes.less +++ b/less/_checkboxes.less @@ -30,6 +30,7 @@ label.checkbox-inline { &:before { // FIXME: document why this is necessary (doesn't seem to be on chrome) display: block; position: absolute; + top:-5px; left: 0; content: ""; background-color: rgba(0, 0, 0, .84); @@ -78,28 +79,32 @@ label.checkbox-inline { opacity: 0.2; } - &:focus:checked{ - & + .checkbox-material:before { - animation: rippleOn 500ms; + &:focus{ + + &:checked{ + & + .checkbox-material:before { + animation: rippleOn 500ms; + } + & + .checkbox-material .check:before { + animation: checkbox-on @mdb-checkbox-animation-check forwards; + } + & + .checkbox-material .check:after { + animation: rippleOn @mdb-checkbox-animation-ripple forwards; // Ripple effect on check + } } - & + .checkbox-material .check:before { - animation: checkbox-on @mdb-checkbox-animation-check forwards; - } - & + .checkbox-material .check:after { - animation: rippleOn @mdb-checkbox-animation-ripple forwards; // Ripple effect on check - } - } - - &:focus:not(:checked){ - & + .checkbox-material:before { - animation: rippleOff 500ms; - } - & + .checkbox-material .check:before { - animation: checkbox-off @mdb-checkbox-animation-check forwards; - } - & + .checkbox-material .check:after { - animation: rippleOff @mdb-checkbox-animation-ripple forwards; // Ripple effect on uncheck + + &:not(:checked) { + & + .checkbox-material:before { + animation: rippleOff 500ms; + } + & + .checkbox-material .check:before { + animation: checkbox-off @mdb-checkbox-animation-check forwards; + } + & + .checkbox-material .check:after { + animation: rippleOff @mdb-checkbox-animation-ripple forwards; // Ripple effect on uncheck + } } + } @@ -120,26 +125,10 @@ label.checkbox-inline { 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; - //animation: checkbox-on @mdb-checkbox-animation-check forwards; - } - - & + .checkbox-material:before { - //animation: rippleOn 500ms; } & + .checkbox-material .check:after { //background-color: @brand-success; // FIXME: seems like tho wrong color, test and make sure it can be removed - //animation: rippleOn @mdb-checkbox-animation-ripple forwards; // Ripple effect on check - } - } - - &:not(:checked) { - & + .checkbox-material:before { - //animation: rippleOff 500ms; - } - - & + .checkbox-material .check:after { - //animation: rippleOff @mdb-checkbox-animation-ripple forwards; // Ripple effect on uncheck } } } @@ -158,30 +147,6 @@ label.checkbox-inline { } } -// Prevent checkbox animation and ripple effect on page load - removed in favour of supporting animation without .form-group -/*.is-focused { - .checkbox, - label.checkbox-inline { - .checkbox-material { - .check:before { - animation: checkbox-off @mdb-checkbox-animation-check forwards; - } - } - input[type=checkbox] { - &:checked { - & + .checkbox-material:before { - animation: rippleOn @mdb-checkbox-animation-ripple; - } - } - &:not(:checked) { - & + .checkbox-material:before { - animation: rippleOff @mdb-checkbox-animation-ripple; - } - } - } - } -}*/ - @keyframes checkbox-on { 0% { box-shadow: diff --git a/less/_radios.less b/less/_radios.less index 79b36cbf..1d4b96c8 100644 --- a/less/_radios.less +++ b/less/_radios.less @@ -91,15 +91,6 @@ } } -// Prevent ripple effect on page load - removed for supporting animation without .form-group -/*.is-focused { - .radio, label.radio-inline { - input[type=radio]:checked ~ .check:after { - animation: rippleOn 500ms; - } - } -}*/ - @keyframes rippleOn { 0% { opacity: 0; diff --git a/scripts/material.js b/scripts/material.js index 0370a695..b0466f03 100644 --- a/scripts/material.js +++ b/scripts/material.js @@ -165,10 +165,6 @@ var validate = this.options.validate; $(document) - /* removed in favour of supporting animation without .form-group using :focus */ - /*.on("change", ".checkbox input[type=checkbox]", function () { - $(this).blur(); - })*/ .on("keydown paste", ".form-control", function (e) { if (_isChar(e)) { $(this).closest(".form-group").removeClass("is-empty");