]> git.mxchange.org Git - friendica.git/blob - view/theme/diabook/bottom.tpl
fc675e9051cc0c412a41b75a1ce19b2878d5d2a6
[friendica.git] / view / theme / diabook / bottom.tpl
1 <script type="text/javascript" src="$baseurl/view/theme/diabook/js/jquery.autogrow.textarea.js"></script>
2 <script type="text/javascript">
3
4 $(document).ready(function() {
5     $("iframe").each(function(){
6         var ifr_source = $(this).attr("src");
7         var wmode = "wmode=transparent";
8         if(ifr_source.indexOf("?") != -1) {
9             var getQString = ifr_source.split("?");
10             var oldString = getQString[1];
11             var newString = getQString[0];
12             $(this).attr("src",newString+"?"+wmode+"&"+oldString);
13         }
14         else $(this).attr("src",ifr_source+"?"+wmode);
15        
16     });
17     
18     $("div#pause").attr("style", "position: fixed;bottom: 43px;left: 5px;");
19     $(".autocomplete").attr("style", "width: 350px;color: black;background: white;cursor: pointer;text-align: left;max-height: 350px;overflow: auto;");
20       
21         });
22         
23         $(document).ready(function(){
24                 $("#sortable_boxes").sortable({
25                         update: function(event, ui) {
26                                 var BoxOrder = $(this).sortable("toArray").toString();
27                                 $.cookie("Boxorder", BoxOrder , { expires: 365, path: "/" });
28                         }
29                 });
30
31         var cookie = $.cookie("Boxorder");              
32         if (!cookie) return;
33         var SavedID = cookie.split(",");
34            for (var Sitem=0, m = SavedID.length; Sitem < m; Sitem++) {
35            $("#sortable_boxes").append($("#sortable_boxes").children("#" + SavedID[Sitem]));
36                }
37              
38         });
39         
40         function tautogrow(id){
41                 $("textarea#comment-edit-text-" +id).autogrow();        
42         };
43         
44         function yt_iframe() {
45         $("iframe").load(function() { 
46         var ifr_src = $(this).contents().find("body iframe").attr("src");
47         $("iframe").contents().find("body iframe").attr("src", ifr_src+"&wmode=transparent");
48     });
49
50         };
51
52         function scrolldown(){
53                         $("html, body").animate({scrollTop:$(document).height()}, "slow");
54                         return false;
55                 };
56                 
57         function scrolltop(){
58                         $("html, body").animate({scrollTop:0}, "slow");
59                         return false;
60                 };
61                 
62         $(window).scroll(function () { 
63                 
64                 var footer_top = $(document).height() - 30;
65                 $("div#footerbox").css("top", footer_top);
66         
67                 var scrollInfo = $(window).scrollTop();      
68                 
69                 if (scrollInfo <= "900"){
70       $("a#top").attr("id","down");
71       $("a#down").attr("onclick","scrolldown()");
72                 $("img#scroll_top_bottom").attr("src","view/theme/diabook/icons/scroll_bottom.png");
73                 $("img#scroll_top_bottom").attr("title","Scroll to bottom");
74                 } 
75                     
76       if (scrollInfo > "900"){
77       $("a#down").attr("id","top");
78       $("a#top").attr("onclick","scrolltop()");
79                 $("img#scroll_top_bottom").attr("src","view/theme/diabook/icons/scroll_top.png");
80                 $("img#scroll_top_bottom").attr("title","Back to top");
81                 }
82                 
83     });
84   
85
86         function insertFormatting(comment,BBcode,id) {
87         
88                 var tmpStr = $("#comment-edit-text-" + id).val();
89                 if(tmpStr == comment) {
90                         tmpStr = "";
91                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
92                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
93                         openMenu("comment-edit-submit-wrapper-" + id);
94                                                                 }
95
96         textarea = document.getElementById("comment-edit-text-" +id);
97         if (document.selection) {
98                 textarea.focus();
99                 selected = document.selection.createRange();
100                 if (BBcode == "url"){
101                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
102                         } else                  
103                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
104         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
105                 var start = textarea.selectionStart;
106                 var end = textarea.selectionEnd;
107                 if (BBcode == "url"){
108                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
109                         } else
110                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
111         }
112         return true;
113         }
114
115         function cmtBbOpen(id) {
116         $(".comment-edit-bb-" + id).show();
117         }
118         function cmtBbClose(id) {
119         $(".comment-edit-bb-" + id).hide();
120         }
121 </script>