New Entity

Draft 1.1:
Index


Source Code: presentEntity.js



Purpose: Link ad-hoc inline blocks to the offical node list, activate extended reasoning based off each list

Additional Usage: Extend tracked nodes, and build element Map functions for each needed silo.

            
// Copyright (C) 2020 New Entity Operations Inc.
// All Rights Reserved
// P6: presentEntity.js
// https://www.NewEntity.io/section/6/
// presentEntity.js
// Version 0.4 (12/24/2020)
function buildPythonPre() {
    // Get the pre element with class="pythonEntity"
    function prePresent() {

        // Set the pre window
        let preCode = document.getElementsByClassName("preCode");
        // for line in pre, code, add that line to a bucket.
         // Build the pre list
        let codeText = document.getElementsByClassName("textEntity");
        let codePython = document.getElementsByClassName("pythonEntity");
        // console.log(preCode);
        // console.log(codeText);
        // console.log(codePython);

        if (preCode.length == 0) {
             // console.log("No code elements were found.");
        } else {
              // console.log("Operating on the following NodeList: ");
              // console.log(preCode);
              // console.log("proceeding...");
              // Set up a curing bucket
              curred_bucket = [];

             // Build the conditions bank
             // Inject the following styles
             // Insert at the scalarValue
             function lineStandard(value, scalarValue, scalarWeight) {
                // Standard Comment: #
                let lineStandard = document.createElement("span");
                lineStandard.className = "lineStandard";
                scalarWeightZ=scalarWeight-1
                // console.log("lineStandard(i) recorded with a scalarValue of: "+scalarValue+" and Position: "+scalarWeightZ);
             }
             function textCommentA(value, scalarValue, scalarWeight) {
                // Standard Comment: #
                let spanTextCommentA = document.createElement("span");
                spanTextCommentA.className = "textCommentA";
                // console.log("textCommentA(i) recorded with a scalarValue of: "+scalarValue+" and Position: "+scalarWeightZ);

             }
             function textCommentB(value, scalarValue, scalarWeight) {
                // Standard Comment: //
               let spanTextCommentB = document.createElement("span");
               spanTextCommentB.className = "textCommentB";
               // console.log("textCommentB(i) recorded with a scalarValue of: "+scalarValue+" and Position: "+scalarWeightZ);

             }
             function textCommentC(value, scalarValue, scalarWeight) {
                // Standard Comment: """
                let spanTextCommentC = document.createElement("span");
                spanTextCommentC.className = "textCommentC";
                // console.log("textCommentC(i) recorded with a scalarValue of: "+scalarValue+" and Position: "+scalarWeightZ);

             }

             // Run setters
             if (preCode.length>0) {
                if (codeText.length > 0)  {
                    var scalarValue = codeText.length;
                    var scalarWeight = 1;
                    while(scalarWeight<=scalarValue) {
                        var code_list = document.getElementsByClassName("textEntity")[scalarWeight-1];
                        scalarWeight++;
                        var code_list_two = code_list.innerHTML;
                        // code_list.remove();
                        var code_list_three = code_list_two.split("\n");
                        // console.log("Text block rendered on scalarValue: "+scalarValue+" with an element: "+code_list_three);
                        for (value in code_list_three) {
                           //i++;
                           // scalarValue--;
                            if (value.startsWith("#") == true) {
                                textCommentA(value, scalarValue, scalarWeight);
                            } else if (value.startsWith("//") == true) {
                                textCommentB(value, scalarValue, scalarWeight);
                            } else {
                                // none
                                lineStandard(value, scalarValue, scalarWeight);
                            }
                        }
                    }
                } else {
                    // console.log("No text-blocks were discovered.");
                }
                if (codePython.length > 0) {
                    var scalarValue = codePython.length;
                    var scalarWeight = 1;
                    while(scalarWeight<=scalarValue) {
                        var code_list = document.getElementsByClassName("pythonEntity")[scalarWeight-1];
                        scalarWeight++;
                        var code_list_two = code_list.innerHTML;
                        // code_list.remove();
                        var code_list_three = code_list_two.split("\n");
                        // console.log("Python block rendered on scalarValue: "+scalarValue+" with an element: "+code_list_three);
                        for (value in code_list_three) {
                           //i++;
                           // scalarValue--;
                           if (value.startsWith("#") == true) {
                               textCommentA(value, scalarValue, scalarWeight);
                           } else if (value.startsWith("'''") == true) {
                               textCommentC(value, scalarValue, scalarWeight);
                           } else {
                                // none
                                lineStandard(value, scalarValue, scalarWeight);
                           }
                       }
                    }
                } else {
                    // console.log("No text-blocks were discovered.");
                }
             } else {
                   // console.log("There wasn't a matched presentation block.");
             }
        }
    }
    // Run the default option
    prePresent();
    // console.log("Current URL bound: Processing...");
    // console.log(currentURL);
};
// Actions Center
// don't log in any instance except windowPresent*
// Perform action and consider various legacy scenarios
if (document.addEventListener, legacy=ON) {
  // Active runner, extend as needed
  document.addEventListener("DOMContentLoaded", () => {
    buildPythonPre();
    // console.log("Extend lookup routines: Chosen->Default (PlainText)")
  });
} else if (document.attachEvent, legacy=ON) {
  document.attachEvent("DOMContentLoaded", buildPythonPre);
}