mirror of https://github.com/zulip/zulip.git
Rename our custom JS events to use Zulip, not Zephyr.
(imported from commit 61ac456d394a6dbc14f3e9183a53313990db5059)
This commit is contained in:
parent
3bba0cc927
commit
bc4d7c687d
|
@ -252,7 +252,7 @@ exports.start = function (msg_type, opts) {
|
|||
update_fade();
|
||||
|
||||
exports.decorate_stream_bar(opts.stream);
|
||||
$(document).trigger($.Event('compose_started.zephyr', opts));
|
||||
$(document).trigger($.Event('compose_started.zulip', opts));
|
||||
};
|
||||
|
||||
function abort_xhr () {
|
||||
|
@ -273,7 +273,7 @@ exports.cancel = function () {
|
|||
if (message_snapshot !== undefined) {
|
||||
$('#restore-draft').show();
|
||||
}
|
||||
$(document).trigger($.Event('compose_canceled.zephyr'));
|
||||
$(document).trigger($.Event('compose_canceled.zulip'));
|
||||
respond_to_cursor = false;
|
||||
};
|
||||
|
||||
|
@ -418,7 +418,7 @@ exports.finish = function () {
|
|||
send_message();
|
||||
// TODO: Do we want to fire the event even if the send failed due
|
||||
// to a server-side error?
|
||||
$(document).trigger($.Event('compose_finished.zephyr'));
|
||||
$(document).trigger($.Event('compose_finished.zulip'));
|
||||
return true;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ exports.changehash = function (newhash) {
|
|||
if (changing_hash) {
|
||||
return;
|
||||
}
|
||||
$(document).trigger($.Event('hashchange.zephyr'));
|
||||
$(document).trigger($.Event('hashchange.zulip'));
|
||||
expected_hash = newhash;
|
||||
// Some browsers reset scrollTop when changing the hash to "",
|
||||
// so we save and restore it.
|
||||
|
@ -99,7 +99,7 @@ function do_hashchange() {
|
|||
return false;
|
||||
}
|
||||
|
||||
$(document).trigger($.Event('hashchange.zephyr'));
|
||||
$(document).trigger($.Event('hashchange.zulip'));
|
||||
|
||||
// NB: In Firefox, window.location.hash is URI-decoded.
|
||||
// Even if the URL bar says #%41%42%43%44, the value here will
|
||||
|
|
|
@ -104,7 +104,7 @@ exports.maybe_show_edit = function (row, id) {
|
|||
}
|
||||
};
|
||||
|
||||
$(document).on('narrow_deactivated.zephyr', function (event) {
|
||||
$(document).on('narrow_deactivated.zulip', function (event) {
|
||||
$.each(currently_editing_messages, function (idx, elem) {
|
||||
if (current_msg_list.get(idx) !== undefined) {
|
||||
var row = rows.get(idx, current_msg_list.table_name);
|
||||
|
|
|
@ -137,7 +137,7 @@ MessageList.prototype = {
|
|||
this._maybe_rerender();
|
||||
}
|
||||
|
||||
$(document).trigger($.Event('message_selected.zephyr', opts));
|
||||
$(document).trigger($.Event('message_selected.zulip', opts));
|
||||
},
|
||||
|
||||
selected_message: function MessageList_selected_message() {
|
||||
|
@ -706,7 +706,7 @@ MessageList.prototype = {
|
|||
// doing something. Be careful, though, if you try to capture
|
||||
// mousemove, then you will have to contend with the autoscroll
|
||||
// itself generating mousemove events.
|
||||
$(document).on('message_selected.zephyr hashchange.zephyr mousewheel', function (event) {
|
||||
$(document).on('message_selected.zulip hashchange.zulip mousewheel', function (event) {
|
||||
viewport.stop_auto_scrolling();
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -24,7 +24,7 @@ mixpanel.register({user: page_params.email, realm: page_params.domain});
|
|||
send_resize_event();
|
||||
|
||||
$(function () {
|
||||
$(document).on('compose_started.zephyr', function (event) {
|
||||
$(document).on('compose_started.zulip', function (event) {
|
||||
if (! include_in_sample()) {
|
||||
return;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ $(function () {
|
|||
mixpanel.track('compose started', {type: event.message_type,
|
||||
trigger: event.trigger});
|
||||
});
|
||||
$(document).on('narrow_activated.zephyr', function (event) {
|
||||
$(document).on('narrow_activated.zulip', function (event) {
|
||||
if (! include_in_sample()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -487,7 +487,7 @@ exports.activate = function (operators, opts) {
|
|||
compose.update_recipient_on_narrow();
|
||||
compose.update_faded_messages();
|
||||
|
||||
$(document).trigger($.Event('narrow_activated.zephyr', {msg_list: narrowed_msg_list,
|
||||
$(document).trigger($.Event('narrow_activated.zulip', {msg_list: narrowed_msg_list,
|
||||
filter: current_filter,
|
||||
trigger: opts.trigger}));
|
||||
};
|
||||
|
@ -585,7 +585,7 @@ exports.deactivate = function () {
|
|||
hashchange.save_narrow();
|
||||
compose.update_faded_messages();
|
||||
|
||||
$(document).trigger($.Event('narrow_deactivated.zephyr', {msg_list: current_msg_list}));
|
||||
$(document).trigger($.Event('narrow_deactivated.zulip', {msg_list: current_msg_list}));
|
||||
};
|
||||
|
||||
exports.restore_home_state = function () {
|
||||
|
|
|
@ -367,7 +367,7 @@ exports.register_click_handlers = function () {
|
|||
if (! $('#subscriptions').hasClass('active')) {
|
||||
// Go to streams page and once it loads, expand the relevant
|
||||
// stream's settings.
|
||||
$(document).one('subs_page_loaded.zephyr', function (event) {
|
||||
$(document).one('subs_page_loaded.zulip', function (event) {
|
||||
subs.show_settings_for(stream);
|
||||
});
|
||||
ui.change_tab_to('#subscriptions');
|
||||
|
|
|
@ -141,28 +141,28 @@ exports.initiate = function (options) {
|
|||
idle_control.cancel();
|
||||
idle_control = $(document).idle({'idle': home_timeout,
|
||||
'onIdle': reload_from_idle});
|
||||
$(document).off('compose_canceled.zephyr compose_finished.zephyr',
|
||||
$(document).off('compose_canceled.zulip compose_finished.zulip',
|
||||
compose_done_handler);
|
||||
$(document).on('compose_started.zephyr', compose_started_handler);
|
||||
$(document).on('compose_started.zulip', compose_started_handler);
|
||||
};
|
||||
compose_started_handler = function () {
|
||||
idle_control.cancel();
|
||||
idle_control = $(document).idle({'idle': composing_timeout,
|
||||
'onIdle': reload_from_idle});
|
||||
$(document).off('compose_started.zephyr', compose_started_handler);
|
||||
$(document).on('compose_canceled.zephyr compose_finished.zephyr',
|
||||
$(document).off('compose_started.zulip', compose_started_handler);
|
||||
$(document).on('compose_canceled.zulip compose_finished.zulip',
|
||||
compose_done_handler);
|
||||
};
|
||||
|
||||
if (compose.composing()) {
|
||||
idle_control = $(document).idle({'idle': composing_timeout,
|
||||
'onIdle': reload_from_idle});
|
||||
$(document).on('compose_canceled.zephyr compose_finished.zephyr',
|
||||
$(document).on('compose_canceled.zulip compose_finished.zulip',
|
||||
compose_done_handler);
|
||||
} else {
|
||||
idle_control = $(document).idle({'idle': home_timeout,
|
||||
'onIdle': reload_from_idle});
|
||||
$(document).on('compose_started.zephyr', compose_started_handler);
|
||||
$(document).on('compose_started.zulip', compose_started_handler);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ exports.update_dom_with_unread_counts = function (counts) {
|
|||
};
|
||||
|
||||
$(function () {
|
||||
$(document).on('narrow_activated.zephyr', function (event) {
|
||||
$(document).on('narrow_activated.zulip', function (event) {
|
||||
$("ul.filters li").removeClass('active-filter active-subject-filter');
|
||||
$('.expanded_subjects').remove();
|
||||
|
||||
|
@ -293,13 +293,13 @@ $(function () {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).on('narrow_deactivated.zephyr', function (event) {
|
||||
$(document).on('narrow_deactivated.zulip', function (event) {
|
||||
$("ul.filters li").removeClass('active-filter active-subject-filter');
|
||||
$("ul.expanded_subjects").remove();
|
||||
$("#global_filters li[data-name='home']").addClass('active-filter');
|
||||
});
|
||||
|
||||
$(document).on('sub_obj_created.zephyr', function (event) {
|
||||
$(document).on('sub_obj_created.zulip', function (event) {
|
||||
if (event.sub.subscribed) {
|
||||
var stream_name = event.sub.name;
|
||||
var li = add_narrow_filter(stream_name, "stream");
|
||||
|
@ -309,7 +309,7 @@ $(function () {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).on('subscription_add_done.zephyr', function (event) {
|
||||
$(document).on('subscription_add_done.zulip', function (event) {
|
||||
var stream_name = event.sub.name;
|
||||
var li = add_narrow_filter(stream_name, "stream");
|
||||
if (li) {
|
||||
|
@ -318,7 +318,7 @@ $(function () {
|
|||
exports.sort_narrow_list();
|
||||
});
|
||||
|
||||
$(document).on('subscription_remove_done.zephyr', function (event) {
|
||||
$(document).on('subscription_remove_done.zulip', function (event) {
|
||||
var stream_name = event.sub.name;
|
||||
exports.remove_narrow_filter(stream_name, 'stream');
|
||||
// We need to make sure we resort if the removed sub gets added again
|
||||
|
|
|
@ -317,7 +317,7 @@ function create_sub(stream_name, attrs) {
|
|||
mark_color_used(sub.color);
|
||||
|
||||
add_sub(stream_name, sub);
|
||||
$(document).trigger($.Event('sub_obj_created.zephyr', {sub: sub}));
|
||||
$(document).trigger($.Event('sub_obj_created.zulip', {sub: sub}));
|
||||
return sub;
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ function mark_subscribed(stream_name, attrs) {
|
|||
// need its unread counts re-calculated
|
||||
process_loaded_for_unread(all_msg_list.all());
|
||||
|
||||
$(document).trigger($.Event('subscription_add_done.zephyr', {sub: sub}));
|
||||
$(document).trigger($.Event('subscription_add_done.zulip', {sub: sub}));
|
||||
}
|
||||
|
||||
function mark_unsubscribed(stream_name) {
|
||||
|
@ -435,14 +435,14 @@ function mark_unsubscribed(stream_name) {
|
|||
current_msg_list.update_trailing_bookend();
|
||||
}
|
||||
|
||||
$(document).trigger($.Event('subscription_remove_done.zephyr', {sub: sub}));
|
||||
$(document).trigger($.Event('subscription_remove_done.zulip', {sub: sub}));
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$(document).on('subscription_add.zephyr', function (e) {
|
||||
$(document).on('subscription_add.zulip', function (e) {
|
||||
mark_subscribed(e.subscription.name, e.subscription);
|
||||
});
|
||||
$(document).on('subscription_remove.zephyr', function (e) {
|
||||
$(document).on('subscription_remove.zulip', function (e) {
|
||||
mark_unsubscribed(e.subscription.name);
|
||||
});
|
||||
|
||||
|
@ -628,7 +628,7 @@ exports.setup_page = function () {
|
|||
$('#subscriptions_table').append(rendered);
|
||||
|
||||
util.destroy_loading_indicator($('#subs_page_loading_indicator'));
|
||||
$(document).trigger($.Event('subs_page_loaded.zephyr'));
|
||||
$(document).trigger($.Event('subs_page_loaded.zulip'));
|
||||
}
|
||||
|
||||
function failed_listing(xhr, error) {
|
||||
|
|
|
@ -131,10 +131,10 @@ function build_tab_bar() {
|
|||
}
|
||||
|
||||
$(function () {
|
||||
$(document).on('narrow_activated.zephyr', function (event) {
|
||||
$(document).on('narrow_activated.zulip', function (event) {
|
||||
build_tab_bar();
|
||||
});
|
||||
$(document).on('narrow_deactivated.zephyr', function (event) {
|
||||
$(document).on('narrow_deactivated.zulip', function (event) {
|
||||
build_tab_bar();
|
||||
});
|
||||
|
||||
|
|
|
@ -829,7 +829,7 @@ $(function () {
|
|||
// If the streams page is shown by clicking directly on the "Streams"
|
||||
// link (in the gear menu), then focus the new stream textbox.
|
||||
subs_link.on('click', function (e) {
|
||||
$(document).one('subs_page_loaded.zephyr', function (e) {
|
||||
$(document).one('subs_page_loaded.zulip', function (e) {
|
||||
$('#create_stream_name').focus().select();
|
||||
});
|
||||
});
|
||||
|
@ -1117,7 +1117,7 @@ $(function () {
|
|||
$(document.body).removeClass('window_blurred');
|
||||
});
|
||||
|
||||
$(document).on('message_selected.zephyr', function (event) {
|
||||
$(document).on('message_selected.zulip', function (event) {
|
||||
if (current_msg_list !== event.msg_list) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -453,7 +453,7 @@ $(function () {
|
|||
onIdle: send_pointer_update,
|
||||
keepTracking: true});
|
||||
|
||||
$(document).on('message_selected.zephyr', function (event) {
|
||||
$(document).on('message_selected.zulip', function (event) {
|
||||
|
||||
// Narrowing is a temporary view on top of the home view and
|
||||
// doesn't affect your pointer in the home view.
|
||||
|
@ -836,12 +836,12 @@ function get_updates_success(data) {
|
|||
case 'subscriptions':
|
||||
if (event.op === 'add') {
|
||||
$.each(event.subscriptions, function (index, subscription) {
|
||||
$(document).trigger($.Event('subscription_add.zephyr',
|
||||
$(document).trigger($.Event('subscription_add.zulip',
|
||||
{subscription: subscription}));
|
||||
});
|
||||
} else if (event.op === 'remove') {
|
||||
$.each(event.subscriptions, function (index, subscription) {
|
||||
$(document).trigger($.Event('subscription_remove.zephyr',
|
||||
$(document).trigger($.Event('subscription_remove.zulip',
|
||||
{subscription: subscription}));
|
||||
});
|
||||
} else if (event.op === 'update') {
|
||||
|
|
Loading…
Reference in New Issue