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

Function insertToAnchorElement

scripts/leetcode.js:718–749  ·  view source on GitHub ↗
(elem)

Source from the content-addressed store, hash-verified

716
717/* we will need specific anchor element that is specific to the page you are in Eg. Explore */
718function insertToAnchorElement(elem) {
719 if (document.URL.startsWith('https://leetcode.com/explore/')) {
720 // means we are in explore page
721 action = document.getElementsByClassName('action');
722 if (
723 checkElem(action) &&
724 checkElem(action[0].getElementsByClassName('row')) &&
725 checkElem(
726 action[0]
727 .getElementsByClassName('row')[0]
728 .getElementsByClassName('col-sm-6'),
729 ) &&
730 action[0]
731 .getElementsByClassName('row')[0]
732 .getElementsByClassName('col-sm-6').length > 1
733 ) {
734 target = action[0]
735 .getElementsByClassName('row')[0]
736 .getElementsByClassName('col-sm-6')[1];
737 elem.className = 'pull-left';
738 if (target.childNodes.length > 0)
739 target.childNodes[0].prepend(elem);
740 }
741 } else {
742 if (checkElem(document.getElementsByClassName('action__38Xc'))) {
743 target = document.getElementsByClassName('action__38Xc')[0];
744 elem.className = 'runcode-wrapper__8rXm';
745 if (target.childNodes.length > 0)
746 target.childNodes[0].prepend(elem);
747 }
748 }
749}
750
751/* start upload will inject a spinner on left side to the "Run Code" button */
752function startUpload() {

Callers 1

startUploadFunction · 0.85

Calls 1

checkElemFunction · 0.85

Tested by

no test coverage detected