]> git.mxchange.org Git - friendica.git/blob - view/theme/smoothly/theme.php
a10a071392aea4df8b5078a4ad4b5f7843053056
[friendica.git] / view / theme / smoothly / theme.php
1 <?php
2
3 /*
4  * Name: Smoothly
5  * Description: Theme based on Testbubble and optimized for Tablets.
6  * Version: Version 2013-05-08
7  * Author: Anne Walk, Devlon Duthied
8  * Author: Alex <https://red.pixelbits.de/channel/alex>
9  * Maintainer: Nomen Nominandum
10  * Screenshot: <a href="screenshot.png">Screenshot</a>
11  */
12
13 function smoothly_init(&$a) {
14         set_template_engine($a, 'smarty3');
15
16         $cssFile = null;
17         $ssl_state = null;
18         $baseurl = App::get_baseurl($ssl_state);
19 $a->page['htmlhead'] .= <<< EOT
20
21 <script>
22 function insertFormatting(BBcode, id) {
23         var tmpStr = $("#comment-edit-text-" + id).val();
24         if (tmpStr == "") {
25                 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
26                 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
27                 openMenu("comment-edit-submit-wrapper-" + id);
28                 $("#comment-edit-text-" + id).val(tmpStr);
29         }
30
31         textarea = document.getElementById("comment-edit-text-" +id);
32         if (document.selection) {
33                 textarea.focus();
34                 selected = document.selection.createRange();
35                 if (BBcode == "url") {
36                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
37                 } else {
38                         selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
39                 }
40         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
41                 var start = textarea.selectionStart;
42                 var end = textarea.selectionEnd;
43                 if (BBcode == "url") {
44                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
45                 } else {
46                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
47                 }
48         }
49
50         return true;
51 }
52
53 function cmtBbOpen(id) {
54         $(".comment-edit-bb-" + id).show();
55 }
56 function cmtBbClose(comment, id) {
57         $(".comment-edit-bb-" + id).hide();
58 }
59 $(document).ready(function() {
60
61         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
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 </script>
101 EOT;
102
103         /** custom css **/
104         if (!is_null($cssFile)) {
105         $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
106         }
107
108 _js_in_foot();
109
110 }
111
112 if (! function_exists('_js_in_foot')) {
113         function _js_in_foot() {
114                 /** @purpose insert stuff in bottom of page
115                 */
116                 $a = get_app();
117                 $ssl_state = null;
118                 $baseurl = App::get_baseurl($ssl_state);
119                 $bottom['$baseurl'] = $baseurl;
120                 $tpl = get_markup_template('bottom.tpl');
121
122                 return $a->page['bottom'] = replace_macros($tpl, $bottom);
123         }
124 }