(Classic) content_changed()
Engine Compatibility
content_changed
is not supported by the Node engine.content_changed(<selector>) with parameters = {"name": "value"}
The content_changed action allows for the checking of changes to the text contents on a page using a jquery selector. This action will set an event timer that executes ever ½ second and checks the prior value of the content with the current contents. If it changes a content_change event will be raised with the optional parameters passed back.
content_changed("#foo") with parameters = {"name": "value"}
The following ruleset shows content_changed being used
ruleset a1299x167 { meta { name "Content Changed Example" author "nathan cerny" logging on } dispatch { // domain "exampley.com" } rule watcher is active { select when pageview ".*" setting () { append('body', '<div id="res">Original Content</div>'); content_changed("#res") with parameters = {"search_results":true}; emit << setTimeout(function () { $K('#res').html("New Content"); }, 1000); >>; } } rule true_listener is active { select when web content_change search_results "true" setting () { notify("Content Changed","true listener"); } } rule false_listener is active { select when web content_change search_results "false" setting () { notify("Content Changed","false listener"); } } }
The following demonstrates the preceding rule:
Copyright Picolabs | Licensed under Creative Commons.