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