]> git.mxchange.org Git - friendica.git/blob - view/theme/smoothly/theme.php
60ea7b24950c2b1dd76cb0e802a5f6cf97249e0b
[friendica.git] / view / theme / smoothly / theme.php
1 <?php
2
3 /*
4  * Name: Smoothly
5  * Description: Like coffee with milk. Theme works fine with iPad[2].
6  * Version: Version 0.10.24
7  * Author: Alex <https://friendica.pixelbits.de/profile/alex>
8  * Maintainer: Alex <https://friendica.pixelbits.de/profile/alex>
9  * Screenshot: <a href="screenshot.png">Screenshot</a>
10  */
11
12 $a = get_app();
13 $a->theme_info = array();
14
15 function smoothly_init(&$a) {
16         $cssFile = null;
17         $ssl_state = null;
18         $baseurl = $a->get_baseurl($ssl_state);
19 $a->page['htmlhead'] .= <<< EOT
20
21 <script>
22 function insertFormatting(comment,BBcode,id) {
23         
24                 var tmpStr = $("#comment-edit-text-" + id).val();
25                 if(tmpStr == comment) {
26                         tmpStr = "";
27                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
28                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
29                         openMenu("comment-edit-submit-wrapper-" + id);
30                         $("#comment-edit-text-" + id).val(tmpStr);
31                 }
32
33         textarea = document.getElementById("comment-edit-text-" +id);
34         if (document.selection) {
35                 textarea.focus();
36                 selected = document.selection.createRange();
37                 if (BBcode == "url"){
38                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
39                         } else                  
40                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
41         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
42                 var start = textarea.selectionStart;
43                 var end = textarea.selectionEnd;
44                 if (BBcode == "url"){
45                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
46                         } else
47                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
48         }
49         return true;
50 }
51
52 function cmtBbOpen(id) {
53         $(".comment-edit-bb-" + id).show();
54 }
55 function cmtBbClose(comment, id) {
56         $(".comment-edit-bb-" + id).hide();
57 }
58 $(document).ready(function() {
59
60 $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
61
62 $('.group-edit-icon').hover(
63         function() {
64                 $(this).addClass('icon'); $(this).removeClass('iconspacer');},
65         function() {
66                 $(this).removeClass('icon'); $(this).addClass('iconspacer');}
67         );
68
69 $('.sidebar-group-element').hover(
70         function() {
71                 id = $(this).attr('id');
72                 $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
73
74         function() {
75                 id = $(this).attr('id');
76                 $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
77         );
78
79
80 $('.savedsearchdrop').hover(
81         function() {
82                 $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
83         function() {
84                 $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
85         );
86
87 $('.savedsearchterm').hover(
88         function() {
89                 id = $(this).attr('id');
90                 $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
91
92         function() {
93                 id = $(this).attr('id');
94                 $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
95         );
96
97 });
98
99 </script>
100 EOT;
101
102         /** custom css **/
103         if (!is_null($cssFile)) {
104         $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
105         }
106
107 _js_in_foot();
108
109 }
110
111 if(! function_exists('_js_in_foot')) {
112         function _js_in_foot() {
113                 /** @purpose insert stuff in bottom of page
114                 */
115                 $a = get_app();
116                 $ssl_state = null;
117                 $baseurl = $a->get_baseurl($ssl_state);
118                 $bottom['$baseurl'] = $baseurl;
119                 $tpl = file_get_contents(dirname(__file__) . '/bottom.tpl');
120
121                 return $a->page['bottom'] = replace_macros($tpl, $bottom);
122         }
123 }