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