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