summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--css/v2.css58
-rw-r--r--elm/Lib/Html.elm3
-rw-r--r--lib/VNWeb/HTML.pm8
-rw-r--r--lib/VNWeb/Misc/HomePage.pm2
-rw-r--r--lib/VNWeb/Releases/Lib.pm2
-rw-r--r--lib/VNWeb/Releases/Page.pm2
-rw-r--r--lib/VNWeb/Releases/VNTab.pm10
-rw-r--r--lib/VNWeb/Reviews/Page.pm2
-rw-r--r--lib/VNWeb/VN/List.pm2
-rw-r--r--lib/VNWeb/VN/Page.pm2
10 files changed, 25 insertions, 66 deletions
diff --git a/css/v2.css b/css/v2.css
index 3cb92609..bb1bef21 100644
--- a/css/v2.css
+++ b/css/v2.css
@@ -514,7 +514,7 @@ div#vntags { margin: 0 30px 0 30px; border-top: 1px solid $bo
}
#screenshots a.scrlnk { margin: 2px; border: none }
#screenshots div.scr { display: block; padding-left: 30px; text-align: center }
-#screenshots img { border: 3px solid transparent; }
+#screenshots a img { border: 3px solid transparent; }
#screenshots a.nsfw img { border: 3px solid $statnok; }
#screenshots a:hover img { border: 3px solid $border; }
@@ -1243,6 +1243,8 @@ div.imagebrowse { padding: 0; display: flex; flex-wrap: wrap }
/****** Icons *******/
+.platicon { width: 16px; height: 16px; margin: -1px 2px -1px 0; border: 0; padding: 0; object-fit: contain }
+
.icons {
background: url(/g/icons.png?#{$icons-version}) no-repeat;
width: 16px;
@@ -1261,62 +1263,10 @@ div.imagebrowse { padding: 0; display: flex; flex-wrap: wrap }
.icons.gen { width: 14px; height: 14px }
.icons.gen.b { width: 28px }
.icons.rtcomplete, .icons.rtpartial, .icons.rttrial { width: 11px; }
-abbr.icons, abbr.uicons { cursor: default; }
+abbr.icons { cursor: default; }
a .icons { cursor: pointer }
@import 'data/icons/icons';
-.icons.plat { height: 16px; margin: -1px 2px -1px 0!important; background-size: contain; background-repeat: no-repeat; background-position: center }
-/* This list of platform icons can be avoided by linking to the icons directly with <img> tags,
- * but I like having the option to have different icons for different skins. */
-.icons.win { background-image: url(/f/plat/win.svg) }
-.icons.lin { background-image: url(/f/plat/lin.svg) }
-.icons.mac { background-image: url(/f/plat/mac.svg) }
-.icons.web { background-image: url(/f/plat/web.svg) }
-.icons.tdo { background-image: url(/f/plat/tdo.svg) }
-.icons.ios { background-image: url(/f/plat/ios.svg) }
-.icons.and { background-image: url(/f/plat/and.svg) }
-.icons.bdp { background-image: url(/f/plat/bdp.svg) }
-.icons.dos { background-image: url(/f/plat/dos.svg) }
-.icons.dvd { background-image: url(/f/plat/dvd.svg) }
-.icons.drc { background-image: url(/f/plat/drc.svg) }
-.icons.nes { background-image: url(/f/plat/nes.svg) }
-.icons.fm7 { background-image: url(/f/plat/fm7.svg) }
-.icons.fm8 { background-image: url(/f/plat/fm8.svg) }
-.icons.fmt { background-image: url(/f/plat/fmt.svg) }
-.icons.gba { background-image: url(/f/plat/gba.svg) }
-.icons.gbc { background-image: url(/f/plat/gbc.svg) }
-.icons.msx { background-image: url(/f/plat/msx.svg) }
-.icons.nds { background-image: url(/f/plat/nds.svg) }
-.icons.swi { background-image: url(/f/plat/swi.svg) }
-.icons.wii { background-image: url(/f/plat/wii.svg) }
-.icons.wiu { background-image: url(/f/plat/wiu.svg) }
-.icons.n3d { background-image: url(/f/plat/n3d.svg) }
-.icons.p88 { background-image: url(/f/plat/p88.svg) }
-.icons.p98 { background-image: url(/f/plat/p98.svg) }
-.icons.pce { background-image: url(/f/plat/pce.svg) }
-.icons.pcf { background-image: url(/f/plat/pcf.svg) }
-.icons.psp { background-image: url(/f/plat/psp.svg) }
-.icons.ps1 { background-image: url(/f/plat/ps1.svg) }
-.icons.ps2 { background-image: url(/f/plat/ps2.svg) }
-.icons.ps3 { background-image: url(/f/plat/ps3.svg) }
-.icons.ps4 { background-image: url(/f/plat/ps4.svg) }
-.icons.ps5 { background-image: url(/f/plat/ps5.svg) }
-.icons.psv { background-image: url(/f/plat/psv.svg) }
-.icons.smd { background-image: url(/f/plat/smd.svg) }
-.icons.scd { background-image: url(/f/plat/scd.svg) }
-.icons.sat { background-image: url(/f/plat/sat.svg) }
-.icons.vnd { background-image: url(/f/plat/vnd.svg) }
-.icons.sfc { background-image: url(/f/plat/sfc.svg) }
-.icons.x1s { background-image: url(/f/plat/x1s.svg) }
-.icons.x68 { background-image: url(/f/plat/x68.svg) }
-.icons.xb1 { background-image: url(/f/plat/xb1.svg) }
-.icons.xb3 { background-image: url(/f/plat/xb3.svg) }
-.icons.xbo { background-image: url(/f/plat/xbo.svg) }
-.icons.xxs { background-image: url(/f/plat/xxs.svg) }
-.icons.mob { background-image: url(/f/plat/mob.svg) }
-.icons.oth { background-image: url(/f/plat/oth.svg) }
-
-
.release_icons { width: 16px; height: 16px; float: right; margin-left: 4px; }
.release_icon_voiced2, .release_icon_anim2 { filter: hue-rotate(30deg); }
.release_icon_voiced3, .release_icon_anim3 { filter: invert(100%) hue-rotate(240deg); }
diff --git a/elm/Lib/Html.elm b/elm/Lib/Html.elm
index e63bd3d9..fdd2e627 100644
--- a/elm/Lib/Html.elm
+++ b/elm/Lib/Html.elm
@@ -7,6 +7,7 @@ import Json.Decode as JD
import List
import Lib.Api as Api
import Lib.Util exposing (..)
+import Lib.Ffi as Ffi
import Gen.Types as T
@@ -205,7 +206,7 @@ langIcon : String -> Html m
langIcon l = abbr [ class "icons lang", class l, title (Maybe.withDefault "" <| lookup l T.languages) ] [ text " " ]
platformIcon : String -> Html m
-platformIcon l = abbr [ class "icons plat", class l, title (Maybe.withDefault "" <| lookup l T.platforms) ] [ text " " ]
+platformIcon l = img [ class "platicon", src <| Ffi.urlStatic ++ "/f/plat/" ++ l ++ ".svg", title (Maybe.withDefault "" <| lookup l T.platforms) ] []
releaseTypeIcon : String -> Html m
releaseTypeIcon t = abbr [ class ("icons rt"++t), title (Maybe.withDefault "" <| lookup t T.releaseTypes) ] [ text " " ]
diff --git a/lib/VNWeb/HTML.pm b/lib/VNWeb/HTML.pm
index 80dae4b6..8ec6ea85 100644
--- a/lib/VNWeb/HTML.pm
+++ b/lib/VNWeb/HTML.pm
@@ -14,6 +14,7 @@ use JSON::XS;
use VNDB::Config;
use VNDB::BBCode;
use VNDB::Skins;
+use VNDB::Types;
use VNWeb::Auth;
use VNWeb::Validation;
use VNWeb::DB;
@@ -21,6 +22,7 @@ use VNDB::Func 'fmtdate';
our @EXPORT = qw/
clearfloat_
+ platform_
debug_
join_
user_ user_displayname
@@ -42,6 +44,12 @@ our @EXPORT = qw/
sub clearfloat_ { div_ class => 'clearfloat', '' }
+# Platform icon
+sub platform_ {
+ img_ src => config->{url_static}.'/f/plat/'.$_[0].'.svg', class => 'platicon', title => $PLATFORM{$_[0]}, undef;
+}
+
+
# Throw any data structure on the page for inspection.
sub debug_ {
return if !tuwf->debug;
diff --git a/lib/VNWeb/Misc/HomePage.pm b/lib/VNWeb/Misc/HomePage.pm
index b3495643..22d81df6 100644
--- a/lib/VNWeb/Misc/HomePage.pm
+++ b/lib/VNWeb/Misc/HomePage.pm
@@ -189,7 +189,7 @@ sub releases_ {
span_ sub {
rdate_ $_->{released};
txt_ ' ';
- abbr_ class => "icons plat $_", title => $PLATFORM{$_}, '' for $_->{plat}->@*;
+ platform_ $_ for $_->{plat}->@*;
abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' for $_->{lang}->@*;
txt_ ' ';
a_ href => "/$_->{id}", title => $_->{original}||$_->{title}, $_->{title};
diff --git a/lib/VNWeb/Releases/Lib.pm b/lib/VNWeb/Releases/Lib.pm
index a20d1339..e14933e5 100644
--- a/lib/VNWeb/Releases/Lib.pm
+++ b/lib/VNWeb/Releases/Lib.pm
@@ -106,7 +106,7 @@ sub release_row_ {
td_ class => 'tc1', sub { rdate_ $r->{released} };
td_ class => 'tc2', defined $r->{minage} ? minage $r->{minage} : '';
td_ class => 'tc3', sub {
- abbr_ class => "icons plat $_", title => $PLATFORM{$_}, '' for $r->{platforms}->@*;
+ platform_ $_ for $r->{platforms}->@*;
if($opt->{lang}) {
abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' for $r->{lang}->@*;
}
diff --git a/lib/VNWeb/Releases/Page.pm b/lib/VNWeb/Releases/Page.pm
index 1f29ad48..36d2f383 100644
--- a/lib/VNWeb/Releases/Page.pm
+++ b/lib/VNWeb/Releases/Page.pm
@@ -108,7 +108,7 @@ sub _infotable_ {
td_ 'Platform'.($r->{platforms}->@* == 1 ? '' : 's');
td_ sub {
join_ \&br_, sub {
- abbr_ class => "icons plat $_", title => $PLATFORM{$_}, ' ';
+ platform_ $_;
txt_ ' '.$PLATFORM{$_};
}, $r->{platforms}->@*;
}
diff --git a/lib/VNWeb/Releases/VNTab.pm b/lib/VNWeb/Releases/VNTab.pm
index 36c69c27..604f2415 100644
--- a/lib/VNWeb/Releases/VNTab.pm
+++ b/lib/VNWeb/Releases/VNTab.pm
@@ -59,7 +59,7 @@ my @rel_cols = (
default => 1,
has_data => sub { !!@{$_[0]{platforms}} },
draw => sub {
- join_ \&br_, sub { abbr_ class => "icons plat $_", title => $PLATFORM{$_}, ''; }, $_[0]{platforms}->@*;
+ join_ \&br_, sub { platform_ $_ }, $_[0]{platforms}->@*;
txt_ 'Unknown' if !$_[0]{platforms}->@*;
},
}, { # Media
@@ -158,17 +158,17 @@ sub buttons_ {
};
my sub pl {
- my($row, $option, $txt, $csscat) = @_;
+ my($row, $option, $txt, $icon) = @_;
my %opts = map +($_,1), map $_->{$row}->@*, @$r;
return if !keys %opts;
p_ class => 'browseopts', sub {
a_ href => $url->($option, $_), $_ eq $opt->{$option} ? (class => 'optselected') : (), sub {
- $_ eq 'all' ? txt_ 'All' : abbr_ class => "icons $csscat $_", title => $txt->{$_}, '';
+ $_ eq 'all' ? txt_ 'All' : $icon->($_);
} for ('all', sort keys %opts);
}
};
- pl 'platforms', 'os', \%PLATFORM, '' if $opt->{pla};
- pl 'lang', 'lang',\%LANGUAGE, 'lang' if $opt->{lan};
+ pl 'platforms', 'os', \%PLATFORM, \&platform_ if $opt->{pla};
+ pl 'lang', 'lang',\%LANGUAGE, sub { abbr_ class => "icons lang $_[0]", title => $LANGUAGE{$_[0]}, '' } if $opt->{lan};
}
diff --git a/lib/VNWeb/Reviews/Page.pm b/lib/VNWeb/Reviews/Page.pm
index e6d78e4c..d32e4f94 100644
--- a/lib/VNWeb/Reviews/Page.pm
+++ b/lib/VNWeb/Reviews/Page.pm
@@ -36,7 +36,7 @@ sub review_ {
a_ href => "/$w->{vid}", $w->{title};
if($w->{rid}) {
br_;
- abbr_ class => "icons plat $_", title => $PLATFORM{$_}, '' for $w->{platforms}->@*;
+ platform_ $_ for $w->{platforms}->@*;
abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' for $w->{lang}->@*;
abbr_ class => "icons rt$w->{rtype}", title => $w->{rtype}, '';
a_ href => "/$w->{rid}", title => $w->{roriginal}||$w->{rtitle}, $w->{rtitle};
diff --git a/lib/VNWeb/VN/List.pm b/lib/VNWeb/VN/List.pm
index cf710fbd..422e8b1b 100644
--- a/lib/VNWeb/VN/List.pm
+++ b/lib/VNWeb/VN/List.pm
@@ -33,7 +33,7 @@ sub listing_ {
abbr_ title => join(', ', $_->{vnlist_labels}->@*), scalar $_->{vnlist_labels}->@* if $_->{vnlist_labels} && $_->{vnlist_labels}->@*;
abbr_ title => 'No labels', ' ' if $_->{vnlist_labels} && !$_->{vnlist_labels}->@*;
};
- td_ class => 'tc2', sub { join_ '', sub { abbr_ class => "icons plat $_", title => $PLATFORM{$_}, '' if $_ ne 'unk' }, sort $_->{platforms}->@* };
+ td_ class => 'tc2', sub { join_ '', sub { platform_ $_ if $_ ne 'unk' }, sort $_->{platforms}->@* };
td_ class => 'tc3', sub { join_ '', sub { abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' }, reverse sort $_->{lang}->@* };
td_ class => 'tc4', sub { rdate_ $_->{c_released} };
td_ class => 'tc5', sprintf '%.2f', ($_->{c_popularity}||0)*100;
diff --git a/lib/VNWeb/VN/Page.pm b/lib/VNWeb/VN/Page.pm
index 052d645f..d865f85f 100644
--- a/lib/VNWeb/VN/Page.pm
+++ b/lib/VNWeb/VN/Page.pm
@@ -697,7 +697,7 @@ sub screenshots_ {
for my $r (grep $rel{$_->{id}}, $v->{releases}->@*) {
p_ class => 'rel', sub {
abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' for $r->{languages}->@*;
- abbr_ class => "icons plat $_", title => $PLATFORM{$_}, '' for $r->{platforms}->@*;
+ platform_ $_ for $r->{platforms}->@*;
a_ href => "/$r->{id}", $r->{title};
};
div_ class => 'scr', sub {