mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
Factorize app tile styling, might make it easier to customize it ?
This commit is contained in:
parent
46b4903456
commit
7bc43392ce
1 changed files with 13 additions and 11 deletions
|
@ -292,8 +292,7 @@ function init_portal()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
var colors = ['redbg','purpledarkbg','darkbluebg','orangebg','greenbg','darkbluebg','purpledarkbg','yellowbg','lightpinkbg','pinkbg','turquoisebg','yellowbg','lightbluebg','purpledarkbg', 'bluebg']
|
var addMailAlias = document.getElementById('add-mailalias')
|
||||||
, addMailAlias = document.getElementById('add-mailalias')
|
|
||||||
, addMaildrop = document.getElementById('add-maildrop')
|
, addMaildrop = document.getElementById('add-maildrop')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -320,15 +319,7 @@ function init_portal()
|
||||||
for (var i = 0; i < app_tiles.length; i++) {
|
for (var i = 0; i < app_tiles.length; i++) {
|
||||||
|
|
||||||
var el = app_tiles[i];
|
var el = app_tiles[i];
|
||||||
|
set_app_tile_style(el);
|
||||||
// Select a color value from the App label
|
|
||||||
randomColorNumber = parseInt(el.textContent, 36) % colors.length;
|
|
||||||
//randomColorNumber = i%colors.length; // Old value
|
|
||||||
// Add color class.
|
|
||||||
el.classList.add(colors[randomColorNumber]);
|
|
||||||
// Set first-letter data attribute.
|
|
||||||
el.querySelector('.first-letter').setAttribute('data-first-letter', el.textContent.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
|
||||||
el.addEventListener('click', function(event) {
|
el.addEventListener('click', function(event) {
|
||||||
// if asked to open in new tab
|
// if asked to open in new tab
|
||||||
|
@ -347,6 +338,17 @@ 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
|
||||||
|
|
Loading…
Add table
Reference in a new issue