2020-07-25 02:02:35 +02:00
|
|
|
import _ from "lodash";
|
|
|
|
|
2020-09-24 12:30:16 +02:00
|
|
|
import * as blueslip from "../blueslip";
|
2020-09-01 22:55:28 +02:00
|
|
|
|
2020-08-29 04:08:14 +02:00
|
|
|
import * as google_analytics from "./google-analytics";
|
2020-07-16 22:40:18 +02:00
|
|
|
import {path_parts} from "./landing-page";
|
2017-08-01 07:21:44 +02:00
|
|
|
|
|
|
|
// these constants are populated immediately with data from the DOM on page load
|
|
|
|
// name -> display name
|
2020-02-12 06:45:30 +01:00
|
|
|
const INTEGRATIONS = new Map();
|
2020-02-12 06:49:41 +01:00
|
|
|
const CATEGORIES = new Map();
|
2017-08-01 07:21:44 +02:00
|
|
|
|
|
|
|
function load_data() {
|
2021-01-22 22:29:08 +01:00
|
|
|
for (const integration of $(".integration-lozenge")) {
|
|
|
|
const name = $(integration).data("name");
|
|
|
|
const display_name = $(integration).find(".integration-name").text().trim();
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2021-01-22 22:29:08 +01:00
|
|
|
if (display_name && name) {
|
|
|
|
INTEGRATIONS.set(name, display_name);
|
|
|
|
}
|
|
|
|
}
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2021-01-22 22:29:08 +01:00
|
|
|
for (const category of $(".integration-category")) {
|
|
|
|
const name = $(category).data("category");
|
|
|
|
const display_name = $(category).text().trim();
|
|
|
|
|
|
|
|
if (display_name && name) {
|
|
|
|
CATEGORIES.set(name, display_name);
|
|
|
|
}
|
|
|
|
}
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
const INITIAL_STATE = {
|
2020-07-15 01:29:15 +02:00
|
|
|
category: "all",
|
2017-08-01 07:21:44 +02:00
|
|
|
integration: null,
|
2020-07-15 01:29:15 +02:00
|
|
|
query: "",
|
2017-08-01 07:21:44 +02:00
|
|
|
};
|
|
|
|
|
2020-12-22 00:37:36 +01:00
|
|
|
let state = {...INITIAL_STATE};
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2017-08-09 02:33:53 +02:00
|
|
|
function adjust_font_sizing() {
|
2021-01-22 22:29:08 +01:00
|
|
|
for (const integration of $(".integration-lozenge")) {
|
|
|
|
const $integration_name = $(integration).find(".integration-name");
|
|
|
|
const $integration_category = $(integration).find(".integration-category");
|
2017-08-09 02:33:53 +02:00
|
|
|
|
2021-01-22 22:29:08 +01:00
|
|
|
// if the text has wrapped to two lines, decrease font-size
|
|
|
|
if ($integration_name.height() > 30) {
|
|
|
|
$integration_name.css("font-size", "1em");
|
2017-08-09 02:33:53 +02:00
|
|
|
if ($integration_name.height() > 30) {
|
2021-01-22 22:29:08 +01:00
|
|
|
$integration_name.css("font-size", ".95em");
|
2017-08-09 02:33:53 +02:00
|
|
|
}
|
2021-01-22 22:29:08 +01:00
|
|
|
}
|
2017-08-09 02:33:53 +02:00
|
|
|
|
2021-01-22 22:29:08 +01:00
|
|
|
if ($integration_category.height() > 30) {
|
|
|
|
$integration_category.css("font-size", ".8em");
|
2017-08-09 02:33:53 +02:00
|
|
|
if ($integration_category.height() > 30) {
|
2021-01-22 22:29:08 +01:00
|
|
|
$integration_category.css("font-size", ".75em");
|
2017-08-09 02:33:53 +02:00
|
|
|
}
|
2021-01-22 22:29:08 +01:00
|
|
|
}
|
|
|
|
}
|
2017-08-09 02:33:53 +02:00
|
|
|
}
|
|
|
|
|
2017-08-01 07:21:44 +02:00
|
|
|
function update_path() {
|
2019-11-02 00:06:25 +01:00
|
|
|
let next_path;
|
2017-08-01 07:21:44 +02:00
|
|
|
if (state.integration) {
|
2021-02-03 23:23:32 +01:00
|
|
|
next_path = $(`.integration-lozenge[data-name="${CSS.escape(state.integration)}"]`)
|
2020-07-15 00:34:28 +02:00
|
|
|
.closest("a")
|
|
|
|
.attr("href");
|
2017-08-01 07:21:44 +02:00
|
|
|
} else if (state.category) {
|
2021-02-03 23:23:32 +01:00
|
|
|
next_path = $(`.integration-category[data-category="${CSS.escape(state.category)}"]`)
|
2020-07-15 00:34:28 +02:00
|
|
|
.closest("a")
|
|
|
|
.attr("href");
|
2017-08-01 07:21:44 +02:00
|
|
|
} else {
|
2020-07-15 01:29:15 +02:00
|
|
|
next_path = "/";
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
window.history.pushState(state, "", next_path);
|
2020-05-08 06:37:58 +02:00
|
|
|
google_analytics.config({page_path: next_path});
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function update_categories() {
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integration-lozenges").css("opacity", 0);
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integration-category").removeClass("selected");
|
2021-02-03 23:23:32 +01:00
|
|
|
$(`[data-category="${CSS.escape(state.category)}"]`).addClass("selected");
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
const $dropdown_label = $(".integration-categories-dropdown .dropdown-category-label");
|
2017-08-01 07:21:44 +02:00
|
|
|
if (state.category === INITIAL_STATE.category) {
|
2020-07-15 01:29:15 +02:00
|
|
|
$dropdown_label.text(i18n.t("Filter by category"));
|
2017-08-01 07:21:44 +02:00
|
|
|
} else {
|
2020-02-12 06:49:41 +01:00
|
|
|
$dropdown_label.text(CATEGORIES.get(state.category));
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-15 00:34:28 +02:00
|
|
|
$(".integration-lozenges").animate({opacity: 1}, {duration: 400});
|
2017-08-09 02:36:29 +02:00
|
|
|
|
|
|
|
adjust_font_sizing();
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-02 01:45:54 +02:00
|
|
|
const update_integrations = _.debounce(() => {
|
2019-11-02 00:06:25 +01:00
|
|
|
const max_scrollY = window.scrollY;
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2021-01-22 22:29:08 +01:00
|
|
|
for (const integration of $(".integration-lozenges").children()) {
|
2020-07-15 01:29:15 +02:00
|
|
|
const $integration = $(integration).find(".integration-lozenge");
|
|
|
|
const $integration_category = $integration.find(".integration-category");
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
if (state.category !== "all") {
|
|
|
|
$integration_category.css("display", "none");
|
|
|
|
$integration.addClass("without-category");
|
2017-08-01 07:21:44 +02:00
|
|
|
} else {
|
2020-07-15 01:29:15 +02:00
|
|
|
$integration_category.css("display", "");
|
|
|
|
$integration.removeClass("without-category");
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
if (!$integration.hasClass("integration-create-your-own")) {
|
|
|
|
const display_name = INTEGRATIONS.get($integration.data("name"));
|
2019-11-02 00:06:25 +01:00
|
|
|
const display =
|
2018-06-25 17:34:11 +02:00
|
|
|
common.phrase_match(state.query, display_name) &&
|
2020-07-15 01:29:15 +02:00
|
|
|
($integration.data("categories").includes(CATEGORIES.get(state.category)) ||
|
2020-07-15 00:34:28 +02:00
|
|
|
state.category === "all");
|
2017-08-01 07:21:44 +02:00
|
|
|
|
|
|
|
if (display) {
|
2020-07-15 01:29:15 +02:00
|
|
|
$integration.css("display", "inline-block");
|
2017-08-01 07:21:44 +02:00
|
|
|
} else {
|
2020-07-15 01:29:15 +02:00
|
|
|
$integration.css("display", "none");
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
document.body.scrollTop = Math.min(window.scrollY, max_scrollY);
|
2021-01-22 22:29:08 +01:00
|
|
|
}
|
2017-08-09 02:36:29 +02:00
|
|
|
|
|
|
|
adjust_font_sizing();
|
2017-08-01 07:21:44 +02:00
|
|
|
}, 50);
|
|
|
|
|
|
|
|
function hide_catalog_show_integration() {
|
2021-02-03 23:23:32 +01:00
|
|
|
const $lozenge_icon = $(
|
|
|
|
`.integration-lozenge.integration-${CSS.escape(state.integration)}`,
|
|
|
|
).clone(false);
|
2020-07-15 01:29:15 +02:00
|
|
|
$lozenge_icon.removeClass("legacy");
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2021-02-03 23:23:32 +01:00
|
|
|
const categories = $(`.integration-${CSS.escape(state.integration)}`)
|
2020-07-15 00:34:28 +02:00
|
|
|
.data("categories")
|
2017-08-01 07:21:44 +02:00
|
|
|
.slice(1, -1)
|
2020-07-15 01:29:15 +02:00
|
|
|
.split(",")
|
2020-07-02 01:45:54 +02:00
|
|
|
.map((category) => category.trim().slice(1, -1));
|
2017-08-01 07:21:44 +02:00
|
|
|
|
|
|
|
function show_integration(doc) {
|
2020-07-15 01:29:15 +02:00
|
|
|
$("#integration-instructions-group .name").text(INTEGRATIONS.get(state.integration));
|
|
|
|
$("#integration-instructions-group .categories .integration-category").remove();
|
2021-01-22 22:29:08 +01:00
|
|
|
for (const category of categories) {
|
2019-11-02 00:06:25 +01:00
|
|
|
let link;
|
2020-02-12 06:49:41 +01:00
|
|
|
for (const [name, display_name] of CATEGORIES) {
|
|
|
|
if (display_name === category) {
|
2017-08-01 07:21:44 +02:00
|
|
|
link = name;
|
|
|
|
}
|
2020-02-12 06:49:41 +01:00
|
|
|
}
|
2020-07-15 01:29:15 +02:00
|
|
|
const category_el = $("<a></a>")
|
|
|
|
.attr("href", "/integrations/" + link)
|
2017-08-01 07:21:44 +02:00
|
|
|
.append('<h3 class="integration-category"></h3>');
|
2020-07-15 00:34:28 +02:00
|
|
|
category_el.find(".integration-category").attr("data-category", link).text(category);
|
2020-07-15 01:29:15 +02:00
|
|
|
$("#integration-instructions-group .categories").append(category_el);
|
2021-01-22 22:29:08 +01:00
|
|
|
}
|
2020-07-15 01:29:15 +02:00
|
|
|
$("#integration-instructions-group").css({
|
2017-08-01 07:21:44 +02:00
|
|
|
opacity: 0,
|
2020-07-15 01:29:15 +02:00
|
|
|
display: "flex",
|
2017-08-01 07:21:44 +02:00
|
|
|
});
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integration-instructions").css("display", "none");
|
2021-02-03 23:23:32 +01:00
|
|
|
$(`#${CSS.escape(state.integration)}.integration-instructions .help-content`).html(doc);
|
2020-07-15 01:29:15 +02:00
|
|
|
$("#integration-instruction-block .integration-lozenge").remove();
|
2020-07-15 00:34:28 +02:00
|
|
|
$("#integration-instruction-block").append($lozenge_icon).css("display", "flex");
|
2021-02-03 23:23:32 +01:00
|
|
|
$(`.integration-instructions#${CSS.escape(state.integration)}`).css("display", "block");
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2020-07-15 00:34:28 +02:00
|
|
|
$("html, body").animate({scrollTop: 0}, {duration: 200});
|
|
|
|
$("#integration-instructions-group").animate({opacity: 1}, {duration: 300});
|
2017-08-09 02:36:29 +02:00
|
|
|
|
|
|
|
adjust_font_sizing();
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function hide_catalog(doc) {
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integration-categories-dropdown").css("display", "none");
|
|
|
|
$(".integrations .catalog").addClass("hide");
|
2017-08-01 07:21:44 +02:00
|
|
|
$(".extra, #integration-main-text, #integration-search").css("display", "none");
|
|
|
|
|
|
|
|
show_integration(doc);
|
2018-06-13 00:55:44 +02:00
|
|
|
$(".main").css("visibility", "visible");
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$.get({
|
2020-07-15 01:29:15 +02:00
|
|
|
url: "/integrations/doc-html/" + state.integration,
|
|
|
|
dataType: "html",
|
2017-08-01 07:21:44 +02:00
|
|
|
success: hide_catalog,
|
2020-07-20 22:18:43 +02:00
|
|
|
error(err) {
|
2020-07-15 00:34:28 +02:00
|
|
|
blueslip.error(
|
|
|
|
"Integration documentation for '" + state.integration + "' not found.",
|
|
|
|
err,
|
|
|
|
);
|
2017-08-01 07:21:44 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function hide_integration_show_catalog() {
|
|
|
|
function show_catalog() {
|
2020-07-15 00:34:28 +02:00
|
|
|
$("html, body").animate({scrollTop: 0}, {duration: 200});
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integration-categories-dropdown").css("display", "");
|
|
|
|
$(".integrations .catalog").removeClass("hide");
|
2017-08-01 07:21:44 +02:00
|
|
|
$(".extra, #integration-main-text, #integration-search").css("display", "block");
|
2017-08-09 02:36:29 +02:00
|
|
|
adjust_font_sizing();
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function hide_integration() {
|
2020-07-15 01:29:15 +02:00
|
|
|
$("#integration-instruction-block").css("display", "none");
|
|
|
|
$("#integration-instructions-group").css("display", "none");
|
2020-07-16 22:40:18 +02:00
|
|
|
$(".inner-content").css({padding: ""});
|
2017-08-01 07:21:44 +02:00
|
|
|
$("#integration-instruction-block .integration-lozenge").remove();
|
|
|
|
show_catalog();
|
|
|
|
}
|
|
|
|
|
|
|
|
hide_integration();
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_state_from_path() {
|
2020-12-22 00:37:36 +01:00
|
|
|
const result = {...INITIAL_STATE};
|
2017-08-01 07:21:44 +02:00
|
|
|
result.query = state.query;
|
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
const parts = path_parts();
|
2020-07-15 01:29:15 +02:00
|
|
|
if (parts[1] === "doc" && INTEGRATIONS.get(parts[2])) {
|
2017-08-01 07:21:44 +02:00
|
|
|
result.integration = parts[2];
|
2020-02-12 06:49:41 +01:00
|
|
|
} else if (CATEGORIES.has(parts[1])) {
|
2017-08-01 07:21:44 +02:00
|
|
|
result.category = parts[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
function render(next_state) {
|
2020-12-22 00:37:36 +01:00
|
|
|
const previous_state = {...state};
|
2017-08-01 07:21:44 +02:00
|
|
|
state = next_state;
|
|
|
|
|
2020-07-15 00:34:28 +02:00
|
|
|
if (previous_state.integration !== next_state.integration && next_state.integration !== null) {
|
2018-06-13 00:55:44 +02:00
|
|
|
hide_catalog_show_integration();
|
|
|
|
} else {
|
|
|
|
if (previous_state.integration !== next_state.integration) {
|
2017-08-01 07:21:44 +02:00
|
|
|
hide_integration_show_catalog();
|
|
|
|
}
|
|
|
|
|
2018-06-13 00:55:44 +02:00
|
|
|
if (previous_state.category !== next_state.category) {
|
|
|
|
update_categories();
|
|
|
|
update_integrations();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (previous_state.query !== next_state.query) {
|
|
|
|
update_integrations();
|
|
|
|
}
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2018-06-13 00:55:44 +02:00
|
|
|
$(".main").css("visibility", "visible");
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function dispatch(action, payload) {
|
|
|
|
switch (action) {
|
2020-07-15 02:14:03 +02:00
|
|
|
case "CHANGE_CATEGORY":
|
2020-12-22 00:37:36 +01:00
|
|
|
render({...state, category: payload.category});
|
2020-07-15 02:14:03 +02:00
|
|
|
update_path();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "SHOW_INTEGRATION":
|
2020-12-22 00:37:36 +01:00
|
|
|
render({...state, integration: payload.integration});
|
2020-07-15 02:14:03 +02:00
|
|
|
update_path();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "HIDE_INTEGRATION":
|
2020-12-22 00:37:36 +01:00
|
|
|
render({...state, integration: null});
|
2020-07-15 02:14:03 +02:00
|
|
|
update_path();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "SHOW_CATEGORY":
|
2020-12-22 00:37:36 +01:00
|
|
|
render({...state, integration: null, category: payload.category});
|
2020-07-15 02:14:03 +02:00
|
|
|
update_path();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "UPDATE_QUERY":
|
2020-12-22 00:37:36 +01:00
|
|
|
render({...state, query: payload.query});
|
2020-07-15 02:14:03 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case "LOAD_PATH":
|
|
|
|
render(get_state_from_path());
|
|
|
|
google_analytics.config({page_path: window.location.pathname});
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
blueslip.error("Invalid action dispatched on /integrations.");
|
|
|
|
break;
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-05 19:51:52 +02:00
|
|
|
function toggle_categories_dropdown() {
|
2020-07-15 01:29:15 +02:00
|
|
|
const $dropdown_list = $(".integration-categories-dropdown .dropdown-list");
|
2018-07-05 20:13:36 +02:00
|
|
|
$dropdown_list.slideToggle(250);
|
2018-07-05 19:51:52 +02:00
|
|
|
}
|
|
|
|
|
2017-08-01 07:21:44 +02:00
|
|
|
function integration_events() {
|
2020-07-20 21:26:58 +02:00
|
|
|
$('#integration-search input[type="text"]').on("keypress", (e) => {
|
2020-07-15 01:29:15 +02:00
|
|
|
if (e.which === 13 && e.target.value !== "") {
|
2021-01-22 22:29:08 +01:00
|
|
|
for (const integration_element of $(".integration-lozenges").children()) {
|
2020-10-07 10:41:58 +02:00
|
|
|
const integration = $(integration_element).find(".integration-lozenge");
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
if ($(integration).css("display") !== "none") {
|
2020-07-28 21:17:06 +02:00
|
|
|
$(integration).closest("a")[0].click();
|
2017-08-01 07:21:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-07-20 21:26:58 +02:00
|
|
|
$(".integration-categories-dropdown .dropdown-toggle").on("click", () => {
|
2018-07-05 19:51:52 +02:00
|
|
|
toggle_categories_dropdown();
|
2017-08-01 07:21:44 +02:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integration-instruction-block").on("click", "a .integration-category", (e) => {
|
2020-09-24 07:50:36 +02:00
|
|
|
e.preventDefault();
|
2020-07-15 01:29:15 +02:00
|
|
|
const category = $(e.target).data("category");
|
2020-07-20 22:18:43 +02:00
|
|
|
dispatch("SHOW_CATEGORY", {category});
|
2017-08-01 07:21:44 +02:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integrations a .integration-category").on("click", (e) => {
|
2020-09-24 07:50:36 +02:00
|
|
|
e.preventDefault();
|
2020-07-15 01:29:15 +02:00
|
|
|
const category = $(e.target).data("category");
|
2020-07-20 22:18:43 +02:00
|
|
|
dispatch("CHANGE_CATEGORY", {category});
|
2018-07-05 19:51:52 +02:00
|
|
|
toggle_categories_dropdown();
|
2017-08-01 07:21:44 +02:00
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integrations a .integration-lozenge").on("click", (e) => {
|
|
|
|
if (!$(e.target).closest(".integration-lozenge").hasClass("integration-create-your-own")) {
|
2020-09-24 07:50:36 +02:00
|
|
|
e.preventDefault();
|
2020-07-15 01:29:15 +02:00
|
|
|
const integration = $(e.target).closest(".integration-lozenge").data("name");
|
2020-07-20 22:18:43 +02:00
|
|
|
dispatch("SHOW_INTEGRATION", {integration});
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-09-24 07:50:36 +02:00
|
|
|
$("a#integration-list-link span, a#integration-list-link i").on("click", (e) => {
|
|
|
|
e.preventDefault();
|
2020-07-15 01:29:15 +02:00
|
|
|
dispatch("HIDE_INTEGRATION");
|
2017-08-01 07:21:44 +02:00
|
|
|
});
|
|
|
|
|
2017-08-24 09:01:26 +02:00
|
|
|
// combine selector use for both focusing the integrations searchbar and adding
|
|
|
|
// the input event.
|
2020-07-28 22:28:56 +02:00
|
|
|
$(".integrations .searchbar input[type='text']").on("input", (e) => {
|
|
|
|
dispatch("UPDATE_QUERY", {query: e.target.value.toLowerCase()});
|
|
|
|
});
|
2017-08-01 07:21:44 +02:00
|
|
|
|
2020-07-20 21:26:58 +02:00
|
|
|
$(window).on("scroll", () => {
|
2017-08-01 07:21:44 +02:00
|
|
|
if (document.body.scrollTop > 330) {
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integration-categories-sidebar").addClass("sticky");
|
2017-08-01 07:21:44 +02:00
|
|
|
} else {
|
2020-07-15 01:29:15 +02:00
|
|
|
$(".integration-categories-sidebar").removeClass("sticky");
|
2017-08-01 07:21:44 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
$(window).on("resize", () => {
|
2017-08-01 07:21:44 +02:00
|
|
|
adjust_font_sizing();
|
|
|
|
});
|
|
|
|
|
2020-07-15 01:29:15 +02:00
|
|
|
$(window).on("popstate", () => {
|
|
|
|
if (window.location.pathname.startsWith("/integrations")) {
|
|
|
|
dispatch("LOAD_PATH");
|
2017-08-01 07:21:44 +02:00
|
|
|
} else {
|
|
|
|
window.location = window.location.href;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// init
|
2020-07-02 01:45:54 +02:00
|
|
|
$(() => {
|
2017-08-01 07:21:44 +02:00
|
|
|
integration_events();
|
|
|
|
load_data();
|
2020-07-15 01:29:15 +02:00
|
|
|
dispatch("LOAD_PATH");
|
2020-07-28 22:28:56 +02:00
|
|
|
$(".integrations .searchbar input[type='text']").trigger("focus");
|
2017-08-01 07:21:44 +02:00
|
|
|
});
|