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