]> git.mxchange.org Git - friendica.git/blob - view/theme/vier/theme.php
Bugfix: There was a JS error that prevented the work of the comment buttons
[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 else if ($style == "plus")
30         $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/vier/plus.css" type="text/css" media="screen"/>'."\n";
31
32 $a->page['htmlhead'] .= <<< EOT
33 <script type="text/javascript" src="$baseurl/view/theme/vier/js/jquery.divgrow-1.3.1.f1.min.js"></script>
34 <script>
35
36 function collapseHeight(elems) {
37         var elemName = '.wall-item-body:not(.divmore)';
38         if(typeof elems != 'undefined') {
39                 elemName = elems + ' ' + elemName;
40         }
41         $(elemName).each(function() {
42                 if($(this).height() > 450) {
43                         $('html').height($('html').height());
44                         $(this).divgrow({ initialHeight: 400, showBrackets: false, speed: 0 });
45                         $(this).addClass('divmore');
46                         $('html').height('auto');
47                 }
48         });
49 }
50
51 function insertFormatting(comment,BBcode,id) {
52
53                 var tmpStr = $("#comment-edit-text-" + id).val();
54                 if(tmpStr == comment) {
55                         tmpStr = "";
56                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
57                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
58                         openMenu("comment-edit-submit-wrapper-" + id);
59                         $("#comment-edit-text-" + id).val(tmpStr);
60                 }
61
62         textarea = document.getElementById("comment-edit-text-" +id);
63         if (document.selection) {
64                 textarea.focus();
65                 selected = document.selection.createRange();
66                 if (BBcode == "url"){
67                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
68                         } else
69                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
70         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
71                 var start = textarea.selectionStart;
72                 var end = textarea.selectionEnd;
73                 if (BBcode == "url"){
74                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
75                         } else
76                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
77         }
78         return true;
79 }
80
81
82 function showThread(id) {
83         $("#collapsed-comments-" + id).show()
84         $("#collapsed-comments-" + id + " .collapsed-comments").show()
85 }
86 function hideThread(id) {
87         $("#collapsed-comments-" + id).hide()
88         $("#collapsed-comments-" + id + " .collapsed-comments").hide()
89 }
90
91
92 function cmtBbOpen(id) {
93         $("#comment-edit-bb-" + id).show();
94 }
95 function cmtBbClose(id) {
96         $("#comment-edit-bb-" + id).hide();
97 }
98 </script>
99 EOT;
100 }
101