Clean
This commit is contained in:
@ -1,176 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@ -1,155 +0,0 @@
|
||||
/* line 11, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-ms-border-radius: 5px;
|
||||
-o-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
position: relative;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
/* line 29, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button.deactivate {
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
|
||||
opacity: 0.5;
|
||||
cursor: default !important;
|
||||
}
|
||||
/* line 32, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button.deactivate label, .toggle-button.deactivate span {
|
||||
cursor: default !important;
|
||||
}
|
||||
/* line 36, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button > div {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
/* line 41, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button > div.disabled {
|
||||
left: -50%;
|
||||
}
|
||||
/* line 45, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button input[type=checkbox] {
|
||||
display: none;
|
||||
}
|
||||
/* line 53, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span, .toggle-button label {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
}
|
||||
/* line 60, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button label {
|
||||
background: #fefefe;
|
||||
margin-left: -4px;
|
||||
margin-right: -4px;
|
||||
border: 1px solid #E6E6E6;
|
||||
margin-top: -1px;
|
||||
z-index: 100;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fefefe), color-stop(100%, #e6e6e6));
|
||||
background-image: -webkit-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: -moz-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: -o-linear-gradient(top, #fefefe, #e6e6e6);
|
||||
background-image: linear-gradient(top, #fefefe, #e6e6e6);
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
-ms-border-radius: 4px;
|
||||
-o-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
/* line 72, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span {
|
||||
color: #fefefe;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
z-index: 1;
|
||||
}
|
||||
/* line 78, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span.labelLeft {
|
||||
-moz-border-radius-topleft: 4px;
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
-moz-border-radius-bottomleft: 4px;
|
||||
-webkit-border-bottom-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
padding-left: 3px;
|
||||
}
|
||||
/* line 83, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span.labelRight {
|
||||
-moz-border-radius-topright: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
-moz-border-radius-bottomright: 4px;
|
||||
-webkit-border-bottom-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
color: black;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #fefefe), color-stop(100%, #e6e6e6));
|
||||
background-image: -webkit-linear-gradient(bottom, #fefefe, #e6e6e6);
|
||||
background-image: -moz-linear-gradient(bottom, #fefefe, #e6e6e6);
|
||||
background-image: -o-linear-gradient(bottom, #fefefe, #e6e6e6);
|
||||
background-image: linear-gradient(bottom, #fefefe, #e6e6e6);
|
||||
padding-right: 3px;
|
||||
}
|
||||
/* line 91, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span.primary, .toggle-button span.labelLeft {
|
||||
color: #fefefe;
|
||||
background: #0088cc;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #0088cc), color-stop(100%, #0055cc));
|
||||
background-image: -webkit-linear-gradient(bottom, #0088cc, #0055cc);
|
||||
background-image: -moz-linear-gradient(bottom, #0088cc, #0055cc);
|
||||
background-image: -o-linear-gradient(bottom, #0088cc, #0055cc);
|
||||
background-image: linear-gradient(bottom, #0088cc, #0055cc);
|
||||
}
|
||||
/* line 96, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span.info {
|
||||
color: #fefefe;
|
||||
background: #5bc0de;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4));
|
||||
background-image: -webkit-linear-gradient(bottom, #5bc0de, #2f96b4);
|
||||
background-image: -moz-linear-gradient(bottom, #5bc0de, #2f96b4);
|
||||
background-image: -o-linear-gradient(bottom, #5bc0de, #2f96b4);
|
||||
background-image: linear-gradient(bottom, #5bc0de, #2f96b4);
|
||||
}
|
||||
/* line 102, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span.success {
|
||||
color: #fefefe;
|
||||
background: #62c462;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #62c462), color-stop(100%, #51a351));
|
||||
background-image: -webkit-linear-gradient(bottom, #62c462, #51a351);
|
||||
background-image: -moz-linear-gradient(bottom, #62c462, #51a351);
|
||||
background-image: -o-linear-gradient(bottom, #62c462, #51a351);
|
||||
background-image: linear-gradient(bottom, #62c462, #51a351);
|
||||
}
|
||||
/* line 108, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span.warning {
|
||||
color: #fefefe;
|
||||
background: #dbb450;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #dbb450), color-stop(100%, #f89406));
|
||||
background-image: -webkit-linear-gradient(bottom, #dbb450, #f89406);
|
||||
background-image: -moz-linear-gradient(bottom, #dbb450, #f89406);
|
||||
background-image: -o-linear-gradient(bottom, #dbb450, #f89406);
|
||||
background-image: linear-gradient(bottom, #dbb450, #f89406);
|
||||
}
|
||||
/* line 114, ../sass/bootstrap-toggle-buttons.scss */
|
||||
.toggle-button span.danger {
|
||||
color: #fefefe;
|
||||
background: #ee5f5b;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ee5f5b), color-stop(100%, #bd362f));
|
||||
background-image: -webkit-linear-gradient(bottom, #ee5f5b, #bd362f);
|
||||
background-image: -moz-linear-gradient(bottom, #ee5f5b, #bd362f);
|
||||
background-image: -o-linear-gradient(bottom, #ee5f5b, #bd362f);
|
||||
background-image: linear-gradient(bottom, #ee5f5b, #bd362f);
|
||||
}
|
||||
@ -1,121 +0,0 @@
|
||||
@import "compass/css3";
|
||||
|
||||
// version: 2.8
|
||||
// by Mattia Larentis - follow me on twitter! @SpiritualGuru
|
||||
|
||||
$border: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
$white: #FEFEFE;
|
||||
$blue: #0088CC;
|
||||
$border-radius: 4px;
|
||||
|
||||
.toggle-button {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
@include border-radius(5px);
|
||||
border: 1px solid;
|
||||
border-color: $border;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
|
||||
// disable text selection highlighting
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
&.deactivate {
|
||||
@include opacity(0.5);
|
||||
cursor: default !important;
|
||||
label, span {
|
||||
cursor: default !important;
|
||||
}
|
||||
}
|
||||
> div {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
&.disabled {
|
||||
left: -50%;
|
||||
}
|
||||
}
|
||||
input[type=checkbox] {
|
||||
//debug
|
||||
display: none;
|
||||
//position: absolute;
|
||||
//margin-left: 60%;
|
||||
//z-index: 123;
|
||||
}
|
||||
|
||||
span, label {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
label {
|
||||
background: $white;
|
||||
margin-left: -$border-radius;
|
||||
margin-right: -$border-radius;
|
||||
border: 1px solid #E6E6E6;
|
||||
margin-top: -1px;
|
||||
z-index: 100;
|
||||
|
||||
@include background-image(linear-gradient(top, $white, #E6E6E6));
|
||||
@include border-radius($border-radius);
|
||||
}
|
||||
|
||||
span {
|
||||
color: $white;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
z-index: 1;
|
||||
|
||||
&.labelLeft {
|
||||
@include border-top-left-radius($border-radius);
|
||||
@include border-bottom-left-radius($border-radius);
|
||||
padding-left: 3px;
|
||||
}
|
||||
&.labelRight {
|
||||
@include border-top-right-radius($border-radius);
|
||||
@include border-bottom-right-radius($border-radius);
|
||||
color: black;
|
||||
@include background-image(linear-gradient(bottom, $white, #E6E6E6));
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
&.primary, &.labelLeft {
|
||||
color: $white;
|
||||
background: $blue;
|
||||
@include background-image(linear-gradient(bottom, $blue, #0055CC));
|
||||
}
|
||||
&.info {
|
||||
$startColor: #5BC0DE;
|
||||
color: $white;
|
||||
background: $startColor;
|
||||
@include background-image(linear-gradient(bottom, $startColor, #2F96B4));
|
||||
}
|
||||
&.success {
|
||||
$startColor: #62C462;
|
||||
color: $white;
|
||||
background: $startColor;
|
||||
@include background-image(linear-gradient(bottom, $startColor, #51A351));
|
||||
}
|
||||
&.warning {
|
||||
$startColor: #DBB450;
|
||||
color: $white;
|
||||
background: $startColor;
|
||||
@include background-image(linear-gradient(bottom, $startColor, #F89406));
|
||||
}
|
||||
&.danger {
|
||||
$startColor: #EE5f5B;
|
||||
color: $white;
|
||||
background: $startColor;
|
||||
@include background-image(linear-gradient(bottom, $startColor, #BD362F));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,289 +0,0 @@
|
||||
!function ($) {
|
||||
"use strict";
|
||||
// version: 2.8.2
|
||||
// by Mattia Larentis - follow me on twitter! @SpiritualGuru
|
||||
|
||||
var addToAttribute = function (obj, array, value) {
|
||||
var i = 0
|
||||
, length = array.length;
|
||||
|
||||
for (; i < length; i++) {
|
||||
obj = obj[array[i]] = obj[array[i]] || i == ( length - 1) ? value : {}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.toggleButtons = function (method) {
|
||||
var $element
|
||||
, $div
|
||||
, $cb
|
||||
, transitionSpeed = 0.05
|
||||
, methods = {
|
||||
init: function (opt) {
|
||||
this.each(function () {
|
||||
var $spanLeft
|
||||
, $spanRight
|
||||
, options
|
||||
, moving
|
||||
, dataAttribute = {};
|
||||
|
||||
$element = $(this);
|
||||
$element.addClass('toggle-button');
|
||||
|
||||
$.each($element.data(), function (i, el) {
|
||||
var key
|
||||
, tmp = {};
|
||||
|
||||
if (i.indexOf("togglebutton") === 0) {
|
||||
key = i.match(/[A-Z][a-z]+/g);
|
||||
key = $.map(key, function (n) {
|
||||
return (n.toLowerCase());
|
||||
});
|
||||
|
||||
addToAttribute(tmp, key, el);
|
||||
dataAttribute = $.extend(true, dataAttribute, tmp);
|
||||
}
|
||||
});
|
||||
|
||||
options = $.extend(true, {}, $.fn.toggleButtons.defaults, opt, dataAttribute);
|
||||
|
||||
$(this).data('options', options);
|
||||
|
||||
$spanLeft = $('<span></span>').addClass("labelLeft").text(options.label.enabled === undefined ? "ON" : options.label.enabled);
|
||||
$spanRight = $('<span></span>').addClass("labelRight").text(options.label.disabled === undefined ? "OFF " : options.label.disabled);
|
||||
|
||||
// html layout
|
||||
$cb = $element.find('input:checkbox')
|
||||
|
||||
$div = $cb.wrap($('<div></div>')).parent();
|
||||
$div.append($spanLeft);
|
||||
$div.append($('<label></label>').attr('for', $cb.attr('id') || ''));
|
||||
$div.append($spanRight);
|
||||
|
||||
if ($cb.is(':checked'))
|
||||
$element.find('>div').css('left', "0");
|
||||
else $element.find('>div').css('left', "-50%");
|
||||
|
||||
if (options.animated) {
|
||||
if (options.transitionspeed !== undefined)
|
||||
if (/^(\d*%$)/.test(options.transitionspeed)) // is a percent value?
|
||||
transitionSpeed = 0.05 * parseInt(options.transitionspeed) / 100;
|
||||
else
|
||||
transitionSpeed = options.transitionspeed;
|
||||
}
|
||||
else transitionSpeed = 0;
|
||||
|
||||
$(this).data('transitionSpeed', transitionSpeed * 1000);
|
||||
|
||||
|
||||
options["width"] /= 2;
|
||||
|
||||
// width of the bootstrap-toggle-button
|
||||
$element
|
||||
.css('width', options.width * 2)
|
||||
.find('>div').css('width', options.width * 3)
|
||||
.find('>span, >label').css('width', options.width);
|
||||
|
||||
// height of the bootstrap-toggle-button
|
||||
$element
|
||||
.css('height', options.height)
|
||||
.find('span, label')
|
||||
.css('height', options.height)
|
||||
.filter('span')
|
||||
.css('line-height', options.height + "px");
|
||||
|
||||
if ($cb.is(':disabled'))
|
||||
$(this).addClass('deactivate');
|
||||
|
||||
$element.find('span').css(options.font);
|
||||
|
||||
|
||||
// enabled custom color
|
||||
if (options.style.enabled === undefined) {
|
||||
if (options.style.custom !== undefined && options.style.custom.enabled !== undefined && options.style.custom.enabled.background !== undefined) {
|
||||
$spanLeft.css('color', options.style.custom.enabled.color);
|
||||
if (options.style.custom.enabled.gradient === undefined)
|
||||
$spanLeft.css('background', options.style.custom.enabled.background);
|
||||
else $.each(["-webkit-", "-moz-", "-o-", ""], function (i, el) {
|
||||
$spanLeft.css('background-color', options.style.custom.enabled.background);
|
||||
$spanLeft.css('background-image', el + 'linear-gradient(top, ' + options.style.custom.enabled.background + ',' + options.style.custom.enabled.gradient + ')');
|
||||
});
|
||||
}
|
||||
}
|
||||
else $spanLeft.addClass(options.style.enabled);
|
||||
|
||||
// disabled custom color
|
||||
if (options.style.disabled === undefined) {
|
||||
if (options.style.custom !== undefined && options.style.custom.disabled !== undefined && options.style.custom.disabled.background !== undefined) {
|
||||
$spanRight.css('color', options.style.custom.disabled.color);
|
||||
if (options.style.custom.disabled.gradient === undefined)
|
||||
$spanRight.css('background', options.style.custom.disabled.background);
|
||||
else $.each(["-webkit-", "-moz-", "-o-", ""], function (i, el) {
|
||||
$spanRight.css('background-color', options.style.custom.disabled.background);
|
||||
$spanRight.css('background-image', el + 'linear-gradient(top, ' + options.style.custom.disabled.background + ',' + options.style.custom.disabled.gradient + ')');
|
||||
});
|
||||
}
|
||||
}
|
||||
else $spanRight.addClass(options.style.disabled);
|
||||
|
||||
var changeStatus = function ($this) {
|
||||
$this.siblings('label')
|
||||
.trigger('mousedown')
|
||||
.trigger('mouseup')
|
||||
.trigger('click');
|
||||
};
|
||||
|
||||
$spanLeft.on('click', function (e) {
|
||||
changeStatus($(this));
|
||||
});
|
||||
$spanRight.on('click', function (e) {
|
||||
changeStatus($(this));
|
||||
});
|
||||
|
||||
$element.find('input:checkbox').on('change', function (e, skipOnChange) {
|
||||
var $element = $(this).parent()
|
||||
, active = $(this).is(':checked')
|
||||
, $toggleButton = $(this).closest('.toggle-button');
|
||||
|
||||
$element.stop().animate({'left': active ? '0' : '-50%'}, $toggleButton.data('transitionSpeed'));
|
||||
|
||||
options = $toggleButton.data('options');
|
||||
|
||||
if (!skipOnChange)
|
||||
options.onChange($element, active, e);
|
||||
});
|
||||
|
||||
$element.find('label').on('mousedown touchstart', function (e) {
|
||||
moving = false;
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
if ($(this).closest('.toggle-button').is('.deactivate'))
|
||||
$(this).off('click');
|
||||
else {
|
||||
$(this).on('mousemove touchmove', function (e) {
|
||||
var $element = $(this).closest('.toggle-button')
|
||||
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
|
||||
, percent = ((relativeX / (options.width * 2)) * 100);
|
||||
moving = true;
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if (percent < 25)
|
||||
percent = 25;
|
||||
else if (percent > 75)
|
||||
percent = 75;
|
||||
|
||||
$element.find('>div').css('left', (percent - 75) + "%");
|
||||
});
|
||||
|
||||
$(this).on('click touchend', function (e) {
|
||||
var $target = $(e.target)
|
||||
, $myCheckBox = $target.siblings('input:checkbox');
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
$(this).off('mouseleave');
|
||||
|
||||
if (moving)
|
||||
if (parseInt($(this).parent().css('left')) < -25)
|
||||
$myCheckBox.attr('checked', false);
|
||||
else $myCheckBox.attr('checked', true);
|
||||
else $myCheckBox.attr("checked", !$myCheckBox.is(":checked"));
|
||||
|
||||
$myCheckBox.trigger('change');
|
||||
});
|
||||
|
||||
$(this).on('mouseleave', function (e) {
|
||||
var $myCheckBox = $(this).siblings('input:checkbox');
|
||||
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
$(this).off('mouseleave');
|
||||
$(this).trigger('mouseup');
|
||||
|
||||
if (parseInt($(this).parent().css('left')) < -25)
|
||||
$myCheckBox.attr('checked', false);
|
||||
else $myCheckBox.attr('checked', true);
|
||||
|
||||
$myCheckBox.trigger('change');
|
||||
});
|
||||
|
||||
$(this).on('mouseup', function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
$(this).off('mousemove');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
return this;
|
||||
},
|
||||
toggleActivation: function () {
|
||||
$(this).toggleClass('deactivate');
|
||||
},
|
||||
toggleState: function (skipOnChange) {
|
||||
var $input = $(this).find('input:checkbox');
|
||||
$input.attr('checked', !$input.is(':checked')).trigger('change', skipOnChange);
|
||||
},
|
||||
setState: function(value, skipOnChange) {
|
||||
$(this).find('input:checkbox').attr('checked', value).trigger('change', skipOnChange);
|
||||
},
|
||||
status: function () {
|
||||
return $(this).find('input:checkbox').is(':checked');
|
||||
},
|
||||
destroy: function () {
|
||||
var $div = $(this).find('div')
|
||||
, $checkbox;
|
||||
|
||||
$div.find(':not(input:checkbox)').remove();
|
||||
|
||||
$checkbox = $div.children();
|
||||
$checkbox.unwrap().unwrap();
|
||||
|
||||
$checkbox.unbind('change');
|
||||
|
||||
return $checkbox;
|
||||
}
|
||||
};
|
||||
|
||||
if (methods[method])
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
else if (typeof method === 'object' || !method)
|
||||
return methods.init.apply(this, arguments);
|
||||
else
|
||||
$.error('Method ' + method + ' does not exist!');
|
||||
};
|
||||
|
||||
$.fn.toggleButtons.defaults = {
|
||||
onChange: function () {
|
||||
},
|
||||
width: 100,
|
||||
height: 25,
|
||||
font: {},
|
||||
animated: true,
|
||||
transitionspeed: undefined,
|
||||
label: {
|
||||
enabled: undefined,
|
||||
disabled: undefined
|
||||
},
|
||||
style: {
|
||||
enabled: undefined,
|
||||
disabled: undefined,
|
||||
custom: {
|
||||
enabled: {
|
||||
background: undefined,
|
||||
gradient: undefined,
|
||||
color: "#FFFFFF"
|
||||
},
|
||||
disabled: {
|
||||
background: undefined,
|
||||
gradient: undefined,
|
||||
color: "#FFFFFF"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}(jQuery);
|
||||
Reference in New Issue
Block a user