<link rel="stylesheet" type="text/css" href="<%=staticPrefix%>/plugins/c9.ide.layout.classic/loading-flat.css" />
<div id="loadingcontainer" class="<%-: theme + (isDark ? " dark" : "") %>">
    <div id="loadingide">
        <div id="c9logo"></div>
        <div class="cool-message"></div>
        <div class="status" style="display:none"><div class="spinner"></div></div>
        
        <div id="content" class="loading-progress">
        </div>
        <div class="footer">
            <a href="https://docs.c9.io">Documentation</a> | 
            <a href="http://status.c9.io">Server Status</a> | 
            <% if (!standalone) { %>
                <a href="http://support.c9.io">Support</a>
            <% } %>
        </div>
    </div>
</div>
<script>
    var loadingIde = document.querySelector("#loadingide");
    document.body.className = "loading " + loadingIde.className;

    var messages = [
        "Share your code by sharing your workspace URL.",
        "Each workspace is its own Ubuntu virtual machine.",
        "Run 'dpkg -l' in the terminal to see all packages installed.",
        "Remember to run your code on port 8080, 8081, or 8082.",
        "Use the Collaborate panel when collaborating for optimal teamwork.",
        "It's better up here.",
        "Happy coding!",
        "Everything as you left it.",
        "Thank you Ada Lovelace!",
        "POST /desktop/era",
        "Try using VIM mode!",
        "Not your grandmother's IDE",
        "Literally makes your laptop cooler"
    ];
    
    var mac_keybindings = [
        "Press Ctrl-Option-Right to select the next instance of a word.",
        "Press Cmd-. to show all keyboard commands.",
        "To rename a variable, highlight it then press Option-Cmd-R.",
        "Press Option-W to close your current IDE tab.",
        "Press Cmd-D to delete the current line of code",
        "Press Option-Tab to go to the next IDE tab.",
        "Press Option-Shift-T to reopen a tab you closed.",
        "Press Option-T to open a new terminal at any time.",
        "Press Cmd-E to search for a file by name.",
        "Press Cmd-Shift-E to search for a function by name.",
        "Press Option-S to switch between a terminal and an editor.",
    ];
    
    var win_keybindings = [
        "Press Ctrl-Alt-Right to select the next instance of a word.",
        "Press Ctrl-. to show all keyboard commands.",
        "To rename a variable, highlight it then press Ctrl-Alt-R.",
        "Press Alt-W to close your current IDE tab.",
        "Press Ctrl-D to delete the current line of code",
        "Press Alt-Shift-T to reopen a tab you closed.",
        "Press Alt-T to open a new terminal at any time.",
        "Press Ctrl-E to search for a file by name.",
        "Press Ctrl-Shift-E to search for a function by name.",
        "Press Alt-S to switch between a terminal and an editor.",
    ];
    
    var isMac = (navigator.platform == "MacIntel" || navigator.platform == "Macintosh" || navigator.platform == "MacPPC");
    var platform_keybindings = isMac ? mac_keybindings : win_keybindings;
    messages = messages.concat(platform_keybindings);
    
    var idx = Math.floor(Math.random() * messages.length);
    if (idx == messages.length) idx = messages.length - 1;
    var msg = messages[idx];
    
    if (~location.hash.indexOf("create")) {
        msg = "Creating Your New Workspace";
        location.hash = location.hash.replace(/&?create/, "");
    }
    
    document.querySelector("#loadingide .cool-message").textContent = msg;

    setTimeout(function(){
        var s = document.querySelector("#loadingide .status");
        if (s) s.style.display = "block";
    }, 2000);
    
    window.hideLoader = function(){
        var loader = document.getElementById("loadingcontainer");
        loader.parentNode.removeChild(loader);
        
        document.body.className = document.body.className.replace("loading " + loadingIde.className, "");
    }
</script>