Created
October 12, 2010 00:54
-
-
Save edorcutt/621484 to your computer and use it in GitHub Desktop.
Kynetx Javascript Annotation via Event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruleset a169x135 { | |
meta { | |
name "Kynetx_Annotate_Javascript_via_Event" | |
description << | |
Kynetx Javascript Annotation via Event | |
from Kynetx Annotate V 2.0 | |
http://docs.kynetx.com/docs/NEW_Search_Annotation_V2.0 | |
>> | |
author "Ed Orcutt" | |
logging on | |
} | |
dispatch { | |
domain "google.com" | |
domain "bing.com" | |
domain "yahoo.com" | |
} | |
global {} | |
rule search_annotate_rule is active { | |
select using "google.com|bing.com/search|search.yahoo.com/search" setting() | |
every { | |
// Request annotation of the current page. We name this specific | |
// annotation rentals. Also we tell annotation we want a | |
// remote event for annotation. | |
annotate:annotate("rentals") with remote = "event"; | |
} | |
} | |
// This rule looks for the webevent annotate_search and executes only | |
// when the name is rentals | |
rule annotate_rentals is active { | |
select when web annotate_search name "rentals" setting () | |
foreach annotate_data setting (mykey,myvalue) | |
pre { | |
// This parameter is used by the annotation system to | |
// know which annotator should work on the resulting data | |
annotate_instance = page:env("annotate_instance"); | |
// This is the data collected by the annotation framework. | |
// This is in the same format as the remote annotation. | |
annotate_data = page:env("annotatedata").as("json"); | |
} | |
// Tell the annotation framework that for the given item (mykey) | |
// to update the annotation wrapper with the provided html | |
// on the given annotate_instance. | |
annotate:add_annotation(mykey, "<span>Event Annotation Me</span>", annotate_instance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment