diff options
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 92 |
1 files changed, 55 insertions, 37 deletions
diff --git a/view/js/main.js b/view/js/main.js index 17ef578be..f43ae4d1b 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1,23 +1,57 @@ function confirmDelete() { return confirm(aStr['delitem']); } + + function commentOpenUI(obj,id) { + + $(document).unbind( "click.commentOpen", handler ); + + var handler = function() { + if(obj.value == aStr['comment']) { + obj.value = ''; + $("#comment-edit-text-" + id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty"); + $("#comment-tools-" + id).show(); + } + }; + + $(document).bind( "click.commentOpen", handler ); + + } + + function commentCloseUI(obj,id) { + + $(document).unbind( "click.commentClose", handler ); + + var handler = function() { + if(obj.value == '') { + obj.value = aStr['comment']; + $("#comment-edit-text-" + id).removeClass("comment-edit-text-full").addClass("comment-edit-text-empty"); + $("#comment-tools-" + id).hide(); + } + }; + + $(document).bind( "click.commentClose", handler ); + + } + function commentOpen(obj,id) { if(obj.value == aStr['comment']) { obj.value = ''; $("#comment-edit-text-" + id).addClass("comment-edit-text-full"); $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty"); $("#mod-cmnt-wrap-" + id).show(); - openMenu("comment-edit-submit-wrapper-" + id); + openMenu("comment-tools-" + id); return true; } return false; } + function commentClose(obj,id) { if(obj.value == '') { obj.value = aStr['comment']; $("#comment-edit-text-" + id).removeClass("comment-edit-text-full"); $("#comment-edit-text-" + id).addClass("comment-edit-text-empty"); $("#mod-cmnt-wrap-" + id).hide(); - closeMenu("comment-edit-submit-wrapper-" + id); + closeMenu("comment-tools-" + id); return true; } return false; @@ -32,14 +66,13 @@ } } - function commentInsert(obj,id) { var tmpStr = $("#comment-edit-text-" + id).val(); if(tmpStr == '$comment') { tmpStr = ''; $("#comment-edit-text-" + id).addClass("comment-edit-text-full"); $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty"); - openMenu("comment-edit-submit-wrapper-" + id); + openMenu("comment-tools-" + id); } var ins = $(obj).html(); ins = ins.replace('<','<'); @@ -62,7 +95,7 @@ tmpStr = ""; $("#comment-edit-text-" + id).addClass("comment-edit-text-full"); $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty"); - openMenu("comment-edit-submit-wrapper-" + id); + openMenu("comment-tools-" + id); $("#comment-edit-text-" + id).val(tmpStr); } @@ -79,8 +112,9 @@ return true; } - - + function viewsrc(id) { + $.colorbox({href: 'viewsrc/' + id }); + } function qCommentInsert(obj,id) { var tmpStr = $("#comment-edit-text-" + id).val(); @@ -101,12 +135,14 @@ function showHideComments(id) { if( $('#collapsed-comments-' + id).is(':visible')) { - $('#collapsed-comments-' + id).hide(); + $('#collapsed-comments-' + id).slideUp(); $('#hide-comments-' + id).html(aStr['showmore']); + $('#hide-comments-total-' + id).show(); } else { - $('#collapsed-comments-' + id).show(); + $('#collapsed-comments-' + id).slideDown(); $('#hide-comments-' + id).html(aStr['showfewer']); + $('#hide-comments-total-' + id).hide(); } } @@ -161,17 +197,6 @@ msie = false; // $.browser.msie ; - /* setup tooltips *//* - $("a,.tt").each(function(){ - var e = $(this); - var pos="bottom"; - if (e.hasClass("tttop")) pos="top"; - if (e.hasClass("ttbottom")) pos="bottom"; - if (e.hasClass("ttleft")) pos="left"; - if (e.hasClass("ttright")) pos="right"; - e.tipTip({defaultPosition: pos, edgeOffset: 8}); - });*/ - var e = document.getElementById('content-complete'); if(e) pageHasMoreContent = false; @@ -341,6 +366,7 @@ if(data.all_events_today == 0) { data.all_events_today = ''; $('.all_events-today-update').removeClass('show') } else { $('.all_events-today-update').addClass('show') } $('.all_events-today-update').html(data.all_events_today); + $.jGrowl.defaults.closerTemplate = '<div>[ ' + aStr['closeAll'] + ']</div>'; $(data.notice).each(function() { $.jGrowl(this.message, { sticky: true, theme: 'notice' }); @@ -564,7 +590,7 @@ function updateConvItems(mode,data) { var update_url; - if(typeof buildCmd == 'function') { +// if(typeof buildCmd == 'function') { if(scroll_next) { bParam_page = next_page; page_load = true; @@ -573,18 +599,18 @@ function updateConvItems(mode,data) { bParam_page = 1; } update_url = buildCmd(); - } - else { - page_load = false; - var udargs = ((page_load) ? '/load' : ''); - update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0); - } +// } +// else { +// page_load = false; +// var udargs = ((page_load) ? '/load' : ''); +// update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0); +// } if(page_load) $("#page-spinner").spin('small'); $.get(update_url,function(data) { - var update_mode = ((page_load) ? 'replace' : 'update'); + var update_mode = ((page_load && bParam_page == 1) ? 'replace' : 'update'); if(scroll_next) update_mode = 'append'; page_load = false; @@ -612,15 +638,6 @@ function updateConvItems(mode,data) { } - - function imgbright(node) { -// $(node).removeClass("drophide").addClass("drop"); - } - - function imgdull(node) { -// $(node).removeClass("drop").addClass("drophide"); - } - function notify_popup_loader(notifyType) { /* notifications template */ @@ -747,6 +764,7 @@ function updateConvItems(mode,data) { $("#comment-edit-form-" + id).serialize(), function(data) { if(data.success) { + $("#comment-edit-preview-" + id).hide(); $("#comment-edit-wrapper-" + id).hide(); $("#comment-edit-text-" + id).val(''); var tarea = document.getElementById("comment-edit-text-" + id); |