mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
js: Automatically convert var to let and const in more files.
This commit was automatically generated by `tools/lint --only=eslint --fix`, after an `.eslintrc.json` change. A half dozen files were removed from the changes by tabbott pending further work to ensure we avoid breaking valuable PRs with merge conflicts. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
const TurndownService = require("turndown/lib/turndown.cjs.js");
|
||||
|
||||
function find_boundary_tr(initial_tr, iterate_row) {
|
||||
var j;
|
||||
var skip_same_td_check = false;
|
||||
var tr = initial_tr;
|
||||
let j;
|
||||
let skip_same_td_check = false;
|
||||
let tr = initial_tr;
|
||||
|
||||
// If the selection boundary is somewhere that does not have a
|
||||
// parent tr, we should let the browser handle the copy-paste
|
||||
@@ -34,7 +34,7 @@ function find_boundary_tr(initial_tr, iterate_row) {
|
||||
}
|
||||
|
||||
function construct_recipient_header(message_row) {
|
||||
var message_header_content = rows.get_message_recipient_header(message_row)
|
||||
const message_header_content = rows.get_message_recipient_header(message_row)
|
||||
.text()
|
||||
.replace(/\s+/g, " ")
|
||||
.replace(/^\s/, "").replace(/\s$/, "");
|
||||
@@ -57,14 +57,14 @@ how modern browsers deal with copy/paste. Just test
|
||||
your changes carefully.
|
||||
*/
|
||||
function construct_copy_div(div, start_id, end_id) {
|
||||
var start_row = current_msg_list.get_row(start_id);
|
||||
var start_recipient_row = rows.get_message_recipient_row(start_row);
|
||||
var start_recipient_row_id = rows.id_for_recipient_row(start_recipient_row);
|
||||
var should_include_start_recipient_header = false;
|
||||
const start_row = current_msg_list.get_row(start_id);
|
||||
const start_recipient_row = rows.get_message_recipient_row(start_row);
|
||||
const start_recipient_row_id = rows.id_for_recipient_row(start_recipient_row);
|
||||
let should_include_start_recipient_header = false;
|
||||
|
||||
var last_recipient_row_id = start_recipient_row_id;
|
||||
for (var row = start_row; rows.id(row) <= end_id; row = rows.next_visible(row)) {
|
||||
var recipient_row_id = rows.id_for_recipient_row(rows.get_message_recipient_row(row));
|
||||
let last_recipient_row_id = start_recipient_row_id;
|
||||
for (let row = start_row; rows.id(row) <= end_id; row = rows.next_visible(row)) {
|
||||
const recipient_row_id = rows.id_for_recipient_row(rows.get_message_recipient_row(row));
|
||||
// if we found a message from another recipient,
|
||||
// it means that we have messages from several recipients,
|
||||
// so we have to add new recipient's bar to final copied message
|
||||
@@ -74,8 +74,8 @@ function construct_copy_div(div, start_id, end_id) {
|
||||
last_recipient_row_id = recipient_row_id;
|
||||
should_include_start_recipient_header = true;
|
||||
}
|
||||
var message = current_msg_list.get(rows.id(row));
|
||||
var message_firstp = $(message.content).slice(0, 1);
|
||||
const message = current_msg_list.get(rows.id(row));
|
||||
const message_firstp = $(message.content).slice(0, 1);
|
||||
message_firstp.prepend(message.sender_full_name + ": ");
|
||||
div.append(message_firstp);
|
||||
div.append($(message.content).slice(1));
|
||||
@@ -132,13 +132,13 @@ exports.copy_handler = function () {
|
||||
// * Otherwise, we want to copy the bodies of all messages that
|
||||
// were partially covered by the selection.
|
||||
|
||||
var selection = window.getSelection();
|
||||
var analysis = exports.analyze_selection(selection);
|
||||
var ranges = analysis.ranges;
|
||||
var start_id = analysis.start_id;
|
||||
var end_id = analysis.end_id;
|
||||
var skip_same_td_check = analysis.skip_same_td_check;
|
||||
var div = $('<div>');
|
||||
const selection = window.getSelection();
|
||||
const analysis = exports.analyze_selection(selection);
|
||||
const ranges = analysis.ranges;
|
||||
const start_id = analysis.start_id;
|
||||
const end_id = analysis.end_id;
|
||||
const skip_same_td_check = analysis.skip_same_td_check;
|
||||
const div = $('<div>');
|
||||
|
||||
if (start_id === undefined || end_id === undefined) {
|
||||
// In this case either the starting message or the ending
|
||||
@@ -186,20 +186,20 @@ exports.analyze_selection = function (selection) {
|
||||
// analyze the combined range of the selections, and copy their
|
||||
// full content.
|
||||
|
||||
var i;
|
||||
var range;
|
||||
var ranges = [];
|
||||
var startc;
|
||||
var endc;
|
||||
var initial_end_tr;
|
||||
var start_id;
|
||||
var end_id;
|
||||
var start_data;
|
||||
var end_data;
|
||||
let i;
|
||||
let range;
|
||||
const ranges = [];
|
||||
let startc;
|
||||
let endc;
|
||||
let initial_end_tr;
|
||||
let start_id;
|
||||
let end_id;
|
||||
let start_data;
|
||||
let end_data;
|
||||
// skip_same_td_check is true whenever we know for a fact that the
|
||||
// selection covers multiple messages (and thus we should no
|
||||
// longer consider letting the browser handle the copy event).
|
||||
var skip_same_td_check = false;
|
||||
let skip_same_td_check = false;
|
||||
|
||||
for (i = 0; i < selection.rangeCount; i += 1) {
|
||||
range = selection.getRangeAt(i);
|
||||
@@ -297,7 +297,7 @@ exports.paste_handler_converter = function (paste_html) {
|
||||
};
|
||||
|
||||
exports.paste_handler = function (event) {
|
||||
var clipboardData = event.originalEvent.clipboardData;
|
||||
const clipboardData = event.originalEvent.clipboardData;
|
||||
if (!clipboardData) {
|
||||
// On IE11, ClipboardData isn't defined. One can instead
|
||||
// access it with `window.clipboardData`, but even that
|
||||
@@ -308,10 +308,10 @@ exports.paste_handler = function (event) {
|
||||
}
|
||||
|
||||
if (clipboardData.getData) {
|
||||
var paste_html = clipboardData.getData('text/html');
|
||||
const paste_html = clipboardData.getData('text/html');
|
||||
if (paste_html && page_params.development_environment) {
|
||||
var text = exports.paste_handler_converter(paste_html);
|
||||
var mdImageRegex = /^!\[.*\]\(.*\)$/;
|
||||
const text = exports.paste_handler_converter(paste_html);
|
||||
const mdImageRegex = /^!\[.*\]\(.*\)$/;
|
||||
if (text.match(mdImageRegex)) {
|
||||
// This block catches cases where we are pasting an
|
||||
// image into Zulip, which should be handled by the
|
||||
|
||||
Reference in New Issue
Block a user