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