소스 검색

switch -> bootstrapSwitch

Mattia Larentis 12 년 전
부모
커밋
e8839e62a0
5개의 변경된 파일81개의 추가작업 그리고 52개의 파일을 삭제
  1. 12 7
      README.md
  2. 13 13
      examples/index.html
  3. 10 2
      static/js/bootstrapSwitch.js
  4. 9 0
      static/sass/bootstrapSwitch.scss
  5. 37 30
      static/stylesheets/bootstrapSwitch.css

+ 12 - 7
README.md

@@ -11,10 +11,10 @@ Usage
 Just include Twitter Bootstrap, jQuery, Bootstrap Switch CSS and Javascript
 ``` html
 <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
-<link href="bootstrap-switch.css" rel="stylesheet">
+<link href="bootstrapSwitch.css" rel="stylesheet">
 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
-<script src="jquery.switch.js"></script>
+<script src="bootstrapSwitch.js"></script>
 ```
 
 Basic Example
@@ -95,9 +95,14 @@ Methods
 -------
 
 ``` javascript
-$('#mySwitch').switch('toggleActivation');
-$('#mySwitch').switch('toggleState');
-$('#mySwitch').switch('setState', true);
-$('#mySwitch').switch('status');  // returns true or false
-$('#mySwitch').switch('destroy');
+$('#mySwitch').bootstrapSwitch('toggleActivation');
+$('#mySwitch').bootstrapSwitch('toggleState');
+$('#mySwitch').bootstrapSwitch('setState', true);
+$('#mySwitch').bootstrapSwitch('status');  // returns true or false
+$('#mySwitch').bootstrapSwitch('destroy');
 ```
+
+License
+-------
+Licensed under the Apache License, Version 2.0
+http://www.apache.org/licenses/LICENSE-2.0

+ 13 - 13
examples/index.html

@@ -2,12 +2,12 @@
 <html lang="en">
 <head>
     <meta charset="utf-8">
-    <title>Bootstrap switch</title>
+    <title>Bootstrap switch - by Mattia Larentis</title>
     <meta name="author" content="Mattia Larentis">
     <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8;"/>
     <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css"
           rel="stylesheet">
-    <link href="../static/stylesheets/bootstrap-switch.css"
+    <link href="../static/stylesheets/bootstrapSwitch.css"
           rel="stylesheet">
     <link href="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css"
           rel="stylesheet">
@@ -35,7 +35,7 @@
 <div class="row-fluid">
     <div class="span12">
         <h1>Bootstrap switch
-            <small>- by Mattia Larentis</small>
+            <small>- by <a href="http://larentis.eu">Mattia Larentis</a></small>
         </h1>
     </div>
 </div>
