]> git.mxchange.org Git - friendica.git/blob - view/theme/smoothly/theme.php
Merge remote-tracking branch 'upstream/develop' into 1705-dbclean-advanced
[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                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
37         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
38                 var start = textarea.selectionStart;
39                 var end = textarea.selectionEnd;
40                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
41         }
42
43         return true;
44 }
45
46 function cmtBbOpen(id) {
47         $(".comment-edit-bb-" + id).show();
48 }
49 function cmtBbClose(comment, id) {
50         $(".comment-edit-bb-" + id).hide();
51 }
52 $(document).ready(function() {
53
54         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
55
56         $('.group-edit-icon').hover(
57                 function() {
58                         $(this).addClass('icon'); $(this).removeClass('iconspacer');},
59                 function() {
60                         $(this).removeClass('icon'); $(this).addClass('iconspacer');}
61         );
62
63         $('.sidebar-group-element').hover(
64                 function() {
65                         id = $(this).attr('id');
66                         $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
67
68                 function() {
69                         id = $(this).attr('id');
70                         $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
71         );
72
73
74         $('.savedsearchdrop').hover(
75                 function() {
76                         $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
77                 function() {
78                         $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
79         );
80
81         $('.savedsearchterm').hover(
82                 function() {
83                         id = $(this).attr('id');
84                         $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
85
86                 function() {
87                         id = $(this).attr('id');
88                         $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
89         );
90
91 });
92
93 </script>
94 EOT;
95
96         /** custom css **/
97         if (!is_null($cssFile)) {
98         $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
99         }
100
101         _js_in_foot();
102 }
103
104 if (! function_exists('_js_in_foot')) {
105         function _js_in_foot() {
106                 /** @purpose insert stuff in bottom of page
107                 */
108                 $a = get_app();
109                 $ssl_state = null;
110                 $baseurl = App::get_baseurl($ssl_state);
111                 $bottom['$baseurl'] = $baseurl;
112                 $tpl = get_markup_template('bottom.tpl');
113
114                 return $a->page['bottom'] = replace_macros($tpl, $bottom);
115         }
116 }