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