|
|
|
@ -9,42 +9,108 @@ define([
|
|
|
|
|
, "jquery"
|
|
|
|
|
, "backbone"
|
|
|
|
|
, "bootstrap"
|
|
|
|
|
|
|
|
|
|
, "text!../../templates/footer/modal-about.html"
|
|
|
|
|
]
|
|
|
|
|
, function (_, $, Backbone, Bootstrap, tmplModalAbout) {
|
|
|
|
|
, function (_, $, Backbone, Bootstrap) {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var Footer = Backbone.View.extend({
|
|
|
|
|
events: {
|
|
|
|
|
"click button[data-target='modalAboutDaapr']": "_buttonAboutClick"
|
|
|
|
|
"click button[data-target='about']": "__eventButtonAboutClick"
|
|
|
|
|
, "click button[data-target='sidebar']": "__eventToggleButtonSideBar"
|
|
|
|
|
, "click button[data-target='random']": "__eventToggleButtonRandom"
|
|
|
|
|
, "click button[data-target='repeat']": "__eventToggleButtonRepeat"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, _stateRepeat: false
|
|
|
|
|
|
|
|
|
|
, _stateRandom: false
|
|
|
|
|
|
|
|
|
|
, initialize: function (options) {
|
|
|
|
|
_.bindAll(this
|
|
|
|
|
, "__eventToggleButtonRandom"
|
|
|
|
|
, "__eventToggleButtonRepeat"
|
|
|
|
|
, "__eventToggleButtonSideBar"
|
|
|
|
|
, "__eventButtonAboutClick"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
Footer.__super__.initialize.apply(that, arguments);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, __eventToggleButtonRandom: function (event) {
|
|
|
|
|
var that = this
|
|
|
|
|
, $target = $(event.target)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
that._stateRandom = !that._stateRandom;
|
|
|
|
|
|
|
|
|
|
if (event.target.tagName === "I") {
|
|
|
|
|
$target = $target.parent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (that._stateRandom) {
|
|
|
|
|
$target.addClass("active");
|
|
|
|
|
} else {
|
|
|
|
|
$target.removeClass("active");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!that.__timeoutDebounceRandomButton) {
|
|
|
|
|
that.__timeoutDebounceRandomButton = setTimeout(function () {
|
|
|
|
|
that.trigger("toggle:random", that._stateRandom);
|
|
|
|
|
|
|
|
|
|
delete that.__timeoutDebounceRandomButton;
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, __eventToggleButtonRepeat: function (event) {
|
|
|
|
|
var that = this
|
|
|
|
|
, $target = $(event.target)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
that._stateRepeat = !that._stateRepeat;
|
|
|
|
|
|
|
|
|
|
if (event.target.tagName === "I") {
|
|
|
|
|
$target = $target.parent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (that._stateRepeat) {
|
|
|
|
|
$target.addClass("active");
|
|
|
|
|
} else {
|
|
|
|
|
$target.removeClass("active");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
that.$el.delegate("button[data-toggle='side-bar']", "click", function (event) {
|
|
|
|
|
that.trigger("toggle:sidebar");
|
|
|
|
|
if (!that.__timeoutDebounceRepeatButton) {
|
|
|
|
|
that.__timeoutDebounceRepeatButton = setTimeout(function () {
|
|
|
|
|
that.trigger("toggle:repeat", that._stateRepeat);
|
|
|
|
|
|
|
|
|
|
var $target = $(event.target);
|
|
|
|
|
if (event.target.tagName === "BUTTON") {
|
|
|
|
|
$target = $target.find("i");
|
|
|
|
|
}
|
|
|
|
|
delete that.__timeoutDebounceRepeatButton;
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, __eventToggleButtonSideBar: function (event) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
that.trigger("toggle:sidebar");
|
|
|
|
|
|
|
|
|
|
$target.toggleClass("icon-chevron-right");
|
|
|
|
|
$target.toggleClass("icon-chevron-left");
|
|
|
|
|
});
|
|
|
|
|
var $target = $(event.target);
|
|
|
|
|
if (event.target.tagName === "BUTTON") {
|
|
|
|
|
$target = $target.find("i");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$target.toggleClass("icon-chevron-right");
|
|
|
|
|
$target.toggleClass("icon-chevron-left");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
, _buttonAboutClick: function(event) {
|
|
|
|
|
var $modal = $(tmplModalAbout)
|
|
|
|
|
, __eventButtonAboutClick: function(event) {
|
|
|
|
|
var that = this
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
$modal.modal();
|
|
|
|
|
Backbone.Router.prototype.navigate("about", true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|