app/js/viewer.js
// Renders html file of node in iframe
Renders html file of node in iframe
Renders html file of node in iframe
function renderPage(node) {
    try {
        let integrity = fs.statSync(node.path);
        console.log(integrity);
        if (!(chromeMap.has(node.id))) {
            chromeTabs.addTab({
                title: node.name,
                id: node.id,
                favicon: node.element.childNodes[0].getElementsByClassName('file-icon')[0].src
            });
            chromeMap.set(node.id, node.path);
            tabMap.set(node.id, chromeTabs.activeTabEl);
        }
        else {
            chromeTabs.setCurrentTab(tabMap.get(node.id))
        }
        let disp = document.getElementById('html_disp');
        disp.src = node.path;
        open_files = node.path;
        let currentTime = new Date();
        let date = currentTime.yyyymmdd()
        if (node.last_accessed != date) {
            updateNode(node, "last_accessed", date);
        }
    }
    catch (err) {
        missingPath(node);
    }
}
function renderPage ( node ) { try { let integrity = fs . statSync ( node . path ) ; console . log ( integrity ) ; if ( ! ( chromeMap . has ( node . id ) ) ) { chromeTabs . addTab ( { title : node . name , id : node . id , favicon : node . element . childNodes [ 0 ] . getElementsByClassName ( 'file-icon' ) [ 0 ] . src } ) ; chromeMap . set ( node . id , node . path ) ; tabMap . set ( node . id , chromeTabs . activeTabEl ) ; } else { chromeTabs . setCurrentTab ( tabMap . get ( node . id ) ) } let disp = document . getElementById ( 'html_disp' ) ; disp . src = node . path ; open_files = node . path ; let currentTime = new Date ( ) ; let date = currentTime . yyyymmdd ( ) if ( node . last_accessed != date ) { updateNode ( node , "last_accessed" , date ) ; } } catch ( err ) { missingPath ( node ) ; } }
Renders html file of node in iframe
Renders html file of node in iframe
// Check if file exists // Throws error if file does not exist // Add new tab // Render web page // Saves the open file path for saving // update date last accessed // Path integrity has failed