Skip to content
Snippets Groups Projects
Select Git revision
  • v0.4b
  • master default protected
  • develop
  • v0.5
  • v0.3b
  • v0.2b
  • v0.1b
7 results

Material.cpp

Blame
  • CloneViewFunctions.js 2.47 KiB
    /*****************************************************************************/
    //
    //    Copyright 2015 Andrew Cohen
    //
    //     This file is part of CloneView - the tool for displaying stem cell lineaging in a webpage.
    //
    //     CloneView is free software: you can redistribute it and/or modify
    //     it under the terms of the GNU General Public License as published by
    //     the Free Software Foundation, either version 3 of the License, or
    //     (at your option) any later version.
    //
    //     CloneView is distributed in the hope that it will be useful,
    //     but WITHOUT ANY WARRANTY; without even the implied warranty of
    //     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    //     GNU General Public License for more details.
    //
    //     You should have received a copy of the GNU General Public License
    //     along with CloneView in file "gnu gpl v3.txt".  If not, see
    //     <http://www.gnu.org/licenses/>.
    //
    /*****************************************************************************/
    
    function xmlGet(URL) {
        if (window.XMLHttpRequest)
        {
            xmlhttp=new XMLHttpRequest();
        }
        else
        {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("GET", URL, false);
        xmlhttp.send();
        return xmlhttp.responseText;
    } // xmlGet
    
    function GetCloneList()
    {
    
        var FileURL = gExperimentPath + '/CloneData/';
    
        var data=xmlGet(FileURL);
        var list=data.match(/"([^"]+?clone)"/gm);
    
        return list;
    
    } // GetFiles
    
    
    function ReadCloneData(name) {
    
        var URL = gExperimentPath + '/CloneData/' + name;
        name = name.split(".");
        var data = xmlGet(URL);
        try {
            data = JSON.parse(data);
        }
        catch(e)
        {
            data=false;
        }
        return data;
    
    } // ReadCloneData
    
    function GetRootPath() {
        //var URL = 'http://' + window.location.host + '/';
        var URL = window.location.pathname;
        var FileURL = window.location.href.split("?");
    
        // this is called by both cloneview and imagewindow - only tag dataset on if from imagewindow
    
        var nTerm = URL.lastIndexOf('/');
        if (nTerm<0) {
            console.log('bad window.location.pathname ? : ' + URL);
            return URL;
        }
        else {
            URL = URL.substring(0,nTerm+1);
        }    
    
        return URL;
    } //GetRootPath
    
    function formatBigNumber(n) {
    
        var nStr = '' + n;
        var outStr='';
    
        for (var i=0;i<nStr.length;i++) {
            if ((i>0) && (nStr.length-i)%3 ==0)
                outStr += ',';
            outStr+=nStr[i];
        }
        return outStr;
    
    } // format BigNumber