Skip to content

Instantly share code, notes, and snippets.

@edorcutt
Created October 9, 2010 19:50
Show Gist options
  • Save edorcutt/618542 to your computer and use it in GitHub Desktop.
Save edorcutt/618542 to your computer and use it in GitHub Desktop.
Kynetx Remote Annotation from Kynetx Annotate V 2.0 http://k-docs.s3.amazonaws.com/Annotate%20V%202.pdf
ruleset a169x132 {
meta {
name "Kynetx_Annotate_Remote"
description <<
Kynetx Remote Annotation
from Kynetx Annotate V 2.0
http://k-docs.s3.amazonaws.com/Annotate%20V%202.pdf
>>
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 {
emit <<
// This callback function will be passed
//
// toAnnotate - Item on screen that is being annotated
// wrapper - A wrapper div element that can be altered
// with the actual annotation.
// data - Data returned from remote service call.
// needs to be annotated on page.
function annotate_rentalcars(toAnnotate, wrapper, data) {
// In this case the data parameter is the data provided by
// the remote service. For our example it might have a
// discount amount we want to display.
wrapper.append("<div style='border: 3px solid red'>" + data.discount + "</div>");
// All wrappers are hidden by default so request that
// it be shown now.
wrapper.show();
}
>>;
// Request annotation of the current page. We name this specific
// annotation rentals and provide the annotate_rentalcars function
// as the javascript function that will add the annotation to the
// page. Also we provide a remote URL that will be used to compute
// what results should be annotated and provide extra data to the
// annotation function.
annotate:annotate("rentals") with
annotator = <| annotate_rentalcars |> and
remote = "http://kynetx.edorcutt.org/annotate/remote_annotate.php?jsoncallback=?";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment