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