Browse Source

Support theme-color meta tag

This allows for some browsers like chrome mobile to change the color of
the address bar to smoothly match the theme of the page
spaghetti 8 years ago
parent
commit
1612fcf6aa
3 changed files with 14 additions and 4 deletions
  1. 11
    3
      design/privateheader.php
  2. 1
    0
      design/publicheader.php
  3. 2
    1
      gazelle.sql

+ 11
- 3
design/privateheader.php View File

@@ -59,9 +59,17 @@ if (isset(G::$LoggedUser['Notify'])) {
59 59
   <link rel="stylesheet" href="<?=STATIC_SERVER?>styles/tooltipster/style.css?v=<?=filemtime(SERVER_ROOT.STATIC_SERVER.'styles/tooltipster/style.css')?>" type="text/css" media="screen" />
60 60
 <?
61 61
 if (empty(G::$LoggedUser['StyleURL'])) {
62
-?>
63
-<link rel="stylesheet" type="text/css" title="<?=G::$LoggedUser['StyleName']?>" media="screen"
64
-    href="<?=STATIC_SERVER?>styles/<?=G::$LoggedUser['StyleName']?>/style.css?v=<?=filemtime(SERVER_ROOT.STATIC_SERVER.'styles/'.G::$LoggedUser['StyleName'].'/style.css')?>" />
62
+  if (($StyleColors = G::$Cache->get_value('stylesheet_colors')) === false) {
63
+    G::$DB->query('SELECT LOWER(REPLACE(Name, " ", "_")) AS Name, Color FROM stylesheets WHERE COLOR IS NOT NULL');
64
+    while (list($StyleName, $StyleColor) = G::$DB->next_record()) {
65
+      $StyleColors[$StyleName] = $StyleColor;
66
+    }
67
+    G::$Cache->cache_value('stylesheet_colors', $StyleColors, 0);
68
+  }
69
+  if (isset($StyleColors[G::$LoggedUser['StyleName']])) { ?>
70
+<meta name="theme-color" content="<?=$StyleColors[G::$LoggedUser['StyleName']]?>">
71
+<? } ?>
72
+<link rel="stylesheet" type="text/css" title="<?=G::$LoggedUser['StyleName']?>" media="screen" href="<?=STATIC_SERVER?>styles/<?=G::$LoggedUser['StyleName']?>/style.css?v=<?=filemtime(SERVER_ROOT.STATIC_SERVER.'styles/'.G::$LoggedUser['StyleName'].'/style.css')?>" />
65 73
 <?
66 74
 } else {
67 75
   $StyleURLInfo = parse_url(G::$LoggedUser['StyleURL']);

+ 1
- 0
design/publicheader.php View File

@@ -7,6 +7,7 @@ define('FOOTER_FILE',SERVER_ROOT.'/design/publicfooter.php');
7 7
 <head>
8 8
   <title><?=display_str($PageTitle)?></title>
9 9
   <meta http-equiv="X-UA-Compatible" content="IE=edge" />
10
+  <meta name="theme-color" content="#461640">
10 11
   <link rel="shortcut icon" href="favicon.ico?v=<?=md5_file('favicon.ico');?>" />
11 12
   <link href="<?=STATIC_SERVER ?>styles/public/style.css?v=<?=filemtime(SERVER_ROOT.'/static/styles/public/style.css')?>" rel="stylesheet" type="text/css" />
12 13
 <?

+ 2
- 1
gazelle.sql
File diff suppressed because it is too large
View File


Loading…
Cancel
Save