How can I remove the "notify" field

When I respond to a web event, I would like to delete the previously disappeared (?) Notification. Is there any way KRL can say to leave or do it through javascript?

If you need to do this using javascript, please provide an example

+3
source share
1 answer

New answer Shiny Awesomer!

All my previous answers suck! What you really need to do is fire the click event on the close button.

$K(".kGrowl-notification .close").trigger("click");

Just release this javascript when you respond with a web event.

Best sample application:

ruleset a60x469 {
  meta {
    name "better-close-notify-example"
    description <<
      better-close-notify-example
    >>
    author "Mike Grace"
    logging on
  }

  rule put_notify_on_page {
    select when pageview ".*"
    {
      // put notify on page
      notify("Hello","I'm on your page") with sticky = true;

      // raise web event
      emit <|
        setTimeout(function() {
          app = KOBJ.get_application("a60x469");
          app.raise_event("clear_notify");
        }, 2000);
      |>;
    }
  }

  rule clear_notify {
    select when web clear_notify
    {
      emit <|
        $K(".kGrowl-notification .close").trigger("click")
      |>;
    }
  }
}

OLD CRAPPY ANSWER


There are several ways to do this.

< > :

set_element_attr

set_element_attr(".kGrowl", "style", "display:none");

[] ()

emit <|
  $K(".kGrowl").remove();
|>;

[]

emit <|
  $K(".kGrowl").hide();
|>;

replace_html ()

replace_html(".kGrowl","");

:

ruleset a60x468 {
  meta {
    name "example-clear-notify"
    description <<
      example-clear-notify
    >>
    author "Mike Grace"
    logging on
  }

  rule put_notify_on_page {
    select when pageview ".*"
    pre {
      button =<<
        <button id="clear-notify">Click me to clear the notify</button>
      >>;
    }
    {
      notify("Hello","I'm on your page") with sticky = true;
      append("body", button);
      emit <|
        $K("#clear-notify").click(function() {
          app = KOBJ.get_application("a60x468");
          app.raise_event("clear_notify");
        });
      |>;
    }
  }

  rule clear_notify {
    select when web clear_notify
    {
      replace_inner(".kGrowl","");
    }
  }
}

: = > http://mikegrace.s3.amazonaws.com/forums/stack-overflow/example-clear-notify-dev_bookmarklet.html

example.com:

alt text

:

alt text

+3

Source: https://habr.com/ru/post/1779088/


All Articles