« app/git@code.facil.services:facil/parlote-facil.git » n'existait pas sur « 46b156762295ea0a5e22cb01279cff6df0d310e3 »
Newer
Older
* licensed under the Affero General Public License version 3 or later. See
var View = {
initialize: function() {
/* Buttons */
$("input[type='submit']").addClass("button");
/* Tooltips */
this.tooltips.bindAll();
/* Animate flashes */
this.flashes.animate();
/* In field labels */
$("label").inFieldLabels();
/* Focus aspect name on fancybox */
$(this.addAspectButton.selector)
.click(this.addAspectButton.click);
/* Showing debug messages */
$(this.debug.selector)
.click(this.debug.click);
/* "Toggling" the search input */
$(this.search.selector)
.blur(this.search.blur)
.focus(this.search.focus);
/* Getting started animation */
$(this.gettingStarted.selector)
.live("click", this.gettingStarted.click);
/* Submitting the status message form when the user hits enter */
$(this.publisher.selector)
.keydown(this.publisher.keydown);
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* User menu */
$(this.userMenu.selector)
.click(this.userMenu.click);
/* Sending a request message */
$(this.newRequest.selector)
.live("submit", this.newRequest.submit);
/* Button fancyboxes */
$(this.fancyBoxButtons.selectors.join(", "))
.fancybox({
'titleShow': false,
'hideOnOverlayClick' : false
});
/* Webfinger form ajaxy loading */
$(this.webFingerForm.selector)
.submit(this.webFingerForm.submit);
$(document.body)
.click(this.userMenu.removeFocus);
},
addAspectButton: {
click: function() {
$("#aspect_name").focus();
},
selector: ".add_aspect_button"
},
fancyBoxButtons: {
selectors: [
".add_aspect_button",
".manage_aspect_contacts_button",
".invite_user_button",
".add_photo_button",
".remove_person_button",
".question_mark"
]
},
debug: {
click: function() {
$("#debug_more").toggle("fast");
},
selector: "#debug_info"
},
flashes: {
animate: function() {
var $this = $(View.flashes.selector);
$this.animate({
top: 0
}).delay(2000).animate({
top: -100
},
selector: "#flash_notice, #flash_error, #flash_alert"
},
gettingStarted: {
click: function() {
var $this = $(this);
$this.animate({
left: parseInt($this.css("left"), 30) === 0 ? -$this.outerWidth() : 0
}, function() {
$this.css("left", "1000px");
});
},
selector: ".getting_started_box"
},
newRequest: {
submit: function() {
$(this).hide().parent().find(".message").removeClass("hidden");
},
selector: ".new_request"
},
publisher: {
keydown: function(e) {
if(e.shiftKey && e.keyCode === 13) {
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
$(this).closest("form").submit();
}
},
selector: "#publisher textarea"
},
search: {
blur: function() {
$(this).removeClass("active");
},
focus: function() {
$(this).addClass("active");
},
selector: "#q"
},
tooltips: {
addAspect: {
bind: function() {
$(".add_aspect_button", "#aspect_nav").tipsy({
gravity:"w"
});
}
},
avatars: {
bind: function() {
$("#left_pane img.avatar, #manage_aspect_zones img.avatar").tipsy({
live: true
});
}
},
whatIsThis: {
bind: function() {
$(".what_is_this").tipsy({
live: true,
delayIn: 400
});
}
},
bindAll: function() {
for(var element in this) {
if(element !== "bindAll") {
this[element].bind();
}
};
},
userMenu: {
click: function() {
$(this).toggleClass("active");
},
removeFocus: function(evt) {
var $target = $(evt.target);
if(!$target.closest("#user_menu").length) {
$(View.userMenu.selector).removeClass("active");
}
},
selector: "#user_menu"
},
webFingerForm: {
submit: function(evt) {
$(evt.currentTarget).siblings("#loader").show();
$("#request_result li:first").hide();
},
selector: ".webfinger_form"
}
$(function() {
/* Make sure this refers to View, not the document */
View.initialize.apply(View);