]> git.mxchange.org Git - friendica.git/blob - view/theme/smoothly/theme.php
Rename App Methods
[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 use Friendica\Core\System;
15
16 function smoothly_init(App $a) {
17         $a->setActiveTemplateEngine('smarty3');
18
19         $cssFile = null;
20         $ssl_state = null;
21         $baseurl = System::baseUrl($ssl_state);
22         $a->page['htmlhead'] .= <<< EOT
23
24 <script>
25 function insertFormatting(BBcode, id) {
26         var tmpStr = $("#comment-edit-text-" + id).val();
27         if (tmpStr == "") {
28                 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
29                 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
30                 openMenu("comment-edit-submit-wrapper-" + id);
31         }
32
33         textarea = document.getElementById("comment-edit-text-" +id);
34         if (document.selection) {
35                 textarea.focus();
36                 selected = document.selection.createRange();
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                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
42         }
43
44         return true;
45 }
46
47 function cmtBbOpen(id) {
48         $(".comment-edit-bb-" + id).show();
49 }
50 function cmtBbClose(comment, id) {
51         $(".comment-edit-bb-" + id).hide();
52 }
53 $(document).ready(function() {
54
55         $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
56
57         $('.group-edit-icon').hover(
58                 function() {
59                         $(this).addClass('icon'); $(this).removeClass('iconspacer');},
60                 function() {
61                         $(this).removeClass('icon'); $(this).addClass('iconspacer');}
62         );
63
64         $('.sidebar-group-element').hover(
65                 function() {
66                         id = $(this).attr('id');
67                         $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
68
69                 function() {
70                         id = $(this).attr('id');
71                         $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
72         );
73
74
75         $('.savedsearchdrop').hover(
76                 function() {
77                         $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
78                 function() {
79                         $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
80         );
81
82         $('.savedsearchterm').hover(
83                 function() {
84                         id = $(this).attr('id');
85                         $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
86
87                 function() {
88                         id = $(this).attr('id');
89                         $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
90         );
91
92 });
93
94 </script>
95 EOT;
96
97         /** custom css **/
98         if (!is_null($cssFile)) {
99         $a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
100         }
101
102         _js_in_foot();
103 }
104
105 if (! function_exists('_js_in_foot')) {
106         function _js_in_foot() {
107                 /** @purpose insert stuff in bottom of page
108                 */
109                 $a = get_app();
110                 $ssl_state = null;
111                 $baseurl = System::baseUrl($ssl_state);
112                 $bottom['$baseurl'] = $baseurl;
113                 $tpl = get_markup_template('bottom.tpl');
114
115                 return $a->page['bottom'] = replace_macros($tpl, $bottom);
116         }
117 }