]> git.mxchange.org Git - friendica.git/blob - view/theme/vier/theme.php
Vier: Now there are buttons for inserting bbcode elements in the comments
[friendica.git] / view / theme / vier / theme.php
1 <?php
2 /**
3  * Name: Vier
4  * Version: 0.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  */
9
10 $a->theme_info = array();
11
12 function vier_init(&$a) {
13 $a->page['htmlhead'] .= <<< EOT
14 <script>
15 function insertFormatting(comment,BBcode,id) {
16
17                 var tmpStr = $("#comment-edit-text-" + id).val();
18                 if(tmpStr == comment) {
19                         tmpStr = "";
20                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
21                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
22                         openMenu("comment-edit-submit-wrapper-" + id);
23                         $("#comment-edit-text-" + id).val(tmpStr);
24                 }
25
26         textarea = document.getElementById("comment-edit-text-" +id);
27         if (document.selection) {
28                 textarea.focus();
29                 selected = document.selection.createRange();
30                 if (BBcode == "url"){
31                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
32                         } else                  
33                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
34         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
35                 var start = textarea.selectionStart;
36                 var end = textarea.selectionEnd;
37                 if (BBcode == "url"){
38                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
39                         } else
40                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
41         }
42         return true;
43 }
44
45
46 function showThread(id) {
47         $("#collapsed-comments-" + id).show()
48         $("#collapsed-comments-" + id + " .collapsed-comments").show()
49 }
50 function hideThread(id) {
51         $("#collapsed-comments-" + id).hide()
52         $("#collapsed-comments-" + id + " .collapsed-comments").hide()
53 }
54
55
56 function cmtBbOpen(id) {
57         $("#comment-edit-bb-" + id).show();
58 }
59 function cmtBbClose(id) {
60         $("#comment-edit-bb-" + id).hide();
61 }
62
63 /*
64 $(document).ready(function() {
65
66 $('html').click(function() { $("#nav-notifications-menu" ).hide(); });
67
68 $('.group-edit-icon').hover(
69         function() {
70                 $(this).addClass('icon'); $(this).removeClass('iconspacer');},
71         function() {
72                 $(this).removeClass('icon'); $(this).addClass('iconspacer');}
73         );
74
75 $('.sidebar-group-element').hover(
76         function() {
77                 id = $(this).attr('id');
78                 $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
79
80         function() {
81                 id = $(this).attr('id');
82                 $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
83         );
84
85
86 $('.savedsearchdrop').hover(
87         function() {
88                 $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
89         function() {
90                 $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
91         );
92
93 $('.savedsearchterm').hover(
94         function() {
95                 id = $(this).attr('id');
96                 $('#drop-' + id).addClass('icon');      $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
97
98         function() {
99                 id = $(this).attr('id');
100                 $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
101         );
102
103 });
104
105 */
106 </script>
107 EOT;
108 }