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