MCPcopy
hub / github.com/ClearURLs/Addon / injectText

Function injectText

core_js/popup.js:233–248  ·  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

231* @param {string} tooltip
232*/
233function injectText(id, attribute, tooltip = "")
234{
235 const object = document.getElementById(id);
236 object.textContent = translate(attribute);
237
238 /*
239 This function will throw an error if no translation
240 is found for the tooltip. This is a planned error.
241 */
242 tooltip = translate(attribute+"_title");
243
244 if(tooltip !== "")
245 {
246 object.setAttribute('title', tooltip);
247 }
248}
249
250/**
251 * Loads data from storage and saves into local variable.

Callers 1

setTextFunction · 0.70

Calls 1

translateFunction · 0.70

Tested by

no test coverage detected