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