Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Integrate personalized suggestions into homepage, add links to 404 page.
Browse files Browse the repository at this point in the history
  • Loading branch information
alcinnz committed Jul 10, 2019
1 parent aa11ac4 commit 414ddd3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions data/pages/NOT-FOUND
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<form action="odysseus:filetype" method="GET"><input type="text" placeholder="MIME Type" name="mime" /></form>
</dt>
<dd>{% trans %}Lists all apps in your package repository capable of opening a specific MIME type.{% endtrans %}</dd>
<dt><a href="odysseus:suggestions">{% trans %}Personalized suggestions{% endtrans %}</a></dt>
<dd>{% trans %}Links recommended by visited pages you have yet to visit.{% endtrans %}</dd>
<dt><a href="odysseus:spring-clean">{% trans %}Database optimization{% endtrans %}</a></dt>
<dd>{% trans %}Clears away junk from database.{% endtrans %}</dd>
</dl>
</main>
</body>
Expand Down
15 changes: 12 additions & 3 deletions data/pages/home
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ and I take advantage of this page to promote project links. #}
main nav img:hover {box-shadow: 4px 4px 4px;}

/* Styling for the different link sources */
.suggestion > a {color: #666; text-decoration: none; font-size: 132px; text-align: center;}
.pinned img {color: #64baff;}
.pinned form:first-of-type * {display: none;}
.history img {color: #666;}
Expand All @@ -78,11 +79,18 @@ and I take advantage of this page to promote project links. #}
AS order_
{% endmacro %}
{% query 20 %}
SELECT uri, 0 as order_, "suggestion" AS cat,
{{"Several sites recommended this link."|trans}} AS help,
{{"<a href='odysseus:suggestions'>Personalized Suggestion</a>"}}
FROM unvisited_links
WHERE uri NOT IN (SELECT uri FROM page_visit)
ORDER BY endorsements*random() DESC LIMIT 1;
SELECT uri, order_, "pinned" AS cat,
{{"You 'pinned' this here"|trans}} AS help, {{"Pinned"|trans}} AS caption
FROM topsites_whitelist ORDER BY order_ ASC;
SELECT url as uri, {% q-tailrank %}, "history" AS cat,
{{"Frequently visited"|trans}} AS help, {{"History"|trans}} AS caption
{{"Frequently visited"|trans}} AS help,
{{"<a href='odysseus:history'>History</a>"|trans}} AS caption
FROM visit_counts
WHERE count >= 10 AND uri NOT IN (SELECT uri FROM topsites_whitelist)
ORDER BY count DESC;
Expand All @@ -97,22 +105,23 @@ and I take advantage of this page to promote project links. #}
<figure class="{{ cat }}" tooltip="{{ cat }}">
<a href="{{ uri }}" title="{{ help }}
{{ uri }}">
{% if cat in "suggestion" %}?{% else %}
<img style="width: 132px; height: 132px;"
{% query %}SELECT image FROM screenshot_v2 WHERE uri = {{ uri }};
{% each-row %}
src="data:image/png;base64,{{ image }}"
{% empty %}{# Custom URI scheme that caches the HTTP responses in this table. #}
src="odysseusproxy:///{{ uri }}"
{% endquery %}
height="128" width="128" />
height="128" width="128" />{% endif %}
</a>
<legend>
<form method="POST"><input aria-hidden name="$" value="topsites_whitelist" />
<input aria-hidden name="uri" value="{{ uri }}" />
<input type="number" name="order_" value="{{ order_ }}" />
<button type="submit" title="Keep this link on this page.">&check;</button>
</form>
{{ caption }}
{{ caption|safe }}
<form method="POST"><input aria-hidden name="$" value="topsites_blacklist" />
<input aria-hidden name="uri" value="{{ uri }}" />
<button type="submit" title="Remove this link from this page.">x</button>
Expand Down

0 comments on commit 414ddd3

Please sign in to comment.