MCPcopy
hub / github.com/QasimWani/LeetHub / getNotesIfAny

Function getNotesIfAny

scripts/leetcode.js:556–584  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

554 the note should be opened atleast once for this to work
555 this is because the dom is populated after data is fetched by opening the note */
556function getNotesIfAny() {
557 // there are no notes on expore
558 if (document.URL.startsWith('https://leetcode.com/explore/'))
559 return '';
560
561 notes = '';
562 if (
563 checkElem(document.getElementsByClassName('notewrap__eHkN')) &&
564 checkElem(
565 document
566 .getElementsByClassName('notewrap__eHkN')[0]
567 .getElementsByClassName('CodeMirror-code'),
568 )
569 ) {
570 notesdiv = document
571 .getElementsByClassName('notewrap__eHkN')[0]
572 .getElementsByClassName('CodeMirror-code')[0];
573 if (notesdiv) {
574 for (i = 0; i < notesdiv.childNodes.length; i++) {
575 if (notesdiv.childNodes[i].childNodes.length == 0) continue;
576 text = notesdiv.childNodes[i].childNodes[0].innerText;
577 if (text) {
578 notes = `${notes}\n${text.trim()}`.trim();
579 }
580 }
581 }
582 }
583 return notes.trim();
584}
585
586const loader = setInterval(() => {
587 let code = null;

Callers 1

leetcode.jsFile · 0.85

Calls 1

checkElemFunction · 0.85

Tested by

no test coverage detected