From 508110a9c0e4763e54e6b7b9c88f908e8e91c11e Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 6 Oct 2017 23:08:06 +0000 Subject: [PATCH] Support for themes --- dist/css/hackernews.css | 78 +++++++++++++++++++ dist/css/terminal.css | 168 ++++++++++++++++++++++++++++++++++++++++ dist/js/sb-admin-2.js | 28 ++++++- includes/themes.php | 47 +++++++++++ index.php | 15 +++- 5 files changed, 332 insertions(+), 4 deletions(-) create mode 100644 dist/css/hackernews.css create mode 100644 dist/css/terminal.css create mode 100644 includes/themes.php diff --git a/dist/css/hackernews.css b/dist/css/hackernews.css new file mode 100644 index 00000000..d6bb7b4d --- /dev/null +++ b/dist/css/hackernews.css @@ -0,0 +1,78 @@ +html * { + font-family: Verdana, Geneva, sans-serif; + font-size: 10pt; + color: #828282; +} + +.nav>li>a { + font-size: 12pt; +} + +a:focus, a:hover { + color: #666; +} + +h4 { + font-size: 18px; +} + +.panel { + border-radius: 1px; +} + +.panel-primary { + border-color: #ff6600; +} + +.panel-primary>.panel-heading { + border-color: #ff6600; + background-color: #ff6600; + color: #000; + font-size: 14pt; + font-weight: bold; +} + +.panel-heading { + border-top-left-radius: 1px; + border-top-right-radius: 1px; +} + +.panel-primary>.panel-heading .fa { + color: #fff; +} + +.page-header { + font-size: 26pt; + margin: 10px 0 20px; +} + +#wrapper,#page-wrapper,.panel-body,.nav>li>a,.navbar-default { + background-color: #f6f6ef; +} + +.panel-footer { + background-color: #eee; +} + +.btn-primary.btn-outline { + color: #c61931; + border-color: #c61931; +} + +.btn-primary:hover { + background-color: #c61931; + border-color: #c61931; +} + +.progress { + background-color: #eee; +} + +.progress-bar { + color: #eee; +} + +.info-item { + width: 140px; + float: left; +} diff --git a/dist/css/terminal.css b/dist/css/terminal.css new file mode 100644 index 00000000..ae6f35c4 --- /dev/null +++ b/dist/css/terminal.css @@ -0,0 +1,168 @@ +html * { + font-family: Courier New, Andale Mono, monospace; + font-size: 10pt; + color: #33ff00; +} + +#page-wrapper { + padding: 0 20px; + border-left: 1px solid #33ff00; +} + +.nav>li>a { + font-size: 10pt; +} + +.nav>li>a:focus, .nav>li>a:hover { + background-color: #000; +} + +.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover { + color: #33ff00; + cursor: default; + background-color: #000; + border: 1px solid #33ff00; + border-bottom-color: #33ff00; +} + +.nav-tabs>li>a,.nav-tabs>li>a:hover { + border: 1px solid #33ff00; +} + +.nav-tabs { + border-bottom: 1px solid #33ff00; +} + +.navbar-default { + border-color: #33ff00; +} + +.navbar-default .navbar-brand, .navbar-default .navbar-brand:hover { + color: #33ff00; +} + +.logo { + visibility: collapse; + width: 0px; +} + +a:focus, a:hover { + color: #33ff00; +} + +.panel-primary { + border-color: #33ff00; +} + +.panel-primary>.panel-heading { + border-color: #33ff00; + background-color: #33ff00; + color: #000; + font-size: 12pt; +} + +.panel-primary>.panel-heading .fa { + color: #000; +} + +.panel { + margin-bottom: 20px; + border: 1px solid #33ff00; + border-radius: 0px; +} + +.page-header { + font-size: 24pt; + margin: 10px 0 20px; + border-bottom: 1px solid #33ff00; +} + +#wrapper,#page-wrapper,.panel-body,.nav>li>a,.navbar-default { + background-color: #000; +} + +.panel-footer { + background-color: #000; + border-top: 1px solid #33ff00; +} + +.sidebar ul li a.active,.sidebar ul li a.hover { + background-color: #000; +} + +.sidebar ul li { + border-bottom: 1px solid #33ff00; +} + +.btn-primary.btn-outline,.btn-warning { + color: #33ff00; + border-color: #33ff00; +} + +.btn-primary:hover,.btn-primary:focus,.btn-warning:hover,.btn-warning:focus,.btn-primary:active { + color: #33ff00; + background-color: #000; + border-color: #33ff00; +} + +.btn-primary.btn-outline:hover,.btn-success, .btn-success.btn-outline:hover, .btn-info.btn-outline:hover, .btn-warning.btn-outline:hover, .btn-danger.btn-outline:hover { + color: #33ff00; +} + +.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th { + background-color: #000; + border-top: 1px solid #000; +} + +.btn-info, .btn-info:hover, .btn-info[disabled], .btn-danger.disabled, .btn-danger.disabled.active, .btn-danger.disabled.focus, .btn-danger.disabled:active, .btn-danger.disabled:focus, .btn-danger.disabled:hover, .btn-danger[disabled], .btn-danger[disabled].active, .btn-danger[disabled].focus, .btn-danger[disabled]:active, .btn-danger[disabled]:focus, .btn-danger[disabled]:hover, fieldset[disabled] .btn-danger, fieldset[disabled] .btn-danger.active, fieldset[disabled] .btn-danger.focus, fieldset[disabled] .btn-danger:active, fieldset[disabled] .btn-danger:focus, fieldset[disabled] .btn-danger:hover, .btn-info:hover { + background-color: #000; + border-color: #33ff00; + color: #33ff00; +} + +.btn { + background-color: #000; + border-radius: 0px; +} + +.alert { + border-radius: 0px; +} + +.alert-success,.alert-warning,.alert-ifo,.alert-dismissable { + color: #33ff00; + background-color: #000; + border-color: #33ff00; + border: 1px dashed; +} + +.close { + font-size: 18px; + font-weight: normal; + text-shadow: 0 0px 0 #000; + opacity: 1; +} + +.form-control, .form-control:focus { + color: #33ff00; + background-color: #000; + border: 1px solid #33ff00; + border-radius: 0px; + transition: unset; +} + +.progress { + background-color: #000; + border-radius: 0px; +} + +.progress-bar { + color: #000; +} + +.info-item { + width: 140px; + float: left; +} + + diff --git a/dist/js/sb-admin-2.js b/dist/js/sb-admin-2.js index 5be2c883..3bbc30da 100755 --- a/dist/js/sb-admin-2.js +++ b/dist/js/sb-admin-2.js @@ -1,9 +1,30 @@ $(function() { - - $('#side-menu').metisMenu(); - + $('#theme-select').change(function() { + var theme = themes[$( "#theme-select" ).val() ]; + set_theme(theme); + }); }); +function set_theme(theme) { + $('link[title="main"]').attr('href', theme); + + // persist selected theme in cookie + setCookie('theme',theme,90); +} + +function setCookie(cname, cvalue, exdays) { + var d = new Date(); + d.setTime(d.getTime() + (exdays*24*60*60*1000)); + var expires = "expires="+ d.toUTCString(); + document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; +} + +var themes = { + "default": "dist/css/custom.css", + "hackernews" : "dist/css/hackernews.css", + "terminal" : "dist/css/terminal.css", +} + //Loads the correct sidebar on window load, //collapses the sidebar on window resize. // Sets the min-height of #page-wrapper to window size @@ -34,3 +55,4 @@ $(function() { element.addClass('active'); } }); + diff --git a/includes/themes.php b/includes/themes.php new file mode 100644 index 00000000..0b502341 --- /dev/null +++ b/includes/themes.php @@ -0,0 +1,47 @@ + +
+
+
+
Change Theme
+
+
+
+
+
+

Theme settings

+ +
+
+ + +
+
+ +
+
+
+
+ +
+ +
+ +
+
+
+
+ + diff --git a/index.php b/index.php index ac9af9f8..f11a2956 100755 --- a/index.php +++ b/index.php @@ -50,6 +50,7 @@ include_once( 'includes/dhcp.php' ); include_once( 'includes/hostapd.php' ); include_once( 'includes/system.php' ); include_once( 'includes/configure_client.php' ); +include_once( 'includes/themes.php' ); $output = $return = 0; $page = $_GET['page']; @@ -63,6 +64,12 @@ if (empty($_SESSION['csrf_token'])) { } } $csrf_token = $_SESSION['csrf_token']; + +if(!isset($_COOKIE['theme'])) { + $theme_url = "dist/css/custom.css"; +} else { + $theme_url = $_COOKIE['theme']; +} ?> @@ -95,7 +102,7 @@ $csrf_token = $_SESSION['csrf_token']; - + @@ -150,6 +157,9 @@ $csrf_token = $_SESSION['csrf_token'];
  • Configure Auth
  • +
  • + Change Theme +
  • System
  • @@ -196,6 +206,9 @@ $csrf_token = $_SESSION['csrf_token']; case "save_hostapd_conf": SaveTORAndVPNConfig(); break; + case "theme_conf": + DisplayThemeConfig(); + break; case "system_info": DisplaySystem(); break;