MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / onInteract

Function onInteract

src/dialogs/rateBox.js:12–47  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

10 ).onclick(onInteract);
11
12 function onInteract(e) {
13 /**
14 * @type {HTMLSpanElement}
15 */
16 const $el = e.target;
17 if (!$el) return;
18 let val = $el.getAttribute("value");
19 if (val) val = Number.parseInt(val);
20 const siblings = $el.parentElement.children;
21 const len = siblings.length;
22 for (let i = 0; i < len; ++i) {
23 const star = siblings[i];
24 star.classList.remove("stargrade", "star_outline");
25 if (i < val) star.classList.add("stargrade");
26 else star.classList.add("star_outline");
27 }
28
29 setTimeout(() => {
30 if (val === 5) {
31 system.openInBrowser(
32 `https://play.google.com/store/apps/details?id=${BuildInfo.packageName}`,
33 );
34 localStorage.dontAskForRating = true;
35 } else {
36 const stars = getStars(val);
37 const subject = "feedback - Acode editor";
38 const textBody = stars + "</br>%0A" + getFeedbackBody("</br>%0A");
39 const email = config.FEEDBACK_EMAIL;
40 system.openInBrowser(
41 `mailto:${email}?subject=${subject}&body=${textBody}`,
42 );
43 }
44 }, 100);
45
46 $box.hide();
47 }
48}
49
50/**

Callers

nothing calls this directly

Calls 6

getStarsFunction · 0.85
getFeedbackBodyFunction · 0.85
addMethod · 0.80
openInBrowserMethod · 0.65
removeMethod · 0.45
hideMethod · 0.45

Tested by

no test coverage detected