themes updated

This commit is contained in:
tmshv committed 2017-02-21 06:53:23 +03:00
1 parent 5d738c71a7
commit bbdabf5610
12 files changed
+216 -62

No files matched your search

@@ -4,9 +4,45 @@ export default function (app) {
app.component('accessibilityControl', { app.component('accessibilityControl', {
template, template,
controller: ($scope, theme) => { controller: ($scope, theme) => {
$scope.scopes = {
color: [
['bw', 'белым по черному'],
['wb', 'черным по белому'],
],
fontSize: [
['normal', 'нормальный'],
['big', 'большой'],
['biggest', 'огромный'],
],
fontFamily: [
['sans', 'без засечек'],
['serif', 'с засечками'],
],
image: [
['yesImg', 'отображаются'],
['noImg', 'спрятаны'],
],
kerning: [
['normal', 'обычный'],
['big', 'увеличенный'],
],
}
$scope.isActive = (scope, [name,]) => theme.isActive(scope, name)
$scope.setDefaultTheme = () => theme.toggle()
$scope.setDefaultSettings = () => theme.setDefaultAccessibilityTheme()
$scope.setColorTheme = theme.setColorTheme.bind(theme) $scope.setColorTheme = theme.setColorTheme.bind(theme)
$scope.setFontTheme = theme.setFontTheme.bind(theme) $scope.setFontTheme = theme.setFontTheme.bind(theme)
$scope.setFontFamilyTheme = theme.setFontFamilyTheme.bind(theme) $scope.setFontFamilyTheme = theme.setFontFamilyTheme.bind(theme)
$scope.setImageTheme = theme.setImageTheme.bind(theme)
$scope.setKerningTheme = theme.setKerningTheme.bind(theme)
}, },
}) })
} }
+40 -5
View File
@@ -14,10 +14,20 @@ const themeScheme = {
}, },
fontSize: { fontSize: {
normal: 'theme-accessibility-font-normal', normal: '',
big: 'theme-accessibility-font-big', big: 'theme-accessibility-font-big',
biggest: 'theme-accessibility-font-biggest', biggest: 'theme-accessibility-font-biggest',
}, },
image: {
yesImg: '',
noImg: 'theme-accessibility-no-image',
},
kerning: {
normal: '',
big: 'theme-accessibility-kerning-big',
},
} }
const defaultAccessibilityTheme = () => ({ const defaultAccessibilityTheme = () => ({
@@ -26,7 +36,9 @@ const defaultAccessibilityTheme = () => ({
accessibility: 'accessibility', accessibility: 'accessibility',
color: 'wb', color: 'wb',
font: 'sans', font: 'sans',
fontSize: 'big', fontSize: 'normal',
image: 'yesImg',
kerning: 'normal',
}, },
}) })
@@ -121,13 +133,36 @@ class Theme {
this.install() this.install()
} }
setImageTheme(theme) {
this.themeSetup.theme.image = theme
this.install()
}
setKerningTheme(theme) {
this.themeSetup.theme.kerning = theme
this.install()
}
install() { install() {
this.setTheme(this.themeSetup) this.setTheme(this.themeSetup)
} }
isDefaultTheme(){ isDefaultTheme() {
const theme = loadTheme() return this.__scope.theme === this.mainTheme
return !theme // default theme cleared up local storage }
isActive(scope, name) {
if (this.isDefaultTheme()) return false
try {
return this.themeSetup.theme[scope] === name
} catch (e) {
return false
}
}
setDefaultAccessibilityTheme () {
this.setTheme(defaultAccessibilityTheme())
} }
} }
@@ -1,11 +1,34 @@
@import "../variables"; @import "../variables";
.accessibility-control{ .accessibility-control {
background-color: white;
height: 100px;
width: 100%; width: 100%;
padding: $single-margin;
span {
margin-right: $single-margin;
}
span.active {
font-weight: bold;
}
&__block {
margin-bottom: $half-margin;
}
ul li { ul li {
display: inline; display: inline;
margin-right: $single-margin;
}
ul {
display: inline;
} }
} }
.accessibility .accessibility-control {
a {
border-bottom-style: dashed;
}
}
+8
View File
@@ -21,3 +21,11 @@ h2{
h3{ h3{
margin-bottom: $single-margin / 2; margin-bottom: $single-margin / 2;
} }
.actor {
border-bottom: 1px dashed black;
&:hover {
border-bottom: 2px solid black;
}
}
+2
View File
@@ -48,3 +48,5 @@
@import "themes/theme-accessibility-font-biggest"; @import "themes/theme-accessibility-font-biggest";
@import "themes/theme-accessibility-font-sans"; @import "themes/theme-accessibility-font-sans";
@import "themes/theme-accessibility-font-serif"; @import "themes/theme-accessibility-font-serif";
@import "themes/theme-accessibility-no-image";
@import "themes/theme-accessibility-kerning-big";
@@ -14,6 +14,10 @@
} }
} }
.accessibility-control{
color: $darker-color;
}
.main-menu { .main-menu {
a { a {
color: $dark-color; color: $dark-color;
@@ -1,7 +1,7 @@
@import "../variables"; @import "../variables";
.theme-accessibility-font-big { .theme-accessibility-font-big {
font-size: 18pt; font-size: 16pt;
.main-menu { .main-menu {
font-size: $bigger-font-size; font-size: $bigger-font-size;
@@ -1,7 +1,7 @@
@import "../variables"; @import "../variables";
.theme-accessibility-font-biggest { .theme-accessibility-font-biggest {
font-size: 36pt; font-size: 18pt;
a { a {
&:hover { &:hover {
@@ -0,0 +1,6 @@
@import "../variables";
.theme-accessibility-kerning-big {
line-height: 2rem;
letter-spacing: .5rem;
}
@@ -0,0 +1,19 @@
@import "../variables";
.theme-accessibility-no-image {
img {
display: none;
}
video {
display: none;
}
.html5-video-player {
display: none;
}
.main-image{
display: none;
}
}
@@ -14,6 +14,10 @@
} }
} }
.accessibility-control{
color: $darker-color;
}
.main-menu { .main-menu {
a { a {
color: $darker-color; color: $darker-color;
@@ -1,58 +1,75 @@
<div class="accessibility-control"> <div class="accessibility-control">
<ul> <div class="accessibility-control__block">
<li> <span>Цветовая схема: </span>
<button ng-click="setColorTheme('bw')" <ul>
>Белым по черному <li ng-repeat="i in scopes.color">
</button> <span
</li> class="actor"
<li> ng-class="{active: isActive('color', i)}"
<button ng-click="setColorTheme('wb')" ng-click="setColorTheme(i[0])"
>Черным по белому >{{i[1]}}</span>
</button> </li>
</li> </ul>
<!--<li>--> </div>
<!--<button ng-click="setTheme('dark-blue')"-->
<!--&gt;Темно-синим по голубому-->
<!--</button>-->
<!--</li>-->
<!--<li>-->
<!--<button ng-click="setTheme('brown')"-->
<!--&gt;Коричневым по бежевому</button>-->
<!--</li>-->
<!--<li>-->
<!--<button ng-click="setTheme('green')"-->
<!--&gt;Зеленым по темно-коричневому</button>-->
<!--</li>-->
</ul>
<ul> <div class="accessibility-control__block">
<li> <span>Размер шрифта: </span>
<button ng-click="setFontTheme('')" <ul>
>Нормально <li ng-repeat="i in scopes.fontSize">
</button> <span
</li> class="actor"
<li> ng-class="{active: isActive('fontSize', i)}"
<button ng-click="setFontTheme('big')" ng-click="setFontTheme(i[0])"
>Большие >{{i[1]}}</span>
</button>
</li>
<li>
<button ng-click="setFontTheme('biggest')"
>Огромные
</button>
</li> </li>
</ul> </ul>
</div>
<ul> <div class="accessibility-control__block">
<li> <span>Начертание: </span>
<button ng-click="setFontFamilyTheme('sans')" <ul>
>Без засечек <li ng-repeat="i in scopes.fontFamily">
</button> <span
</li> class="actor"
<li> ng-class="{active: isActive('font', i)}"
<button ng-click="setFontFamilyTheme('serif')" ng-click="setFontFamilyTheme(i[0])"
>С засечками >{{i[1]}}</span>
</button> </li>
</li> </ul>
</ul> </div>
<div class="accessibility-control__block">
<span>Картинки: </span>
<ul>
<li ng-repeat="i in scopes.image">
<span
class="actor"
ng-class="{active: isActive('image', i)}"
ng-click="setImageTheme(i[0])"
>{{i[1]}}</span>
</li>
</ul>
</div>
<div class="accessibility-control__block">
<span>Кернинг: </span>
<ul>
<li ng-repeat="i in scopes.kerning">
<span
class="actor"
ng-class="{active: isActive('kerning', i)}"
ng-click="setKerningTheme(i[0])"
>{{i[1]}}</span>
</li>
</ul>
</div>
<div style="margin: 1em 0">
<span class="actor"
ng-click="setDefaultSettings()"
>Стандартная настройка</span>
<span class="actor"
ng-click="setDefaultTheme()"
>Обычный режим</span>
</div>
</div> </div>