mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
js: Automatically convert var to let and const in most files.
This commit was originally automatically generated using `tools/lint --only=eslint --fix`. It was then modified by tabbott to contain only changes to a set of files that are unlikely to result in significant merge conflicts with any open pull request, excluding about 20 files. His plan is to merge the remaining changes with more precise care, potentially involving merging parts of conflicting pull requests before running the `eslint --fix` operation. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
f7245e9ec6
commit
28f3dfa284
@@ -12,8 +12,8 @@ export function path_parts() {
|
||||
});
|
||||
}
|
||||
|
||||
var hello_events = function () {
|
||||
var counter = 0;
|
||||
const hello_events = function () {
|
||||
let counter = 0;
|
||||
$(window).scroll(function () {
|
||||
if (counter % 2 === 0) {
|
||||
$(".screen.hero-screen .message-feed").css("transform", "translateY(-" + $(this).scrollTop() / 5 + "px)");
|
||||
@@ -24,8 +24,8 @@ var hello_events = function () {
|
||||
$(".footer").addClass("hello");
|
||||
};
|
||||
|
||||
var apps_events = function () {
|
||||
var info = {
|
||||
const apps_events = function () {
|
||||
const info = {
|
||||
windows: {
|
||||
image: "/static/images/landing-page/microsoft.png",
|
||||
alt: "Windows",
|
||||
@@ -66,11 +66,11 @@ var apps_events = function () {
|
||||
},
|
||||
};
|
||||
|
||||
var version;
|
||||
let version;
|
||||
|
||||
function get_version_from_path() {
|
||||
var result;
|
||||
var parts = path_parts();
|
||||
let result;
|
||||
const parts = path_parts();
|
||||
|
||||
Object.keys(info).forEach(function (version) {
|
||||
if (parts.indexOf(version) !== -1) {
|
||||
@@ -87,15 +87,15 @@ var apps_events = function () {
|
||||
}
|
||||
|
||||
function update_path() {
|
||||
var next_path = get_path_from_version();
|
||||
const next_path = get_path_from_version();
|
||||
history.pushState(version, '', next_path);
|
||||
}
|
||||
|
||||
var update_page = function () {
|
||||
var $download_instructions = $(".download-instructions");
|
||||
var $third_party_apps = $("#third-party-apps");
|
||||
var $download_android_apk = $("#download-android-apk");
|
||||
var version_info = info[version];
|
||||
const update_page = function () {
|
||||
const $download_instructions = $(".download-instructions");
|
||||
const $third_party_apps = $("#third-party-apps");
|
||||
const $download_android_apk = $("#download-android-apk");
|
||||
const version_info = info[version];
|
||||
|
||||
$(".info .platform").text(version_info.alt);
|
||||
$(".info .description").text(version_info.description);
|
||||
@@ -117,7 +117,7 @@ var apps_events = function () {
|
||||
});
|
||||
|
||||
$(".apps a .icon").click(function (e) {
|
||||
var next_version = $(e.target).closest('a')
|
||||
const next_version = $(e.target).closest('a')
|
||||
.attr('href')
|
||||
.replace('/apps/', '');
|
||||
version = next_version;
|
||||
@@ -135,16 +135,16 @@ var apps_events = function () {
|
||||
update_page();
|
||||
};
|
||||
|
||||
var events = function () {
|
||||
const events = function () {
|
||||
// get the location url like `zulipchat.com/features/`, cut off the trailing
|
||||
// `/` and then split by `/` to get ["zulipchat.com", "features"], then
|
||||
// pop the last element to get the current section (eg. `features`).
|
||||
var location = window.location.pathname.replace(/\/#*$/, "").split(/\//).pop();
|
||||
const location = window.location.pathname.replace(/\/#*$/, "").split(/\//).pop();
|
||||
|
||||
$("[data-on-page='" + location + "']").addClass("active");
|
||||
|
||||
$("body").click(function (e) {
|
||||
var $e = $(e.target);
|
||||
const $e = $(e.target);
|
||||
|
||||
if ($e.is("nav ul .exit")) {
|
||||
$("nav ul").removeClass("show");
|
||||
@@ -171,7 +171,7 @@ var events = function () {
|
||||
|
||||
|
||||
// run this callback when the page is determined to have loaded.
|
||||
var load = function () {
|
||||
const load = function () {
|
||||
|
||||
// Initiate the bootstrap carousel logic
|
||||
$('.carousel').carousel({
|
||||
@@ -180,14 +180,14 @@ var load = function () {
|
||||
|
||||
// Move to the next slide on clicking inside the carousel container
|
||||
$(".carousel-inner .item-container").click(function (e) {
|
||||
var get_tag_name = e.target.tagName.toLowerCase();
|
||||
var is_button = get_tag_name === "button";
|
||||
var is_link = get_tag_name === "a";
|
||||
var is_last_slide = $("#tour-carousel .carousel-inner .item:last-child").hasClass("active");
|
||||
const get_tag_name = e.target.tagName.toLowerCase();
|
||||
const is_button = get_tag_name === "button";
|
||||
const is_link = get_tag_name === "a";
|
||||
const is_last_slide = $("#tour-carousel .carousel-inner .item:last-child").hasClass("active");
|
||||
|
||||
// Do not trigger this event if user clicks on a button, link
|
||||
// or if it's the last slide
|
||||
var move_slide_forward = !is_button && !is_link && !is_last_slide;
|
||||
const move_slide_forward = !is_button && !is_link && !is_last_slide;
|
||||
|
||||
if (move_slide_forward) {
|
||||
$(this).closest('.carousel').carousel('next');
|
||||
@@ -195,7 +195,7 @@ var load = function () {
|
||||
});
|
||||
|
||||
$('.carousel').on('slid', function () {
|
||||
var $this = $(this);
|
||||
const $this = $(this);
|
||||
$this.find('.visibility-control').show();
|
||||
if ($this.find('.carousel-inner .item').first().hasClass('active')) {
|
||||
$this.find('.left.visibility-control').hide();
|
||||
|
||||
Reference in New Issue
Block a user