]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/templates/theme_settings.tpl
Improved protocol storing
[friendica.git] / view / theme / frio / templates / theme_settings.tpl
1
2 <link rel="stylesheet" href="{{$baseurl}}/view/theme/frio/frameworks/jRange/jquery.range.css" type="text/css" media="screen" />
3 <script src="{{$baseurl}}/view/theme/quattro/jquery.tools.min.js"></script>
4 <script src="{{$baseurl}}/view/theme/frio/frameworks/jRange/jquery.range.js"></script>
5 <script type="text/javascript" src="{{$baseurl}}/view/js/ajaxupload.js" ></script>
6
7 {{include file="field_select.tpl" field=$scheme}}
8
9 {{if $nav_bg}}{{include file="field_input.tpl" field=$share_string}}{{/if}}
10 {{if $nav_bg}}{{include file="field_colorinput.tpl" field=$nav_bg}}{{/if}}
11 {{if $nav_icon_color}}{{include file="field_colorinput.tpl" field=$nav_icon_color}}{{/if}}
12 {{if $link_color}}{{include file="field_colorinput.tpl" field=$link_color}}{{/if}}
13
14 {{if $background_color}}{{include file="field_colorinput.tpl" field=$background_color}}{{/if}}
15
16 {{* The slider for the content opacity - We use no template for this since it is only used at this page *}}
17 {{if $contentbg_transp}}
18 <div class="form-group field input color">
19         <label for="id_{{$contentbg_transp.0}}" id="label_{{$contentbg_transp.0}}">{{$contentbg_transp.1}}</label>
20         <input type="hidden" class="form-control color slider-input" name="{{$contentbg_transp.0}}" id="{{$contentbg_transp.0}}" type="text" value="{{$contentbg_transp.2}}" aria-describedby="{{$contentbg_transp.0}}_tip">
21         <span id="{{$contentbg_transp.0}}_tip" class="help-block" role="tooltip">{{$contentbg_transp.3}}</span>
22         <div id="end_{{$contentbg_transp.0}}" class="field_end"></div>
23 </div>
24 {{/if}}
25
26 {{if $background_image}}{{include file="field_fileinput.tpl" field=$background_image}}{{/if}}
27
28 <div id="frio_bg_image_options" style="display: none;">
29         <label>{{$bg_image_options_title}}:</label>
30 {{foreach $bg_image_options as $options}}
31         {{include file="field_radio.tpl" field=$options}}
32 {{/foreach}}
33 </div>
34
35 {{if $login_bg_image}}{{include file="field_fileinput.tpl" field=$login_bg_image}}{{/if}}
36 {{if $login_bg_color}}{{include file="field_colorinput.tpl" field=$login_bg_color}}{{/if}}
37
38 <script type="text/javascript">
39         $(document).ready(function() {
40
41                 function GenerateShareString() {
42                         var theme = {};
43                         // Parse initial share_string
44                         if ($("#id_frio_nav_bg").length) {
45                                 theme.nav_bg = $("#id_frio_nav_bg").val();
46                         }
47
48                         if ($("#id_frio_nav_icon_color").length) {
49                                 theme.nav_icon_color = $("#id_frio_nav_icon_color").val();
50                         }
51
52                         if ($("#id_frio_link_color").length) {
53                                 theme.link_color = $("#id_frio_link_color").val();
54                         }
55
56                         if ($("#id_frio_background_color").length) {
57                                 theme.background_color = $("#id_frio_background_color").val();
58                         }
59
60                         if ($("#id_frio_background_image").length) {
61                                 theme.background_image = $("#id_frio_background_image").val();
62
63                                 if (theme.background_image.length > 0) {
64                                         if ($("#id_frio_bg_image_option_stretch").is(":checked") == true) {
65                                                 theme.background_image_option = "stretch";
66                                         }
67                                         if ($("#id_frio_bg_image_option_cover").is(":checked") == true) {
68                                                 theme.background_image_option = "cover";
69                                         }
70                                         if ($("#id_frio_bg_image_option_contain").is(":checked") == true) {
71                                                 theme.background_image_option = "contain";
72                                         }
73                                         if ($("#id_frio_bg_image_option_repeat").is(":checked") == true) {
74                                                 theme.background_image_option = "repeat";
75                                         }
76                                  }
77                         }
78
79                         if ($("#frio_contentbg_transp").length) {
80                                 theme.contentbg_transp = $("#frio_contentbg_transp").val();
81                         }
82
83                         if ($("#id_frio_login_bg_image").length) {
84                                 theme.login_bg_image = $("#id_frio_login_bg_image").val();
85                         }
86
87                         if ($("#id_frio_login_bg_color").length) {
88                                 theme.login_bg_color = $("#id_frio_login_bg_color").val();
89                         }
90                         if (!($("#id_frio_share_string").is(":focus"))){
91                                 var share_string = JSON.stringify(theme);
92                                 $("#id_frio_share_string").val(share_string);
93                         }
94                 }
95
96                 // interval because jquery.val does not trigger events
97                 window.setInterval(GenerateShareString, 500);
98                 GenerateShareString();
99
100                 // Take advantage of the effects of previous comment
101                 $(document).on("input", "#id_frio_share_string", function() {
102                         theme = JSON.parse($("#id_frio_share_string").val());
103
104                         if ($("#id_frio_nav_bg").length) {
105                                 $("#id_frio_nav_bg").val(theme.nav_bg);
106                         }
107
108                         if ($("#id_frio_nav_icon_color").length) {
109                                 $("#id_frio_nav_icon_color").val(theme.nav_icon_color);
110                         }
111
112                         if ($("#id_frio_link_color").length) {
113                                  $("#id_frio_link_color").val(theme.link_color);
114                         }
115
116                         if ($("#id_frio_background_color").length) {
117                                 $("#id_frio_background_color").val(theme.background_color);
118                         }
119
120                         if ($("#id_frio_background_image").length) {
121                                 $("#id_frio_background_image").val(theme.background_image);
122                                 var elText = theme.background_image;
123                                 if(elText.length !== 0) {
124                                         $("#frio_bg_image_options").show();
125                                 } else {
126                                         $("#frio_bg_image_options").hide();
127                                 }
128
129                                 switch (theme.background_image_option) {
130                                         case 'stretch':
131                                                 $("#id_frio_bg_image_option_stretch").prop("checked", true);
132                                                 break;
133                                         case 'cover':
134                                                 $("#id_frio_bg_image_option_cover").prop("checked", true);
135                                                 break;
136                                         case 'contain':
137                                                 $("#id_frio_bg_image_option_contain").prop("checked", true);
138                                                 break;
139                                         case 'repeat':
140                                                 $("#id_frio_bg_image_option_repeat").prop("checked", true);
141                                                 break;
142                                 }
143                         }
144
145                         if ($("#frio_contentbg_transp").length) {
146                                 $("#frio_contentbg_transp").val(theme.contentbg_transp);
147                         }
148
149                         if ($("#id_frio_login_bg_image").length) {
150                                 $("#id_frio_login_bg_image").val(theme.login_bg_image);
151                         }
152
153                         if ($("#id_frio_login_bg_color").length) {
154                                 $("#id_frio_login_bg_color").val(theme.login_bg_color);
155                         }
156                 });
157                 // Create colorpickers
158                 $("#frio_nav_bg, #frio_nav_icon_color, #frio_background_color, #frio_link_color, #frio_login_bg_color").colorpicker({format: 'hex', align: 'left'});
159
160                 // show image options when user user starts to type the address of the image
161                 $("#id_frio_background_image").keyup(function(){
162                         var elText = $(this).val();
163                         if(elText.length !== 0) {
164                                 $("#frio_bg_image_options").show();
165                         } else {
166                                 $("#frio_bg_image_options").hide();
167                         }
168                 });
169
170                 // show the image options is there is allready an image
171                 if($("#id_frio_background_image").val().length != 0) {
172                                 $("#frio_bg_image_options").show();
173                 }
174
175                 $('.slider-input').jRange({
176                         from: 0,
177                         to: 100,
178                         step: 1,
179                         scale: [0,10,20,30,40,50,60,70,80,90,100],
180                         format: '%s',
181                         width: '100%',
182                         showLabels: true,
183                         theme: 'theme-frio',
184                 });
185
186                 // The position of the slider is wrong calculated on hidden elements.
187                 // So set an event listener toggle and update the jRange value.
188                 $(document).on('click', '#custom-settings-title a', function() {
189                         var bgTransp = $('#frio_contentbg_transp').val();
190                         $('.slider-input').jRange('setValue', bgTransp);
191                 });
192
193         });
194 </script>
195
196 <div class="settings-submit-wrapper form-group pull-right">
197         <button type="submit" value="{{$submit}}" class="settings-submit btn btn-primary" name="frio-settings-submit">{{$submit}}</button>
198 </div>
199 <div class="clearfix"></div>
200
201 <script type="text/javascript">
202         $(".inputRange").rangeinput();
203 </script>