common: Remove copy_data_attribute_value.

Commit 90d0531e20 (#23721) removed
envelope-link and data-admin-emails.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-02 18:18:12 -07:00 committed by Tim Abbott
parent eb45eca57b
commit ffd1a80ef4
4 changed files with 0 additions and 66 deletions

View File

@ -1,9 +0,0 @@
import $ from "jquery";
import * as common from "../common";
$(() => {
$("a.envelope-link").on("click", function () {
common.copy_data_attribute_value($(this), "admin-emails");
});
});

View File

@ -25,18 +25,6 @@ export function phrase_match(query: string, phrase: string): boolean {
return false;
}
export function copy_data_attribute_value($elem: JQuery, key: string): void {
// function to copy the value of data-key
// attribute of the element to clipboard
const $temp = $(document.createElement("input"));
$("body").append($temp);
$temp.val($elem.data(key)).trigger("select");
document.execCommand("copy");
$temp.remove();
$elem.fadeOut(250);
$elem.fadeIn(1000);
}
const keys_map = new Map([
["Backspace", "Delete"],
["Enter", "Return"],

View File

@ -28,49 +28,6 @@ run_test("phrase_match", () => {
assert.ok(!common.phrase_match("tes", "hostess"));
});
run_test("copy_data_attribute_value", ({override}) => {
const admin_emails_val = "iago@zulip.com";
const $input = $.create("input");
let removed;
$input.remove = () => {
removed = true;
};
override(document, "createElement", () => $input);
override(document, "execCommand", noop);
$("body").append = noop;
$input.val = (arg) => {
assert.equal(arg, admin_emails_val);
return {
trigger: noop,
};
};
const $elem = {};
let faded_in = false;
let faded_out = false;
$elem.data = (key) => {
assert.equal(key, "admin-emails");
return admin_emails_val;
};
$elem.fadeOut = (val) => {
assert.equal(val, 250);
faded_out = true;
};
$elem.fadeIn = (val) => {
assert.equal(val, 1000);
faded_in = true;
};
common.copy_data_attribute_value($elem, "admin-emails");
assert.ok(removed);
assert.ok(faded_in);
assert.ok(faded_out);
});
run_test("adjust_mac_kbd_tags non-mac", ({override}) => {
override(navigator, "platform", "Windows");

View File

@ -3,7 +3,6 @@
"./third/bootstrap/css/bootstrap.portico.css",
"./src/bundles/common",
"sorttable",
"./src/activity/activity",
"./styles/portico/activity.css"
],
"billing": [
@ -109,7 +108,6 @@
"./third/bootstrap/css/bootstrap.portico.css",
"./src/bundles/common",
"sorttable",
"./src/activity/activity",
"./styles/portico/activity.css",
"./src/support/support"
],