MCPcopy Index your code
hub / github.com/ClearURLs/Addon / injectText

Function injectText

core_js/settings.js:326–339  ·  view source on GitHub ↗

* Helper function to inject the translated text and tooltip. * * @param {string} id ID of the HTML element * @param {string} attribute Name of the attribute used for localization * @param {string} tooltip

(id, attribute, tooltip = "")

Source from the content-addressed store, hash-verified

324 * @param {string} tooltip
325 */
326function injectText(id, attribute, tooltip = "") {
327 let object = document.getElementById(id);
328 object.textContent = translate(attribute);
329
330 /*
331 This function will throw an error if no translation
332 is found for the tooltip. This is a planned error.
333 */
334 tooltip = translate(attribute + "_title");
335
336 if (tooltip !== "") {
337 object.setAttribute('title', tooltip);
338 }
339}
340
341/**
342 * Set the value of a switch button.

Callers 1

setTextFunction · 0.70

Calls 1

translateFunction · 0.70

Tested by

no test coverage detected