/usr/share/hotot/js/ui.peopleview.js is in hotot-common 1:0.9.8.14-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | if (typeof ui == 'undefined') var ui = {};
ui.PeopleView = {
relation_map: {},
relation_icon_set: [' ', '∞ ', '∋ ', '∈ ', '∅ '],
init:
function init() {
ui.PeopleView.update_trans();
},
update_trans:
function update_trans (argument) {
ui.PeopleView.relation_map = {
0: _('hey_it_is_you')
, 1: _('you_are_friends')
, 2: _('you_are_followed_by_them')
, 3: _('you_are_following')
, 4: _('you_are_not_following_each_other')
};
},
init_view:
function init_view(view) {
ui.PeopleView.update_trans();
var vcard = view._header.find('.people_vcard');
vcard.find('.mochi_button_group_item').click(function () {
var pagename = '.' + $(this).attr('href').substring(1);
vcard.find('.vcard_tabs_page').hide();
vcard.find(pagename).show();
var a = $(this).attr("name");
$(".mochi_button_group_item[name=" + a + "]").not(this).removeClass("selected");
$(this).addClass("selected");
return false;
});
var toggle = view._header.find('.people_view_toggle');
var sub_view_btns = toggle.find('.mochi_button_group_item');
sub_view_btns.click(function (event) {
var pagename = $(this).attr('href').substring(1);
if (pagename === 'list') {
toggle.find('.lists_menu').toggle();
} else if (pagename === 'people') {
toggle.find('.people_menu').toggle();
} else {
var a = $(this).attr("name");
sub_view_btns.not(this).removeClass('selected');
$(this).addClass('selected');
ui.PeopleView.switch_sub_view(view, pagename);
}
return false;
});
vcard.find('.profile_img_wrapper').click(function() {
ui.Previewer.reload($(this).attr('href'))
ui.Previewer.open();
return false;
});
vcard.find('.vcard_follow').click('click',
function (event) {
var _this = this;
if ($(this).hasClass('unfo')) {
toast.set(_("unfollow_at") + view.screen_name + " ...").show();
globals.twitterClient.destroy_friendships(view.screen_name,
function () {
toast.set(
_("unfollow_at")+ view.screen_name+" Successfully!").show();
$(_this).text(_("follow")).removeClass('unfo').addClass('blue');
});
} else {
toast.set(_("follow_at") + view.screen_name + " ...").show();
globals.twitterClient.create_friendships(view.screen_name,
function () {
toast.set(
_("follow_at")+ view.screen_name+" Successfully!").show();
$(_this).text(_("unfollow")).addClass('unfo').removeClass('blue');
});
}
});
vcard.find('.vcard_edit').click(
function (event) {
ui.ProfileDlg.request_profile();
globals.profile_dialog.open();
});
var people_action_more_memu = vcard.find('.people_action_more_memu');
vcard.find('.people_action_more_trigger').mouseleave(function () {
people_action_more_memu.hide();
});
vcard.find('.vcard_more').click(function () {
people_action_more_memu.toggle();
});
vcard.find('.mention_menu_item').click(
function (event) {
ui.StatusBox.set_status_text('@' + view.screen_name+' ');
ui.StatusBox.open(
function() {
ui.StatusBox.move_cursor(ui.StatusBox.POS_END);
ui.StatusBox.change_mode(ui.StatusBox.MODE_TWEET);
});
people_action_more_memu.hide();
return false;
});
vcard.find('.message_menu_item').click(
function (event) {
ui.StatusBox.set_dm_target(view.screen_name);
ui.StatusBox.set_status_text('');
ui.StatusBox.open(
function () {
ui.StatusBox.change_mode(ui.StatusBox.MODE_DM);
ui.StatusBox.move_cursor(ui.StatusBox.POS_END);
});
people_action_more_memu.hide();
return false;
});
vcard.find('.add_to_list_menu_item').click(
function (event) {
ui.AddToListDlg.load(view.screen_name);
globals.add_to_list_dialog.open();
});
vcard.find('.block_menu_item').click(
function (event) {
if (!confirm("Are you sure you want to block @"+view.screen_name+"?!\n"))
return;
toast.set("Block @" + view.screen_name + " ...").show();
globals.twitterClient.create_blocks(view.screen_name,
function (result) {
toast.set(
"Block @"+ result.screen_name+" Successfully!").show();
globals.blocking_ids.push(result.id_str);
});
people_action_more_memu.hide();
});
vcard.find('.unblock_menu_item').click(
function (event) {
toast.set("Unblock @" + view.screen_name + " ...").show();
globals.twitterClient.destroy_blocks(view.screen_name,
function (result) {
toast.set(
"Unblock @"+ result.screen_name+" Successfully").show();
var pos = globals.blocking_ids.indexOf(result.id_str);
if (pos !== -1) {
globals.blocking_ids.splice(pos, 1);
}
});
people_action_more_memu.hide();
});
vcard.find('.report_spam_menu_item').click(
function (event) {
if(!confirm('Are you sure you want to BLOCK them and REPORT for SPAM?'))
return;
toast.set("Report @" + view.screen_name + " for spam...").show();
globals.twitterClient.create_blocks(view.screen_name,
function () {
toast.set(
"Report @"+ view.screen_name+" for Spam Successfully").show();
});
people_action_more_memu.hide();
});
var people_menu = toggle.find('.people_menu');
toggle.find('.people_view_people_trigger').mouseleave(function () {
people_menu.hide();
});
people_menu.find('.followers_menu_item').click(function () {
view.is_trim = false;
view.item_type = 'cursor';
view.cursor = '';
view.former = ui.Template.form_people;
view._load = ui.PeopleView.load_follower;
view._loadmore = ui.PeopleView.loadmore_follower;
view._load_success = ui.Main.load_people_success;
view._loadmore_success = ui.Main.loadmore_people_success;
people_menu.hide();
sub_view_btns.removeClass('selected');
$('.people_view_people_btn').addClass('selected');
view.clear();
view.load();
return false;
});
people_menu.find('.friends_menu_item').click(function () {
view.is_trim = false;
view.item_type = 'cursor';
view.cursor = '';
view.former = ui.Template.form_people;
view._load = ui.PeopleView.load_friend;
view._loadmore = ui.PeopleView.loadmore_friend;
view._load_success = ui.Main.load_people_success;
view._loadmore_success = ui.Main.loadmore_people_success;
people_menu.hide();
sub_view_btns.removeClass('selected');
$('.people_view_people_btn').addClass('selected');
view.clear();
view.load();
return false;
});
var lists_menu = toggle.find('.lists_menu');
toggle.find('.people_view_list_trigger').mouseleave(function () {
lists_menu.hide();
});
lists_menu.find('.user_lists_menu_item').click(function () {
view.is_trim = false;
view.item_type = 'cursor';
view.cursor = '';
view.former = ui.Template.form_list;
view._load = ui.PeopleView.load_lists;
view._loadmore = null;
view._load_success = ui.Main.load_list_success;
view._loadmore_success = null;
lists_menu.hide();
sub_view_btns.removeClass('selected');
$('.people_view_list_btn').addClass('selected');
view.clear();
view.load();
return false;
});
lists_menu.find('.listed_lists_menu_item').click(function () {
view.is_trim = false;
view.item_type = 'cursor';
view.cursor = '';
view.former = ui.Template.form_list;
view._load = ui.PeopleView.load_listed_lists;
view._loadmore = ui.PeopleView.loadmore_listed_lists;
view._load_success = ui.Main.load_listed_list_success;
view._loadmore_success = ui.Main.loadmore_listed_list_success;
lists_menu.hide();
sub_view_btns.removeClass('selected');
$('.people_view_list_btn').addClass('selected');
view.clear();
view.load();
return false;
});
lists_menu.find('.create_list_menu_item').click(function () {
ui.ListAttrDlg.load(globals.myself.screen_name,'');
globals.list_attr_dialog.open();
lists_menu.hide();
return false;
});
view._header.find('.expand').click(function () {
if (vcard.is(':hidden')) {
vcard.slideDown('fast');
} else {
vcard.slideUp('fast');
}
});
},
destroy_view:
function destroy_view(view) {
// unbind
var vcard = view._header.find('.people_vcard');
vcard.find('.button').unbind();
vcard.find('.radio_group_btn').unbind();
view._header.find('expand').unbind();
// remove slide, view and DOM
ui.Slider.remove(view.name);
},
switch_sub_view:
function switch_sub_view(view, name) {
switch (name) {
case 'tweet':
view.is_trim = true;
view.item_type = 'id';
view.since_id = 1;
view.former = ui.Template.form_tweet;
view._load = ui.PeopleView.load_timeline_full;
view._loadmore = ui.PeopleView.loadmore_timeline;
view._load_success = ui.Main.load_tweet_success;
view._loadmore_success = ui.Main.loadmore_tweet_success;
break;
case 'fav':
view.is_trim = false;
view.item_type = 'page';
view.page = 1;
view.former = ui.Template.form_tweet;
view._load = ui.PeopleView.load_fav;
view._loadmore = ui.PeopleView.loadmore_fav;
view._load_success = ui.Main.load_tweet_success;
view._loadmore_success = ui.Main.loadmore_tweet_success;
break;
default: break;
}
view.clear();
view.load();
},
get_relationship:
function get_relationship(screen_name, callback) {
if (screen_name == globals.myself.screen_name) {
callback(0);
} else {
globals.twitterClient.show_friendships(
screen_name
, globals.myself.screen_name
, function (result) {
var relation = 0;
var source = result.relationship.source;
if (source.following && source.followed_by) {
relation = 1;
} else if (source.following && !source.followed_by) {
relation = 2;
} else if (!source.following && source.followed_by) {
relation = 3;
} else {
relation = 4;
}
callback(relation);
}
);
}
},
render_people_view:
function render_people_view(self, user_obj, proc) {
var btn_follow = self._header.find('.vcard_follow');
var btn_edit = self._header.find('.vcard_edit');
var btn_block = self._header.find('.vcard_block');
var btn_unblock = self._header.find('.vcard_unblock');
var btn_request = self._header.find('.people_request_btn');
var request_hint = self._header.find('.people_request_hint');
var toggle_btns = self._header.find('.people_view_toggle');
btn_follow.show();
ui.Template.fill_people_vcard(user_obj, self._header);
db.dump_users([user_obj]);
self._header.find('.create_list_menu_item').hide();
if (user_obj.screen_name == globals.myself.screen_name) {
btn_edit.show();
btn_follow.hide();
btn_block.hide();
btn_unblock.hide();
self._header.find('.create_list_menu_item').show();
proc();
self.protected_user = false;
} else {
if (user_obj.protected && !user_obj.following) {
// not friend and user protect his tweets,
// then hide follow btn.
btn_follow.hide();
// and display request box.
toggle_btns.hide();
request_hint.show();
btn_request.attr('href'
, conf.get_current_profile().preferences.base_url
+ user_obj.screen_name);
self.protected_user = true;
} else {
btn_follow.text(_("follow"));
btn_follow.removeClass('unfo');
proc();
self.protected_user = false;
}
}
ui.PeopleView.get_relationship(user_obj.screen_name
, function (rel) {
self._header.find('.relation').text(
ui.PeopleView.relation_map[rel]
);
self._header.find('.relation').prepend(
ui.PeopleView.relation_icon_set[rel]
);
if (rel == 1 || rel == 3) {
btn_follow.text(_("unfollow"));
btn_follow.addClass('unfo');
btn_follow.removeClass('blue');
} else {
btn_follow.addClass('blue');
}
});
ui.Slider.set_icon(self.name, user_obj.profile_image_url, ui.Slider.BOARD_ICON);
},
load_timeline_full:
function load_timeline_full(view, success, fail) {
var render_proc = function (user_obj) {
ui.PeopleView.render_people_view(view, user_obj
, function () {
globals.twitterClient.get_user_timeline(null, view.screen_name
, view.since_id, null, conf.vars.items_per_request, success);
});
view._load = ui.PeopleView.load_timeline;
}
globals.twitterClient.show_user(view.screen_name, render_proc,
function (xhr, textStatus, errorThrown) {
if (xhr.status == 404) {
widget.DialogManager.alert('This person does not exist.'
, 'The person @' + view.screen_name + ' you are looking for does not exist. He/she may have deleted the account or changed the user name.');
view.destroy();
}
});
},
load_timeline:
function load_timeline(view, success, fail) {
globals.twitterClient.get_user_timeline(null, view.screen_name
, view.since_id, null, conf.vars.items_per_request, success);
},
loadmore_timeline:
function loadmore_people(self, success, fail) {
if (self.protected_user) {
self._footer.hide();
return;
}
globals.twitterClient.get_user_timeline(null
, self.screen_name
, null
, self.max_id, 20, success);
},
load_fav:
function load_fav(view, success, fail) {
globals.twitterClient.get_favorites(view.screen_name, 1, success);
},
loadmore_fav:
function loadmore_fav(view, success, fail) {
globals.twitterClient.get_favorites(view.screen_name, view.page, success);
},
load_follower:
function load_follower(view, success, fail) {
globals.twitterClient.get_user_followers(view.screen_name, -1, success);
},
loadmore_follower:
function loadmore_follower(view, success, fail) {
globals.twitterClient.get_user_followers(view.screen_name, view.cursor, success);
},
load_friend:
function load_friend(view, success, fail) {
globals.twitterClient.get_user_friends(view.screen_name, -1, success);
},
loadmore_friend:
function loadmore_friend(view, success, fail) {
globals.twitterClient.get_user_friends(view.screen_name, view.cursor, success);
},
load_lists:
function load_lists(view, success, fail) {
globals.twitterClient.get_user_lists(view.screen_name, -1, success);
},
load_listed_lists:
function load_listed_lists(view, success, fail) {
globals.twitterClient.get_user_listed_lists(view.screen_name, -1, success);
},
loadmore_listed_lists:
function loadmore_listed_lists(view, success, fail) {
globals.twitterClient.get_user_listed_lists(view.screen_name, view.cursor, success);
}
};
|