]> git.mxchange.org Git - friendica.git/blob - view/theme/cleanzero/theme.php
Merge remote-tracking branch 'upstream/develop' into 1601-api-statuses-lookup
[friendica.git] / view / theme / cleanzero / theme.php
1 <?php
2 /*
3  * Name: cleanzero
4  * Description: Theme with clean design derived from the zero theme family. Including options to set color schemes, font sizes and resizing of images in posts 
5  * Version:
6  * Author: Christian Vogeley (https://christian-vogeley.de/profile/christian)
7  */
8
9 function cleanzero_init(&$a) {
10 $a->theme_info = array(
11   'extends' => 'duepuntozero',
12 );
13 set_template_engine($a, 'smarty3');
14
15 $a->page['htmlhead'] .= <<< EOT
16 <script>
17
18 function insertFormatting(comment,BBcode,id) {
19         
20                 var tmpStr = $("#comment-edit-text-" + id).val();
21                 if(tmpStr == comment) {
22                         tmpStr = "";
23                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
24                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
25                         openMenu("comment-edit-submit-wrapper-" + id);
26                         $("#comment-edit-text-" + id).val(tmpStr);
27                 }
28
29         textarea = document.getElementById("comment-edit-text-" +id);
30         if (document.selection) {
31                 textarea.focus();
32                 selected = document.selection.createRange();
33                 if (BBcode == "url"){
34                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
35                         } else                  
36                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
37         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
38                 var start = textarea.selectionStart;
39                 var end = textarea.selectionEnd;
40                 if (BBcode == "url"){
41                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
42                         } else
43                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
44         }
45         return true;
46 }
47
48 function cmtBbOpen(comment, id) {
49         if($(comment).hasClass('comment-edit-text-full')) {
50                 $(".comment-edit-bb-" + id).show();
51                 return true;
52         }
53         return false;
54 }
55 function cmtBbClose(comment, id) {
56 //      if($(comment).hasClass('comment-edit-text-empty')) {
57 //              $(".comment-edit-bb-" + id).hide();
58 //              return true;
59 //      }
60         return false;
61 }
62
63
64 $(document).ready(function() {
65
66 $('.group-edit-icon').hover(
67         function() {
68                 $(this).addClass('icon'); $(this).removeClass('iconspacer');},
69         function() {
70                 $(this).removeClass('icon'); $(this).addClass('iconspacer');}
71         );
72
73 $('.sidebar-group-element').hover(
74         function() {
75                 id = $(this).attr('id');
76                 $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
77
78         function() {
79                 id = $(this).attr('id');
80                 $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
81         );
82
83
84 $('.savedsearchdrop').hover(
85         function() {
86                 $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
87         function() {
88                 $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
89         );
90
91 $('.savedsearchterm').hover(
92         function() {
93                 id = $(this).attr('id');
94                 $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
95
96         function() {
97                 id = $(this).attr('id');
98                 $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
99         );
100
101 });
102
103
104 </script>
105 EOT;
106 // get resize configuration
107
108 $resize=false;
109 $site_resize = get_config('cleanzero', 'resize' );
110 if(local_user()) $resize = get_pconfig(local_user(), 'cleanzero', 'resize' );
111
112 if ($resize===false) $resize=$site_resize;
113 if ($resize===false) $resize=0;
114
115 if (intval($resize) > 0) {
116 //load jquery.ae.image.resize.js
117 $imageresizeJS = $a->get_baseurl($ssl_state)."/view/theme/cleanzero/js/jquery.ae.image.resize.js";
118 $a->page['htmlhead'] .= sprintf('<script language="JavaScript" src="%s" ></script>', $imageresizeJS);
119 $a->page['htmlhead'] .= '
120 <script>
121
122  $(function() {
123         $(".wall-item-content  img").aeImageResize({height: '.$resize.', width: '.$resize.'});
124   });
125 </script>';}
126 }