Html download snippet
This commit is contained in:
@@ -102,7 +102,7 @@ def gen_page(bundle_id, obj):
|
||||
{ gen_dotgraph(obj['subdom']) }
|
||||
{ gen_dom_tags(obj['subdom'], HTML.a_subdomain) }
|
||||
</div>
|
||||
<p class="right snd">Download: <a href="data.json" download="{bundle_id}.json">json</a></p>
|
||||
{ HTML.p_download_json('data.json', bundle_id + '.json') }
|
||||
<script type="text/javascript" src="/static/lookup-rank.js"></script>
|
||||
<script type="text/javascript">
|
||||
lookup_rank_js('{bundle_id}');
|
||||
|
||||
@@ -61,7 +61,7 @@ def gen_html_top_10(path, subset, total, title):
|
||||
<a class="snd" href="by_name.html">Alphabetical order</a>.
|
||||
</p>
|
||||
</div>
|
||||
<p class="right snd">Download: <a href="data.json" download="domains.json">json</a></p>
|
||||
{ HTML.p_download_json('data.json', 'domains.json') }
|
||||
''', title=title)
|
||||
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ def process():
|
||||
title = 'Ranking'
|
||||
header = HTML.a_path([('Results', '/results/')], title)
|
||||
base = mylib.path_out('ranking')
|
||||
HTML.write(base, '''
|
||||
<h2>{}</h2>
|
||||
HTML.write(base, f'''
|
||||
<h2>{header}</h2>
|
||||
<p>
|
||||
This ranking shows only the 500 most recently updated applications.<br>
|
||||
If you're missing an app, feel free to contribute a new app recording.
|
||||
@@ -19,12 +19,12 @@ def process():
|
||||
<div class="xscroll yscroll">
|
||||
<table id="rank-list" class="alternate"><tr><td>Loading …</td></tr></table>
|
||||
</div>
|
||||
<p class="right snd">Download: <a href="data.json" download="ranking-all.json">json</a></p>
|
||||
{ HTML.p_download_json('data.json', 'ranking-all.json') }
|
||||
<script type="text/javascript" src="/static/ranking.js"></script>
|
||||
<script type="text/javascript" src="/static/lozad.js"></script>
|
||||
<script type="text/javascript">
|
||||
rank_js('data.json');
|
||||
</script>'''.format(header), title=title)
|
||||
</script>''', title=title)
|
||||
mylib.symlink(index_rank.fname_ranking_list(),
|
||||
mylib.path_add(base, 'data.json'))
|
||||
print('')
|
||||
|
||||
@@ -24,6 +24,11 @@ def a_subdomain(x, inner=None, attr_str=''):
|
||||
return '<a{} href="/subdomain/#{}">{}</a>'.format(attr_str, x, inner or x)
|
||||
|
||||
|
||||
def p_download_json(href, download_name):
|
||||
return '<p class="right snd">Download: <a href="{}" download="{}">json</a></p>'.format(
|
||||
href, download_name)
|
||||
|
||||
|
||||
# Data object preparation
|
||||
|
||||
def apps_sorted_batch(bundle_ids, batch_size=60):
|
||||
@@ -168,7 +173,7 @@ def write(path, content, title=None, fname='index.html'):
|
||||
fp.write(base_template(content, title=title))
|
||||
|
||||
|
||||
def write_app_pages(base, bundle_ids, title, per_page=60, pre=''):
|
||||
def write_app_pages(base, bundle_ids, title, per_page=60, pre='', post=''):
|
||||
pages = 0
|
||||
entries = 0
|
||||
mylib.rm_dir(base)
|
||||
@@ -177,5 +182,5 @@ def write_app_pages(base, bundle_ids, title, per_page=60, pre=''):
|
||||
entries += count
|
||||
pth = base if i == 1 else mylib.path_add(base, str(i))
|
||||
mylib.mkdir(pth)
|
||||
write(pth, pre + '\n' + src, title=title)
|
||||
write(pth, pre + '\n' + src + '\n' + post, title=title)
|
||||
return pages, entries
|
||||
|
||||
Reference in New Issue
Block a user