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