Skip to content

Added support for user provided image icons. #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions css/image_icons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.splash_image_icon
{
width:5em;
height:5em;
}
.menu_image_icon
{
width:1.33333333em;
height:1.33333333em;
vertical-align: -15%;
}
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<meta name="msapplication-config" content="images/favicon/browserconfig.xml?v=ngGoyLXN9n">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="css/loader.css"/>
<link rel="stylesheet" href="combineify.php?type=css&files=css/cssreset.min.css,css/jquery-ui.min.css,css/bootstrap.min.css,css/bootstrap-iconpicker.min.css,css/font-awesome.min.css,css/font-muximux.css,css/font-pt_sans.css,css/style.css,css/spectrum.min.css,<?php echo getThemeFile();?>">
<link rel="stylesheet" href="combineify.php?type=css&files=css/cssreset.min.css,css/jquery-ui.min.css,css/bootstrap.min.css,css/bootstrap-iconpicker.min.css,css/font-awesome.min.css,css/font-muximux.css,css/font-pt_sans.css,css/style.css,css/spectrum.min.css,css/image_icons.css,<?php echo getThemeFile();?>">
<title><?php echo getTitle(); ?></title>

</head>
Expand Down
51 changes: 43 additions & 8 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,21 @@ function settingsEventHandlers() {
'<div class="col-xs-7 col-md-8">' +
'<input class="form-control form-control-sm ' + rand + 'newApplication_-_value" name="' + rand + 'newApplication_-_url" type="text" value="">' +
'</div>' +
'</div><br>' +
'<div class="appdiv form-group">' +
'</div>' +
'<div class="appdiv form-group icoSelDiv_' + rand + 'newApplication">' +
'<label for="' + rand + 'newApplication_-_icon" class="col-xs-4 control-label right-label">Icon: </label>' +
'<div class="col-xs-7 col-md-5">' +
'<button role="iconpicker" class="form-control form-control-sm iconpicker btn btn-default ' + rand + 'newApplication_-_icon" name="' + rand + 'newApplication_-_icon" id="' + rand + 'newApplication_-_iconPicker" data-rows="4" data-cols="6" data-search="true" data-search-text="Search..." data-iconset="muximux" data-placement="left">' +
'</div>' +
'</div>' +
'<div class="appDiv form-group imgSelDiv_' + rand + 'newApplication" style="display:none">' +
'<label for="' + rand + 'newApplication_-_image" class="col-xs-4 col-md-5 control-label color-label">Image:' +
'<input type="text" class="form-control form-control ' + rand + 'newApplication_-_value" id="' +rand + 'newApplication_-_image" name="' + rand + 'newApplication_-_image" value="">'+
'</label>'+
'</div>'+
'<div class="hidden-xl-up">' +
'<br>' +
' </div>'+
'<div class="appdiv form-group colorDiv">' +
'<label for="' + rand + 'newApplication_-_color" class="col-xs-4 col-md-5 control-label color-label">Color: </label>' +
'<div class="col-xs-7">' +
Expand All @@ -183,6 +191,11 @@ function settingsEventHandlers() {
'<input type="checkbox" class="form-check-input form-control ' + rand + 'newApplication_-_value" id="' + rand + 'newApplication_-_dd" name="' + rand + 'newApplication_-_dd">' +
'</label>' +
'</div>' +
'<div class="appdiv form-group">' +
'<label for="' + rand + 'newApplication_-_img_icon" class="col-xs-6 col-md-12 control-label col-form-label form-check-inline">Image Icon: ' +
'<input type="checkbox" class="form-check-input form-control iconSelection ' + rand + 'newApplication_-_value" id="' + rand + 'newApplication_-_img_icon" name="' + rand + 'newApplication_-_img_icon">' +
'</label>' +
'</div>' +
'<div class="appdiv form-group">' +
'<label for="' + rand + 'newApplication_-_default" class="col-xs-6 col-md-12 control-label col-form-label form-check-inline">Default: ' +
'<input type="radio" class="form-check-input form-control ' + rand + 'newApplication_-_value" id="' + rand + 'newApplication_-_default" name="' + rand + 'newApplication_-_default">' +
Expand All @@ -192,6 +205,8 @@ function settingsEventHandlers() {
'<button type="button" class="form-control form-control-sm removeButton btn btn-danger btn-xs" value="Remove" id="remove_-_' + rand + 'newApplication">Remove<meta class="newAppRand" value="' + rand + '"></button>' +
'<meta class="newAppRand" value="' + rand + '">' +
'</div>');
setIconSelectCallback();
changeTabColorVisibility();
initIconPicker('#' + rand + 'newApplication_-_iconPicker');
$('.' + rand + 'newApplication_-_color').spectrum({
showInput: true,
Expand Down Expand Up @@ -254,13 +269,33 @@ function settingsEventHandlers() {
form.ajaxSubmit(options);
});
$('#tabcolorCheckbox').click(function(event) {
if ($(this).prop('checked')) {
$('.colorDiv').slideDown('fast');
} else {
$('.colorDiv').slideUp('fast');
}

changeTabColorVisibility();
});
setIconSelectCallback();
}

function changeTabColorVisibility()
{
show = $('#tabcolorCheckbox').prop('checked')
if (show)
$('.colorDiv').slideDown('fast');
else
$('.colorDiv').slideUp('fast');
}

function setIconSelectCallback()
{
$('.iconSelection').click(function(event) {
base = $(this).prop('name').split("_-_")[0]
if($(this).prop('checked'))
{
$('.icoSelDiv_'+base).slideUp('fast',function(){$('.imgSelDiv_'+base).slideDown('fast');});
}else
{
$('.imgSelDiv_'+base).slideUp('fast',function(){$('.icoSelDiv_'+base).slideDown('fast');});

}
});
}
// Takes all the data we have to generate our changelog
function viewChangelog() {
Expand Down
93 changes: 70 additions & 23 deletions muximux.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,21 @@ function parse_ini()
$url = $config->get($section, 'url', 'http://www.plex.com');
$color = $config->get($section, 'color', '#000');
$icon = $config->get($section, 'icon', 'muximux-play');
$icon = str_replace('fa-','muximux-',$icon);
$scale = $config->get($section, 'scale', '1');
$img_icon = $config->getBool($section, 'img_icon', false);
if($img_icon === false)
{
$img_display = 'inline-block';
$img_display = 'none';
$ico_display = 'inline-block';
}
else
{
$icon = $config->getString($section, 'image', 'default.png');
$ico_display = 'none';
$icon = str_replace('fa-','muximux-',$icon);
}

$scale = $config->get($section, 'scale', '1');
$default = $config->getBool($section, 'default', false);
$enabled = $config->getBool($section, 'enabled', true);
$landingpage = $config->getBool($section, 'landingpage', false);
Expand Down Expand Up @@ -280,12 +293,17 @@ function parse_ini()
<select id='" . $section . "_-_scale' class='form-control custom-select form-control-sm ' name='" . $section . "_-_scale'>". $scaleRange ."</select>
</div>
</div>
<div class='appDiv form-group'>
<div class='appDiv form-group icoSelDiv_" . $section . "' style='display:" . $ico_display . "'>
<label for='" . $section . "_-_icon' class='col-xs-4 control-label right-label'>Icon: </label>
<div class='col-xs-7 col-md-5'>
<button role='iconpicker' class='form-control form-control-sm iconpicker btn btn-default' name='" . $section . "_-_icon' data-rows='4' data-cols='6' data-search='true' data-search-text='Search...' data-iconset='muximux' data-placement='left' data-icon='" . $icon . "'></button>
</div>
</div>
<div class='appDiv form-group imgSelDiv_" . $section . "' style='display:" . $img_display . "'>
<label for='" . $section . "_-_image' class='col-xs-6 col-md-12 control-label col-form-label form-check-inline'>Image:
<input type='text' class='form-control form-control " . $section . "_-_value' id='" . $section . "_-_image' name='" . $section . "_-_image' value='" . $icon ."'>
</label>
</div>
<div class='appDiv form-group colorDiv'>
<label for='" . $section . "_-_color' class='col-xs-4 col-md-5 control-label color-label right-label'>Color: </label>
<div class='col-xs-7'>
Expand All @@ -310,6 +328,11 @@ function parse_ini()
<input type='checkbox' class='form-check-input form-control " . $section . "_-_value' id='" . $section . "_-_dd' name='" . $section . "_-_dd'".($dd ? 'checked' : '') .">
</label>
</div>
<div class='appDiv form-group'>
<label for='" . $section . "_-_img_icon' class='col-xs-6 col-md-12 control-label col-form-label form-check-inline'>Image Icon:
<input type='checkbox' class='form-check-input form-control iconSelection " . $section . "_-_value' id='" . $section . "_-_img_icon' name='" . $section . "_-_img_icon'".($img_icon ? 'checked' : '') .">
</label>
</div>
<div class='appDiv form-group'>
<label for='" . $section . "_-_default' class='col-xs-6 col-md-12 control-label col-form-label form-check-inline'>Default:
<input type='radio' class='form-check-input form-control " . $section . "_-_value' id='" . $section . "_-_default' name='" . $section . "_-_default'".($default ? 'checked' : '') .">
Expand Down Expand Up @@ -347,18 +370,27 @@ function splashScreen() {
$enabled = $config->getBool($keyname,'enabled',false);
if (($keyname != "general") && ($keyname != "settings") && $enabled) {
$color = ($tabColor===true ? $section["color"] : $themeColor);
$icon = $config->get($keyname,'icon','fa-play');
$icon = str_replace('fa-','muximux-',$icon);

$splash .= "
<div class='btnWrap'>
<div class='well splashBtn' data-content='" . $keyname . "'>
<a class='panel-heading' data-title='" . $section["name"] . "'>
<br><i class='fa fa-5x " . $icon . "' style='color:".$color."'></i><br>
<p class='splashBtnTitle' style='color:#ddd'>".$section["name"]."</p>
</a>
</div>
</div>";
$img_icon = $config->getBool($keyname, 'img_icon', false);
$icon = $config->get($keyname,'icon','fa-play');

if($img_icon === false)
$icon = str_replace('fa-','muximux-',$icon);
else
$icon = $config->getString($keyname, 'image', 'default.png');

$splash .= "
<div class='btnWrap'>
<div class='well splashBtn' data-content='" . $keyname . "'>
<a class='panel-heading' data-title='" . $section["name"] . "'>";
if($img_icon === false)
$splash .= "<br><i class='fa fa-5x " . $icon . "' style='color:".$color."'></i><br>";
else
$splash .= "<br><img class='splash_image_icon' src='images/" . $icon . "'><br>";

$splash .= "<p class='splashBtnTitle' style='color:#ddd'>".$section["name"]."</p>
</a>
</div>
</div>";
}
}
return $splash;
Expand Down Expand Up @@ -500,6 +532,13 @@ function listThemes() {
return $themelist;
}

function menuImage($img_icon,$icon,$extra){
if($img_icon === false)
return "<span class='fa " . $icon . " " . $extra . "'></span> ";
else
return "<img class='menu_image_icon' src='images/" . $icon . "'></span> ";
}

// Build the contents of our menu
function menuItems() {
$config = new Config_Lite(CONFIG);
Expand Down Expand Up @@ -527,9 +566,17 @@ function menuItems() {
$name = $config->get($keyname, 'name', '');
$url = $config->get($keyname, 'url', 'http://www.plex.com');
$color = $config->get($keyname, 'color', '#000');
$icon = $config->get($keyname, 'icon', 'fa-play');
$icon = str_replace('fa-','muximux-',$icon);
$scale = $config->get($keyname, 'scale', '1');

$img_icon = $config->getBool($keyname, 'img_icon', false);
$icon = $config->get($keyname,'icon','fa-play');

if($img_icon === false)
$icon = str_replace('fa-','muximux-',$icon);
else
$icon = $config->getString($keyname, 'image', 'default.png');

$scale = $config->get($keyname, 'scale', '1');

$default = $config->getBool($keyname, 'default', false);
$enabled = $config->getBool($keyname, 'enabled', false);
$landingpage = $config->getBool($keyname, 'landingpage', false);
Expand All @@ -540,16 +587,16 @@ function menuItems() {
if (!$dd) {
$standardmenu .= "
<li class='cd-tab' data-index='".$int."'>
<a data-content='" . $keyname . "' data-title='" . $section["name"] . "' data-color='" . $section["color"] . "' class='".($default ? 'selected' : '')."'>
<span class='fa " . $icon . " fa-lg'></span> " . $section["name"] . "
<a data-content='" . $keyname . "' data-title='" . $section["name"] . "' data-color='" . $section["color"] . "' class='".($default ? 'selected' : '')."'>"
. menuImage($img_icon,$icon,"fa-lg") . $section["name"] . "
</a>
</li>";
$int++;
} else {
$dropdownmenu .= "
<li>
<a data-content='" . $keyname . "' data-title='" . $section["name"] . "'>
<span class='fa " . $icon . "'></span> " . $section["name"] . "
<a data-content='" . $keyname . "' data-title='" . $section["name"] . "'>"
. menuImage($img_icon,$icon,"") . $section["name"] . "
</a>
</li>";
}
Expand Down Expand Up @@ -1222,4 +1269,4 @@ function saveConfig($inConfig) {
function setStatus($message) {
$scriptBlock = "<script language='javascript'>alert(\"" . $message . "\");</script>";
echo $scriptBlock;
}
}