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