-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0c1c7be
Showing
14 changed files
with
985 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# darkMode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "Aurelienazerty/darkMode", | ||
"type": "phpbb-extension", | ||
"description": "Enable switching between Dark and Light mode", | ||
"homepage": "https://www.team-azerty.com", | ||
"version": "0.9.0", | ||
"time": "2019-03-24", | ||
"keywords": ["phpbb", "extension", "style", "Dark Mode"], | ||
"license": "GPL-2.0", | ||
"authors": [ | ||
{ | ||
"name": "Aurelienazerty", | ||
"homepage": "https://www.team-azerty.com", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.3.3" | ||
}, | ||
"extra": { | ||
"display-name": "Dark Mode", | ||
"soft-require": { | ||
"phpbb/phpbb": "3.1.*" | ||
}, | ||
"version-check": { | ||
"host": "phpbb.team-azerty.com", | ||
"directory": "/", | ||
"filename": "darkmode.json" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
services: | ||
Aurelienazerty.darkMode.listener: | ||
class: Aurelienazerty\darkMode\event\listener | ||
arguments: | ||
- '@template' | ||
- '@user' | ||
tags: | ||
- { name: event.listener } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/** | ||
* | ||
* Display Last Post extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2013 phpBB Limited <https://www.phpbb.com> | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
namespace Aurelienazerty\darkMode\event; | ||
|
||
/** | ||
* Event listener | ||
*/ | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
||
class listener implements EventSubscriberInterface | ||
{ | ||
/** @var \phpbb\template\template */ | ||
protected $template; | ||
/** @var \phpbb\user $user */ | ||
protected $user; | ||
|
||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \phpbb\template\template $config Config object | ||
* @return \Aurelienazerty\darkMode\event\listener | ||
* @access public | ||
*/ | ||
public function __construct(\phpbb\template\template $template, \phpbb\user $user) | ||
{ | ||
$this->template = $template; | ||
$this->user = $user; | ||
} | ||
|
||
static public function getSubscribedEvents() | ||
{ | ||
return array( | ||
'core.page_header' => 'do_dark', | ||
); | ||
} | ||
|
||
public function do_dark($event) | ||
{ | ||
$idDark = request_var('darkmode','',false,true); | ||
if ($idDark) | ||
{ | ||
$styleDoLight = ""; | ||
$styleDoDark = "display: none;"; | ||
$class = "darkmode"; | ||
} | ||
else | ||
{ | ||
$styleDoLight = "display: none;"; | ||
$styleDoDark = ""; | ||
$class = ""; | ||
} | ||
|
||
$this->template->append_var('BODY_CLASS', $class); | ||
$this->template->append_var('STYLE_DO_DARK', $styleDoDark); | ||
$this->template->append_var('STYLE_DO_LIGHT', $styleDoLight); | ||
|
||
$this->user->add_lang_ext('Aurelienazerty/darkMode', 'dark_mode'); | ||
$this->template->assign_var('DO_DARK_MESSAGE' , $this->user->lang['DO_DARK_MODE']); | ||
$this->template->assign_var('DO_LIGHT_MESSAGE' , $this->user->lang['DO_LIGHT_MODE']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* | ||
* Dark mode extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2013 phpBB Limited <https://www.phpbb.com> | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
/** | ||
* DO NOT CHANGE | ||
*/ | ||
if (!defined('IN_PHPBB')) | ||
{ | ||
exit; | ||
} | ||
|
||
if (empty($lang) || !is_array($lang)) | ||
{ | ||
$lang = array(); | ||
} | ||
|
||
// DEVELOPERS PLEASE NOTE | ||
// | ||
// All language files should use UTF-8 as their encoding and the files must not contain a BOM. | ||
// | ||
// Placeholders can now contain order information, e.g. instead of | ||
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows | ||
// translators to re-order the output of data while ensuring it remains correct | ||
// | ||
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine | ||
// equally where a string contains only two placeholders which are used to wrap text | ||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine | ||
|
||
$lang = array_merge($lang, array( | ||
'DO_DARK_MODE' => 'Dark mode', | ||
'DO_LIGHT_MODE' => 'Light mode', | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* | ||
* Dark mode extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2013 phpBB Limited <https://www.phpbb.com> | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
/** | ||
* DO NOT CHANGE | ||
*/ | ||
if (!defined('IN_PHPBB')) | ||
{ | ||
exit; | ||
} | ||
|
||
if (empty($lang) || !is_array($lang)) | ||
{ | ||
$lang = array(); | ||
} | ||
|
||
// DEVELOPERS PLEASE NOTE | ||
// | ||
// All language files should use UTF-8 as their encoding and the files must not contain a BOM. | ||
// | ||
// Placeholders can now contain order information, e.g. instead of | ||
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows | ||
// translators to re-order the output of data while ensuring it remains correct | ||
// | ||
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine | ||
// equally where a string contains only two placeholders which are used to wrap text | ||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine | ||
|
||
$lang = array_merge($lang, array( | ||
'DO_DARK_MODE' => 'Mode sombre', | ||
'DO_LIGHT_MODE' => 'Mode clair', | ||
)); |
10 changes: 10 additions & 0 deletions
10
styles/all/template/event/navbar_header_user_profile_prepend.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<li data-last-responsive="true" class="rightside" style="{STYLE_DO_LIGHT}" id='callLight'> | ||
<a href='javascript:void(0);' onclick='darkmode(false)'> | ||
<i class="icon fa-lightbulb-o fa-fw" aria-hidden="true"></i><span>{DO_LIGHT_MESSAGE}</span> | ||
</a> | ||
</li> | ||
<li data-last-responsive="true" class="rightside" style="{STYLE_DO_DARK}" id='callDark'> | ||
<a href='javascript:void(0);' onclick='darkmode(true)'> | ||
<i class="icon fa-moon-o fa-fw" aria-hidden="true"></i><span>{DO_DARK_MESSAGE}</span> | ||
</a> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% if not INCLUDED_DARKMODE_JS %} | ||
{% INCLUDEJS '@Aurelienazerty_darkMode/darkmode.js' %} | ||
{% set INCLUDED_DARKMODE_JS = true %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- INCLUDECSS darkmode.css --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
body.darkmode { | ||
filter: invert(1) hue-rotate(.5turn); | ||
} | ||
|
||
.darkmode img { | ||
filter: invert(1) hue-rotate(.5turn); | ||
} | ||
|
||
.darkmode img:not(:hover) { | ||
opacity: .7; | ||
transition: opacity .25s ease-in-out; | ||
} | ||
|
||
.darkmode .headerbar { | ||
background-image: none; | ||
} | ||
|
||
/** La suite est un copier coller sans le .darkmode */ | ||
@media (prefers-color-scheme: dark) { | ||
|
||
html { | ||
filter: invert(1) hue-rotate(.5turn); | ||
} | ||
|
||
img { | ||
filter: invert(1) hue-rotate(.5turn); | ||
} | ||
|
||
img:not(:hover) { | ||
opacity: .7; | ||
transition: opacity .25s ease-in-out; | ||
} | ||
|
||
.headerbar { | ||
background-image: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function darkmode(doDark) { | ||
if (doDark) { | ||
$("body").addClass("darkmode"); | ||
$("#callDark").hide(); | ||
$("#callLight").show(); | ||
var date = new Date(); | ||
date.setTime(date.getTime()+(365*24*60*60*1000)); | ||
document.cookie = "darkmode=true;expires=" + date.toGMTString() + ";path=/"; | ||
} else { | ||
$("body").removeClass("darkmode"); | ||
$("#callDark").show(); | ||
$("#callLight").hide(); | ||
var date = new Date(); | ||
document.cookie = "darkmode=false;expires=" + date.toGMTString() + ";path=/"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*.darkmode .headerbar { | ||
background-image: none; | ||
background-color: #1F1F1F; | ||
} | ||
.site_logo { | ||
filter: invert(1) hue-rotate(.5turn); | ||
}*/ | ||
body.darkmode { | ||
filter: invert(1) hue-rotate(.5turn); | ||
} | ||
|
||
.darkmode img { | ||
filter: invert(1) hue-rotate(.5turn); | ||
} | ||
|
||
.darkmode img:not(:hover) { | ||
opacity: .7; | ||
transition: opacity .25s ease-in-out; | ||
} | ||
|
||
/** Les couleurs sont inversées | ||
http://www.mattlag.com/scripting/hexcolorinverter.php | ||
*/ | ||
.darkmode .headerbar { | ||
background-image: none; | ||
background-color: #E0E0E0; | ||
} | ||
|
||
.darkmode .headerbar h1, .darkmode .headerbar p { | ||
color: #000000; | ||
} | ||
|
||
/** La suite est un copier coller sans le .darkmode */ | ||
@media (prefers-color-scheme: dark) { | ||
|
||
html { | ||
filter: invert(1) hue-rotate(.5turn); | ||
} | ||
|
||
img { | ||
filter: invert(1) hue-rotate(.5turn); | ||
} | ||
|
||
img:not(:hover) { | ||
opacity: .7; | ||
transition: opacity .25s ease-in-out; | ||
} | ||
|
||
.headerbar { | ||
background-image: none; | ||
background-color: #1F1F1F; | ||
} | ||
} |