]> git.mxchange.org Git - friendica.git/blob - view/theme/diabook/bottom.tpl
Merge https://github.com/friendica/friendica into pull
[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     $("div#pause").html("<img src='images/pause.gif' alt='pause' title='pause live-updates (ctrl+space)' style='border: 1px solid black;opacity: 0.2;'>");
20     $(document).keydown(function(event) {
21     if (!$("div#pause").html()){
22     $("div#pause").html("<img src='images/pause.gif' alt='pause' title='pause live-updates (ctrl+space)' style='border: 1px solid black;opacity: 0.2;'>");
23                 }});  
24     $(".autocomplete").attr("style", "width: 350px;color: black;border: 1px solid #D2D2D2;background: white;cursor: pointer;text-align: left;max-height: 350px;overflow: auto;");
25          
26         });
27         
28         $(document).ready(function(){
29                 $("#sortable_boxes").sortable({
30                         update: function(event, ui) {
31                                 var BoxOrder = $(this).sortable("toArray").toString();
32                                 $.cookie("Boxorder", BoxOrder , { expires: 365, path: "/" });
33                         }
34                 });
35
36         var cookie = $.cookie("Boxorder");              
37         if (!cookie) return;
38         var SavedID = cookie.split(",");
39            for (var Sitem=0, m = SavedID.length; Sitem < m; Sitem++) {
40            $("#sortable_boxes").append($("#sortable_boxes").children("#" + SavedID[Sitem]));
41                }
42              
43         });
44         
45         function tautogrow(id){
46                 $("textarea#comment-edit-text-" +id).autogrow();        
47         };
48         
49         function open_boxsettings() {
50                 $("div#boxsettings").attr("style","display: block;height:500px;width:300px;");
51                 $("label").attr("style","width: 150px;");
52                 };
53         
54         function yt_iframe() {
55         $("iframe").load(function() { 
56         var ifr_src = $(this).contents().find("body iframe").attr("src");
57         $("iframe").contents().find("body iframe").attr("src", ifr_src+"&wmode=transparent");
58     });
59
60         };
61
62         function scrolldown(){
63                         $("html, body").animate({scrollTop:$(document).height()}, "slow");
64                         return false;
65                 };
66                 
67         function scrolltop(){
68                         $("html, body").animate({scrollTop:0}, "slow");
69                         return false;
70                 };
71                 
72         $(window).scroll(function () { 
73                 
74                 var footer_top = $(document).height() - 30;
75                 $("div#footerbox").css("top", footer_top);
76         
77                 var scrollInfo = $(window).scrollTop();      
78                 
79                 if (scrollInfo <= "900"){
80       $("a#top").attr("id","down");
81       $("a#down").attr("onclick","scrolldown()");
82                 $("img#scroll_top_bottom").attr("src","view/theme/diabook/icons/scroll_bottom.png");
83                 $("img#scroll_top_bottom").attr("title","Scroll to bottom");
84                 } 
85                     
86       if (scrollInfo > "900"){
87       $("a#down").attr("id","top");
88       $("a#top").attr("onclick","scrolltop()");
89                 $("img#scroll_top_bottom").attr("src","view/theme/diabook/icons/scroll_top.png");
90                 $("img#scroll_top_bottom").attr("title","Back to top");
91                 }
92                 
93     });
94   
95
96         function insertFormatting(comment,BBcode,id) {
97         
98                 var tmpStr = $("#comment-edit-text-" + id).val();
99                 if(tmpStr == comment) {
100                         tmpStr = "";
101                         $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
102                         $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
103                         openMenu("comment-edit-submit-wrapper-" + id);
104                                                                 }
105
106         textarea = document.getElementById("comment-edit-text-" +id);
107         if (document.selection) {
108                 textarea.focus();
109                 selected = document.selection.createRange();
110                 if (BBcode == "url"){
111                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
112                         } else                  
113                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
114         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
115                 var start = textarea.selectionStart;
116                 var end = textarea.selectionEnd;
117                 if (BBcode == "url"){
118                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
119                         } else
120                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
121         }
122         return true;
123         }
124
125         function cmtBbOpen(id) {
126         $(".comment-edit-bb-" + id).show();
127         }
128         function cmtBbClose(id) {
129         $(".comment-edit-bb-" + id).hide();
130         }
131
132         
133 </script>