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