Socket
Socket
Sign inDemoInstall

zl-angular-bootstrap-toggle

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.5 to 0.1.6

2

dist/zl-angular-bootstrap-toggle.js
(function () {
'use strict';
angular.module('ui.toggle', [])
angular.module('zl.ui.toggle', [])

@@ -6,0 +6,0 @@ .value('$toggleSuppressError', false)

@@ -1,1 +0,1 @@

!function(){"use strict";angular.module("ui.toggle",[]).value("$toggleSuppressError",!1).constant("toggleConfig",{on:"On",off:"Off",size:"",onstyle:"btn-primary",offstyle:"btn-default",style:"",disable:!1}).controller("ToggleController",["$scope","$attrs","$interpolate","$log","toggleConfig","$toggleSuppressError",function(e,l,t,s,n,a){var o=this,i={$setViewValue:angular.noop};angular.forEach(["on","off","size","onstyle","offstyle","style","disable"],function(s,a){o[s]=angular.isDefined(l[s])?a<7?t(l[s])(e.$parent):e.$parent.$eval(l[s]):n[s]}),this.init=function(t){i=t,o.computeStyle(),i.$render=function(){o.toggle()},i.$viewChangeListeners.push(function(){e.$eval(l.ngChange)})},this.computeStyle=function(){o.disable="true"==o.disable;var l=o.element.find("label");angular.element(l[0]).html(o.on),angular.element(l[1]).html(o.off);var t=o.element.find("span"),s=o.width||Math.max(l[0].offsetWidth,l[1].offsetWidth)+t[0].offsetWidth/2,n=o.height||Math.max(l[0].offsetHeight,l[1].offsetHeight),a=o.element.find("div"),i=a[0].offsetWidth,r=a[1].offsetHeight;e.wrapperStyle={},i<s?e.wrapperStyle.width=s+"px":e.wrapperStyle.width=i+"px",r<n&&"btn-xs"!==o.size&&"btn-sm"!==o.size?e.wrapperStyle.height=n+"px":e.wrapperStyle.height=r+"px","btn-block"===o.size?(e.wrapperStyle.width="100%",e.onClass=[o.onstyle,"toggle-on",o.disable?"disabled":""],e.offClass=[o.offstyle,"toggle-off",o.disable?"disabled":""],e.handleClass=["toggle-handle",o.disable?"disabled":""]):(e.onClass=[o.onstyle,o.size,"toggle-on",o.disable?"disabled":""],e.offClass=[o.offstyle,o.size,"toggle-off",o.disable?"disabled":""],e.handleClass=[o.size,"toggle-handle",o.disable?"disabled":""])},this.toggle=function(){angular.isDefined(i.$viewValue)?this.isOn=i.$viewValue:this.isOn=!1,this.isOn?e.wrapperClass=[o.onstyle,o.size,o.style,o.disable?"disabled":""]:e.wrapperClass=[o.offstyle,"off ",o.size,o.style,o.disable?"disabled":""]},e.onSwitch=function(e){o.disable||(i.$setViewValue(!i.$viewValue),i.$render())},angular.forEach(["ngModel"],function(t){var s=e.$parent.$watch(l[t],function(e){i.$render()});e.$parent.$on("$destroy",function(){s()})}),angular.forEach(["on","off","size","onstyle","offstyle","style","disable"],function(e){l.$observe(e,function(l){o[e]!==l&&(o[e]=l,o.computeStyle())})})}]).directive("toggle",function(){return{restrict:"E",transclude:!0,template:'<div class="toggle btn" ng-class="wrapperClass" ng-style="wrapperStyle" ng-click="onSwitch()"><div class="toggle-group"><label class="btn" ng-class="onClass"></label><label class="btn active" ng-class="offClass"></label><span class="btn btn-default" ng-class="handleClass"></span></div></div>',scope:{bindModel:"=ngModel"},require:["toggle","ngModel"],controller:"ToggleController",controllerAs:"toggle",compile:function(e,l,t){return{pre:function(e,l,t,s){var n=s[0],a=s[1];n.element=l,n.init(a)},post:function(){}}}}})}();
!function(){"use strict";angular.module("zl.ui.toggle",[]).value("$toggleSuppressError",!1).constant("toggleConfig",{on:"On",off:"Off",size:"",onstyle:"btn-primary",offstyle:"btn-default",style:"",disable:!1}).controller("ToggleController",["$scope","$attrs","$interpolate","$log","toggleConfig","$toggleSuppressError",function(e,l,t,s,n,a){var o=this,i={$setViewValue:angular.noop};angular.forEach(["on","off","size","onstyle","offstyle","style","disable"],function(s,a){o[s]=angular.isDefined(l[s])?a<7?t(l[s])(e.$parent):e.$parent.$eval(l[s]):n[s]}),this.init=function(t){i=t,o.computeStyle(),i.$render=function(){o.toggle()},i.$viewChangeListeners.push(function(){e.$eval(l.ngChange)})},this.computeStyle=function(){o.disable="true"==o.disable;var l=o.element.find("label");angular.element(l[0]).html(o.on),angular.element(l[1]).html(o.off);var t=o.element.find("span"),s=o.width||Math.max(l[0].offsetWidth,l[1].offsetWidth)+t[0].offsetWidth/2,n=o.height||Math.max(l[0].offsetHeight,l[1].offsetHeight),a=o.element.find("div"),i=a[0].offsetWidth,r=a[1].offsetHeight;e.wrapperStyle={},i<s?e.wrapperStyle.width=s+"px":e.wrapperStyle.width=i+"px",r<n&&"btn-xs"!==o.size&&"btn-sm"!==o.size?e.wrapperStyle.height=n+"px":e.wrapperStyle.height=r+"px","btn-block"===o.size?(e.wrapperStyle.width="100%",e.onClass=[o.onstyle,"toggle-on",o.disable?"disabled":""],e.offClass=[o.offstyle,"toggle-off",o.disable?"disabled":""],e.handleClass=["toggle-handle",o.disable?"disabled":""]):(e.onClass=[o.onstyle,o.size,"toggle-on",o.disable?"disabled":""],e.offClass=[o.offstyle,o.size,"toggle-off",o.disable?"disabled":""],e.handleClass=[o.size,"toggle-handle",o.disable?"disabled":""])},this.toggle=function(){angular.isDefined(i.$viewValue)?this.isOn=i.$viewValue:this.isOn=!1,this.isOn?e.wrapperClass=[o.onstyle,o.size,o.style,o.disable?"disabled":""]:e.wrapperClass=[o.offstyle,"off ",o.size,o.style,o.disable?"disabled":""]},e.onSwitch=function(e){o.disable||(i.$setViewValue(!i.$viewValue),i.$render())},angular.forEach(["ngModel"],function(t){var s=e.$parent.$watch(l[t],function(e){i.$render()});e.$parent.$on("$destroy",function(){s()})}),angular.forEach(["on","off","size","onstyle","offstyle","style","disable"],function(e){l.$observe(e,function(l){o[e]!==l&&(o[e]=l,o.computeStyle())})})}]).directive("toggle",function(){return{restrict:"E",transclude:!0,template:'<div class="toggle btn" ng-class="wrapperClass" ng-style="wrapperStyle" ng-click="onSwitch()"><div class="toggle-group"><label class="btn" ng-class="onClass"></label><label class="btn active" ng-class="offClass"></label><span class="btn btn-default" ng-class="handleClass"></span></div></div>',scope:{bindModel:"=ngModel"},require:["toggle","ngModel"],controller:"ToggleController",controllerAs:"toggle",compile:function(e,l,t){return{pre:function(e,l,t,s){var n=s[0],a=s[1];n.element=l,n.init(a)},post:function(){}}}}})}();
{
"name": "zl-angular-bootstrap-toggle",
"version": "0.1.5",
"version": "0.1.6",
"author": {

@@ -5,0 +5,0 @@ "name": "Cristiano Oliveira",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc