From a873d891ea64f8dbd2d02cd38d50765228f8e632 Mon Sep 17 00:00:00 2001 From: Simon Twiforce Date: Thu, 5 Jun 2014 15:28:38 +0400 Subject: [PATCH] better compact-boardlist.js integration --- inc/display.php | 32 +++++++++++++++++---------- stylesheets/style.css | 50 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/inc/display.php b/inc/display.php index 5766c79..510265e 100644 --- a/inc/display.php +++ b/inc/display.php @@ -19,20 +19,24 @@ function format_bytes($size) { return round($size, 2).$units[$i]; } -function doBoardListPart($list, $root) { +function doBoardListPart($list, $root, &$boards) { global $config; $body = ''; - foreach ($list as $board) { + foreach ($list as $key => $board) { if (is_array($board)) - $body .= ' [' . doBoardListPart($board, $root) . '] '; - // $body .= ' [' . doBoardListPart($board, $root) . '] '; + $body .= ' [' . doBoardListPart($board, $root, $boards) . '] '; else { - if (($key = array_search($board, $list)) && gettype($key) == 'string') { - $body .= ' ' . $key . ' /'; - } else { - $body .= ' ' . $board . ' /'; - } + if (gettype($key) == 'string') { + $body .= ' ' . $key . ' /'; + } else { + $title = ''; + if (isset ($boards[$board])) { + $title = ' title="'.$boards[$board].'"'; + } + + $body .= ' ' . $board . ' /'; + } } } $body = preg_replace('/\/$/', '', $body); @@ -44,8 +48,14 @@ function createBoardlist($mod=false) { global $config; if (!isset($config['boards'])) return array('top'=>'','bottom'=>''); - - $body = doBoardListPart($config['boards'], $mod?'?/':$config['root']); + + $xboards = listBoards(); + $boards = array(); + foreach ($xboards as $val) { + $boards[$val['uri']] = $val['title']; + } + + $body = doBoardListPart($config['boards'], $mod?'?/':$config['root'], $boards); if ($config['boardlist_wrap_bracket'] && !preg_match('/\] $/', $body)) $body = '[' . $body . ']'; diff --git a/stylesheets/style.css b/stylesheets/style.css index 894df43..64aa049 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -586,4 +586,52 @@ div.post.reply.closed p.fileinfo, div.post.reply.closed div.body, div.post.reply } .pace-inactive { display: none; -} \ No newline at end of file +} +html.desktop-style .boardlist:nth-child(1) { + position: fixed; + top: 0px; + left: 0px; + right: 0px; + /* text-shadow: white 1px 0px 6px, white 1px 0px 6px, black 1px 0px 3px; */ + margin-top: 0px; + z-index: 30; +} +.desktop-style .boardlist:nth-child(1):hover, .desktop-style .boardlist:nth-child(1).cb-menu { + background-color: rgba(90%, 90%, 90%, 0.6); +} +.compact-boardlist { + padding: 3px; + padding-bottom: 0px; +} +.compact-boardlist .cb-item { + display: inline-block; + vertical-align: middle; +} +.compact-boardlist .cb-icon { + padding-bottom: 1px; +} +.compact-boardlist .cb-fa { + font-size: 21px; + padding: 2px; + padding-top: 0; +} +.compact-boardlist .cb-cat { + padding: 5px 6px 8px 6px; +} +.compact-boardlist #watch-pinned { + display: inline-block; +} +/* styles also used by watch.js */ +.cb-menuitem { + display: table-row; +} +.cb-menuitem span { + padding: 5px; + display: table-cell; + text-align: left; + border-top: 1px solid rgba(0, 0, 0, 0.5); +} +.cb-menuitem span.cb-uri { + text-align: right; + padding-left: 0; +}