@@ -168,8 +168,8 @@ $('#mySwitch').on('switch-change', function (e, data) {
 &lt;/div></pre>
         <h4>Js:</h4>
 <pre class="prettyprint linenums">
-$('#toggle-state-switch').switch('toggleState');
-$('#toggle-state-switch').switch('setState', false); // true || false
+$('#toggle-state-switch').bootstrapSwitch('toggleState');
+$('#toggle-state-switch').bootstrapSwitch('setState', false); // true || false
 </pre>
     </div>
 </div>
@@ -200,7 +200,7 @@ $('#toggle-state-switch').switch('setState', false); // true || false
 &lt;/div></pre>
         <h4>Js:</h4>
 <pre class="prettyprint linenums">
-$('#destroy-switch').switch('destroy');
+$('#destroy-switch').bootstrapSwitch('destroy');
 </pre>
     </div>
 </div>
@@ -231,7 +231,7 @@ $('#destroy-switch').switch('destroy');
 &lt;/div></pre>
         <h4>Js:</h4>
 <pre class="prettyprint linenums">
-$('#disable-switch').switch('toggleActivation');
+$('#disable-switch').bootstrapSwitch('toggleActivation');
 </pre>
     </div>
 </div>
@@ -287,7 +287,7 @@ $('#disable-switch').switch('toggleActivation');
 
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
 <script src="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js"></script>
-<script src="../static/js/jquery.switch.js"></script>
+<script src="../static/js/bootstrapSwitch.js"></script>
 <script>
     window.prettyPrint && prettyPrint();
     $('#mySwitch').on('switch-change', function (e, data) {
@@ -297,24 +297,24 @@ $('#disable-switch').switch('toggleActivation');
     });
 
     $('#toggle-state-switch-button').on('click', function () {
-        $('#toggle-state-switch').switch('toggleState');
+        $('#toggle-state-switch').bootstrapSwitch('toggleState');
     });
 
     $('#toggle-state-switch-button-on').on('click', function () {
-        $('#toggle-state-switch').switch('setState', true);
+        $('#toggle-state-switch').bootstrapSwitch('setState', true);
     });
 
     $('#toggle-state-switch-button-off').on('click', function () {
-        $('#toggle-state-switch').switch('setState', false);
+        $('#toggle-state-switch').bootstrapSwitch('setState', false);
     });
 
     $('#btn-destroy-switch').on('click', function () {
-        $('#destroy-switch').switch('destroy');
+        $('#destroy-switch').bootstrapSwitch('destroy');
         $(this).remove();
     });
 
     $('#btn-disable-switch').on('click', function () {
-        $('#disable-switch').switch('toggleActivation');
+        $('#disable-switch').bootstrapSwitch('toggleActivation');
     });
 </script>
 </body>

+ 10 - 2
static/js/jquery.switch.js → static/js/bootstrapSwitch.js

@@ -1,7 +1,15 @@
+/* ============================================================
+ * bootstrapSwitch v1.0 by Larentis Mattia @spiritualGuru
+ * http://www.larentis.eu/switch/
+ * ============================================================
+ * Licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * ============================================================ */
+
 !function ($) {
   "use strict";
 
-  $.fn['switch'] = function (method) {
+  $.fn['bootstrapSwitch'] = function (method) {
     var methods = {
       init:function () {
         this.each(function () {
@@ -205,5 +213,5 @@
 }(jQuery);
 
 $(function () {
-  $('.switch')['switch']();
+  $('.switch')['bootstrapSwitch']();
 });

+ 9 - 0
static/sass/bootstrap-switch.scss → static/sass/bootstrapSwitch.scss

@@ -1,3 +1,12 @@
+/* ============================================================
+ * bootstrapSwitch v1.0 by Larentis Mattia @spiritualGuru
+ * http://www.larentis.eu/switch/
+ * ============================================================
+ * Licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * ============================================================ */
+
+
 @import "compass/css3";
 
 $border: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);

+ 37 - 30
static/stylesheets/bootstrap-switch.css → static/stylesheets/bootstrapSwitch.css

@@ -1,4 +1,11 @@
-/* line 9, ../sass/bootstrap-switch.scss */
+/* ============================================================
+ * bootstrapSwitch v1.0 by Larentis Mattia @spiritualGuru
+ * http://www.larentis.eu/switch/
+ * ============================================================
+ * Licensed under the Apache License, Version 2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * ============================================================ */
+/* line 18, ../sass/bootstrapSwitch.scss */
 .switch {
   display: inline-block;
   cursor: pointer;
@@ -20,57 +27,57 @@
   -moz-user-select: none;
   -ms-user-select: none;
   user-select: none;
-  min-width: 100px;
+  min-width: 102px;
 }
-/* line 31, ../sass/bootstrap-switch.scss */
+/* line 40, ../sass/bootstrapSwitch.scss */
 .switch.switch-mini {
-  min-width: 70px;
+  min-width: 72px;
 }
-/* line 35, ../sass/bootstrap-switch.scss */
+/* line 44, ../sass/bootstrapSwitch.scss */
 .switch.switch-small {
-  min-width: 80px;
+  min-width: 81px;
 }
-/* line 39, ../sass/bootstrap-switch.scss */
+/* line 48, ../sass/bootstrapSwitch.scss */
 .switch.switch-large {
   min-width: 120px;
 }
-/* line 43, ../sass/bootstrap-switch.scss */
+/* line 52, ../sass/bootstrapSwitch.scss */
 .switch.deactivate {
   filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
   opacity: 0.5;
   cursor: default !important;
 }
-/* line 46, ../sass/bootstrap-switch.scss */
+/* line 55, ../sass/bootstrapSwitch.scss */
 .switch.deactivate label, .switch.deactivate span {
   cursor: default !important;
 }
-/* line 50, ../sass/bootstrap-switch.scss */
+/* line 59, ../sass/bootstrapSwitch.scss */
 .switch > div {
   display: inline-block;
   width: 150%;
   position: relative;
   top: 0;
 }
-/* line 56, ../sass/bootstrap-switch.scss */
+/* line 65, ../sass/bootstrapSwitch.scss */
 .switch > div.switch-animate {
   -webkit-transition: left 0.5s;
   -moz-transition: left 0.5s;
   -o-transition: left 0.5s;
   transition: left 0.5s;
 }
-/* line 59, ../sass/bootstrap-switch.scss */
+/* line 68, ../sass/bootstrapSwitch.scss */
 .switch > div.switch-off {
-  left: -49.5%;
+  left: -50%;
 }
-/* line 62, ../sass/bootstrap-switch.scss */
+/* line 71, ../sass/bootstrapSwitch.scss */
 .switch > div.switch-on {
   left: 0%;
 }
-/* line 66, ../sass/bootstrap-switch.scss */
+/* line 75, ../sass/bootstrapSwitch.scss */
 .switch input[type=checkbox] {
   display: none;
 }
-/* line 74, ../sass/bootstrap-switch.scss */
+/* line 83, ../sass/bootstrapSwitch.scss */
 .switch span, .switch label {
   -webkit-box-sizing: border-box;
   -moz-box-sizing: border-box;
@@ -84,34 +91,34 @@
   font-size: 14px;
   line-height: 20px;
 }
-/* line 87, ../sass/bootstrap-switch.scss */
+/* line 96, ../sass/bootstrapSwitch.scss */
 .switch span.switch-mini, .switch label.switch-mini {
   padding-bottom: 4px;
   padding-top: 4px;
   font-size: 10px;
   line-height: 9px;
 }
-/* line 94, ../sass/bootstrap-switch.scss */
+/* line 103, ../sass/bootstrapSwitch.scss */
 .switch span.switch-small, .switch label.switch-small {
   padding-bottom: 3px;
   padding-top: 3px;
   font-size: 12px;
   line-height: 18px;
 }
-/* line 101, ../sass/bootstrap-switch.scss */
+/* line 110, ../sass/bootstrapSwitch.scss */
 .switch span.switch-large, .switch label.switch-large {
   padding-bottom: 9px;
   padding-top: 9px;
   font-size: 16px;
   line-height: normal;
 }
-/* line 109, ../sass/bootstrap-switch.scss */
+/* line 118, ../sass/bootstrapSwitch.scss */
 .switch label {
   background: white;
   margin-top: -1px;
   margin-bottom: -1px;
   z-index: 100;
-  width: 34%;
+  width: 33.333333%;
   border-left: 1px solid #e6e6e6;
   border-right: 1px solid #e6e6e6;
   background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6));
@@ -120,14 +127,14 @@
   background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
   background-image: linear-gradient(top, #ffffff, #e6e6e6);
 }
-/* line 121, ../sass/bootstrap-switch.scss */
+/* line 130, ../sass/bootstrapSwitch.scss */
 .switch span {
   color: white;
   text-align: center;
   z-index: 1;
-  width: 33%;
+  width: 33.333333%;
 }
-/* line 127, ../sass/bootstrap-switch.scss */
+/* line 136, ../sass/bootstrapSwitch.scss */
 .switch span.switch-left {
   -moz-border-radius-topleft: 4px;
   -webkit-border-top-left-radius: 4px;
@@ -136,7 +143,7 @@
   -webkit-border-bottom-left-radius: 4px;
   border-bottom-left-radius: 4px;
 }
-/* line 131, ../sass/bootstrap-switch.scss */
+/* line 140, ../sass/bootstrapSwitch.scss */
 .switch span.switch-right {
   color: black;
   -moz-border-radius-topright: 4px;
@@ -151,7 +158,7 @@
   background-image: -o-linear-gradient(bottom, #ffffff, #e6e6e6);
   background-image: linear-gradient(bottom, #ffffff, #e6e6e6);
 }
-/* line 138, ../sass/bootstrap-switch.scss */
+/* line 147, ../sass/bootstrapSwitch.scss */
 .switch span.switch-primary, .switch span.switch-left {
   color: white;
   background: #0088cc;
@@ -161,7 +168,7 @@
   background-image: -o-linear-gradient(bottom, #0088cc, #0055cc);
   background-image: linear-gradient(bottom, #0088cc, #0055cc);
 }
-/* line 143, ../sass/bootstrap-switch.scss */
+/* line 152, ../sass/bootstrapSwitch.scss */
 .switch span.switch-info {
   color: white;
   background: #5bc0de;
@@ -171,7 +178,7 @@
   background-image: -o-linear-gradient(bottom, #5bc0de, #2f96b4);
   background-image: linear-gradient(bottom, #5bc0de, #2f96b4);
 }
-/* line 149, ../sass/bootstrap-switch.scss */
+/* line 158, ../sass/bootstrapSwitch.scss */
 .switch span.switch-success {
   color: white;
   background: #62c462;
@@ -181,7 +188,7 @@
   background-image: -o-linear-gradient(bottom, #62c462, #51a351);
   background-image: linear-gradient(bottom, #62c462, #51a351);
 }
-/* line 155, ../sass/bootstrap-switch.scss */
+/* line 164, ../sass/bootstrapSwitch.scss */
 .switch span.switch-warning {
   color: white;
   background: #dbb450;
@@ -191,7 +198,7 @@
   background-image: -o-linear-gradient(bottom, #dbb450, #f89406);
   background-image: linear-gradient(bottom, #dbb450, #f89406);
 }
-/* line 161, ../sass/bootstrap-switch.scss */
+/* line 170, ../sass/bootstrapSwitch.scss */
 .switch span.switch-danger {
   color: white;
   background: #ee5f5b;