MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / feedsubmit

Function feedsubmit

api/prettydiff-webtool.ts:378–435  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

376 parent.onclick = feedradio;
377 },
378 feedsubmit = function dom_load_feedsubmit():void {
379 let a:number = 0;
380 const datapack:any = {},
381 namecheck:any = (localStorage.getItem("settings") !== undefined && localStorage.getItem("settings") !== null)
382 ? JSON.parse(localStorage.getItem("settings"))
383 : {},
384 radios:HTMLCollectionOf<HTMLInputElement> = id("feedradio1")
385 .parentNode
386 .parentNode
387 .getElementsByTagName("input"),
388 text = (id("feedtextarea") === null)
389 ? ""
390 :id("feedtextarea")
391 .value,
392 email:string = (id("feedemail") === null)
393 ? ""
394 : id("feedemail")
395 .value,
396 xhr:XMLHttpRequest = new XMLHttpRequest(),
397 sendit = function dom_load_feedsubmit_sendit():void {
398 const node:HTMLElement = id("feedintro");
399 xhr.withCredentials = true;
400 xhr.open("POST", "https://prettydiff.com:8000/feedback/", true);
401 xhr.setRequestHeader("Content-type", "application/json; charset=utf-8");
402 xhr.send(JSON.stringify(datapack));
403 report
404 .feed
405 .box
406 .getElementsByTagName("button")[1]
407 .click();
408 if (node !== null) {
409 node.innerHTML = "Please feel free to submit feedback about Pretty Diff at any time by answering t" +
410 "he following questions.";
411 }
412 };
413 if (id("feedradio1") === null || namecheck.knownname !== data.settings.knownname) {
414 return;
415 }
416 a = radios.length - 1;
417 if (a > 0) {
418 do {
419 if (radios[a].checked === true) {
420 break;
421 }
422 a = a - 1;
423 } while (a > -1);
424 }
425 if (a < 0) {
426 return;
427 }
428 datapack.comment = text;
429 datapack.email = email;
430 datapack.name = data.settings.knownname;
431 datapack.rating = a + 1;
432 datapack.settings = data.settings;
433 datapack.type = "feedback";
434 sendit();
435 },

Callers

nothing calls this directly

Calls 2

idFunction · 0.85
senditFunction · 0.85

Tested by

no test coverage detected