view mercurial/templates/monoblue/graph.tmpl @ 35255:ad0de63e1d6a

hgweb: move common vertex code to Graph.prototype Just to give some context to the return values: vertex() needs to return two HTML elements as strings, <li> to be used as a background and a <li> to be shown in foreground. The latter was made obsolete recently when changesets started to be rendered server-side, but background elements are still useful for now.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 06 Dec 2017 12:10:16 +0800
parents 75f9f366e5cc
children 27ab3150cd50
line wrap: on
line source

{header}
    <title>{repo|escape}: graph</title>
    <link rel="alternate" type="application/atom+xml" href="{url|urlescape}atom-log" title="Atom feed for {repo|escape}"/>
    <link rel="alternate" type="application/rss+xml" href="{url|urlescape}rss-log" title="RSS feed for {repo|escape}"/>
    <!--[if IE]><script type="text/javascript" src="{staticurl|urlescape}excanvas.js"></script><![endif]-->
</head>

<body>
<div id="container">
    <div class="page-header">
        <h1 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb} / graph</h1>

        {searchform}

        <ul class="page-nav">
            <li><a href="{url|urlescape}summary{sessionvars%urlparameter}">summary</a></li>
            <li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">shortlog</a></li>
            <li><a href="{url|urlescape}changelog{sessionvars%urlparameter}">changelog</a></li>
            <li class="current">graph</li>
            <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
            <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li>
            <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li>
            <li><a href="{url|urlescape}file/{symrev}{sessionvars%urlparameter}">files</a></li>
            <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
        </ul>
    </div>

    <h2 class="no-link no-border">graph</h2>

    <div id="noscript">The revision graph only works with JavaScript-enabled browsers.</div>
    <div id="wrapper">
        <ul id="nodebgs"></ul>
        <canvas id="graph" width="{canvaswidth}" height="{canvasheight}"></canvas>
        <ul id="graphnodes">{nodes%graphentry}</ul>
    </div>

    <script{if(nonce, ' nonce="{nonce}"')}>
    <!-- hide script content

    document.getElementById('noscript').style.display = 'none';

    var data = {jsdata|json};
    var graph = new Graph();
    graph.scale({bg_height});

    graph.vertex = function(x, y, radius, color, parity, cur) \{
        Graph.prototype.vertex.apply(this, arguments);
        return ['<li class="bg parity' + parity + '"></li>', ''];
    }

    graph.render(data);

    // stop hiding script -->
    </script>

    <div class="page-path">
        <a href="{url|urlescape}graph/{symrev}{lessvars%urlparameter}">less</a>
        <a href="{url|urlescape}graph/{symrev}{morevars%urlparameter}">more</a>
        | {changenav%navgraph}
    </div>

    <script type="text/javascript"{if(nonce, ' nonce="{nonce}"')}>
    ajaxScrollInit(
            '{url|urlescape}graph/{rev}?revcount=%next%&style={style}',
            {revcount}+60,
            function (htmlText, previousVal) \{ return previousVal + 60; },
            '#wrapper',
            '<div class="%class%" style="text-align: center;">%text%</div>',
            'graph'
    );
    </script>

{footer}