1 <script type="text/javascript" src="{{$baseurl}}/view/theme/diabook/js/jquery.autogrow.textarea.js"></script>
2 <script type="text/javascript">
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);
14 else $(this).attr("src",ifr_source+"?"+wmode);
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;'>");
24 $(".autocomplete").attr("style", "width: 350px;color: black;border: 1px solid #D2D2D2;background: white;cursor: pointer;text-align: left;max-height: 350px;overflow: auto;");
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: "/" });
36 var cookie = $.cookie("Boxorder");
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]));
46 function tautogrow(id){
47 $("textarea#comment-edit-text-" +id).autogrow();
50 function open_boxsettings() {
51 $("div#boxsettings").attr("style","display: block;height:500px;width:300px;");
52 $("label").attr("style","width: 150px;");
55 function yt_iframe() {
56 $("iframe").load(function() {
57 var ifr_src = $(this).contents().find("body iframe").attr("src");
58 $("iframe").contents().find("body iframe").attr("src", ifr_src+"&wmode=transparent");
63 function scrolldown(){
64 $("html, body").animate({scrollTop:$(document).height()}, "slow");
69 $("html, body").animate({scrollTop:0}, "slow");
73 $(window).scroll(function () {
75 var footer_top = $(document).height() - 30;
76 $("div#footerbox").css("top", footer_top);
78 var scrollInfo = $(window).scrollTop();
80 if (scrollInfo <= "900"){
81 $("a#top").attr("id","down");
82 $("a#down").attr("onclick","scrolldown()");
83 $("img#scroll_top_bottom").attr("src","view/theme/diabook/icons/scroll_bottom.png");
84 $("img#scroll_top_bottom").attr("title","Scroll to bottom");
87 if (scrollInfo > "900"){
88 $("a#down").attr("id","top");
89 $("a#top").attr("onclick","scrolltop()");
90 $("img#scroll_top_bottom").attr("src","view/theme/diabook/icons/scroll_top.png");
91 $("img#scroll_top_bottom").attr("title","Back to top");
97 function insertFormatting(comment,BBcode,id) {
99 var tmpStr = $("#comment-edit-text-" + id).val();
100 if(tmpStr == comment) {
102 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
103 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
104 openMenu("comment-edit-submit-wrapper-" + id);
107 textarea = document.getElementById("comment-edit-text-" +id);
108 if (document.selection) {
110 selected = document.selection.createRange();
111 if (BBcode == "url"){
112 selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
114 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
115 } else if (textarea.selectionStart || textarea.selectionStart == "0") {
116 var start = textarea.selectionStart;
117 var end = textarea.selectionEnd;
118 if (BBcode == "url"){
119 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
121 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
126 function cmtBbOpen(id) {
127 $(".comment-edit-bb-" + id).show();
129 function cmtBbClose(id) {
130 $(".comment-edit-bb-" + id).hide();
133 /*$(document).ready(function(){
134 var doctitle = document.title;
135 function checkNotify() {
136 if(document.getElementById("notify-update").innerHTML != "")
137 document.title = "("+document.getElementById("notify-update").innerHTML+") " + doctitle;
139 document.title = doctitle;
141 setInterval(function () {checkNotify();}, 10 * 1000);
145 var pagetitle = null;
146 $("nav").bind('nav-update', function(e,data){
147 if (pagetitle==null) pagetitle = document.title;
148 var count = $(data).find('notif').attr('count');
150 document.title = "("+count+") "+pagetitle;
152 document.title = pagetitle;