You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

lc-switch

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lc-switch - npm Package Compare versions

Comparing version

to
2.0.2

8

lc_switch.min.js

@@ -5,3 +5,3 @@ /* ------------------------------------------------------------------------

*
* @version: 2.0.1
* @version: 2.0.2
* @author: Luca Montanari (LCweb)

@@ -17,6 +17,6 @@ * @website: https://lcweb.it

b.parentNode.insertBefore(k,b);k.appendChild(b);k.querySelector(".lcs_switch").addEventListener("click",function(l){(l.target.classList.contains("lcs_switch")?l.target:r(l.target,".lcs_switch")).classList.contains("lcs_disabled")||lcs_toggle(b)});b.addEventListener("change",function(l){lcs_update(b)})}});q||(q=!0,document.head.insertAdjacentHTML("beforeend",'<style>\n.lcs_wrap,\n.lcs_wrap * {\n user-select: none;\n}\n.lcs_wrap {\n\tdisplay: inline-block;\n\tdirection: ltr;\n\theight: 28px;\n width: 73px;\n vertical-align: middle;\n}\n.lcs_wrap input {\n\tdisplay: none;\n}\n.lcs_switch {\n\tdisplay: inline-block;\n\tposition: relative;\n\twidth: 100%;\n\theight: 100%;\n\tborder-radius: 30px;\n\tbackground: #ddd;\n\toverflow: hidden;\n\tcursor: pointer;\n\ttransition: all .2s ease-in-out;\n}\n.lcs_cursor {\n\tdisplay: inline-block;\n\tposition: absolute;\n\ttop: 50%;\n margin-top: -11px;\n\twidth: 22px;\n\theight: 22px;\n\tborder-radius: 100%;\n\tbackground: #fff;\n\tbox-shadow: 0 1px 2px 0 rgba(0, 0, 0, .2), 0 3px 4px 0 rgba(0, 0, 0, .1);\n\tz-index: 10;\n\ttransition: all .2s linear;\n}\n.lcs_label {\n\tfont-family: "Trebuchet MS", Helvetica, sans-serif;\n font-size: 12px;\n\tletter-spacing: 1px;\n\tline-height: 18px;\n\tcolor: #fff;\n\tfont-weight: bold;\n\tposition: absolute;\n\twidth: 33px;\n\ttop: 5px;\n\toverflow: hidden;\n\ttext-align: center;\n\topacity: 0;\n text-shadow: 0 0 2px rgba(0,0,0, .1);\n\ttransition: all .2s ease-in-out .1s;\n}\n.lcs_label.lcs_label_on {\n\tleft: -70px;\n\tz-index: 6;\n}\n.lcs_label.lcs_label_off {\n\tright: -70px;\n\tz-index: 5;\n}\n.lcs_switch.lcs_on {\n\tbackground: #75b936;\n}\n.lcs_switch.lcs_on .lcs_cursor {\n\tleft: 48px;\n}\n.lcs_switch.lcs_on .lcs_label_on {\n\tleft: 10px;\n\topacity: 1;\n}\n.lcs_switch.lcs_off {\n\tbackground: #b2b2b2;\n\tbox-shadow: 0px 0px 2px #a4a4a4 inset;\n}\n.lcs_switch.lcs_off .lcs_cursor {\n\tleft: 3px;\n}\n.lcs_switch.lcs_off .lcs_label_off {\n\tright: 10px;\n\topacity: 1;\n}\n.lcs_switch.lcs_disabled {\n\topacity: 0.65;\n\tcursor: default;\n}\n.lcs_compact {\n height: 22px;\n width: 47px;\n}\n.lcs_compact .lcs_label {\n display: none;\n}\n.lcs_compact .lcs_cursor {\n\tmargin-top: -8px;\n\twidth: 16px;\n\theight: 16px;\n}\n.lcs_compact .lcs_switch.lcs_on .lcs_cursor {\n\tleft: 28px;\n}\n</style>'))};
window.lcs_destroy=function(c){f(c).forEach(function(a){g(a)&&a.parentNode.replaceWith(a)})};window.lcs_on=function(c){f(c).forEach(function(a){if(g(a)&&(!a.checked||e)){"radio"==a.getAttribute("type")&&lcs_off(r(a,"form").querySelectorAll('input[name="'+a.getAttribute("name")+'"]'),!0);a.checked=!0;var b=a.previousElementSibling;b.classList.add("lcs_on");b.classList.remove("lcs_off");b.getAttribute("data-on-color")&&(b.style.background=b.getAttribute("data-on-color"));if(!e){b=new Event("lcs-off");
window.lcs_destroy=function(c){f(c).forEach(function(a){g(a)&&a.parentNode.replaceWith(a)})};window.lcs_on=function(c){f(c).forEach(function(a){if(g(a)&&(!a.checked||e)){"radio"==a.getAttribute("type")&&lcs_off(r(a,"form").querySelectorAll('input[name="'+a.getAttribute("name")+'"]'),!0);a.checked=!0;var b=a.previousElementSibling;b.classList.add("lcs_on");b.classList.remove("lcs_off");b.getAttribute("data-on-color")&&(b.style.background=b.getAttribute("data-on-color"));if(!e){b=new Event("lcs-on");
var d=new Event("lcs-statuschange");a.dispatchEvent(b);a.dispatchEvent(d)}}})};window.lcs_off=function(c,a){f(c).forEach(function(b){if(g(b)&&(b.checked||e)&&("radio"!=b.getAttribute("type")||a||e)){b.checked=!1;var d=b.previousElementSibling;d.classList.add("lcs_off");d.classList.remove("lcs_on");d.getAttribute("data-on-color")&&(d.style.background=null);if(!e){d=new Event("lcs-off");var m=new Event("lcs-statuschange");b.dispatchEvent(d);b.dispatchEvent(m)}}})};window.lcs_toggle=function(c){f(c).forEach(function(a){g(a)&&
("radio"==a.getAttribute("type")&&a.checked||(a.checked?lcs_off(a):lcs_on(a)))})};window.lcs_disable=function(c){f(c).forEach(function(a){if(g(a)&&(!a.disabled||e)){a.disabled=!0;a.previousElementSibling.classList.add("lcs_disabled");var b=new Event("lcs-disabled"),d=new Event("lcs-statuschange");a.dispatchEvent(b);a.dispatchEvent(d)}})};window.lcs_enable=function(c){f(c).forEach(function(a){if(g(a)&&(a.disabled||e)){a.disabled=!1;a.previousElementSibling.classList.remove("lcs_disabled");var b=new Event("lcs-enabled"),
d=new Event("lcs-statuschange");a.dispatchEvent(b);a.dispatchEvent(d)}})};window.lcs_update=function(c){f(c).forEach(function(a){g(a)&&(e=!0,a.checked?lcs_on(a):lcs_off(a),a.disabled?lcs_disable(a):lcs_enable(a),e=!1)})};var f=function(c){return"string"!=typeof c?"undefined"!=typeof c[0]?Object.values(c):c.length?c:[c]:document.querySelectorAll(c)},g=function(c){return"INPUT"!=c.tagName||"INPUT"==c.tagName&&"checkbox"!=c.getAttribute("type")&&"radio"!=c.getAttribute("type")||!c.parentNode.classList.length||
c.parentNode.classList.length&&!c.parentNode.classList.contains("lcs_wrap")?!1:!0},r=function(c,a){for(var b=c;null!=b.parentNode&&!b.matches(a);)b=b.parentNode;return b}})();
d=new Event("lcs-statuschange");a.dispatchEvent(b);a.dispatchEvent(d)}})};window.lcs_update=function(c){f(c).forEach(function(a){g(a)&&(e=!0,a.checked?lcs_on(a):lcs_off(a),a.disabled?lcs_disable(a):lcs_enable(a),e=!1)})};var f=function(c){if("string"!=typeof c)return c instanceof Element?[c]:Object.values(c);(c.match(/(#[0-9][^\s:,]*)/g)||[]).forEach(function(a){c=c.replace(a,'[id="'+a.replace("#","")+'"]')});return document.querySelectorAll(c)},g=function(c){return"INPUT"!=c.tagName||"INPUT"==c.tagName&&
"checkbox"!=c.getAttribute("type")&&"radio"!=c.getAttribute("type")||!c.parentNode.classList.length||c.parentNode.classList.length&&!c.parentNode.classList.contains("lcs_wrap")?!1:!0},r=function(c,a){for(var b=c;null!=b.parentNode&&!b.matches(a);)b=b.parentNode;return b}})();
{
"author": "LCweb",
"name": "lc-switch",
"version": "2.0.1",
"version": "2.0.2",
"description": "Superlight vanilla javascript plugin improving forms look and functionality",

@@ -6,0 +6,0 @@ "keywords": [