Browse Source

Switch PDA stylesheet to useragent detection

master
parent
commit
d8cda8dfc7
6 changed files with 98 additions and 11 deletions
  1. +13
    -0
      app/Helper/PDA.php
  2. +1
    -0
      public/css/main.css
  3. +14
    -0
      public/css/page/index.css
  4. +30
    -4
      public/css/page/subforum.css
  5. +30
    -3
      public/css/pda.css
  6. +10
    -4
      resources/views/layout/default.blade.php

+ 13
- 0
app/Helper/PDA.php View File

@@ -0,0 +1,13 @@
<?php

namespace App\Helper;

class PDA
{
public static function isPDA()
{
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '';
if (str_contains($ua, 'Windows CE; PPC;')) return true;
return false;
}
}

+ 1
- 0
public/css/main.css View File

@@ -11,6 +11,7 @@ body {
padding: 15px; padding: 15px;
margin: 0 auto; margin: 0 auto;
line-height: 1.3; line-height: 1.3;
background: #333;
} }


p { p {


+ 14
- 0
public/css/page/index.css View File

@@ -16,6 +16,10 @@
border: none; border: none;
} }


body.simple .row.subforums {
padding: 0;
}

.cell { .cell {
width: 50%; width: 50%;
float: left; float: left;
@@ -29,6 +33,16 @@
margin-left: 5px; margin-left: 5px;
} }


body.simple .cell {
width: unset;
float: none;
}

body.simple .cell .row {
margin-left: 0;
margin-right: 0;
}

.row.subforum h3, .row.subforum h3,
.row.lastThread h4 { .row.lastThread h4 {
margin: 0; margin: 0;


+ 30
- 4
public/css/page/subforum.css View File

@@ -2,6 +2,10 @@
padding: 0; padding: 0;
} }


body.simple .row.threads {
padding: 0;
}

.row.thread { .row.thread {
position: relative; position: relative;
padding-top: 0; padding-top: 0;
@@ -19,6 +23,13 @@
height: 44px; height: 44px;
} }


body.simple .row.thread img.icon {
width: 22px;
height: 22px;
top: 5px;
left: 5px;
}

.row.thread a { .row.thread a {
margin: 1px 0; margin: 1px 0;
display: block; display: block;
@@ -32,20 +43,35 @@
padding-top: 10px; padding-top: 10px;
} }


body.simple .row.thread a.main {
padding-top: 0;
padding-left: 27px;
width: unset;
min-height: 27px;
}

.row.thread .meta { .row.thread .meta {
position: relative; position: relative;
width: 100%; width: 100%;
padding-bottom: 10px; padding-bottom: 10px;
} }


.row.thread a.left,
.row.thread a.right {
.row.thread .meta a.left,
.row.thread .meta a.right {
display: block; display: block;
float: left; float: left;
width: 49.5%; width: 49.5%;
} }


.row.thread a.right {
.row.thread .meta a.right {
float: right; float: right;
text-align: right; text-align: right;
}
}

body.simple .row.thread .meta a {
float: none;
width: unset;
text-align: left;
font-size: 10px;
padding-left: 27px;
}

+ 30
- 3
public/css/pda.css View File

@@ -1,10 +1,37 @@
.row.titlebar .logo {
/* reduce padding */
body.simple {
padding: 5px;
}

body.simple .row {
padding: 5px;
}

body.simple .row.spacer {
height: 5px;
padding: 0;
}

/* Fix header styling */
body.simple .row.titlebar .logo {
position: relative; position: relative;
padding: 10px 15px;
padding: 0;
text-align: center; text-align: center;
margin: 0; margin: 0;
} }


.row.titlebar .menu {
body.simple .row.titlebar .menu {
text-align: center; text-align: center;
padding: 10px 0 0 0;
}

body.simple .row.titlebar .menu a {
line-height: 1;
}

/* Fix stats styling */
body.simple .row.stats span {
display: block;
width: unset;
float: none;
} }

+ 10
- 4
resources/views/layout/default.blade.php View File

@@ -1,3 +1,6 @@
@php
$pda = App\Helper\PDA::isPDA();
@endphp
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN' 'http://www.w3.org/TR/html4/frameset.dtd'> <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN' 'http://www.w3.org/TR/html4/frameset.dtd'>
<html class="lang-eng" dir="ltr" ng-app="" > <html class="lang-eng" dir="ltr" ng-app="" >
<head> <head>
@@ -7,13 +10,16 @@
<meta charset='ISO-8859-1'> <meta charset='ISO-8859-1'>
<link rel='icon' type='image/x-icon' href='/favicon.ico' /> <link rel='icon' type='image/x-icon' href='/favicon.ico' />
<link rel='stylesheet' type='text/css' href='/css/main.css'/> <link rel='stylesheet' type='text/css' href='/css/main.css'/>
@if ($pda)
<link rel='stylesheet' type='text/css' href='/css/pda.css'/>
@else
<link rel='stylesheet' type='text/css' href='/css/mobile.css'/>
@endif
@yield('scripts')
<meta name='theme-color' content='#333'> <meta name='theme-color' content='#333'>
<title>Knockout Lite | @yield('title', 'Index')</title> <title>Knockout Lite | @yield('title', 'Index')</title>
</head> </head>
<body>
<body class="{{ $pda ? 'simple' : null }}">
@yield('page') @yield('page')
@yield('scripts')
<link rel='stylesheet' type='text/css' href='/css/mobile.css'/>
<link rel='stylesheet' type='text/css' media='handheld' href='/css/pda.css'/>
</body> </body>
</html> </html>

Loading…
Cancel
Save