Making feedback message disappear on click

Making feedback message disappear on click

  

Users of our application often complain that it's hard to hit the closing button of the feedback message, and they also confuse a "cross" icon on the left, thinking it should close, but it's just an icon. So what I'm trying to do is to make it close when user clicks anywhere on the message. After looking into RichWisgets script, I did a web block which should override the original RichWidgets_Feedback_Message_feedbackSlideDown function. This didn't look like a complicated task, but now I'm messing with it the whole day. The best version I have is this:


SyntaxEditor Code Snippet

var origRichWidgets_Feedback_Message_feedbackSlideDown = RichWidgets_Feedback_Message_feedbackSlideDown;

RichWidgets_Feedback_Message_feedbackSlideDown = function(feedbackWrapperId, autoHide) {
    origRichWidgets_Feedback_Message_feedbackSlideDown(feedbackWrapperId, autoHide);    
    $(function($){
        setTimeout(function() {
            $('#' + feedbackWrapperId).click(function(){
                $(RichWidgets_Feedback_Message_widget).hide('slide',{direction:'up'}, 500); 
                clearTimeout(RichWidgets_Feedback_Message_timerHide);
            });
        }, 1000);
    });
}

This at least makes the message disappear, but without sliding, because error happens on the line with hide() call:

_osjs.js?10_0_408_0:26 Uncaught TypeError: $.easing[this.easing] is not a function
    at init.run (_osjs.js?10_0_408_0:26)
    at h (_osjs.js?10_0_408_0:18)
    at Function.$.fx.timer (_osjs.js?10_0_408_0:26)
    at H (_osjs.js?10_0_408_0:18)
    at HTMLDivElement.g (_osjs.js?10_0_408_0:26)
    at Function.dequeue (_osjs.js?10_0_408_0:18)
    at HTMLDivElement.<anonymous> (_osjs.js?10_0_408_0:18)
    at Function.each (_osjs.js?10_0_408_0:18)
    at a.fn.init.each (_osjs.js?10_0_408_0:18)
    at a.fn.init.queue (_osjs.js?10_0_408_0:18)

I don't understand what is it about and how is it related. Any ideas? Or maybe someone did what i'm trying to achieve and can share solution?

Interesting is that at some point I decided to simply copy the whole function from RichWidgets and make small change there - but it didn't work at all, and the error was the same, even when I tried version without any changes.

Hi,


That happens because the $ available for your applications is different from the $ used inside RichWidgets. The "easing" is part of jqueryUI, that is not present in the normal $.


Does this work?


var origRichWidgets_Feedback_Message_feedbackSlideDown = RichWidgets_Feedback_Message_feedbackSlideDown;

RichWidgets_Feedback_Message_feedbackSlideDown = function(feedbackWrapperId, autoHide) {
    origRichWidgets_Feedback_Message_feedbackSlideDown(feedbackWrapperId, autoHide);    
    $(function($){
        setTimeout(function() {
            $('#' + feedbackWrapperId).click(function(){
                $('#' + feedbackWrapperId).find('.Feedback_Message_Wrapper_Close').click();
            });
        }, 1000);
    });
}


Regards,

João Rosado


João Rosado , I tried this already earlier, the error is different:

_osjs.js?10_0_408_0:32 Uncaught RangeError: Maximum call stack size exceeded
    at String.replace (<anonymous>)
    at a.fn.init (_osjs.js?10_0_408_0:32)
    at $ (_osjs.js?10_0_408_0:18)
    at HTMLDivElement.<anonymous> (FeedbackMessage_CloseOnClick.js?23888:8)
    at HTMLDivElement.dispatch (_osjs.js?10_0_408_0:19)
    at HTMLDivElement.h (_osjs.js?10_0_408_0:19)
    at Object.trigger (_osjs.js?10_0_408_0:19)
    at HTMLAnchorElement.<anonymous> (_osjs.js?10_0_408_0:19)
    at Function.each (_osjs.js?10_0_408_0:18)
    at a.fn.init.each (_osjs.js?10_0_408_0:18)

You are saying that $ is different in RichWidgets and in my app - does this mean that even if I clone the whole Feedback_Message block - it won't work? I'm about to try that.

So I did a copy of Feedback_Message, made the change I needed, and now it works smoothly. Even though I don't like this approach off course - will live with it.