Merge pull request #123 from eauchat/theming-reloaded-plus

Simplify tiles styling
This commit is contained in:
Alexandre Aubin 2019-03-08 23:24:04 +01:00 committed by GitHub
commit 1eff5b7c23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 90 deletions

View file

@ -331,13 +331,12 @@ textarea {
-webkit-transform: skew(0deg, 45deg); -webkit-transform: skew(0deg, 45deg);
} }
.listing-apps span { .listing-apps span {
display: block; display: block;
margin: -1.2em 0 0 0.2em; margin: -1.2em 0 0 0.2em;
} }
.listing-apps .first-letter { margin: 0; } .listing-apps .first-letter {
.listing-apps .first-letter:before { margin: 0;
content: attr(data-first-letter);
display: inline-block; display: inline-block;
} }
.listing-apps .name { .listing-apps .name {

View file

@ -324,7 +324,8 @@ function init_portal()
}); });
Array.each(document.getElementsByClassName("app-tile"), function(el) { Array.each(document.getElementsByClassName("app-tile"), function(el) {
set_app_tile_style(el); // Set first-letter data attribute.
el.querySelector('.first-letter').innerHTML = el.getAttribute("data-appname").substring(0, 2);
// handle app links so they work both in plain info page and in the info iframe called from ynhpanel.js // handle app links so they work both in plain info page and in the info iframe called from ynhpanel.js
window.addEvent(el, 'click', function(event) { window.addEvent(el, 'click', function(event) {
// if asked to open in new tab // if asked to open in new tab
@ -342,17 +343,6 @@ function init_portal()
}); });
} }
var app_tile_colors = ['redbg','purpledarkbg','darkbluebg','orangebg','greenbg','darkbluebg','purpledarkbg','yellowbg','lightpinkbg','pinkbg','turquoisebg','yellowbg','lightbluebg','purpledarkbg', 'bluebg'];
function set_app_tile_style(el)
{
// Select a color value from the App label
randomColorNumber = parseInt(el.textContent, 36) % app_tile_colors.length;
// Add color class.
el.classList.add(app_tile_colors[randomColorNumber]);
// Set first-letter data attribute.
el.querySelector('.first-letter').setAttribute('data-first-letter', el.textContent.substring(0, 2));
}
function tweak_portal_when_in_iframe() function tweak_portal_when_in_iframe()
{ {
// Set class to body to show we're in overlay // Set class to body to show we're in overlay

View file

@ -0,0 +1,11 @@
var app_tile_colors = ['redbg','purpledarkbg','darkbluebg','orangebg','greenbg','darkbluebg','purpledarkbg','yellowbg','lightpinkbg','pinkbg','turquoisebg','yellowbg','lightbluebg','purpledarkbg', 'bluebg'];
function set_app_tile_style(el)
{
// Select a color value from the App label
randomColorNumber = parseInt(el.textContent, 36) % app_tile_colors.length;
// Add color class.
el.classList.add(app_tile_colors[randomColorNumber]);
}
Array.each(document.getElementsByClassName("app-tile"), set_app_tile_style);

View file

@ -85,20 +85,7 @@ input.btn.classic-btn.large-btn:hover,
} }
/* There are no colors, there is only vapor! */ /* There are no colors, there is only vapor! */
.bluebg, .app-tile,
.purplebg,
.orangebg,
.redbg,
.greenbg,
.darkbluebg,
.lightbluebg,
.yellowbg,
.lightpinkbg,
.pinkbg,
.turquoisebg,
.lightyellow,
.lightgreen,
.purpledarkbg,
.form-group input, .form-group input,
.form-group label, .form-group label,
a.btn:hover, a.btn:hover,
@ -107,61 +94,9 @@ a.btn:hover,
border: none; border: none;
} }
.bluebg:hover:after, .app-tile:hover:after,
.bluebg:focus:after, .app-tile:focus:after,
.bluebg:hover:before, .app-tile:hover:before,
.bluebg:focus:before, .app-tile:focus:before {
.purplebg:hover:after,
.purplebg:focus:after,
.purplebg:hover:before,
.purplebg:focus:before,
.orangebg:hover:after,
.orangebg:focus:after,
.orangebg:hover:before,
.orangebg:focus:before,
.redbg:hover:after,
.redbg:focus:after,
.redbg:hover:before,
.redbg:focus:before,
.greenbg:hover:after,
.greenbg:focus:after,
.greenbg:hover:before,
.greenbg:focus:before,
.darkbluebg:hover:after,
.darkbluebg:focus:after,
.darkbluebg:hover:before,
.darkbluebg:focus:before,
.lightbluebg:hover:after,
.lightbluebg:focus:after,
.lightbluebg:hover:before,
.lightbluebg:focus:before,
.yellowbg:hover:after,
.yellowbg:focus:after,
.yellowbg:hover:before,
.yellowbg:focus:before,
.lightpinkbg:hover:after,
.lightpinkbg:focus:after,
.lightpinkbg:hover:before,
.lightpinkbg:focus:before,
.pinkbg:hover:after,
.pinkbg:focus:after,
.pinkbg:hover:before,
.pinkbg:focus:before,
.turquoisebg:hover:after,
.turquoisebg:focus:after,
.turquoisebg:hover:before,
.turquoisebg:focus:before,
.lightyellow:hover:after,
.lightyellow:focus:after,
.lightyellow:hover:before,
.lightyellow:focus:before,
.lightgreen:hover:after,
.lightgreen:focus:after,
.lightgreen:hover:before,
.lightgreen:focus:before,
.purpledarkbg:hover:after,
.purpledarkbg:focus:after,
.purpledarkbg:hover:before,
.purpledarkbg:focus:before {
background: rgba(200, 200, 200, 0.4) !important; background: rgba(200, 200, 200, 0.4) !important;
} }

View file

@ -14,7 +14,12 @@
<div id="apps" class="wrapper apps"> <div id="apps" class="wrapper apps">
<ul class="listing-apps"> <ul class="listing-apps">
{{#app}} {{#app}}
<li><a class="app-tile" href="https://{{url}}"><span class="first-letter"></span><span class="name">{{name}}</span></a></li> <li>
<a class="app-tile" href="https://{{url}}" data-appname="{{name}}">
<span class="first-letter"></span>
<span class="name">{{name}}</span>
</a>
</li>
{{/app}} {{/app}}
</ul> </ul>
</div> </div>