]> git.mxchange.org Git - friendica.git/blob - view/theme/smoothly/theme.php
Merge pull request #3472 from rabuzarus/feature/frio/fixedaside2
[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 use Friendica\App;
14
15 function smoothly_init(App $a) {
16         set_template_engine($a, 'smarty3');
17
18         $cssFile = null;
19         $ssl_state = null;
20         $baseurl = App::get_baseurl($ssl_state);
21         $a->page['htmlhead'] .= <<< EOT
22
23 <script>
24 function insertFormatting(BBcode, id) {
25         var tmpStr = $("#comment-edit-text-" + id).val();
26         if (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         }
31
32         textarea = document.getElementById("comment-edit-text-" +id);
33         if (document.selection) {
34                 textarea.focus();
35                 selected = document.selection.createRange();
36                 if (BBcode == "url") {
37                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
38                 } else {
39                         selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
40                 }
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         }
50
51         return true;
52 }
53
54 function cmtBbOpen(id) {
55         $(".comment-edit-bb-" + id).show();
56 }
57 function cmtBbClose(comment, id) {
58         $(".comment-edit-bb-" + id).hide();
59 }
60 $(document).ready(function() {
61
62         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
63
64         $('.group-edit-icon').hover(
65                 function() {
66                         $(this).addClass('icon'); $(this).removeClass('iconspacer');},
67                 function() {
68                         $(this).removeClass('icon'); $(this).addClass('iconspacer');}
69         );
70
71         $('.sidebar-group-element').hover(
72                 function() {
73                         id = $(this).attr('id');
74                         $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
75
76                 function() {
77                         id = $(this).attr('id');
78                         $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
79         );
80
81
82         $('.savedsearchdrop').hover(
83                 function() {
84                         $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
85                 function() {
86                         $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
87         );
88
89         $('.savedsearchterm').hover(
90                 function() {
91                         id = $(this).attr('id');
92                         $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
93
94                 function() {
95                         id = $(this).attr('id');
96                         $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
97         );
98
99 });
100
101 </script>
102 EOT;
103
104         /** custom css **/
105         if (!is_null($cssFile)) {
106         $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
107         }
108
109         _js_in_foot();
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 }