parent
bafb742141
commit
6636b77489
@ -1,233 +0,0 @@
|
||||
/* ============================================================
|
||||
* bootstrapSwitch v1.2 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 */
|
||||
.has-switch {
|
||||
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);
|
||||
background: #e6e6e6;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
line-height: 8px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
min-width: 102px;
|
||||
}
|
||||
|
||||
/* line 40, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch.switch-mini {
|
||||
min-width: 72px;
|
||||
}
|
||||
|
||||
/* line 44, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch.switch-small {
|
||||
min-width: 81px;
|
||||
}
|
||||
|
||||
/* line 48, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch.switch-large {
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
/* line 52, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch.deactivate {
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
|
||||
opacity: 0.5;
|
||||
cursor: default !important;
|
||||
}
|
||||
|
||||
/* line 55, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch.deactivate label, .has-switch.deactivate span {
|
||||
cursor: default !important;
|
||||
}
|
||||
|
||||
/* line 59, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch > div {
|
||||
display: inline-block;
|
||||
width: 150%;
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* line 65, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch > div.switch-animate {
|
||||
-webkit-transition: left 0.5s;
|
||||
-moz-transition: left 0.5s;
|
||||
-o-transition: left 0.5s;
|
||||
transition: left 0.5s;
|
||||
}
|
||||
|
||||
/* line 68, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch > div.switch-off {
|
||||
left: -50%;
|
||||
}
|
||||
|
||||
/* line 71, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch > div.switch-on {
|
||||
left: 0%;
|
||||
}
|
||||
|
||||
/* line 75, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch input[type=checkbox] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* line 83, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span, .has-switch label {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
padding-bottom: 4px;
|
||||
padding-top: 4px;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
/* line 96, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-mini, .has-switch label.switch-mini {
|
||||
padding-bottom: 4px;
|
||||
padding-top: 4px;
|
||||
font-size: 10px;
|
||||
line-height: 9px;
|
||||
}
|
||||
|
||||
/* line 103, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-small, .has-switch label.switch-small {
|
||||
padding-bottom: 3px;
|
||||
padding-top: 3px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
/* line 110, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-large, .has-switch label.switch-large {
|
||||
padding-bottom: 9px;
|
||||
padding-top: 9px;
|
||||
font-size: 16px;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
/* line 118, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch label {
|
||||
background: white;
|
||||
margin-top: -1px;
|
||||
margin-bottom: -1px;
|
||||
z-index: 100;
|
||||
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));
|
||||
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: linear-gradient(top, #ffffff, #e6e6e6);
|
||||
}
|
||||
|
||||
/* line 130, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span {
|
||||
color: white;
|
||||
text-align: center;
|
||||
z-index: 1;
|
||||
width: 33.333333%;
|
||||
}
|
||||
|
||||
/* line 136, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-left {
|
||||
-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;
|
||||
}
|
||||
|
||||
/* line 140, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-right {
|
||||
color: black;
|
||||
-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;
|
||||
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6));
|
||||
background-image: -webkit-linear-gradient(bottom, #ffffff, #e6e6e6);
|
||||
background-image: -moz-linear-gradient(bottom, #ffffff, #e6e6e6);
|
||||
background-image: -o-linear-gradient(bottom, #ffffff, #e6e6e6);
|
||||
background-image: linear-gradient(bottom, #ffffff, #e6e6e6);
|
||||
}
|
||||
|
||||
/* line 147, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-primary, .has-switch span.switch-left {
|
||||
color: white;
|
||||
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 152, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-info {
|
||||
color: white;
|
||||
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 158, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-success {
|
||||
color: white;
|
||||
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 164, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-warning {
|
||||
color: white;
|
||||
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 170, ../sass/bootstrapSwitch.scss */
|
||||
.has-switch span.switch-danger {
|
||||
color: white;
|
||||
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,251 +0,0 @@
|
||||
/* ============================================================
|
||||
* bootstrapSwitch v1.3 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['bootstrapSwitch'] = function (method) {
|
||||
var methods = {
|
||||
init: function () {
|
||||
return this.each(function () {
|
||||
var $element = $(this)
|
||||
, $div
|
||||
, $switchLeft
|
||||
, $switchRight
|
||||
, $label
|
||||
, myClasses = ""
|
||||
, classes = $element.attr('class')
|
||||
, color
|
||||
, moving
|
||||
, onLabel = "ON"
|
||||
, offLabel = "OFF"
|
||||
, icon = false;
|
||||
|
||||
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
|
||||
if (classes.indexOf(el) >= 0)
|
||||
myClasses = el;
|
||||
});
|
||||
|
||||
$element.addClass('has-switch');
|
||||
|
||||
if ($element.data('on') !== undefined)
|
||||
color = "switch-" + $element.data('on');
|
||||
|
||||
if ($element.data('on-label') !== undefined)
|
||||
onLabel = $element.data('on-label');
|
||||
|
||||
if ($element.data('off-label') !== undefined)
|
||||
offLabel = $element.data('off-label');
|
||||
|
||||
if ($element.data('icon') !== undefined)
|
||||
icon = $element.data('icon');
|
||||
|
||||
$switchLeft = $('<span>')
|
||||
.addClass("switch-left")
|
||||
.addClass(myClasses)
|
||||
.addClass(color)
|
||||
.html(onLabel);
|
||||
|
||||
color = '';
|
||||
if ($element.data('off') !== undefined)
|
||||
color = "switch-" + $element.data('off');
|
||||
|
||||
$switchRight = $('<span>')
|
||||
.addClass("switch-right")
|
||||
.addClass(myClasses)
|
||||
.addClass(color)
|
||||
.html(offLabel);
|
||||
|
||||
$label = $('<label>')
|
||||
.html(" ")
|
||||
.addClass(myClasses)
|
||||
.attr('for', $element.find('input').attr('id'));
|
||||
|
||||
if (icon) {
|
||||
$label.html('<i class="icon icon-' + icon + '"></i>');
|
||||
}
|
||||
|
||||
$div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false);
|
||||
|
||||
if ($element.data('animated') !== false)
|
||||
$div.addClass('switch-animate').data('animated', true);
|
||||
|
||||
$div
|
||||
.append($switchLeft)
|
||||
.append($label)
|
||||
.append($switchRight);
|
||||
|
||||
$element.find('>div').addClass(
|
||||
$element.find('input').is(':checked') ? 'switch-on' : 'switch-off'
|
||||
);
|
||||
|
||||
if ($element.find('input').is(':disabled'))
|
||||
$(this).addClass('deactivate');
|
||||
|
||||
var changeStatus = function ($this) {
|
||||
$this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
|
||||
};
|
||||
|
||||
$element.on('keydown', function (e) {
|
||||
if (e.keyCode === 32) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
changeStatus($(e.target).find('span:first'));
|
||||
}
|
||||
});
|
||||
|
||||
$switchLeft.on('click', function (e) {
|
||||
changeStatus($(this));
|
||||
});
|
||||
|
||||
$switchRight.on('click', function (e) {
|
||||
changeStatus($(this));
|
||||
});
|
||||
|
||||
$element.find('input').on('change', function (e) {
|
||||
var $this = $(this)
|
||||
, $element = $this.parent()
|
||||
, thisState = $this.is(':checked')
|
||||
, state = $element.is('.switch-off');
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$element.css('left', '');
|
||||
|
||||
if (state === thisState) {
|
||||
|
||||
if (thisState)
|
||||
$element.removeClass('switch-off').addClass('switch-on');
|
||||
else $element.removeClass('switch-on').addClass('switch-off');
|
||||
|
||||
if ($element.data('animated') !== false)
|
||||
$element.addClass("switch-animate");
|
||||
|
||||
$element.parent().trigger('switch-change', {'el': $this, 'value': thisState})
|
||||
}
|
||||
});
|
||||
|
||||
$element.find('label').on('mousedown touchstart', function (e) {
|
||||
var $this = $(this);
|
||||
moving = false;
|
||||
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
$this.closest('div').removeClass('switch-animate');
|
||||
|
||||
if ($this.closest('.switch').is('.deactivate'))
|
||||
$this.unbind('click');
|
||||
else {
|
||||
$this.on('mousemove touchmove', function (e) {
|
||||
var $element = $(this).closest('.switch')
|
||||
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
|
||||
, percent = (relativeX / $element.width()) * 100
|
||||
, left = 25
|
||||
, right = 75;
|
||||
|
||||
moving = true;
|
||||
|
||||
if (percent < left)
|
||||
percent = left;
|
||||
else if (percent > right)
|
||||
percent = right;
|
||||
|
||||
$element.find('>div').css('left', (percent - right) + "%")
|
||||
});
|
||||
|
||||
$this.on('click touchend', function (e) {
|
||||
var $this = $(this)
|
||||
, $target = $(e.target)
|
||||
, $myCheckBox = $target.siblings('input');
|
||||
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
|
||||
$this.unbind('mouseleave');
|
||||
|
||||
if (moving)
|
||||
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
|
||||
else $myCheckBox.prop("checked", !$myCheckBox.is(":checked"));
|
||||
|
||||
moving = false;
|
||||
$myCheckBox.trigger('change');
|
||||
});
|
||||
|
||||
$this.on('mouseleave', function (e) {
|
||||
var $this = $(this)
|
||||
, $myCheckBox = $this.siblings('input');
|
||||
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
$this.unbind('mouseleave');
|
||||
$this.trigger('mouseup');
|
||||
|
||||
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
|
||||
});
|
||||
|
||||
$this.on('mouseup', function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
|
||||
$(this).unbind('mousemove');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
toggleActivation: function () {
|
||||
$(this).toggleClass('deactivate');
|
||||
},
|
||||
isActive: function () {
|
||||
return !$(this).hasClass('deactivate');
|
||||
},
|
||||
setActive: function (active) {
|
||||
if (active)
|
||||
$(this).removeClass('deactivate');
|
||||
else $(this).addClass('deactivate');
|
||||
},
|
||||
toggleState: function (skipOnChange) {
|
||||
var $input = $(this).find('input:checkbox');
|
||||
$input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
|
||||
},
|
||||
setState: function (value, skipOnChange) {
|
||||
$(this).find('input:checkbox').prop('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!');
|
||||
};
|
||||
}(jQuery);
|
||||
|
||||
$(function () {
|
||||
$('.switch')['bootstrapSwitch']();
|
||||
});
|
@ -1,59 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var oldItemViewRender = Marionette.ItemView.prototype.render;
|
||||
var oldItemCollectionViewRender = Marionette.CollectionView.prototype.render;
|
||||
|
||||
|
||||
Marionette.View.prototype.viewName = function () {
|
||||
if (this.template) {
|
||||
var regex = new RegExp('\/', 'g');
|
||||
|
||||
return this.template
|
||||
.toLocaleLowerCase()
|
||||
.replace('template', '')
|
||||
.replace(regex, '-');
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
Marionette.ItemView.prototype.self$ = function (selector) {
|
||||
return this.$(selector).not("[class*='iv-'] " + selector);
|
||||
};
|
||||
|
||||
Marionette.ItemView.prototype.render = function () {
|
||||
|
||||
var result = oldItemViewRender.apply(this, arguments);
|
||||
|
||||
|
||||
//check to see if el has bindings (name attribute)
|
||||
// any element that has a name attribute and isn't child of another view.
|
||||
if (this.self$('[name]').length > 0) {
|
||||
if (!this.model) {
|
||||
throw 'view ' + this.viewName() + ' has binding attributes but model is not defined';
|
||||
}
|
||||
|
||||
if (!this._modelBinder) {
|
||||
this._modelBinder = new Backbone.ModelBinder();
|
||||
}
|
||||
|
||||
window.console.log('binding ' + this.viewName());
|
||||
|
||||
this._modelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
this.self$('.switch').bootstrapSwitch();
|
||||
this.$el.addClass('iv-' + this.viewName());
|
||||
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Marionette.CollectionView.prototype.render = function () {
|
||||
|
||||
if (this.model) {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
return oldItemCollectionViewRender.apply(this, arguments);
|
||||
};
|
Loading…
Reference in new issue