mirror of https://github.com/zulip/zulip.git
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:
parent
eb45eca57b
commit
ffd1a80ef4
|
@ -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");
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -25,18 +25,6 @@ export function phrase_match(query: string, phrase: string): boolean {
|
||||||
return false;
|
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([
|
const keys_map = new Map([
|
||||||
["Backspace", "Delete"],
|
["Backspace", "Delete"],
|
||||||
["Enter", "Return"],
|
["Enter", "Return"],
|
||||||
|
|
|
@ -28,49 +28,6 @@ run_test("phrase_match", () => {
|
||||||
assert.ok(!common.phrase_match("tes", "hostess"));
|
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}) => {
|
run_test("adjust_mac_kbd_tags non-mac", ({override}) => {
|
||||||
override(navigator, "platform", "Windows");
|
override(navigator, "platform", "Windows");
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
"./third/bootstrap/css/bootstrap.portico.css",
|
"./third/bootstrap/css/bootstrap.portico.css",
|
||||||
"./src/bundles/common",
|
"./src/bundles/common",
|
||||||
"sorttable",
|
"sorttable",
|
||||||
"./src/activity/activity",
|
|
||||||
"./styles/portico/activity.css"
|
"./styles/portico/activity.css"
|
||||||
],
|
],
|
||||||
"billing": [
|
"billing": [
|
||||||
|
@ -109,7 +108,6 @@
|
||||||
"./third/bootstrap/css/bootstrap.portico.css",
|
"./third/bootstrap/css/bootstrap.portico.css",
|
||||||
"./src/bundles/common",
|
"./src/bundles/common",
|
||||||
"sorttable",
|
"sorttable",
|
||||||
"./src/activity/activity",
|
|
||||||
"./styles/portico/activity.css",
|
"./styles/portico/activity.css",
|
||||||
"./src/support/support"
|
"./src/support/support"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue