1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-31 20:25:32 +01:00

remove dead favourites on 404 pages

This commit is contained in:
Bui 2014-09-28 11:39:41 +09:00 committed by 8chan
parent 4b3e33c5b0
commit 037d392e1f

13
404.php
View File

@ -29,6 +29,19 @@ $page = <<<EOT
<div class="ban">
<p style="text-align:center"><img src="/static/404/{$errorimage}" style="width:100%"></p>
</div>
<script type="text/javascript">
if (localStorage.favorites) {
var faves = JSON.parse(localStorage.favorites);
$.each(faves, function(k, v) {
if (window.location.pathname === '/' + v + '/') {
faves.pop(v);
localStorage.favorites = JSON.stringify(faves);
}
})
}
</script>
EOT;
echo Element("page.html", array("config" => $config, "body" => $errorimage ? $page : "", "title" => "404 Not Found"));