From 8b610cb9f6e968e0f760023b63e5e296eee29365 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Mon, 27 Aug 2018 10:59:17 -0400 Subject: [PATCH 01/62] Update to work with FPP 2.0 --- bigbuttons.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index 295ff7a..b940dcf 100644 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -1,4 +1,4 @@ - + - +
Date: Mon, 27 Aug 2018 11:03:22 -0400 Subject: [PATCH 02/62] Back to 100% --- bigbuttons.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigbuttons.php b/bigbuttons.php index b940dcf..511ee96 100644 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -31,7 +31,7 @@ function buttonClicked(cell, x) else echo $settings['HostName'] . " - Big Buttons Plugin"; ?> -
+
Date: Mon, 27 Aug 2018 11:07:58 -0400 Subject: [PATCH 03/62] No left margin --- bigbuttons.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigbuttons.php b/bigbuttons.php index 511ee96..c7b99c4 100644 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -31,7 +31,7 @@ function buttonClicked(cell, x) else echo $settings['HostName'] . " - Big Buttons Plugin"; ?> -
+
Date: Thu, 17 Jan 2019 22:45:51 -0800 Subject: [PATCH 04/62] Allow customization via URL parameters. This commit adds parsing for several command line parameters which control which buttons are displayed on the page as well as overriding the title of the page. New options: start - start button number end - end button number title - title for page Example URLs which you can use to access this page and display specific buttons: http://192.168.1.10/plugin.php?plugin=fpp-BigButtons&page=bigbuttons.php&nopage=1&start=11&end=18&title=Buttons_11-18 --- bigbuttons.php | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index c7b99c4..d397206 100644 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -1,3 +1,4 @@ + -
px'> +html, body { + height: 100%; + min-height: 100%; +} + +.tableWrapper { + height: 100%; + width: 100%; + display: inline-block; +} + + + + +
px'> + 1) && (($x % 2) == 1)) + if (($i > 1) && (($i % $width) == 1)) echo "
\n"; - printf( "\n", + printf( "\n", $pluginSettings[sprintf("button%02dcolor", $x)], $x, $pluginSettings["buttonFontSize"], $pluginSettings[sprintf("button%02ddesc", $x)]); @@ -56,3 +90,5 @@ function buttonClicked(cell, x) ?>
%s%s
+ + From 18a9c920d6604bbead838d6b22630a1fb62eaea8 Mon Sep 17 00:00:00 2001 From: Chris Pinkham Date: Thu, 17 Jan 2019 22:55:49 -0800 Subject: [PATCH 05/62] Initial version of pluginInfo.json for new plugin install page. --- pluginInfo.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pluginInfo.json diff --git a/pluginInfo.json b/pluginInfo.json new file mode 100644 index 0000000..f487743 --- /dev/null +++ b/pluginInfo.json @@ -0,0 +1,18 @@ +{ + "repoName": "fpp-BigButtons", + "name": "Big Buttons", + "author": "Chris Pinkham (CaptainMurdoch)", + "name": "This plugin displays multiple big buttons in a grid on a page. Each button can be individually configured to run a different user script. The title and color of each button can also be configured.", + "homeURL": "https://github.com/FalconChristmas/fpp-BigButtons", + "srcURL": "https://github.com/FalconChristmas/fpp-BigButtons.git", + "bugURL": "https://github.com/FalconChristmas/fpp-BigButtons/issues", + "versions": [ + { + "minFPPVersion": 0, + "maxFPPVersion": 0, + "branch": "master", + "sha": "" + } + ] +} + From c1b51c6d308fa293e6fe29207674166d525aced8 Mon Sep 17 00:00:00 2001 From: Chris Pinkham Date: Thu, 17 Jan 2019 22:57:20 -0800 Subject: [PATCH 06/62] Fix description field name. --- pluginInfo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pluginInfo.json b/pluginInfo.json index f487743..9eeb574 100644 --- a/pluginInfo.json +++ b/pluginInfo.json @@ -2,7 +2,7 @@ "repoName": "fpp-BigButtons", "name": "Big Buttons", "author": "Chris Pinkham (CaptainMurdoch)", - "name": "This plugin displays multiple big buttons in a grid on a page. Each button can be individually configured to run a different user script. The title and color of each button can also be configured.", + "description": "This plugin displays multiple big buttons in a grid on a page. Each button can be individually configured to run a different user script. The title and color of each button can also be configured.", "homeURL": "https://github.com/FalconChristmas/fpp-BigButtons", "srcURL": "https://github.com/FalconChristmas/fpp-BigButtons.git", "bugURL": "https://github.com/FalconChristmas/fpp-BigButtons/issues", From 0c90df83b969015d5f611741de12e0e2bb073682 Mon Sep 17 00:00:00 2001 From: Chris Pinkham Date: Sun, 20 Jan 2019 15:58:53 -0800 Subject: [PATCH 07/62] Put version number in quotes. --- pluginInfo.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pluginInfo.json b/pluginInfo.json index 9eeb574..c7bfb96 100644 --- a/pluginInfo.json +++ b/pluginInfo.json @@ -8,8 +8,8 @@ "bugURL": "https://github.com/FalconChristmas/fpp-BigButtons/issues", "versions": [ { - "minFPPVersion": 0, - "maxFPPVersion": 0, + "minFPPVersion": "0", + "maxFPPVersion": "0", "branch": "master", "sha": "" } From 9ce9583300e373c7f04bd291e7de8316cf269833 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Tue, 6 Aug 2019 23:19:47 +0000 Subject: [PATCH 08/62] Fix bigbuttons plugin on 3.0 --- bigbuttons.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bigbuttons.php b/bigbuttons.php index d397206..d115cfe 100644 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -1,9 +1,12 @@ - \n", basename($jquery[0])); + + $pluginSettings = array(); $pluginConfigFile = $settings['configDirectory'] . "/plugin." . $_GET['plugin']; From 01d5ff0eb3e437adb323f3831cece600bb73ad05 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Fri, 8 Nov 2019 13:44:45 -0500 Subject: [PATCH 09/62] Updates for new features on master --- bb-common.php | 54 +++++++++++++ bigbuttons.php | 139 ++++++++++++++++++++++++++------- config.php | 204 ++++++++++++++++++++++++++++-------------------- pluginInfo.json | 10 ++- 4 files changed, 293 insertions(+), 114 deletions(-) create mode 100755 bb-common.php mode change 100644 => 100755 bigbuttons.php mode change 100644 => 100755 config.php mode change 100644 => 100755 pluginInfo.json diff --git a/bb-common.php b/bb-common.php new file mode 100755 index 0000000..a8e90f5 --- /dev/null +++ b/bb-common.php @@ -0,0 +1,54 @@ + diff --git a/bigbuttons.php b/bigbuttons.php old mode 100644 new mode 100755 index d115cfe..b31780e --- a/bigbuttons.php +++ b/bigbuttons.php @@ -2,30 +2,28 @@ \n", basename($jquery[0])); - -$pluginSettings = array(); - -$pluginConfigFile = $settings['configDirectory'] . "/plugin." . $_GET['plugin']; -if (file_exists($pluginConfigFile)) - $pluginSettings = parse_ini_file($pluginConfigFile); +$pluginJson = convertAndGetSettings(); ?> @@ -41,15 +39,44 @@ function buttonClicked(cell, x) display: inline-block; } +.adjustableSlider { + -webkit-appearance: none; + width: 90%; + height: 15px; + border-radius: 5px; + outline: none; + opacity: 0.7; + background: #3F3F3F; + -webkit-transition: .2s; + transition: opacity .2s; +} + +.adjustableSlider::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 25px; + height: 25px; + border-radius: 50%; + background: black; + cursor: pointer; +} + +.adjustableSlider::-moz-range-thumb { + width: 25px; + height: 25px; + border-radius: 50%; + cursor: pointer; +} + -
px'> +
@@ -58,11 +85,21 @@ function buttonClicked(cell, x) 1) && (($i % $width) == 1)) - echo "\n"; - - printf( "%s\n", - $pluginSettings[sprintf("button%02dcolor", $x)], $x, - $pluginSettings["buttonFontSize"], - $pluginSettings[sprintf("button%02ddesc", $x)]); +for ($x = $start; $x <= $end; $x++) { + if (array_key_exists($x, $pluginJson["buttons"])) { + if (($i > 1) && (($i % $width) == 1)) + echo "\n"; + $i++; + + $color = returnIfExists($pluginJson["buttons"][$x], "color"); + if ($color == "") { + $color = "aqua"; + } + printf( "%s", + $color, + $x, + $buttonFontSize, + returnIfExists($pluginJson["buttons"][$x], "description")); + + if (returnIfExists($pluginJson["buttons"][$x], "adjustable") != "") { + $adj = array_keys($pluginJson["buttons"][$x]["adjustable"])[0]; + + printf("\n\n"); + printf("
\n", $x, $x); + printf("\n"); + + } + + printf("\n"); + } } if (($x % 2) == 0) diff --git a/config.php b/config.php old mode 100644 new mode 100755 index 462f535..5cca9d8 --- a/config.php +++ b/config.php @@ -1,52 +1,85 @@ + + + +
Big Buttons Config - +" . $i . ""; + } } - -function colorSelect($id) -{ - global $colors; - - echo "\n"; +function PrintColors($cur) { + global $colorList; + foreach ($colorList as $color) { + echo "\n"; + } } ?> + - - + + +
Button Page Title:
Text Font Size:
Button Page Title:
Text Font Size:
-
"; + } + + $description = ""; + $color = "aqua"; + $command = ""; + $buttonJson = array(); + $buttonJson["command"] = ""; + if (array_key_exists("buttons", $pluginJson) + && array_key_exists($x, $pluginJson["buttons"])) { + $buttonJson = $pluginJson["buttons"][$x]; + $description = returnIfExists($pluginJson["buttons"][$x], "description"); + $color = returnIfExists($pluginJson["buttons"][$x], "color");; + $command = returnIfExists($pluginJson["buttons"][$x], "command");; + } -for ($x = 1; $x <= 20; $x++) -{ - $id = sprintf( '%02d', $x); ?> - - \n"; $i++; @@ -127,8 +150,9 @@ function buttonClicked(cell, x) if ($color == "") { $color = "aqua"; } - printf( "\n"; - ?>
Button # - - - - - + + + "; + } } ?>
Description:
Script:
Button # + + - + + +
Description:
Color:
Command:
-
- + + + diff --git a/pluginInfo.json b/pluginInfo.json old mode 100644 new mode 100755 index c7bfb96..3d45a18 --- a/pluginInfo.json +++ b/pluginInfo.json @@ -9,10 +9,16 @@ "versions": [ { "minFPPVersion": "0", - "maxFPPVersion": "0", + "maxFPPVersion": "3.4.99", + "branch": "master", + "sha": "9ce9583300e373c7f04bd291e7de8316cf269833" + }, + { + "minFPPVersion": "3.5", + "maxFPPVersion": "", "branch": "master", "sha": "" - } + }, ] } From 8f5ba73579df74679bff4a3d2ad299d2963d1613 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Fri, 8 Nov 2019 14:58:07 -0500 Subject: [PATCH 10/62] Add variable text entry --- bigbuttons.php | 91 +++++++++++++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 34 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index b31780e..e504c18 100755 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -21,7 +21,7 @@ function buttonClicked(cell, x) url += pluginJson["buttons"][x]["command"]; $.each( pluginJson["buttons"][x]["args"], function(key, v) { url += "/"; - url += v; + url += encodeURIComponent(v); }); $.get(url); $(cell).animate({'opacity':'1.0'}, 100); @@ -39,6 +39,10 @@ function buttonClicked(cell, x) display: inline-block; } +.adjustableText { + width: 90%; +} + .adjustableSlider { -webkit-appearance: none; width: 90%; @@ -71,7 +75,7 @@ function buttonClicked(cell, x) -
+
%s", + printf( "
%s", $color, $x, $buttonFontSize, @@ -131,40 +135,59 @@ function buttonClicked(cell, x) if (returnIfExists($pluginJson["buttons"][$x], "adjustable") != "") { $adj = array_keys($pluginJson["buttons"][$x]["adjustable"])[0]; + $type = $pluginJson["buttons"][$x]["adjustable"][$adj]; + if ($type == "number") { - printf("\n\n"); - printf("
\n", $x, $x); - printf("\n"); + printf("\n\n"); + printf("
\n", $x, $x); + printf("\n"); + + } else if ($type == "text") { + printf("
\n", $x, $x); + ?> + + \n"); } From 2899106aa154b27a40027116268c6071b866b677 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Fri, 8 Nov 2019 20:21:42 -0500 Subject: [PATCH 11/62] Fix font size --- config.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/config.php b/config.php index 5cca9d8..383130b 100755 --- a/config.php +++ b/config.php @@ -92,9 +92,15 @@ function SaveButtons() { array_push($colorList, "whitesmoke"); array_push($colorList, "yellow"); -function PrintFontSizes() { +function PrintFontSizes($cur2) { + $cur = (int)$cur2; + for ($i = 10; $i <= 64; $i += 2) { - echo ""; + echo ""; } } function PrintColors($cur) { @@ -112,7 +118,7 @@ function PrintColors($cur) { - +
Button Page Title:
Text Font Size:
Text Font Size:
@@ -176,7 +177,7 @@ function PrintColors($cur) { From 02872aa98f29a1f86abe305ba5e25a11ae6cf20e Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Mon, 11 Nov 2019 16:55:36 -0500 Subject: [PATCH 16/62] Update to use POST with FPP 3.5.1, some layout enhancements --- bigbuttons.php | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index e504c18..93d169b 100755 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -3,6 +3,7 @@ require_once("config.php"); require_once("common.php"); require_once("bb-common.php"); +require_once("fppversion.php"); $jquery = glob("/opt/fpp/www/js/jquery-*.min.js"); printf("\n", basename($jquery[0])); @@ -19,11 +20,31 @@ function buttonClicked(cell, x) var url = "api/command/"; url += pluginJson["buttons"][x]["command"]; - $.each( pluginJson["buttons"][x]["args"], function(key, v) { + + + var data = new Array(); + $.each( pluginJson["buttons"][x]["args"], function(key, v) { + data.push(v); + }); + $.ajax({ + type: "POST", + url: url, + dataType: 'json', + async: false, + data: JSON.stringify(data), + processData: false, + contentType: 'application/json', + success: function (data) { + } + }); + + $.each( pluginJson["buttons"][x]["args"], function(key, v) { url += "/"; url += encodeURIComponent(v); - }); - $.get(url); + }); + $.get(url); + + $(cell).animate({'opacity':'1.0'}, 100); } @@ -117,9 +138,11 @@ function buttonClicked(cell, x) if (isset($_GET['width'])) $width = $_GET['width']; +$wdPct = 100 / (int)$width; + for ($x = $start; $x <= $end; $x++) { if (array_key_exists($x, $pluginJson["buttons"])) { - if (($i > 1) && (($i % $width) == 1)) + if (($i > 1) && ((($i % $width) == 1) || ($width == 1))) echo "
%s", + printf( "%s", $color, + $wdPct, $x, $buttonFontSize, returnIfExists($pluginJson["buttons"][$x], "description")); @@ -193,9 +217,6 @@ function OnTextChanged(text) { } } -if (($x % 2) == 0) - echo " 
From 125d54a38cdcf87e4006f7caf560e978453b5fe8 Mon Sep 17 00:00:00 2001 From: Chris Pinkham Date: Sat, 22 Feb 2020 20:25:57 -0800 Subject: [PATCH 17/62] Make descriptions a little skinner to fit on screen. --- config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.php b/config.php index 91f3a98..ae9b719 100755 --- a/config.php +++ b/config.php @@ -118,7 +118,7 @@ function PrintColors($cur) { ?> - +
Button Page Title:
Button Page Title:
Text Font Size:
@@ -154,7 +154,7 @@ function PrintColors($cur) { Button # - + From d7eb362297f35928d6e8ac34b58449d2ce4929dc Mon Sep 17 00:00:00 2001 From: Chris Pinkham Date: Thu, 12 Mar 2020 09:25:38 -0700 Subject: [PATCH 18/62] Fix a config save issue. When the font size was changed, an invalid config would be written. If the user did not press the Save button to overwrite this invalid config, then subsequent loads of the config page were unable to overwrite due to loading the invalid config. This patch fixes the issue with the font size so that it is not saved until the save button is clicked and it also provides a workaround for users who already have the invalid config file containing only the word 'null'. --- bigbuttons.php | 2 +- config.php | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index 93d169b..4b192f9 100755 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -110,7 +110,7 @@ function buttonClicked(cell, x) ; +var bigButtonsConfig = ; + function SaveBigButtonConfig(config) { var data = JSON.stringify(config); $.ajax({ @@ -38,7 +44,6 @@ function SaveBigButtonConfig(config) { function buttonFontSizeChanged() { bigButtonsConfig['fontSize'] = parseInt($('#buttonFontSize').val()); - SaveBigButtonConfig(); } function GetButton(i) { @@ -142,7 +147,7 @@ function PrintColors($cur) { $command = ""; $buttonJson = array(); $buttonJson["command"] = ""; - if (array_key_exists("buttons", $pluginJson) + if (is_array($pluginJson) && array_key_exists("buttons", $pluginJson) && array_key_exists($x, $pluginJson["buttons"])) { $buttonJson = $pluginJson["buttons"][$x]; $description = returnIfExists($pluginJson["buttons"][$x], "description"); @@ -154,7 +159,7 @@ function PrintColors($cur) {
Description:
Description:
Color:
Command:Button # - + From 852d81841bec0a4fcf5518489fc25118d67378ea Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Tue, 4 Aug 2020 10:25:03 -0400 Subject: [PATCH 19/62] Fix deleting of buttons --- config.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.php b/config.php index 6598ad4..108fb4f 100755 --- a/config.php +++ b/config.php @@ -61,6 +61,8 @@ function SaveButtons() { if (button.description != "" && button.command != "") { bigButtonsConfig["buttons"][key] = button; + } else if (bigButtonsConfig["buttons"][key] != null) { + delete bigButtonsConfig["buttons"][key]; } } SaveBigButtonConfig(bigButtonsConfig); From 168a8e845930804d1acd860518ef469438652e46 Mon Sep 17 00:00:00 2001 From: Adam Coulombe Date: Mon, 25 Jan 2021 10:42:22 -0500 Subject: [PATCH 20/62] Refactor to allow sorting Refactor to allow re-sorting --- bigbuttons.php | 327 +++++++++++++++---------------- config.php | 508 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 526 insertions(+), 309 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index 4b192f9..a98975e 100755 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -1,4 +1,5 @@ + \n", basename($jquery[0])); - -$pluginJson = convertAndGetSettings(); - ?> + - - - -
- -
Description:
Description:
Color:
Command:
- - 1) && ((($i % $width) == 1) || ($width == 1))) - echo "\n"; - $i++; + + + + + + + +

+
+
- } - - printf("\n"); + -?> - -
diff --git a/config.php b/config.php index 108fb4f..370737c 100755 --- a/config.php +++ b/config.php @@ -1,4 +1,5 @@ + -
-Big Buttons Config + + -" . $i . ""; - } +return $newButtonRow; } -function PrintColors($cur) { - global $colorList; - foreach ($colorList as $color) { - echo "\n"; +function createButtonRow(i,v){ + + var $newButtonRow = $($(".configRowTemplate").html()); + var newButtonRowColor = 'button_'+i+'_color'; + var newButtonRowCommand = 'button_'+i+'_Command'; + var newButtonRowTitle = 'button_'+i+'_Title'; + var newButtonRowTable = 'tableButton'+i; + $newButtonRow.data('bbKey',i); + $newButtonRow.find('.buttonCommand').attr('id',newButtonRowCommand).on('change',function(){ + CommandSelectChanged(newButtonRowCommand, "tableButton"+$(this).closest('.bb_configRow').data('bbKey'), true); + }) + $newButtonRow.find('.buttonTitle').attr('id',newButtonRowTitle); + $newButtonRow.find('.buttonColor').attr('id',newButtonRowColor); + $newButtonRow.find('.tableButton').attr('id',newButtonRowTable); + $newButtonRow.find('.buttonDelete').click(function(){ + $(this).closest('.bb_configRow').remove(); + $.each($('#buttonList li'), function(i, v) { + updateButtonRow(i,v); + }); + }); + $('#buttonList').append($newButtonRow); + LoadCommandList('button_'+i+'_Command'); + var hex = "ff8800"; + if(v){ + hex=v.color; } + $newButtonRow.find('.buttonColor').colpick({ + colorScheme:'flat', + layout:'rgbhex', + color:hex, + onSubmit:function(hsb,newHex,rgb,el) { + $(el).css({'background-color': '#'+newHex,'color': '#'+newHex}).colpickHide().val('#'+newHex); + } + }) + .css({'background-color': '#'+hex,'color': '#'+hex}).val('#'+hex); + + return $newButtonRow; } +$( function() { -?> + $('#saveBigButtonConfigButton').click(function(){ + SaveButtons(); + }); + + $('#buttonTitle').on('change keydown paste input', function() { + bigButtonsConfig['title'] = $(this).val(); + }); + $.ajax({ + type: "GET", + url: 'fppjson.php?command=getPluginJSON&plugin=fpp-BigButtons', + dataType: 'json', + contentType: 'application/json', + success: function (data) { + bigButtonsConfig = $.parseJSON(data); + + if(!bigButtonsConfig){ + bigButtonsConfig={ "title": "", "fontSize": 12, "buttons": { "1": {}}} + } - - - - -
Button Page Title:
Text Font Size:
- + $.each(bigButtonsConfig.buttons,function(i,v){ + $newButtonRow=createButtonRow(i,v); + + $newButtonRow.find('.buttonTitle').val(v.description); + $newButtonRow.find('.buttonColor').val(v.color); + PopulateExistingCommand(v, 'button_'+i+'_Command', 'tableButton'+i, true); + }) + $('#buttonFontSize').val(bigButtonsConfig.fontSize).on('input change',function(){ + $('.bb_fontSizeDisplay').html($(this).val()); + bigButtonsConfig['fontSize']=$(this).val(); + }); + $('.bb_fontSizeDisplay').html(bigButtonsConfig.fontSize); - -"; - } - - $description = ""; - $color = "aqua"; - $command = ""; - $buttonJson = array(); - $buttonJson["command"] = ""; - if (is_array($pluginJson) && array_key_exists("buttons", $pluginJson) - && array_key_exists($x, $pluginJson["buttons"])) { - $buttonJson = $pluginJson["buttons"][$x]; - $description = returnIfExists($pluginJson["buttons"][$x], "description"); - $color = returnIfExists($pluginJson["buttons"][$x], "color");; - $command = returnIfExists($pluginJson["buttons"][$x], "command");; - } -?> - - - -"; - } + // newBigButtonsConfig.buttons[""+i]= bigButtonsConfig.buttons[$(v).data('bbKey')]; + // }); + // console.log(bigButtonsConfig) + // UpdateBigButtonConfig(newBigButtonsConfig); + + + + // $.each($('#buttonList li'), function(i, v) { + updateButtonRow(i,v); + }) + } + + }); + $( "#buttonList" ).disableSelection(); + + $("#fppBBAddNewButton").click(function(){ + var i=$( "#buttonList" ).children().length; + var $newButtonRow = $newButtonRow=createButtonRow(i); + $newButtonRow.addClass('bb_newButton') + + }); +} ); + + + + + +
+
+
+
+ +
+
+
+
+
Text Font Size
+
+ +
+
+
+
+ + + +
+ +
+ + + +
    +
+ + + + + From 5026de67e9c571338307ffa57bb88444b973fe7b Mon Sep 17 00:00:00 2001 From: Adam Coulombe Date: Wed, 27 Jan 2021 13:25:48 -0500 Subject: [PATCH 21/62] Update button styling on config page --- bigbuttons.php | 14 ++- config.php | 248 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 235 insertions(+), 27 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index a98975e..809655c 100755 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -14,7 +14,6 @@ var pluginJson; var fppVersionTriplet; - function sendButtonCommand(x) { var url = "api/command/"; @@ -66,7 +65,8 @@ function sendButtonCommand(x) $newButton.find('.bb_buttonDescription').html(button.description); $newButton.css({ backgroundColor:button.color, - fontSize:pluginJson.fontSize + fontSize:pluginJson.fontSize, + color:'#fff' }) if(button["adjustable"] !== undefined ){ @@ -130,8 +130,14 @@ function sendButtonCommand(x) }) - - +var getForegroundColor = function(hexcolor) { + hexcolor = hexcolor.replace("#", ""); + var r = parseInt(hexcolor.substr(0,2),16); + var g = parseInt(hexcolor.substr(2,2),16); + var b = parseInt(hexcolor.substr(4,2),16); + var yiq = ((r*299)+(g*587)+(b*114))/1000; + return (yiq >= 128) ? '000' : 'fff'; +} + + +
+ +
Button # + } + }); + + $( "#buttonList" ).sortable({ + update:function(){ + var newBigButtonsConfig = Object.assign({}, bigButtonsConfig); + newBigButtonsConfig.buttons=[]; + $.each($('#buttonList li'), function(i, v) { + $(this).removeClass('bb_newButton'); - - - - - -
Description:
Color:
Command:
-
+ + 1) && ((($i % $width) == 1) || ($width == 1))) + echo "\n"; + $i++; + + $color = returnIfExists($pluginJson["buttons"][$x], "color"); + if ($color == "") { + $color = "aqua"; + } + printf( " +
%s", + $color, + $wdPct, + $x, + $buttonFontSize, + returnIfExists($pluginJson["buttons"][$x], "description")); + + if (returnIfExists($pluginJson["buttons"][$x], "adjustable") != "") { + $adj = array_keys($pluginJson["buttons"][$x]["adjustable"])[0]; + $type = $pluginJson["buttons"][$x]["adjustable"][$adj]; + if ($type == "number") { + + printf("\n\n"); + printf("
\n", $x, $x); + printf("\n"); + + } else if ($type == "text") { + printf("
\n", $x, $x); + ?> + + \n"); + } +} + +?> +
+ + diff --git a/config.php b/config.php index 0e86c50..80bbbe2 100755 --- a/config.php +++ b/config.php @@ -409,10 +409,14 @@ function(){ #buttonTitle:hover { border-bottom: 1px solid #2E4260; } -#buttonTitle:focus { +#buttonTitle:focus, .buttonTitle:focus { outline-style: none; - border-bottom: 1px solid #2E4260; - box-shadow: 0px 1px 0px 0px #2E4260; + border-bottom: 1px solid #fff; + box-shadow: 0px 1px 0px 0px #fff; +} +#buttonList li:hover .buttonTitle:focus { + border-bottom: 1px solid #2E4260; + box-shadow: 0px 1px 0px 0px #2E4260; } .buttonTitle::-webkit-input-placeholder { /* Edge */ color: rgba(0,0,0,0.4); diff --git a/config_old.php b/config_old.php new file mode 100644 index 0000000..7396f88 --- /dev/null +++ b/config_old.php @@ -0,0 +1,205 @@ + + + + +
+
+Big Buttons Config + + +" . $i . ""; + } +} +function PrintColors($cur) { + global $colorList; + foreach ($colorList as $color) { + echo "\n"; + } +} + +?> + + + + + +
Button Page Title:
Text Font Size:
+ + +
    +
  • Item 1
  • +
  • Item 2
  • +
  • Item 3
  • +
  • Item 4
  • +
  • Item 5
  • +
  • Item 6
  • +
  • Item 7
  • +
+ + + + +"; + } + + $description = ""; + $color = "aqua"; + $command = ""; + $buttonJson = array(); + $buttonJson["command"] = ""; + if (is_array($pluginJson) && array_key_exists("buttons", $pluginJson) + && array_key_exists($x, $pluginJson["buttons"])) { + $buttonJson = $pluginJson["buttons"][$x]; + $description = returnIfExists($pluginJson["buttons"][$x], "description"); + $color = returnIfExists($pluginJson["buttons"][$x], "color");; + $command = returnIfExists($pluginJson["buttons"][$x], "command");; + } + +?> + + + +"; + } +} +?> +
Button # + + + + + + +
Description:
Color:
Command:
+
+ + + From da066bc7cdcd27dcb2316fee82e20b6a249c419b Mon Sep 17 00:00:00 2001 From: Adam Coulombe Date: Thu, 25 Feb 2021 15:06:06 -0500 Subject: [PATCH 23/62] Update config.php --- config.php | 416 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 234 insertions(+), 182 deletions(-) diff --git a/config.php b/config.php index 80bbbe2..304edc7 100755 --- a/config.php +++ b/config.php @@ -1,23 +1,13 @@ - - -
- - + -
-
-
-
-
-
Text Font Size
@@ -297,40 +284,48 @@ function(){
- + +
+
    - -
    +
    + +
    + diff --git a/bigbuttons__.php b/bigbuttons__.php deleted file mode 100644 index 52cdcab..0000000 --- a/bigbuttons__.php +++ /dev/null @@ -1,226 +0,0 @@ - -\n", basename($jquery[0])); - -$pluginJson = convertAndGetSettings(); - -?> - - - - -
    - - - - 1) && ((($i % $width) == 1) || ($width == 1))) - echo "\n"; - $i++; - - $color = returnIfExists($pluginJson["buttons"][$x], "color"); - if ($color == "") { - $color = "aqua"; - } - printf( " -
    %s", - $color, - $wdPct, - $x, - $buttonFontSize, - returnIfExists($pluginJson["buttons"][$x], "description")); - - if (returnIfExists($pluginJson["buttons"][$x], "adjustable") != "") { - $adj = array_keys($pluginJson["buttons"][$x]["adjustable"])[0]; - $type = $pluginJson["buttons"][$x]["adjustable"][$adj]; - if ($type == "number") { - - printf("\n\n"); - printf("
    \n", $x, $x); - printf("\n"); - - } else if ($type == "text") { - printf("
    \n", $x, $x); - ?> - - \n"); - } -} - -?> -
    - - diff --git a/config.php b/config.php index 304edc7..dc8dfad 100755 --- a/config.php +++ b/config.php @@ -7,6 +7,34 @@ -" . $i . ""; - } -} -function PrintColors($cur) { - global $colorList; - foreach ($colorList as $color) { - echo "\n"; - } -} - -?> - - - - - -
    Button Page Title:
    Text Font Size:
    - - -
      -
    • Item 1
    • -
    • Item 2
    • -
    • Item 3
    • -
    • Item 4
    • -
    • Item 5
    • -
    • Item 6
    • -
    • Item 7
    • -
    - - - - -"; - } - - $description = ""; - $color = "aqua"; - $command = ""; - $buttonJson = array(); - $buttonJson["command"] = ""; - if (is_array($pluginJson) && array_key_exists("buttons", $pluginJson) - && array_key_exists($x, $pluginJson["buttons"])) { - $buttonJson = $pluginJson["buttons"][$x]; - $description = returnIfExists($pluginJson["buttons"][$x], "description"); - $color = returnIfExists($pluginJson["buttons"][$x], "color");; - $command = returnIfExists($pluginJson["buttons"][$x], "command");; - } - -?> - - - -"; - } -} -?> -
    Button # - - - - - - -
    Description:
    Color:
    Command:
    -
    - - - diff --git a/pluginInfo.json b/pluginInfo.json index 1dadb67..93ca2d9 100755 --- a/pluginInfo.json +++ b/pluginInfo.json @@ -15,9 +15,15 @@ }, { "minFPPVersion": "3.5.0", - "maxFPPVersion": "0", + "maxFPPVersion": "4.9", "branch": "master", "sha": "" + }, + { + "minFPPVersion": "5.0", + "maxFPPVersion": "0", + "branch": "newui", + "sha": "" } ] } From 49b43cb72a0b1eb2a4795013277b669bcfab78de Mon Sep 17 00:00:00 2001 From: Adam Coulombe Date: Mon, 1 Mar 2021 21:57:57 -0500 Subject: [PATCH 25/62] update plugininfo.json to point 5.x users to newui branch --- pluginInfo.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pluginInfo.json b/pluginInfo.json index 1dadb67..acd91c4 100755 --- a/pluginInfo.json +++ b/pluginInfo.json @@ -15,9 +15,15 @@ }, { "minFPPVersion": "3.5.0", - "maxFPPVersion": "0", + "maxFPPVersion": "4.99", "branch": "master", "sha": "" + }, + { + "minFPPVersion": "5.0", + "maxFPPVersion": "0", + "branch": "newui", + "sha": "" } ] } From 0b3057eb53475842a126d80d05898132a82c5f17 Mon Sep 17 00:00:00 2001 From: Adam Coulombe Date: Mon, 1 Mar 2021 22:37:40 -0500 Subject: [PATCH 26/62] fix logic so buttons work --- bigbuttons.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index 4fc3632..a323719 100755 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -14,14 +14,14 @@ var pluginJson; var fppVersionTriplet; -function sendButtonCommand(x) +function sendButtonCommand(tab_i,j) { var url = "api/command/"; - url += pluginJson["buttons"][x]["command"]; + url += pluginJson[tab_i]["buttons"][j]["command"]; if (fppVersionTriplet != "3.5.0") { var data = new Array(); - $.each( pluginJson["buttons"][x]["args"], function(i, v) { + $.each( pluginJson[tab_i]["buttons"][j]["args"], function(i, v) { data.push(v); }); $.ajax({ @@ -36,7 +36,7 @@ function sendButtonCommand(x) } }); } else { - $.each( pluginJson["buttons"][x]["args"], function(i, v) { + $.each( pluginJson[tab_i]["buttons"][j]["args"], function(i, v) { url += "/"; url += encodeURIComponent(v); }); @@ -103,11 +103,12 @@ function SetCurrentTab(i){ fontSize:tab.fontSize, color:'#fff' }) + if(button["adjustable"] !== undefined ){ var adjustmentKey = Object.keys(button["adjustable"])[0]-1; var adjustmentType = button["adjustable"][adjustmentKey+1]; - + console.log(adjustmentKey) if(adjustmentType==='number'){ var $adjustableNumber = $($('#adjustableNumberTemplate').html()); $newButton.append( @@ -117,7 +118,7 @@ function SetCurrentTab(i){ var command = button.command; $slider.on('change',function(){ tab['buttons'][j]['args'][adjustmentKey] = $(this).val(); - sendButtonCommand(j); + sendButtonCommand(i,j); }) $.ajax({ @@ -141,7 +142,8 @@ function SetCurrentTab(i){ } }); } - else if(adjustmentType==='text'){ + else if(adjustmentType=='text'){ + var $adjustableText = $($('#adjustableTextTemplate').html()); $newButton.append( $adjustableText @@ -149,14 +151,16 @@ function SetCurrentTab(i){ tab['buttons'][j]['args'][adjustmentKey] = text.value; var $input = $adjustableText.find('input[type=text]'); $input.on('input change',function(){ - sendButtonCommand(j); + sendButtonCommand(i,j); }) - }else{ - $newButton.on('click',function(){ - sendButtonCommand(j); - }) } + }else{ + + $newButton.on('click',function(){ + console.log('clicking') + sendButtonCommand(i,j); + }) } $tabPanel.append($newButton); }) From da31f17b8273eb05b31ffdcdf7d4130c92401a79 Mon Sep 17 00:00:00 2001 From: Adam Coulombe Date: Mon, 1 Mar 2021 23:17:08 -0500 Subject: [PATCH 27/62] add some font scaling --- bigbuttons.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index a323719..99d6d3e 100755 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -44,6 +44,27 @@ function sendButtonCommand(tab_i,j) } } +function lerp(x, y, a) { + return x * (1 - a) + y * a; +} +var startScaling=360; +var endScaling=900; +function getScale(number){ + var at = number-startScaling; + return at / (endScaling-startScaling); +} +function getFontScale(){ + return lerp(0.6, 1, + getScale( + Math.max( + Math.min( + window.innerWidth + ,endScaling) + ,startScaling) + ) + ); +} + function slugify(text) { return text.toString().toLowerCase() @@ -100,7 +121,7 @@ function SetCurrentTab(i){ $newButton.find('.bb_buttonDescription').html(button.description); $newButton.css({ backgroundColor:button.color, - fontSize:tab.fontSize, + fontSize: tab.fontSize * getFontScale(), color:'#fff' }) @@ -233,6 +254,9 @@ function SetCurrentTab(i){ display: flex; margin:1%; } + .bb_buttonDescription{ + text-align:center; + } .bb_button{ flex:1; flex-direction:column; @@ -254,7 +278,7 @@ function SetCurrentTab(i){ } .bb-nav-item{ appearance:none; - padding:1em; + padding:1em 0.5em; background-color:transparent; border:none; font-weight:bold; From 4efd972a5e484055955129593b0ab705331b5096 Mon Sep 17 00:00:00 2001 From: Adam Coulombe Date: Tue, 2 Mar 2021 00:28:15 -0500 Subject: [PATCH 28/62] use fpp-icon-grip for button grip --- config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.php b/config.php index dc8dfad..f5a6702 100755 --- a/config.php +++ b/config.php @@ -309,7 +309,7 @@ function createTab(title,tab_i){
  • - +
    From e3551d4b4481e02ae5bdd2171305b7ab724cddb0 Mon Sep 17 00:00:00 2001 From: Adam Coulombe Date: Tue, 2 Mar 2021 21:48:58 -0500 Subject: [PATCH 29/62] add kiosk mode query var support --- bigbuttons.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/bigbuttons.php b/bigbuttons.php index 99d6d3e..230e00b 100755 --- a/bigbuttons.php +++ b/bigbuttons.php @@ -118,7 +118,7 @@ function SetCurrentTab(i){ $.each(tab.buttons,function(j,button){ var $newButton= $($('#buttonTemplate').html()); - $newButton.find('.bb_buttonDescription').html(button.description); + $newButton.find('.bb-buttonDescription').html(button.description); $newButton.css({ backgroundColor:button.color, fontSize: tab.fontSize * getFontScale(), @@ -193,6 +193,9 @@ function SetCurrentTab(i){ if($('.bb-active').length<1){ SetCurrentTab(0); } + if(getParameterByName('kiosk')!="true"){ + $('body').removeClass('is-kiosk') + } } }); @@ -212,20 +215,20 @@ function SetCurrentTab(i){ - +