From 67ccb8bfcd083fc9cc860d9ea1979c47a666460a Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Thu, 21 Feb 2019 18:07:31 +0100 Subject: [PATCH 01/12] Added the share_string field --- view/theme/frio/config.php | 3 +++ view/theme/frio/templates/theme_settings.tpl | 1 + 2 files changed, 4 insertions(+) diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index f73ef3ab0a..a8d4198b84 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -57,6 +57,7 @@ function theme_content(App $a) $arr = []; $arr['scheme'] = PConfig::get(local_user(), 'frio', 'scheme', PConfig::get(local_user(), 'frio', 'schema')); + $arr['share_string'] = ''; $arr['nav_bg'] = PConfig::get(local_user(), 'frio', 'nav_bg'); $arr['nav_icon_color'] = PConfig::get(local_user(), 'frio', 'nav_icon_color'); $arr['link_color'] = PConfig::get(local_user(), 'frio', 'link_color'); @@ -76,6 +77,7 @@ function theme_admin(App $a) $arr = []; $arr['scheme'] = Config::get('frio', 'scheme', Config::get('frio', 'scheme')); + $arr['share_string'] = ''; $arr['nav_bg'] = Config::get('frio', 'nav_bg'); $arr['nav_icon_color'] = Config::get('frio', 'nav_icon_color'); $arr['link_color'] = Config::get('frio', 'link_color'); @@ -120,6 +122,7 @@ function frio_form($arr) '$baseurl' => System::baseUrl(), '$title' => L10n::t('Theme settings'), '$scheme' => ['frio_scheme', L10n::t('Select color scheme'), $arr['scheme'], '', $scheme_choices], + '$share_string' => ['frio_share_string', L10n::t('Copy or paste schemestring'), $arr['share_string'], L10n::t('You can copy this string to share your theme with others. Pasting here applies the schemestring'), false, false], '$nav_bg' => array_key_exists('nav_bg', $disable) ? '' : ['frio_nav_bg', L10n::t('Navigation bar background color'), $arr['nav_bg'], '', false], '$nav_icon_color' => array_key_exists('nav_icon_color', $disable) ? '' : ['frio_nav_icon_color', L10n::t('Navigation bar icon color '), $arr['nav_icon_color'], '', false], '$link_color' => array_key_exists('link_color', $disable) ? '' : ['frio_link_color', L10n::t('Link color'), $arr['link_color'], '', false], diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 50a8934d1b..4f26e090ea 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -6,6 +6,7 @@ {{include file="field_select.tpl" field=$scheme}} +{{if $nav_bg}}{{include file="field_input.tpl" field=$share_string}}{{/if}} {{if $nav_bg}}{{include file="field_colorinput.tpl" field=$nav_bg}}{{/if}} {{if $nav_icon_color}}{{include file="field_colorinput.tpl" field=$nav_icon_color}}{{/if}} {{if $link_color}}{{include file="field_colorinput.tpl" field=$link_color}}{{/if}} From f2040d14c7859370c9f59504826b57eb394a14ed Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Thu, 21 Feb 2019 18:37:11 +0100 Subject: [PATCH 02/12] Added string creation --- view/theme/frio/templates/theme_settings.tpl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 4f26e090ea..0598c7e48b 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -37,6 +37,19 @@ From f57d8dbdb23b6bdafe80be84b0d0746b5f037e7a Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 22 Feb 2019 12:16:48 +0100 Subject: [PATCH 05/12] Implemented parsing share string --- view/theme/frio/templates/theme_settings.tpl | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 9f780471ec..1e1485586c 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -77,6 +77,37 @@ window.setInterval(GenerateShareString, 500); GenerateShareString(); + $(document).on("keyup", "#id_frio_share_string", function() { + theme = JSON.parse($("#id_frio_share_string").val()); + + if ($("#id_frio_nav_bg").length) { + $("#id_frio_nav_bg").val(theme.nav_bg); + } + + if ($("#id_frio_nav_icon_color").length) { + $("#id_frio_nav_icon_color").val(theme.nav_icon_color); + } + + if ($("#id_frio_link_color").length) { + $("#id_frio_link_color").val(theme.link_color); + } + + if ($("#id_frio_background_color").length) { + $("#id_frio_background_color").val(theme.background_color); + } + + if ($("#frio_contentbg_transp").length) { + $("#frio_contentbg_transp").val(theme.contentbg_transp); + } + + if ($("#id_frio_login_bg_image").length) { + $("#id_frio_login_bg_image").val(theme.login_bg_image); + } + + if ($("#id_frio_login_bg_color").length) { + $("#id_frio_login_bg_color").val(theme.login_bg_color); + } + }); // Create colorpickers $("#frio_nav_bg, #frio_nav_icon_color, #frio_background_color, #frio_link_color, #frio_login_bg_color").colorpicker({format: 'hex', align: 'left'}); From bad46cf9be475f36557fd3addfeba600d767a982 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 22 Feb 2019 12:42:51 +0100 Subject: [PATCH 06/12] Added background image sharing Why did I miss this? --- view/theme/frio/templates/theme_settings.tpl | 44 ++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 1e1485586c..44817449d8 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -57,6 +57,25 @@ theme.background_color = $("#id_frio_background_color").val(); } + if ($("#id_frio_background_image").length) { + theme.background_image = $("#id_frio_background_image").val(); + + var elText = theme.background_image; + + if ($("#id_frio_bg_image_option_stretch").is(":checked") == true) { + theme.background_image_option = "stretch"; + } + if ($("#id_frio_bg_image_option_cover").is(":checked") == true) { + theme.background_image_option = "cover"; + } + if ($("#id_frio_bg_image_option_contain").is(":checked") == true) { + theme.background_image_option = "contain"; + } + if ($("#id_frio_bg_image_option_repeat").is(":checked") == true) { + theme.background_image_option = "repeat"; + } + } + if ($("#frio_contentbg_transp").length) { theme.contentbg_transp = $("#frio_contentbg_transp").val(); } @@ -96,6 +115,31 @@ $("#id_frio_background_color").val(theme.background_color); } + if ($("#id_frio_background_image").length) { + $("#id_frio_background_image").val(theme.background_image); + var elText = theme.background_image; + if(elText.length !== 0) { + $("#frio_bg_image_options").show(); + } else { + $("#frio_bg_image_options").hide(); + } + + switch (theme.background_image_option) { + case 'stretch': + $("#id_frio_bg_image_option_stretch").prop("checked", true); + break; + case 'cover': + $("#id_frio_bg_image_option_cover").prop("checked", true); + break; + case 'contain': + $("#id_frio_bg_image_option_contain").prop("checked", true); + break; + case 'repeat': + $("#id_frio_bg_image_option_repeat").prop("checked", true); + break; + } + } + if ($("#frio_contentbg_transp").length) { $("#frio_contentbg_transp").val(theme.contentbg_transp); } From 18ae83b88a6ec2e3d562e60966dc46a83077aade Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 22 Feb 2019 12:59:44 +0100 Subject: [PATCH 07/12] Changed spaces into tabs --- view/theme/frio/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index a8d4198b84..aebedd114b 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -57,7 +57,7 @@ function theme_content(App $a) $arr = []; $arr['scheme'] = PConfig::get(local_user(), 'frio', 'scheme', PConfig::get(local_user(), 'frio', 'schema')); - $arr['share_string'] = ''; + $arr['share_string'] = ''; $arr['nav_bg'] = PConfig::get(local_user(), 'frio', 'nav_bg'); $arr['nav_icon_color'] = PConfig::get(local_user(), 'frio', 'nav_icon_color'); $arr['link_color'] = PConfig::get(local_user(), 'frio', 'link_color'); From 9189045e23dc9e4adfb4e70c17c48ebc93ccac2c Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 22 Feb 2019 13:11:10 +0100 Subject: [PATCH 08/12] Add a comment --- view/theme/frio/templates/theme_settings.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 44817449d8..eaa71d3fe1 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -96,6 +96,7 @@ window.setInterval(GenerateShareString, 500); GenerateShareString(); + // Take advantage of the effects of previous comment $(document).on("keyup", "#id_frio_share_string", function() { theme = JSON.parse($("#id_frio_share_string").val()); From 0ab44daf3cb29997d49e42c9449a99c8ed49db11 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 22 Feb 2019 14:07:06 +0100 Subject: [PATCH 09/12] Updated docs --- doc/FAQ.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/FAQ.md b/doc/FAQ.md index 562ff681b7..d4f034b108 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -14,6 +14,8 @@ User * **[Can I subscribe to a hashtag?](help/FAQ#hashtag)** * **[How to create a RSS feed of the stream?](help/FAQ#rss)** * **[Are there any clients for friendica I can use?](help/FAQ#clients)** +* **[How can I share my color scheme with others?](help/FAQ#schemesharing)** +* **[How can I apply a color scheme shared by others?](help/FAQ#schemesharingpaste)** * **[Where I can find help?](help/FAQ#help)** Admins @@ -189,6 +191,20 @@ Here is a list of known working clients: Depending on the features of the client you might encounter some glitches in usability, like being limited in the length of your postings to 140 characters and having no access to the [permission settings](help/Groups-and-Privacy). + + +### How can I share my color scheme with others? + +If you created a color scheme you want to share it with others, you can do this easily by sharing the schemestring. + +You can find this string within the `custom theme settings` of the [display settings](/settings/display) page. This input box is only available when custom color scheme is selected. + + + + +### How can I apply a color scheme shared by others? +People who want to apply a color scheme shared by others can paste the string in the schemestring box on `custom theme settings` of the [display settings](/settings/display) page and click `submit`. + ### Where I can find help? From e1060c8b66f6ca2d5a88180eacd297c24af8098a Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 22 Feb 2019 14:13:07 +0100 Subject: [PATCH 10/12] I will not share options that are not being used. --- view/theme/frio/templates/theme_settings.tpl | 58 ++++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index eaa71d3fe1..656d8dee84 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -60,20 +60,20 @@ if ($("#id_frio_background_image").length) { theme.background_image = $("#id_frio_background_image").val(); - var elText = theme.background_image; - - if ($("#id_frio_bg_image_option_stretch").is(":checked") == true) { - theme.background_image_option = "stretch"; - } - if ($("#id_frio_bg_image_option_cover").is(":checked") == true) { - theme.background_image_option = "cover"; - } - if ($("#id_frio_bg_image_option_contain").is(":checked") == true) { - theme.background_image_option = "contain"; - } - if ($("#id_frio_bg_image_option_repeat").is(":checked") == true) { - theme.background_image_option = "repeat"; - } + if (theme.background_image.length > 0) { + if ($("#id_frio_bg_image_option_stretch").is(":checked") == true) { + theme.background_image_option = "stretch"; + } + if ($("#id_frio_bg_image_option_cover").is(":checked") == true) { + theme.background_image_option = "cover"; + } + if ($("#id_frio_bg_image_option_contain").is(":checked") == true) { + theme.background_image_option = "contain"; + } + if ($("#id_frio_bg_image_option_repeat").is(":checked") == true) { + theme.background_image_option = "repeat"; + } + } } if ($("#frio_contentbg_transp").length) { @@ -121,23 +121,23 @@ var elText = theme.background_image; if(elText.length !== 0) { $("#frio_bg_image_options").show(); - } else { - $("#frio_bg_image_options").hide(); - } + } else { + $("#frio_bg_image_options").hide(); + } switch (theme.background_image_option) { - case 'stretch': - $("#id_frio_bg_image_option_stretch").prop("checked", true); - break; - case 'cover': - $("#id_frio_bg_image_option_cover").prop("checked", true); - break; - case 'contain': - $("#id_frio_bg_image_option_contain").prop("checked", true); - break; - case 'repeat': - $("#id_frio_bg_image_option_repeat").prop("checked", true); - break; + case 'stretch': + $("#id_frio_bg_image_option_stretch").prop("checked", true); + break; + case 'cover': + $("#id_frio_bg_image_option_cover").prop("checked", true); + break; + case 'contain': + $("#id_frio_bg_image_option_contain").prop("checked", true); + break; + case 'repeat': + $("#id_frio_bg_image_option_repeat").prop("checked", true); + break; } } From c9c030bcbfdceb7cf3bab067050b5c4ca7e18292 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 22 Feb 2019 14:07:06 +0100 Subject: [PATCH 11/12] Revert "Updated docs" This reverts commit 0ab44daf3cb29997d49e42c9449a99c8ed49db11. --- doc/FAQ.md | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/doc/FAQ.md b/doc/FAQ.md index d4f034b108..562ff681b7 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -14,8 +14,6 @@ User * **[Can I subscribe to a hashtag?](help/FAQ#hashtag)** * **[How to create a RSS feed of the stream?](help/FAQ#rss)** * **[Are there any clients for friendica I can use?](help/FAQ#clients)** -* **[How can I share my color scheme with others?](help/FAQ#schemesharing)** -* **[How can I apply a color scheme shared by others?](help/FAQ#schemesharingpaste)** * **[Where I can find help?](help/FAQ#help)** Admins @@ -191,20 +189,6 @@ Here is a list of known working clients: Depending on the features of the client you might encounter some glitches in usability, like being limited in the length of your postings to 140 characters and having no access to the [permission settings](help/Groups-and-Privacy). - - -### How can I share my color scheme with others? - -If you created a color scheme you want to share it with others, you can do this easily by sharing the schemestring. - -You can find this string within the `custom theme settings` of the [display settings](/settings/display) page. This input box is only available when custom color scheme is selected. - - - - -### How can I apply a color scheme shared by others? -People who want to apply a color scheme shared by others can paste the string in the schemestring box on `custom theme settings` of the [display settings](/settings/display) page and click `submit`. - ### Where I can find help? From 1c20886442bc9fb1e75263eba017aa3e4ef8f69d Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 22 Feb 2019 16:44:12 +0100 Subject: [PATCH 12/12] No schemestring update if focus --- view/theme/frio/templates/theme_settings.tpl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 656d8dee84..1c870c92be 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -87,9 +87,10 @@ if ($("#id_frio_login_bg_color").length) { theme.login_bg_color = $("#id_frio_login_bg_color").val(); } - - var share_string = JSON.stringify(theme); - $("#id_frio_share_string").val(share_string); + if (!($("#id_frio_share_string").is(":focus"))){ + var share_string = JSON.stringify(theme); + $("#id_frio_share_string").val(share_string); + } } // interval because jquery.val does not trigger events