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