From 06bcc0e0379f9491f8566911dce4bd004f94b679 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Fri, 3 Nov 2017 17:54:38 -0300 Subject: [PATCH 01/20] Fixes problem with `a` into `ul` Refs #49 --- factory/sass/layouts/_header.sass | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/factory/sass/layouts/_header.sass b/factory/sass/layouts/_header.sass index aa73bd8..424e89f 100644 --- a/factory/sass/layouts/_header.sass +++ b/factory/sass/layouts/_header.sass @@ -18,7 +18,7 @@ .btn, .action, .tag margin: 2px 0 - & > li, & > a, & > a > li + & > li width: 100% display: inline-block &.active @@ -80,11 +80,17 @@ li:not(.btn):not(.action):not(.tag) border-bottom: 2px solid transparent li - cursor: pointer - padding: 10px 8px + padding: 0 margin: 0 1px +transition() + & > a + display: block + height: 100% + text-decoration: none + color: inherit + padding: 10px 8px + &.dropdown &::after top: -5px From e93b083cf0dad47ee7c9c3874136b149906cb6ff Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Fri, 3 Nov 2017 21:24:08 -0300 Subject: [PATCH 02/20] Fixes problem with centralized `.content-align` Refs #50 --- factory/sass/helpers/_singles.sass | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/factory/sass/helpers/_singles.sass b/factory/sass/helpers/_singles.sass index 25aefee..0a0c670 100644 --- a/factory/sass/helpers/_singles.sass +++ b/factory/sass/helpers/_singles.sass @@ -8,11 +8,6 @@ .visible display: inline!important -.center - display: block - margin-left: auto - margin-right: auto - .padding padding: 15px &-lr @@ -26,7 +21,7 @@ & > * display: block!important margin: 5px 0 - + .content-align display: block margin: 15px 0 @@ -63,3 +58,8 @@ margin: 0!important .no-padding padding: 0!important + +.center + display: block + margin-left: auto + margin-right: auto From 0863c3ac28684c9a377cfa109436ea86b5efedeb Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Sun, 5 Nov 2017 14:33:15 -0300 Subject: [PATCH 03/20] Make `.dropdown`list accessible via keyboard Refs #52 --- factory/js/gainTime.js | 16 +++++++++++++++- factory/sass/components/_dropdowns.sass | 6 +++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index e56aedf..6de02c8 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -29,15 +29,29 @@ function closeMenus() { function makeDropdown(e) { e.setAttribute("role", "button"), e.setAttribute("tabindex", "0"), e.addEventListener("click", function(t) { t.stopPropagation(), toogleDropdown(e) + }), [].slice.call(e.getElementsByTagName("ul")[0].getElementsByTagName("li")).forEach(function(i) { + i.setAttribute("tabindex", "-1") }), e.addEventListener("keypress", function(t) { - 13 === t.keyCode && (t.preventDefault(), toogleDropdown(e)), 27 === t.keyCode && closeDropdowns() + 13 === t.keyCode && (toogleDropdown(e)), 27 === t.keyCode && closeDropdowns() + }), e.addEventListener("keydown", function(t) { + (38 === t.keyCode || 40 === t.keyCode) && (t.preventDefault(), dropdownsNavKeys(e, t.keyCode)) }) } +function dropdownsNavKeys(e, k) { + var n = [].slice.call(e.getElementsByTagName("ul")[0].getElementsByTagName("li")), + s = n.indexOf(document.activeElement); + -1 == s && (s = n.indexOf(document.activeElement.parentElement)), 40 == k? s++: s--; + + if (s >= 0 && s < n.length) + (n[s].firstChild.nodeName == "A")? n[s].firstChild.focus(): n[s].focus(); +} + function toogleDropdown(e) { var t = e.getElementsByTagName("ul")[0], o = !!t.style.display; closeDropdowns(), o ? t.style.removeProperty("display") : t.style.display = "list-item" + e.focus(); } function closeDropdowns() { diff --git a/factory/sass/components/_dropdowns.sass b/factory/sass/components/_dropdowns.sass index 905f738..b40891b 100644 --- a/factory/sass/components/_dropdowns.sass +++ b/factory/sass/components/_dropdowns.sass @@ -45,11 +45,15 @@ height: auto li + position: relative padding: 5px 10px border: none!important color: $color-default - &:hover + &:hover, &:focus, & > a:focus background-color: #d1d5da + li > a + display: block + position: relative .dropdown-right, .dropup-right @extend %drop From 63cf2cf875e8a8e26c47517429abeb19f14eae28 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Sun, 5 Nov 2017 15:20:48 -0300 Subject: [PATCH 04/20] Block scrolling of the page while displaying modal Refs #55 --- factory/js/gainTime.js | 5 ++++- factory/sass/components/_modals.sass | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index 6de02c8..4d56dec 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -186,6 +186,7 @@ function cnpj(u) { function closeModal(e) { e.addEventListener("click", function(t) { t.stopPropagation(), e.parentElement.parentElement.removeAttribute("style") + document.getElementsByTagName('body')[0].style.overflow = "" }) } var smoothScroll = function(e, t, o) { @@ -236,15 +237,17 @@ gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = closeMenus(), closeDropdowns() }), gtModals.forEach(function(e) { e.addEventListener("click", function(t) { - "gt-modal" == t.target.className && e.removeAttribute("style") + "gt-modal" == t.target.className && e.removeAttribute("style"); document.getElementsByTagName('body')[0].style.overflow = "" }) }), document.addEventListener("keypress", function(e) { 27 == e.keyCode && gtModals.forEach(function(e) { e.removeAttribute("style") + document.getElementsByTagName('body')[0].style.overflow = "" }) }), modals.forEach(function(e) { e.addEventListener("click", function(t) { var o = document.getElementById(e.dataset.modal); o.parentElement.style.display = "block" + document.getElementsByTagName('body')[0].style.overflow = "hidden" }) }); diff --git a/factory/sass/components/_modals.sass b/factory/sass/components/_modals.sass index 23b3ecb..e334eaf 100644 --- a/factory/sass/components/_modals.sass +++ b/factory/sass/components/_modals.sass @@ -21,6 +21,7 @@ width: 90% padding: 30px background-color: #FFF + color: $color-default margin: 30px auto position: relative overflow: hidden From bde06d08961a353cabc51976250058a237048eb8 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 13:27:19 -0300 Subject: [PATCH 05/20] =?UTF-8?q?Remove=20importa=C3=A7=C3=A3o=20da=20font?= =?UTF-8?q?e=20Roboto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #56 --- factory/sass/layouts/_base.sass | 2 +- factory/sass/run.sass | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/factory/sass/layouts/_base.sass b/factory/sass/layouts/_base.sass index 25d26d0..3d94aa9 100644 --- a/factory/sass/layouts/_base.sass +++ b/factory/sass/layouts/_base.sass @@ -11,7 +11,7 @@ html, body color: $color-default body - font-family: "Roboto", Helvetica, Arial, sans-serif + font-family: Helvetica, Arial, sans-serif font-size: 14px line-height: 1.42857 background-color: $body diff --git a/factory/sass/run.sass b/factory/sass/run.sass index c8a4713..4288e66 100644 --- a/factory/sass/run.sass +++ b/factory/sass/run.sass @@ -1,5 +1,3 @@ -@import url('https://fonts.googleapis.com/css?family=Roboto') - @import "config/mixins" @import "config/variables" From 989151b3d3b68efc9487789943c7f4ab6f56e47b Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 13:28:07 -0300 Subject: [PATCH 06/20] Remove cor de fundo da body --- factory/sass/layouts/_base.sass | 1 - 1 file changed, 1 deletion(-) diff --git a/factory/sass/layouts/_base.sass b/factory/sass/layouts/_base.sass index 3d94aa9..00d92c8 100644 --- a/factory/sass/layouts/_base.sass +++ b/factory/sass/layouts/_base.sass @@ -14,7 +14,6 @@ body font-family: Helvetica, Arial, sans-serif font-size: 14px line-height: 1.42857 - background-color: $body > footer, main > footer padding: 15px 5% From 96df80353034dcda875a65ae097b0d1ef16228a0 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 13:38:30 -0300 Subject: [PATCH 07/20] =?UTF-8?q?Aplica=20position=20absolute=20=C3=A0=20b?= =?UTF-8?q?ody?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- factory/sass/layouts/_base.sass | 1 + 1 file changed, 1 insertion(+) diff --git a/factory/sass/layouts/_base.sass b/factory/sass/layouts/_base.sass index 00d92c8..786dd67 100644 --- a/factory/sass/layouts/_base.sass +++ b/factory/sass/layouts/_base.sass @@ -14,6 +14,7 @@ body font-family: Helvetica, Arial, sans-serif font-size: 14px line-height: 1.42857 + position: absolute > footer, main > footer padding: 15px 5% From 9746779175154cbfc65dd81b016eee6398533809 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 15:38:18 -0300 Subject: [PATCH 08/20] =?UTF-8?q?Adiciona=20valida=C3=A7=C3=A3o=20e=20m?= =?UTF-8?q?=C3=A1scara=20para=20cpf,=20cnpj,=20cep-br,=20telefone-br,=20da?= =?UTF-8?q?ta=20(dd/mm/Y)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- factory/js/gainTime.js | 478 +++++++++++++++++++++++++++-------------- 1 file changed, 313 insertions(+), 165 deletions(-) diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index 4d56dec..32f8ba8 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -1,253 +1,401 @@ function makeA(e) { - e.addEventListener("click", function(t) { - var o = e.href.split("/"), - n = o[o.length - 1].split("#"), - a = document.location.toString().split("/"), - l = a[a.length - 1].split("#"); - if (f = n[1], void 0 != f && l[0] === n[0]) { - t.preventDefault(); - var r = document.scrollingElement || document.documentElement, - s = document.getElementById(f).offsetTop - 60; - smoothScroll(r, s, 600) - } - }) + e.addEventListener("click", function(t) { + var o = e.href.split("/"), + n = o[o.length - 1].split("#"), + a = document.location.toString().split("/"), + l = a[a.length - 1].split("#"); + if (f = n[1], void 0 != f && l[0] === n[0]) { + t.preventDefault(); + var r = document.scrollingElement || document.documentElement, + s = document.getElementById(f).offsetTop - 60; + smoothScroll(r, s, 600) + } + }) } function menuToggle(e) { - var t = e.nextElementSibling; - e.addEventListener("click", function(e) { - e.stopPropagation(), t.style.maxWidth ? t.style.removeProperty("max-width") : t.style.maxWidth = "400px" - }) + var t = e.nextElementSibling; + e.addEventListener("click", function(e) { + e.stopPropagation(), t.style.maxWidth ? t.style.removeProperty("max-width") : t.style.maxWidth = "400px" + }) } function closeMenus() { - menuToggles.forEach(function(e) { - e.nextElementSibling.style.removeProperty("max-width") - }) + menuToggles.forEach(function(e) { + e.nextElementSibling.style.removeProperty("max-width") + }) } function makeDropdown(e) { - e.setAttribute("role", "button"), e.setAttribute("tabindex", "0"), e.addEventListener("click", function(t) { - t.stopPropagation(), toogleDropdown(e) - }), [].slice.call(e.getElementsByTagName("ul")[0].getElementsByTagName("li")).forEach(function(i) { - i.setAttribute("tabindex", "-1") - }), e.addEventListener("keypress", function(t) { - 13 === t.keyCode && (toogleDropdown(e)), 27 === t.keyCode && closeDropdowns() - }), e.addEventListener("keydown", function(t) { - (38 === t.keyCode || 40 === t.keyCode) && (t.preventDefault(), dropdownsNavKeys(e, t.keyCode)) - }) + e.setAttribute("role", "button"), e.setAttribute("tabindex", "0"), e.addEventListener("click", function(t) { + t.stopPropagation(), toogleDropdown(e) + }), [].slice.call(e.getElementsByTagName("ul")[0].getElementsByTagName("li")).forEach(function(i) { + i.setAttribute("tabindex", "-1") + }), e.addEventListener("keypress", function(t) { + 13 === t.keyCode && (toogleDropdown(e)), 27 === t.keyCode && closeDropdowns() + }), e.addEventListener("keydown", function(t) { + (38 === t.keyCode || 40 === t.keyCode) && (t.preventDefault(), dropdownsNavKeys(e, t.keyCode)) + }) } function dropdownsNavKeys(e, k) { - var n = [].slice.call(e.getElementsByTagName("ul")[0].getElementsByTagName("li")), - s = n.indexOf(document.activeElement); - -1 == s && (s = n.indexOf(document.activeElement.parentElement)), 40 == k? s++: s--; + var n = [].slice.call(e.getElementsByTagName("ul")[0].getElementsByTagName("li")), + s = n.indexOf(document.activeElement); + -1 == s && (s = n.indexOf(document.activeElement.parentElement)), 40 == k? s++: s--; - if (s >= 0 && s < n.length) - (n[s].firstChild.nodeName == "A")? n[s].firstChild.focus(): n[s].focus(); + if (s >= 0 && s < n.length) + (n[s].firstChild.nodeName == "A")? n[s].firstChild.focus(): n[s].focus(); } function toogleDropdown(e) { - var t = e.getElementsByTagName("ul")[0], - o = !!t.style.display; - closeDropdowns(), o ? t.style.removeProperty("display") : t.style.display = "list-item" - e.focus(); + var t = e.getElementsByTagName("ul")[0], + o = !!t.style.display; + closeDropdowns(), o ? t.style.removeProperty("display") : t.style.display = "list-item" + e.focus(); } function closeDropdowns() { - dropdowns.forEach(function(e) { - e.getElementsByTagName("ul")[0].style.removeProperty("display") - }) + dropdowns.forEach(function(e) { + e.getElementsByTagName("ul")[0].style.removeProperty("display") + }) } function bar(e) { - var t = document.createElement("div"); - t.setAttribute("class", "percentage " + e.dataset.color), t.setAttribute("style", "width: " + e.dataset.percentage); - var o = document.createTextNode(e.dataset.text); - if ("undefined" != o.data) { - var n = document.createElement("span"); - n.appendChild(o), n.style.padding = "0 10px", t.appendChild(n), e.style.height = "20px" - } - e.appendChild(t) + var t = document.createElement("div"); + t.setAttribute("class", "percentage " + e.dataset.color), t.setAttribute("style", "width: " + e.dataset.percentage); + var o = document.createTextNode(e.dataset.text); + if ("undefined" != o.data) { + var n = document.createElement("span"); + n.appendChild(o), n.style.padding = "0 10px", t.appendChild(n), e.style.height = "20px" + } + e.appendChild(t) } function tooltip(e) { - e.style.position = "relative"; - var t = document.createTextNode(e.dataset.tooltip), - o = document.createElement("div"); - o.appendChild(t), o.setAttribute("class", "tooltip"), e.appendChild(o) + e.style.position = "relative"; + var t = document.createTextNode(e.dataset.tooltip), + o = document.createElement("div"); + o.appendChild(t), o.setAttribute("class", "tooltip"), e.appendChild(o) } function close(e) { - e.addEventListener("click", function(t) { - t.stopPropagation(), remove(e.parentElement) - }) + e.addEventListener("click", function(t) { + t.stopPropagation(), remove(e.parentElement) + }) } function fadeOut(e) { - function t() { - e.style.opacity = "0", e.style.padding = "0", e.style.maxHeight = "0px", clearInterval(o) - } - var o = setInterval(t, 1) + function t() { + e.style.opacity = "0", e.style.padding = "0", e.style.maxHeight = "0px", clearInterval(o) + } + var o = setInterval(t, 1) } function remove(e) { - e.parentElement.removeChild(e) + e.parentElement.removeChild(e) } function ask(e) { - e.addEventListener("click", function(t) { - return confirm(e.dataset.ask) ? void 0 : (t.preventDefault(), !1) - }) + e.addEventListener("click", function(t) { + return confirm(e.dataset.ask) ? void 0 : (t.preventDefault(), !1) + }) } -function formater(e) { +function formater(e, text) { + var n = text ? e.textContent: e.value; + var a = ""; + if (n) { + switch (e.dataset.validate) { + case "cpf": + a = preformatCpf(e, n); + break; + case "cnpj": + a = preformatCnpj(e, n); + break; + case "brPhone": + a = preformatPhone(e, n); + break; + case "cep": + a = preformatCep(e, n); + break; + case "date": + a = preformatDate(e, n); + break; + } + text && (e.innerHTML = a), e.value = a + } else text ? e.textContent = "": e.value = "" + + if (!text) { + e.addEventListener("keyup", function(t) { + switch (e.dataset.validate) { + case "date": + formatDate(e, t); + break; + } + }) + e.addEventListener("keydown", function(t) { - switch (e.dataset.validate) { - case "cpf": - formatCpf(e, t); - break; - case "cnpj": - formatCnpj(e, t); - break; - } + switch (e.dataset.validate) { + case "cpf": + formatCpf(e, t); + break; + case "cnpj": + formatCnpj(e, t); + break; + case "brPhone": + formatBrPhone(e, t); + break; + case "cep": + formatCep(e, t); + break; + } }) + } +} + +function onlyNumbers(t) { + if (isNaN(t.key) && ctrlButtons(t) && !t.ctrlKey && t.key != "Tab" && t.key != "ArrowLeft" && t.key != "ArrowRight" && t.key != "ArrowDown" && t.key != "ArrowUp" && t.key != "Enter" || " " == t.key) { + t.preventDefault(); + return false; + } +} + +function ctrlButtons(t) { + return 0 != t.keyCode && 8 != t.keyCode && 46 != t.keyCode; +} + +function preformatPhone(e, n, t){ + s2 = ("" + n).replace(/\D/g,""); + if (s2.length == 10) { + m = s2.match(/^(\d{2})?[- ]??[\s]?(\d{4})?[\s]?(\d{4})?(.*)?$/); + } else { + m = s2.match(/^(\d{2})?[- ]??[\s]?(\d{5})?[\s]?(\d{4})?(.*)?$/); + } + + return m ? "(" + m[1] + ") " + m[2] + "-" + m[3] : null; +} + +function preformatCpf(e, n, t){ + s2 = ("" + n).replace(/\D/g,""); + m = s2.match(/^(\d{3})?[- ]??[\s]?(\d{3})?[\s]?(\d{3})?(.*)?$/); + return m ? m[1] + "." + m[2] + "." + m[3] + "-" + m[4] : null; +} + +function preformatCnpj(e, n, t){ + s2 = ("" + n).replace(/\D/g,""); + m = s2.match(/^(\d{2})?[- ]??[\s]?(\d{3})?[\s]?(\d{3})?(\d{4})?(\d{2})?(.*)?$/); + return m ? m[1] + "." + m[2] + "." + m[3] + "/" + m[4] + "-" + m[5] : null; +} + +function preformatCep(e, n, t){ + s2 = ("" + n).replace(/\D/g,""); + m = s2.match(/^(\d{5})?[- ]??[\s]?(\d{3})?(.*)?$/); + return m ? m[1] + "-" + m[2]: null; +} + +function preformatDate(e, n, t){ + s2 = ("" + n).replace(/\D/g,""); + m = s2.match(/^(\d{2})?[- ]??[\s]?(\d{2})?(.*)?$/); + return m ? m[1] + "/" + m[2] + "/" + m[3]: null; } function formatCpf(e, t) { - 0 != t.keyCode && 8 != t.keyCode && 46 != t.keyCode && (3 != e.value.length && 7 != e.value.length || (e.value = e.value + "."), 11 == e.value.length && (e.value = e.value + "-")) + onlyNumbers(t); + ctrlButtons(t) && (3 != e.value.length && 7 != e.value.length || (e.value = e.value + "."), 11 == e.value.length && (e.value = e.value + "-")) } function formatCnpj(e, t) { - 0 != t.keyCode && 8 != t.keyCode && 46 != t.keyCode && (2 != e.value.length && 6 != e.value.length || (e.value = e.value + "."), 10 == e.value.length && (e.value = e.value + "/"), 15 == e.value.length && (e.value = e.value + "-")) + onlyNumbers(t); + ctrlButtons(t) && (2 != e.value.length && 6 != e.value.length || (e.value = e.value + "."), 10 == e.value.length && (e.value = e.value + "/"), 15 == e.value.length && (e.value = e.value + "-")) +} + +function formatBrPhone(e, t) { + onlyNumbers(t); + ctrlButtons(t) && ((0 != e.value.length && e.selectionStart > 1 || t.key == "Tab" || t.key == "Enter" || t.ctrlKey) || (e.value = "\("), e.value[5] == "9" && 10 == e.value.length && (e.value = e.value + "-"), e.value[5] != "9" && 9 == e.value.length && (e.value = e.value + "-"), (3 != e.value.length || (e.value = e.value + "\) "))) +} + +function formatCep(e, t) { + onlyNumbers(t); + ctrlButtons(t) && (5 != e.value.length || (e.value = e.value + "-")) +} + +function formatDate(e, t) { + onlyNumbers(t); + ctrlButtons(t) && (2 != e.value.length && 5 != e.value.length || (e.value = e.value + "/")) } + function validates(e) { - e.addEventListener("blur", function(t) { - switchValidations(e) - }) + e.addEventListener("blur", function(t) { + switchValidations(e) + }) } function switchValidations(e) { - switch (e.dataset.validate) { - case "text": - searcher(e, /^[a-zA-ZÃẼĨÕŨãẽĩõũÁÉÍÓÚáéíóúÂÊÎÔÛâêîôûÀÈÌÒÙàèìòùÄËÏÖÜäëïöü' ]*$/); - break; - case "num": - searcher(e, /^[\d]*$/g); - break; - case "email": - searcher(e, /^(([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+(\.([A-Za-z]{2,4}))*)*$/); - break; - case "cpf": - cpf(e.value) || "" == e.value ? validsIt(e) : invalidsIt(e, "Este CPF é inválido."); - break; - case "cnpj": - cnpj(e.value) || "" == e.value ? validsIt(e) : invalidsIt(e, "Este CNPJ é inválido."); - break; - default: - searcher(e, new RegExp(e.dataset.validate)) - } + switch (e.dataset.validate) { + case "text": + searcher(e, /^[a-zA-ZÃẼĨÕŨãẽĩõũÁÉÍÓÚáéíóúÂÊÎÔÛâêîôûÀÈÌÒÙàèìòùÄËÏÖÜäëïöü' ]*$/); + break; + case "num": + searcher(e, /^[\d]*$/g); + break; + case "email": + searcher(e, /^(([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+(\.([A-Za-z]{2,4}))*)*$/); + break; + case "cpf": + validateCpf(e.value) || "" == e.value ? validsIt(e) : invalidsIt(e, "Este CPF é inválido."); + break; + case "cnpj": + validateCnpj(e.value) || "" == e.value ? validsIt(e) : invalidsIt(e, "Este CNPJ é inválido."); + break; + case "brPhone": + validateBrPhone(e.value) || "" == e.value ? validsIt(e) : invalidsIt(e, "Este Telefone é inválido."); + break; + case "date": + validateDate(e.value) || "" == e.value ? validsIt(e) : invalidsIt(e, "Esta data é inválida."); + break; + case "cep": + break; + default: + searcher(e, new RegExp(e.dataset.validate)) + } } function invalidsIt(a, b) { - a.style.border = '1px solid #F00', (b)? a.setCustomValidity(b) : a.setCustomValidity("Invalid field."); + a.style.border = '1px solid #F00', (b)? a.setCustomValidity(b) : a.setCustomValidity("Invalid field."); } function validsIt(a) { - a.style.removeProperty("border"), a.setCustomValidity(""); + a.style.removeProperty("border"), a.setCustomValidity(""); } function searcher(e, t) { - null == e.value.match(t) ? invalidsIt(e, false) : validsIt(e) + null == e.value.match(t) ? invalidsIt(e, false) : validsIt(e) +} + +function validateBrPhone(e) { + var p = e.replace(/\D/g, ''); + + if (!(p.length >= 10 && p.length <= 11) || (p.length == 11 && parseInt(p.substring(2, 3)) != 9)) return !1; + + var ddds = [ + 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, + 22, 24, 27, 28, 31, 32, 33, 34, 35, 37, + 38, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 51, 53, 54, 55, 61, 62, 64, 63, 65, 66, + 67, 68, 69, 71, 73, 74, 75, 77, 79, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, + 93, 94, 95, 96, 97, 98, 99]; + + return !(ddds.indexOf(parseInt(p.substring(0, 2))) == -1); } -function cpf(e) { - var t = e.replace(/\./g, ""); - t = t.replace(/\-/g, ""); - var o, n; - if (o = 0, "00000000000" == t) return !1; - for (i = 1; i <= 9; i++) o += parseInt(t.substring(i - 1, i)) * (11 - i); - if (n = 10 * o % 11, 10 != n && 11 != n || (n = 0), n != parseInt(t.substring(9, 10))) return !1; - for (o = 0, i = 1; i <= 10; i++) o += parseInt(t.substring(i - 1, i)) * (12 - i); - return n = 10 * o % 11, 10 != n && 11 != n || (n = 0), n == parseInt(t.substring(10, 11)) +function validateDate(e) { + var p = e.replace(/\D/g, ''); + + var day = parseInt(p.substring(0,2)); + var month = parseInt(p.substring(2,4)); + var year = parseInt(p.substring(4)); + + if (day > 30 && (month == 4 || month == 6 || month == 9 || month==11)) return !1; + if (month == 2) { + if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) { + if (day > 29) return !1; + } + else if (day > 28) return !1; + } + if (p.length < 5 || month > 12 || day > 31 || day < 1) return !1; + + return 1; } -function cnpj(u) { - if (u = u.replace(/[^\d]+/g, ""), "" == u) return !1; - if (14 != u.length) return !1; - if ("00000000000000" == u || "11111111111111" == u || "22222222222222" == u || "33333333333333" == u || "44444444444444" == u || "55555555555555" == u || "66666666666666" == u || "77777777777777" == u || "88888888888888" == u || "99999999999999" == u) return !1; - for (n = u.substring(0, 12), d = u.substring(12), t = 12, s = 0, p = 5, i = t; i >= 1; i--) s += n.charAt(t - i) * p--, p < 2 && (p = 9); - if (r = s % 11 < 2 ? 0 : 11 - s % 11, r != d.charAt(0)) return !1; - for (n = u.substring(0, 13), t = 13, s = 0, p = 6, i = t; i >= 1; i--) s += n.charAt(t - i) * p--, p < 2 && (p = 9); - return r = s % 11 < 2 ? 0 : 11 - s % 11, r != d.charAt(1) ? !1 : !0 +function validateCpf(e) { + var t = e.replace(/\./g, ""); + t = t.replace(/\-/g, ""); + var o, n; + if (o = 0, "00000000000" == t) return !1; + for (i = 1; i <= 9; i++) o += parseInt(t.substring(i - 1, i)) * (11 - i); + if (n = 10 * o % 11, 10 != n && 11 != n || (n = 0), n != parseInt(t.substring(9, 10))) return !1; + for (o = 0, i = 1; i <= 10; i++) o += parseInt(t.substring(i - 1, i)) * (12 - i); + return n = 10 * o % 11, 10 != n && 11 != n || (n = 0), n == parseInt(t.substring(10, 11)) +} + +function validateCnpj(u) { + if (u = u.replace(/[^\d]+/g, ""), "" == u) return !1; + if (14 != u.length) return !1; + if ("00000000000000" == u || "11111111111111" == u || "22222222222222" == u || "33333333333333" == u || "44444444444444" == u || "55555555555555" == u || "66666666666666" == u || "77777777777777" == u || "88888888888888" == u || "99999999999999" == u) return !1; + for (n = u.substring(0, 12), d = u.substring(12), t = 12, s = 0, p = 5, i = t; i >= 1; i--) s += n.charAt(t - i) * p--, p < 2 && (p = 9); + if (r = s % 11 < 2 ? 0 : 11 - s % 11, r != d.charAt(0)) return !1; + for (n = u.substring(0, 13), t = 13, s = 0, p = 6, i = t; i >= 1; i--) s += n.charAt(t - i) * p--, p < 2 && (p = 9); + return r = s % 11 < 2 ? 0 : 11 - s % 11, r != d.charAt(1) ? !1 : !0 } function closeModal(e) { - e.addEventListener("click", function(t) { - t.stopPropagation(), e.parentElement.parentElement.removeAttribute("style") - document.getElementsByTagName('body')[0].style.overflow = "" - }) + e.addEventListener("click", function(t) { + t.stopPropagation(), e.parentElement.parentElement.removeAttribute("style") + document.getElementsByTagName('body')[0].style.overflow = "" + }) } + var smoothScroll = function(e, t, o) { - if (t = Math.round(t), o = Math.round(o), 0 > o) return Promise.reject("bad duration"); - if (0 === o) return e.scrollTop = t, Promise.resolve(); - var n = Date.now(), - a = n + o, - l = e.scrollTop, - r = t - l, - s = function(e, t, o) { - if (e >= o) return 0; - if (o >= t) return 1; - var n = (o - e) / (t - e); - return n * n * (3 - 2 * n) - }; - return new Promise(function(t, o) { - var i = e.scrollTop, - c = function() { - var o = Date.now(), - d = s(n, a, o), - u = Math.round(l + r * d); - return e.scrollTop = u, o >= a ? void t() : e.scrollTop === i && e.scrollTop !== u ? void t() : (i = e.scrollTop, void setTimeout(c, 0)) - }; - setTimeout(c, 0) - }) + if (t = Math.round(t), o = Math.round(o), 0 > o) return Promise.reject("bad duration"); + if (0 === o) return e.scrollTop = t, Promise.resolve(); + var n = Date.now(), + a = n + o, + l = e.scrollTop, + r = t - l, + s = function(e, t, o) { + if (e >= o) return 0; + if (o >= t) return 1; + var n = (o - e) / (t - e); + return n * n * (3 - 2 * n) + }; + return new Promise(function(t, o) { + var i = e.scrollTop, + c = function() { + var o = Date.now(), + d = s(n, a, o), + u = Math.round(l + r * d); + return e.scrollTop = u, o >= a ? void t() : e.scrollTop === i && e.scrollTop !== u ? void t() : (i = e.scrollTop, void setTimeout(c, 0)) + }; + setTimeout(c, 0) + }) }; gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = [].slice.call(document.querySelectorAll("[data-modal]")), closeModals = [].slice.call(document.getElementsByClassName("modal-close")), askers = [].slice.call(document.querySelectorAll("[data-ask]")), as = [].slice.call(document.getElementsByTagName("a")), closes = [].slice.call(document.getElementsByClassName("close")), deletes = [].slice.call(document.getElementsByClassName("deleter")), bars = [].slice.call(document.getElementsByClassName("bar")), toValidate = [].slice.call(document.querySelectorAll("[data-validate]")), dropdowns = [].slice.call(document.querySelectorAll(".dropdown, .dropdown-right, .dropdown-left, .dropup, .dropup-left, .dropup-right")), menuToggles = [].slice.call(document.getElementsByClassName("menu-toggle")), tooltips = [].slice.call(document.querySelectorAll("[data-tooltip]")), tooltips.forEach(function(e) { - tooltip(e) + tooltip(e) }), menuToggles.forEach(function(e) { - menuToggle(e) + menuToggle(e) }), bars.forEach(function(e) { - bar(e) + bar(e) }), closes.forEach(function(e) { - close(e) + close(e) }), deletes.forEach(function(e) { - deleter(e) + deleter(e) }), dropdowns.forEach(function(e) { - makeDropdown(e) + makeDropdown(e) }), as.forEach(function(e) { - makeA(e) + makeA(e) }), askers.forEach(function(e) { - ask(e) + ask(e) }), toValidate.forEach(function(e) { - formater(e), validates(e), switchValidations(e) + formater(e), validates(e), switchValidations(e) }), closeModals.forEach(function(e) { - closeModal(e) + closeModal(e) }), document.addEventListener("click", function() { - closeMenus(), closeDropdowns() + closeMenus(), closeDropdowns() }), gtModals.forEach(function(e) { - e.addEventListener("click", function(t) { - "gt-modal" == t.target.className && e.removeAttribute("style"); document.getElementsByTagName('body')[0].style.overflow = "" - }) + e.addEventListener("click", function(t) { + "gt-modal" == t.target.className && e.removeAttribute("style"); document.getElementsByTagName('body')[0].style.overflow = "" + }) }), document.addEventListener("keypress", function(e) { - 27 == e.keyCode && gtModals.forEach(function(e) { - e.removeAttribute("style") - document.getElementsByTagName('body')[0].style.overflow = "" - }) + 27 == e.keyCode && gtModals.forEach(function(e) { + e.removeAttribute("style") + document.getElementsByTagName('body')[0].style.overflow = "" + }) }), modals.forEach(function(e) { - e.addEventListener("click", function(t) { - var o = document.getElementById(e.dataset.modal); - o.parentElement.style.display = "block" - document.getElementsByTagName('body')[0].style.overflow = "hidden" - }) + e.addEventListener("click", function(t) { + var o = document.getElementById(e.dataset.modal); + o.parentElement.style.display = "block" + document.getElementsByTagName('body')[0].style.overflow = "hidden" + }) }); From 628f0c711c6683bc029cb01e01be0138b5f3c7b0 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 18:00:29 -0300 Subject: [PATCH 09/20] =?UTF-8?q?Adiciona=20vers=C3=A3o=20de=20modal=20con?= =?UTF-8?q?trol=C3=A1vel=20via=20TAB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #53 --- factory/js/gainTime.js | 23 ++++++++++++++++++++++- factory/sass/components/_modals.sass | 9 ++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index 32f8ba8..a170114 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -385,7 +385,10 @@ gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = closeMenus(), closeDropdowns() }), gtModals.forEach(function(e) { e.addEventListener("click", function(t) { - "gt-modal" == t.target.className && e.removeAttribute("style"); document.getElementsByTagName('body')[0].style.overflow = "" + if ("gt-modal" == t.target.className) { + e.removeAttribute("style") + document.getElementsByTagName('body')[0].style.overflow = "" + } }) }), document.addEventListener("keypress", function(e) { 27 == e.keyCode && gtModals.forEach(function(e) { @@ -395,7 +398,25 @@ gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = }), modals.forEach(function(e) { e.addEventListener("click", function(t) { var o = document.getElementById(e.dataset.modal); + o.parentElement.style.display = "block" document.getElementsByTagName('body')[0].style.overflow = "hidden" + var focusable = [].slice.call(o.querySelectorAll('button, [href], input, select, textarea, [tabindex]')); + var first = focusable[0]; + var last = focusable[focusable.length - 1]; + first.focus() + + first.addEventListener("keypress", function(e) { + if (e.shiftKey && e.key == "Tab") { + e.preventDefault(); + last.focus(); + } + }) + last.addEventListener("keypress", function(e) { + if (!e.shiftKey && e.key == "Tab") { + e.preventDefault(); + first.focus() + } + }) }) }); diff --git a/factory/sass/components/_modals.sass b/factory/sass/components/_modals.sass index e334eaf..e27dea7 100644 --- a/factory/sass/components/_modals.sass +++ b/factory/sass/components/_modals.sass @@ -19,12 +19,13 @@ .modal width: 90% - padding: 30px background-color: #FFF color: $color-default margin: 30px auto position: relative overflow: hidden + max-width: 600px + padding: 30px +border-radius(3px) &-close font-size: 35px @@ -38,6 +39,12 @@ +transition() &:hover color: #AAA + &-header + border-bottom: 1px solid #e5e5e5 + + &-footer + border-top: 1px solid #e5e5e5 + &-body overflow-y: auto max-height: calc(100% - 120px) From 1ee1ce0e98ffcdec952536319f3b7884ea0be28c Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 18:04:02 -0300 Subject: [PATCH 10/20] =?UTF-8?q?Remove=20c=C3=B3digo=20sobrescrito=20de?= =?UTF-8?q?=20css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs #53 --- factory/sass/components/_modals.sass | 3 --- 1 file changed, 3 deletions(-) diff --git a/factory/sass/components/_modals.sass b/factory/sass/components/_modals.sass index e27dea7..2c6e264 100644 --- a/factory/sass/components/_modals.sass +++ b/factory/sass/components/_modals.sass @@ -1,9 +1,6 @@ [data-modal] cursor: pointer -.modal - max-width: 500px - .gt-modal position: fixed width: 100% From 5e797724b341001c6b0c816f5c52d220ff483a32 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 18:17:13 -0300 Subject: [PATCH 11/20] Normaliza tamanho de fonte do h1 --- factory/sass/layouts/_base.sass | 8 ++++++-- factory/sass/run.sass | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/factory/sass/layouts/_base.sass b/factory/sass/layouts/_base.sass index 786dd67..eaf6858 100644 --- a/factory/sass/layouts/_base.sass +++ b/factory/sass/layouts/_base.sass @@ -17,20 +17,24 @@ body position: absolute > footer, main > footer padding: 15px 5% + +article, aside, nav, section + h1 + font-size: 2em %container margin: 30px auto padding: 30px width: calc(100% - 10%) +box-shadow (0 1px 1px 0 rgba(0,0,0,0.06),0 2px 5px 0 rgba(0,0,0,0.2)) -.panel +.painel section @extend %container .container @extend %container -section +body > section, .gt-section width: 100% padding: 30px 5% margin: 0 diff --git a/factory/sass/run.sass b/factory/sass/run.sass index 4288e66..9d90416 100644 --- a/factory/sass/run.sass +++ b/factory/sass/run.sass @@ -18,9 +18,9 @@ @import "components/highlight" @import "components/modals" -@import "helpers/colors" -@import "helpers/singles" -@import "helpers/garnishes" @import "helpers/grid-visibility" @import "helpers/text" @import "helpers/grid" +@import "helpers/colors" +@import "helpers/singles" +@import "helpers/garnishes" From c8da0f8305b5528bf59fd5799dac5104dc77c5d1 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 19:02:06 -0300 Subject: [PATCH 12/20] Adiciona componente cards e remove auth --- factory/sass/components/_auth.sass | 11 ------ factory/sass/components/_cards.sass | 54 +++++++++++++++++++++++++++++ factory/sass/run.sass | 2 +- 3 files changed, 55 insertions(+), 12 deletions(-) delete mode 100644 factory/sass/components/_auth.sass create mode 100644 factory/sass/components/_cards.sass diff --git a/factory/sass/components/_auth.sass b/factory/sass/components/_auth.sass deleted file mode 100644 index f7ebea0..0000000 --- a/factory/sass/components/_auth.sass +++ /dev/null @@ -1,11 +0,0 @@ -.login-card - top: 70px - margin: 0 auto!important - background-color: $base - +border-radius(3px) - max-width: 520px - position: relative - -@media (max-width: 768px) - .login-card - top: 30px diff --git a/factory/sass/components/_cards.sass b/factory/sass/components/_cards.sass new file mode 100644 index 0000000..f3e179d --- /dev/null +++ b/factory/sass/components/_cards.sass @@ -0,0 +1,54 @@ +.card + position: relative + display: -webkit-box + display: -ms-flexbox + display: flex + -webkit-box-orient: vertical + -webkit-box-direction: normal + -ms-flex-direction: column + flex-direction: column + min-width: 0 + word-wrap: break-word + background-color: #fff + background-clip: border-box + border: 1px solid rgba(0,0,0,.125) + border-radius: .25rem + margin-bottom: 15px + color: #494d55!important + transition: all .2s + overflow: hidden + +.card.hoverable:hover + cursor: pointer + -webkit-transform: scale(1.01) + -moz-transform: scale(1.01) + -ms-transform: scale(1.01) + -o-transform: scale(1.01) + transform: scale(1.01) + box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.2), 0 3px 3px 0 rgba(0, 0, 0, 0.15) + +.card-img + width: 100% + background-size: 100% + background-repeat: no-repeat + overflow: hidden + + img + width: 100% + border-bottom: 1px solid #f0f0f0 + +.card-body + -webkit-box-flex: 1 + -ms-flex: 1 1 auto + flex: 1 1 auto + padding: 1.25rem + +.card-title + margin-bottom: .75rem + font-size: 18px + font-weight: 700 + margin-top: 10px + text-overflow: ellipsis + overflow: hidden + white-space: nowrap + text-transform: capitalize diff --git a/factory/sass/run.sass b/factory/sass/run.sass index 9d90416..929ae92 100644 --- a/factory/sass/run.sass +++ b/factory/sass/run.sass @@ -6,7 +6,7 @@ @import "layouts/tables" @import "layouts/flexes" -@import "components/auth" +@import "components/cards" @import "components/graphs" @import "components/buttons" @import "components/tags" From c16c5af26624782a64bd701ad80b618a256004b7 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 19:09:10 -0300 Subject: [PATCH 13/20] modifica efeito de hover para cards --- factory/sass/components/_cards.sass | 9 +++------ factory/sass/helpers/_colors.sass | 3 +++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/factory/sass/components/_cards.sass b/factory/sass/components/_cards.sass index f3e179d..7011b5c 100644 --- a/factory/sass/components/_cards.sass +++ b/factory/sass/components/_cards.sass @@ -20,12 +20,9 @@ .card.hoverable:hover cursor: pointer - -webkit-transform: scale(1.01) - -moz-transform: scale(1.01) - -ms-transform: scale(1.01) - -o-transform: scale(1.01) - transform: scale(1.01) - box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.2), 0 3px 3px 0 rgba(0, 0, 0, 0.15) + border-bottom-color: #959595 + border-top-color: #959595 + background-color: #f6f6f6cc .card-img width: 100% diff --git a/factory/sass/helpers/_colors.sass b/factory/sass/helpers/_colors.sass index 10e0f30..f3fcfb9 100644 --- a/factory/sass/helpers/_colors.sass +++ b/factory/sass/helpers/_colors.sass @@ -1,3 +1,6 @@ +.transparent + background-color: transparent + %badgeInColor .badge background: #FFF From 85fd72ea920efb110b7eabf4ea37055113a53063 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 19:50:08 -0300 Subject: [PATCH 14/20] Adiciona o componente banner --- factory/sass/components/_banner.sass | 56 ++++++++++++++++++++++++++++ factory/sass/components/_cards.sass | 2 +- factory/sass/helpers/_singles.sass | 8 ++++ factory/sass/run.sass | 1 + 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 factory/sass/components/_banner.sass diff --git a/factory/sass/components/_banner.sass b/factory/sass/components/_banner.sass new file mode 100644 index 0000000..322e53b --- /dev/null +++ b/factory/sass/components/_banner.sass @@ -0,0 +1,56 @@ +.banner + height: 408px + padding: 0px + position: relative + @media (max-width: 768px) + button + padding: 0px 15px !important + height: 41px + .cover-box + height: 408px + overflow: hidden + position: absolute + width: 100% + height: 100% + z-index: 0 + .cover + background-position: right + background-attachment: fixed + transform: scaleY(1.1) + position: absolute + width: 100% + height: 100% + background-color: #333 + z-index: 0 + top: 0 + .centerex + background: rgba(0, 0, 0, 0.2) + height: 100% + width: 100% + z-index: 1 + position: relative + + h1 + color: #FFF + font-size: 40px + text-transform: capitalize + + input + min-width: 50% + width: 60% + text-align: left + height: 40px + + input, button + border: 0px + font-size: 18px + padding: 10px + + button + width: 200px + +@keyframes parallax + 0% + transform: scaleY(1) + 100% + transform: scaleY(1.1) diff --git a/factory/sass/components/_cards.sass b/factory/sass/components/_cards.sass index 7011b5c..1bdefa7 100644 --- a/factory/sass/components/_cards.sass +++ b/factory/sass/components/_cards.sass @@ -12,7 +12,7 @@ background-color: #fff background-clip: border-box border: 1px solid rgba(0,0,0,.125) - border-radius: .25rem + +border-radius(3px) margin-bottom: 15px color: #494d55!important transition: all .2s diff --git a/factory/sass/helpers/_singles.sass b/factory/sass/helpers/_singles.sass index 0a0c670..223c013 100644 --- a/factory/sass/helpers/_singles.sass +++ b/factory/sass/helpers/_singles.sass @@ -36,17 +36,25 @@ clear: both display: table +.full-bg + background-size: cover + background-repeat: no-repeat + .brand max-height: 100px .small + width: 300px max-width: 300px .medium + width: 700px max-width: 700px .large + width: 1200px max-width: 1200px .full width: 100% + max-width: 100% .fixed position: fixed diff --git a/factory/sass/run.sass b/factory/sass/run.sass index 929ae92..a7bd95c 100644 --- a/factory/sass/run.sass +++ b/factory/sass/run.sass @@ -6,6 +6,7 @@ @import "layouts/tables" @import "layouts/flexes" +@import "components/banner" @import "components/cards" @import "components/graphs" @import "components/buttons" From d01554ae20c818dc106a294e9bc672e44f8ee44b Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Wed, 14 Mar 2018 23:06:40 -0300 Subject: [PATCH 15/20] =?UTF-8?q?Melhora=20componente=20vertical-list,=20c?= =?UTF-8?q?riando=20extens=C3=A3o=20vertical-list-table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- factory/js/gainTime.js | 16 +++++------- factory/sass/components/_modals.sass | 2 +- factory/sass/components/_vertical-list.sass | 29 +++++++++++++++++++++ factory/sass/run.sass | 1 + 4 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 factory/sass/components/_vertical-list.sass diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index a170114..579f9d0 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -331,10 +331,8 @@ function validateCnpj(u) { } function closeModal(e) { - e.addEventListener("click", function(t) { - t.stopPropagation(), e.parentElement.parentElement.removeAttribute("style") - document.getElementsByTagName('body')[0].style.overflow = "" - }) + e.removeAttribute("style") + document.getElementsByTagName('body')[0].style.overflow = "" } var smoothScroll = function(e, t, o) { @@ -361,7 +359,7 @@ var smoothScroll = function(e, t, o) { setTimeout(c, 0) }) }; -gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = [].slice.call(document.querySelectorAll("[data-modal]")), closeModals = [].slice.call(document.getElementsByClassName("modal-close")), askers = [].slice.call(document.querySelectorAll("[data-ask]")), as = [].slice.call(document.getElementsByTagName("a")), closes = [].slice.call(document.getElementsByClassName("close")), deletes = [].slice.call(document.getElementsByClassName("deleter")), bars = [].slice.call(document.getElementsByClassName("bar")), toValidate = [].slice.call(document.querySelectorAll("[data-validate]")), dropdowns = [].slice.call(document.querySelectorAll(".dropdown, .dropdown-right, .dropdown-left, .dropup, .dropup-left, .dropup-right")), menuToggles = [].slice.call(document.getElementsByClassName("menu-toggle")), tooltips = [].slice.call(document.querySelectorAll("[data-tooltip]")), tooltips.forEach(function(e) { +gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = [].slice.call(document.querySelectorAll("[data-modal]")), askers = [].slice.call(document.querySelectorAll("[data-ask]")), as = [].slice.call(document.getElementsByTagName("a")), closes = [].slice.call(document.getElementsByClassName("close")), deletes = [].slice.call(document.getElementsByClassName("deleter")), bars = [].slice.call(document.getElementsByClassName("bar")), toValidate = [].slice.call(document.querySelectorAll("[data-validate]")), dropdowns = [].slice.call(document.querySelectorAll(".dropdown, .dropdown-right, .dropdown-left, .dropup, .dropup-left, .dropup-right")), menuToggles = [].slice.call(document.getElementsByClassName("menu-toggle")), tooltips = [].slice.call(document.querySelectorAll("[data-tooltip]")), tooltips.forEach(function(e) { tooltip(e) }), menuToggles.forEach(function(e) { menuToggle(e) @@ -379,15 +377,13 @@ gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = ask(e) }), toValidate.forEach(function(e) { formater(e), validates(e), switchValidations(e) -}), closeModals.forEach(function(e) { - closeModal(e) }), document.addEventListener("click", function() { closeMenus(), closeDropdowns() }), gtModals.forEach(function(e) { e.addEventListener("click", function(t) { - if ("gt-modal" == t.target.className) { - e.removeAttribute("style") - document.getElementsByTagName('body')[0].style.overflow = "" + t.stopPropagation(); + if (-1 < t.target.className.indexOf("gt-modal") || -1 < t.target.className.indexOf("modal-close")) { + closeModal(e); } }) }), document.addEventListener("keypress", function(e) { diff --git a/factory/sass/components/_modals.sass b/factory/sass/components/_modals.sass index 2c6e264..c1d239f 100644 --- a/factory/sass/components/_modals.sass +++ b/factory/sass/components/_modals.sass @@ -24,7 +24,7 @@ max-width: 600px padding: 30px +border-radius(3px) - &-close + > .modal-close font-size: 35px position: absolute top: 15px diff --git a/factory/sass/components/_vertical-list.sass b/factory/sass/components/_vertical-list.sass new file mode 100644 index 0000000..8f40683 --- /dev/null +++ b/factory/sass/components/_vertical-list.sass @@ -0,0 +1,29 @@ +.vertical-list + & > * + display: block!important + margin: 5px 0 + + &-table + padding: 0 + overflow: hidden + +border-radius(3px) + + & > * + display: block!important + padding: 8px 15px + margin: 0 + width: 100% + border: 0 + +border-radius(0) + &.active + background-color: #56BFF6 + &.bordered + border-collapse: collapse + border: 1px solid #bcbcbc + border-bottom: none + & > * + border-collapse: collapse + border-bottom: 1px solid #bcbcbc + &.striped + & > *:nth-child(even) + background-color: #E6E6E6 diff --git a/factory/sass/run.sass b/factory/sass/run.sass index a7bd95c..75d47f3 100644 --- a/factory/sass/run.sass +++ b/factory/sass/run.sass @@ -18,6 +18,7 @@ @import "components/tooltips" @import "components/highlight" @import "components/modals" +@import "components/vertical-list" @import "helpers/grid-visibility" @import "helpers/text" From 106b5bb4955da886f98cdc539ca8c693fa6b6d59 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Fri, 16 Mar 2018 09:16:54 -0300 Subject: [PATCH 16/20] Bloqueia letras no campo data-validate='date' --- factory/js/gainTime.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index 579f9d0..e06b46a 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -137,17 +137,20 @@ function formater(e, text) { e.addEventListener("keydown", function(t) { switch (e.dataset.validate) { case "cpf": - formatCpf(e, t); - break; + formatCpf(e, t); + break; case "cnpj": - formatCnpj(e, t); - break; + formatCnpj(e, t); + break; case "brPhone": - formatBrPhone(e, t); - break; + formatBrPhone(e, t); + break; case "cep": - formatCep(e, t); - break; + formatCep(e, t); + break; + case "date": + onlyNumbers(t); + break; } }) } From 7393fe531dfffedef4500e2475880909ae8c8c35 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Fri, 16 Mar 2018 13:02:17 -0300 Subject: [PATCH 17/20] =?UTF-8?q?Melhora=20m=C3=A1scaras=20de=20data-valid?= =?UTF-8?q?ate=20Corrige=20bug=20de=20fechamento=20de=20modal=20com=20esc?= =?UTF-8?q?=20no=20chrome?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- factory/js/gainTime.js | 119 ++++++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 50 deletions(-) diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index e06b46a..5a74d53 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -101,59 +101,72 @@ function ask(e) { }) } -function formater(e, text) { +function preformat(e, text) { var n = text ? e.textContent: e.value; + var a = ""; + var s = text ? text: e.dataset.validate; if (n) { + switch (s) { + case "cpf": + a = preformatCpf(n); + break; + case "cnpj": + a = preformatCnpj(n); + break; + case "brPhone": + a = preformatPhone(n); + break; + case "cep": + a = preformatCep(n); + break; + case "date": + a = preformatDate(n); + break; + } + text && (e.innerHTML = a), e.value = a + } else text ? e.textContent = "": e.value = "" +} + +function formater(e) { + preformat(e); + + e.addEventListener("keyup", function(t) { + switch (e.dataset.validate) { + case "date": + if (isPaste(e, t)) preformat(e) + else formatDate(e, t); + break; + default: + if (isPaste(e, t)) preformat(e) + break; + } + }) + + e.addEventListener("keydown", function(t) { switch (e.dataset.validate) { case "cpf": - a = preformatCpf(e, n); + formatCpf(e, t); break; case "cnpj": - a = preformatCnpj(e, n); + formatCnpj(e, t); break; case "brPhone": - a = preformatPhone(e, n); + formatBrPhone(e, t); break; case "cep": - a = preformatCep(e, n); + formatCep(e, t); break; case "date": - a = preformatDate(e, n); + onlyNumbers(t); break; } - text && (e.innerHTML = a), e.value = a - } else text ? e.textContent = "": e.value = "" + }) - if (!text) { - e.addEventListener("keyup", function(t) { - switch (e.dataset.validate) { - case "date": - formatDate(e, t); - break; - } - }) +} - e.addEventListener("keydown", function(t) { - switch (e.dataset.validate) { - case "cpf": - formatCpf(e, t); - break; - case "cnpj": - formatCnpj(e, t); - break; - case "brPhone": - formatBrPhone(e, t); - break; - case "cep": - formatCep(e, t); - break; - case "date": - onlyNumbers(t); - break; - } - }) - } +function isPaste(e, t) { + return (t.ctrlKey && t.keyCode == 86) } function onlyNumbers(t) { @@ -167,38 +180,43 @@ function ctrlButtons(t) { return 0 != t.keyCode && 8 != t.keyCode && 46 != t.keyCode; } -function preformatPhone(e, n, t){ - s2 = ("" + n).replace(/\D/g,""); - if (s2.length == 10) { - m = s2.match(/^(\d{2})?[- ]??[\s]?(\d{4})?[\s]?(\d{4})?(.*)?$/); +function preformatPhone(n) { + var s2 = ("" + n).replace(/\D/g,""); + if (s2.length <= 10) { + m = s2.match(/^(\d{1,2})?[- ]?(\d{1,4})?(\d{1,4})?(.*)?$/); } else { - m = s2.match(/^(\d{2})?[- ]??[\s]?(\d{5})?[\s]?(\d{4})?(.*)?$/); + m = s2.match(/^(\d{1,2})?[- ]?(\d{1,5})?(\d{1,4})?(.*)?$/); } + for (var i = 1; i <= 3; i++) if (!m[i]) m[i] = ""; return m ? "(" + m[1] + ") " + m[2] + "-" + m[3] : null; } -function preformatCpf(e, n, t){ +function preformatCpf(n) { s2 = ("" + n).replace(/\D/g,""); - m = s2.match(/^(\d{3})?[- ]??[\s]?(\d{3})?[\s]?(\d{3})?(.*)?$/); + m = s2.match(/^(\d{1,3})?[- ]??[\s]?(\d{1,3})?[\s]?(\d{1,3})?(.*)?$/); + for (var i = 1; i <= 4; i++) if (!m[i]) m[i] = ""; return m ? m[1] + "." + m[2] + "." + m[3] + "-" + m[4] : null; } -function preformatCnpj(e, n, t){ +function preformatCnpj(n) { s2 = ("" + n).replace(/\D/g,""); - m = s2.match(/^(\d{2})?[- ]??[\s]?(\d{3})?[\s]?(\d{3})?(\d{4})?(\d{2})?(.*)?$/); + m = s2.match(/^(\d{1,2})?[- ]??[\s]?(\d{1,3})?[\s]?(\d{1,3})?(\d{1,4})?(\d{1,2})?(.*)?$/); + for (var i = 1; i <= 5; i++) if (!m[i]) m[i] = ""; return m ? m[1] + "." + m[2] + "." + m[3] + "/" + m[4] + "-" + m[5] : null; } -function preformatCep(e, n, t){ +function preformatCep(n) { s2 = ("" + n).replace(/\D/g,""); - m = s2.match(/^(\d{5})?[- ]??[\s]?(\d{3})?(.*)?$/); + m = s2.match(/^(\d{1,5})?[- ]??[\s]?(\d{1,3})?(.*)?$/); + for (var i = 1; i <= 2; i++) if (!m[i]) m[i] = ""; return m ? m[1] + "-" + m[2]: null; } -function preformatDate(e, n, t){ +function preformatDate(n) { s2 = ("" + n).replace(/\D/g,""); - m = s2.match(/^(\d{2})?[- ]??[\s]?(\d{2})?(.*)?$/); + m = s2.match(/^(\d{1,2})?[- ]??[\s]?(\d{1,2})?(.*)?$/); + for (var i = 1; i <= 3; i++) if (!m[i]) m[i] = ""; return m ? m[1] + "/" + m[2] + "/" + m[3]: null; } @@ -230,6 +248,7 @@ function formatDate(e, t) { function validates(e) { e.addEventListener("blur", function(t) { + formater(e) switchValidations(e) }) } @@ -389,7 +408,7 @@ gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = closeModal(e); } }) -}), document.addEventListener("keypress", function(e) { +}), document.addEventListener("keydown", function(e) { 27 == e.keyCode && gtModals.forEach(function(e) { e.removeAttribute("style") document.getElementsByTagName('body')[0].style.overflow = "" From 0c0d3514e4630ca67f63575320335ccef4eb7c29 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Fri, 16 Mar 2018 13:24:43 -0300 Subject: [PATCH 18/20] Melhora compatibilidade do modal com o chrome --- factory/js/gainTime.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index 5a74d53..b6b5c02 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -424,13 +424,13 @@ gtModals = [].slice.call(document.getElementsByClassName("gt-modal")), modals = var last = focusable[focusable.length - 1]; first.focus() - first.addEventListener("keypress", function(e) { + first.addEventListener("keydown", function(e) { if (e.shiftKey && e.key == "Tab") { e.preventDefault(); last.focus(); } }) - last.addEventListener("keypress", function(e) { + last.addEventListener("keydown", function(e) { if (!e.shiftKey && e.key == "Tab") { e.preventDefault(); first.focus() From 3bf288e18bac57adfa60a5a11b9f2a2e181e7a37 Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Sat, 17 Mar 2018 18:53:17 -0300 Subject: [PATCH 19/20] =?UTF-8?q?Corre=C3=A7=C3=B5es=20e=20ajustes=20para?= =?UTF-8?q?=20lan=C3=A7amento=20da=20vers=C3=A3o=20v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- factory/js/gainTime.js | 19 ++++++--- factory/sass/components/_banner.sass | 2 + factory/sass/components/_cards.sass | 6 --- factory/sass/components/_dropdowns.sass | 4 ++ factory/sass/helpers/_grid.sass | 2 +- factory/sass/helpers/_singles.sass | 56 ++++++++++++++++++++++--- factory/sass/helpers/_text.sass | 3 ++ factory/sass/layouts/_base.sass | 12 ++---- factory/sass/layouts/_tables.sass | 5 +++ 9 files changed, 83 insertions(+), 26 deletions(-) diff --git a/factory/js/gainTime.js b/factory/js/gainTime.js index b6b5c02..17d4945 100644 --- a/factory/js/gainTime.js +++ b/factory/js/gainTime.js @@ -103,8 +103,7 @@ function ask(e) { function preformat(e, text) { var n = text ? e.textContent: e.value; - - var a = ""; + var a = n; var s = text ? text: e.dataset.validate; if (n) { switch (s) { @@ -160,6 +159,12 @@ function formater(e) { case "date": onlyNumbers(t); break; + case "num": + onlyNumbers(t); + break; + case "text": + blockNum(t); + break; } }) @@ -176,6 +181,13 @@ function onlyNumbers(t) { } } +function blockNum(t) { + if (!isNaN(t.key) && 0 != t.keyCode && 8 != t.keyCode && 46 != t.keyCode && !t.ctrlKey && t.key != "Tab" && t.key != "ArrowLeft" && t.key != "ArrowRight" && t.key != "ArrowDown" && t.key != "ArrowUp" && t.key != "Enter" && " " != t.key) { + t.preventDefault(); + return false; + } +} + function ctrlButtons(t) { return 0 != t.keyCode && 8 != t.keyCode && 46 != t.keyCode; } @@ -261,9 +273,6 @@ function switchValidations(e) { case "num": searcher(e, /^[\d]*$/g); break; - case "email": - searcher(e, /^(([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+(\.([A-Za-z]{2,4}))*)*$/); - break; case "cpf": validateCpf(e.value) || "" == e.value ? validsIt(e) : invalidsIt(e, "Este CPF é inválido."); break; diff --git a/factory/sass/components/_banner.sass b/factory/sass/components/_banner.sass index 322e53b..2af1ba7 100644 --- a/factory/sass/components/_banner.sass +++ b/factory/sass/components/_banner.sass @@ -13,6 +13,8 @@ width: 100% height: 100% z-index: 0 + left: 0 + top: 0 .cover background-position: right background-attachment: fixed diff --git a/factory/sass/components/_cards.sass b/factory/sass/components/_cards.sass index 1bdefa7..70c092d 100644 --- a/factory/sass/components/_cards.sass +++ b/factory/sass/components/_cards.sass @@ -18,12 +18,6 @@ transition: all .2s overflow: hidden -.card.hoverable:hover - cursor: pointer - border-bottom-color: #959595 - border-top-color: #959595 - background-color: #f6f6f6cc - .card-img width: 100% background-size: 100% diff --git a/factory/sass/components/_dropdowns.sass b/factory/sass/components/_dropdowns.sass index b40891b..99d1439 100644 --- a/factory/sass/components/_dropdowns.sass +++ b/factory/sass/components/_dropdowns.sass @@ -7,6 +7,10 @@ &.btn &::after right: -5px + &.sm + &::after + right: 0 + & > * display: inline-block vertical-align: middle diff --git a/factory/sass/helpers/_grid.sass b/factory/sass/helpers/_grid.sass index b166090..ce89d3a 100644 --- a/factory/sass/helpers/_grid.sass +++ b/factory/sass/helpers/_grid.sass @@ -51,7 +51,7 @@ $columns: 12 +col-factory("min-width: 993px", md) +col-factory("min-width: 1201px", lg) -.false-gutter +.false-gutter > +float-col-to-false-gutter(xs) +float-col-to-false-gutter(sm) +float-col-to-false-gutter(md) diff --git a/factory/sass/helpers/_singles.sass b/factory/sass/helpers/_singles.sass index 223c013..18e7730 100644 --- a/factory/sass/helpers/_singles.sass +++ b/factory/sass/helpers/_singles.sass @@ -1,7 +1,12 @@ .left + left: 0!important float: left!important .right float: right!important + right: 0!important + +.scrollable-y + overflow: auto .hidden display: none!important @@ -10,13 +15,38 @@ .padding padding: 15px + &-l + padding-left: 15px + &-r + padding-right: 15px &-lr padding-left: 15px padding-right: 15px + &-t + padding-top: 15px + &-b + padding-bottom: 15px &-tb padding-top: 15px padding-bottom: 15px +.margin + margin: 15px + &-l + margin-left: 15px + &-r + margin-right: 15px + &-lr + margin-left: 15px + margin-right: 15px + &-t + margin-top: 15px + &-b + margin-bottom: 15px + &-tb + margin-top: 15px + margin-bottom: 15px + .vertical-list & > * display: block!important @@ -44,13 +74,10 @@ max-height: 100px .small - width: 300px max-width: 300px .medium - width: 700px max-width: 700px .large - width: 1200px max-width: 1200px .full width: 100% @@ -59,15 +86,34 @@ .fixed position: fixed -.first - margin-top: 60px +.vertical-full + height: 100% .no-margin margin: 0!important .no-padding padding: 0!important +.first + margin-top: 60px + .center display: block margin-left: auto margin-right: auto + +.border + border: 1px solid rgba(23, 67, 104, 0.35) + +.hoverable:hover + cursor: pointer + background-color: #e6e6e6e6 + background-clip: border-box + +.lg + font-size: 18px + padding: 12px 30px + +.sm + font-size: 12px + padding: 2.5px 5px diff --git a/factory/sass/helpers/_text.sass b/factory/sass/helpers/_text.sass index b89be49..fbceef0 100644 --- a/factory/sass/helpers/_text.sass +++ b/factory/sass/helpers/_text.sass @@ -12,3 +12,6 @@ white-space: nowrap overflow: hidden text-overflow: ellipsis + +abbr[title] + cursor: help diff --git a/factory/sass/layouts/_base.sass b/factory/sass/layouts/_base.sass index eaf6858..bef141a 100644 --- a/factory/sass/layouts/_base.sass +++ b/factory/sass/layouts/_base.sass @@ -17,24 +17,18 @@ body position: absolute > footer, main > footer padding: 15px 5% - + article, aside, nav, section h1 font-size: 2em -%container +.container margin: 30px auto padding: 30px width: calc(100% - 10%) +box-shadow (0 1px 1px 0 rgba(0,0,0,0.06),0 2px 5px 0 rgba(0,0,0,0.2)) -.painel - section - @extend %container - -.container - @extend %container -body > section, .gt-section +body > section, main > section, .gt-section width: 100% padding: 30px 5% margin: 0 diff --git a/factory/sass/layouts/_tables.sass b/factory/sass/layouts/_tables.sass index bfd0e0a..2db939a 100644 --- a/factory/sass/layouts/_tables.sass +++ b/factory/sass/layouts/_tables.sass @@ -23,6 +23,11 @@ img height: 35px width: 35px + &.bordered + border: 1px solid rgba(23, 67, 104, 0.35) + tr > td, tr > th + border-left: 1px solid rgba(23, 67, 104, 0.35) + &.striped tbody tr:nth-child(even) background-color: #E6E6E6 From 5c2230e7c43ce42423590d56fa2b7cdfe1f5768d Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Sat, 17 Mar 2018 19:15:01 -0300 Subject: [PATCH 20/20] Atualiza README --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4c130c4..17c2229 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,19 @@ GainTime é um novo framework de HTML, CSS e JS para desenvolvimento de projetos │   │   └── gainTime.js │   └── sass │   ├── components -│   │   ├── _auth.sass │   │   ├── _badges.sass +│   │   ├── _banner.sass │   │   ├── _buttons.sass +│   │   ├── _cards.sass │   │   ├── _dropdowns.sass │   │   ├── _forms.sass │   │   ├── _graphs.sass │   │   ├── _highlight.sass +│   │   ├── _modals.sass │   │   ├── _msgs.sass │   │   ├── _tags.sass -│   │   └── _tooltips.sass +│   │   ├── _tooltips.sass +│   │   └── _vertical-list.sass │   ├── config │   │   ├── _mixins.sass │   │   └── _variables.sass