]> git.mxchange.org Git - friendica.git/blob - view/theme/vier/theme.php
928ab6c8b2a4f49303a7c12831a1946d63774a3f
[friendica.git] / view / theme / vier / theme.php
1 <?php
2 /**
3  * Name: Vier
4  * Version: 1.1
5  * Author: Fabio <http://kirgroup.com/profile/fabrixxm>
6  * Author: Ike <http://pirati.ca/profile/heluecht>
7  * Maintainer: Ike <http://pirati.ca/profile/heluecht>
8  * Description: "Vier" is a very compact and modern theme. It uses the font awesome font library: http://fortawesome.github.com/Font-Awesome/
9  */
10
11 function vier_init(&$a) {
12 set_template_engine($a, 'smarty3');
13
14 $baseurl = $a->get_baseurl();
15
16 $a->theme_info = array();
17
18 $style = get_pconfig(local_user(), 'vier', 'style');
19
20 if ($style == "")
21         $style = get_config('vier', 'style');
22
23 if ($style == "flat")
24         $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/flat.css" type="text/css" media="screen"/>'."\n";
25 else if ($style == "netcolour")
26         $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/netcolour.css" type="text/css" media="screen"/>'."\n";
27 else if ($style == "breathe")
28         $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/breathe.css" type="text/css" media="screen"/>'."\n";
29
30 $a->page['htmlhead'] .= <<< EOT
31 <script type="text/javascript" src="$baseurl/view/theme/vier/js/jquery.divgrow-1.3.1.f1.min.js"></script>
32 <script>
33
34 function collapseHeight(elems) {
35         var elemName = '.wall-item-body:not(.divmore)';
36         if(typeof elems != 'undefined') {
37                 elemName = elems + ' ' + elemName;
38         }
39         $(elemName).each(function() {
40                 if($(this).height() > 450) {
41                         $('html').height($('html').height());
42                         $(this).divgrow({ initialHeight: 400, showBrackets: false, speed: 0 });
43                         $(this).addClass('divmore');
44                         $('html').height('auto');
45                 }
46         });
47 }
48
49 function insertFormatting(comment,BBcode,id) {
50
51                 var tmpStr = $("#comment-edit-text-" + id).val();
52                 if(tmpStr == comment) {
53                         tmpStr = "";
54                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
55                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
56                         openMenu("comment-edit-submit-wrapper-" + id);
57                         $("#comment-edit-text-" + id).val(tmpStr);
58                 }
59
60         textarea = document.getElementById("comment-edit-text-" +id);
61         if (document.selection) {
62                 textarea.focus();
63                 selected = document.selection.createRange();
64                 if (BBcode == "url"){
65                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
66                         } else
67                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
68         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
69                 var start = textarea.selectionStart;
70                 var end = textarea.selectionEnd;
71                 if (BBcode == "url"){
72                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
73                         } else
74                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
75         }
76         return true;
77 }
78
79
80 function showThread(id) {
81         $("#collapsed-comments-" + id).show()
82         $("#collapsed-comments-" + id + " .collapsed-comments").show()
83 }
84 function hideThread(id) {
85         $("#collapsed-comments-" + id).hide()
86         $("#collapsed-comments-" + id + " .collapsed-comments").hide()
87 }
88
89
90 function cmtBbOpen(id) {
91         $("#comment-edit-bb-" + id).show();
92 }
93 function cmtBbClose(id) {
94         $("#comment-edit-bb-" + id).hide();
95 }
96 </script>
97 EOT;
98 }
99