Skip to content

Instantly share code, notes, and snippets.

@edorcutt
Created October 8, 2010 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edorcutt/617431 to your computer and use it in GitHub Desktop.
Save edorcutt/617431 to your computer and use it in GitHub Desktop.
Kynetx Local Javascript Annotation from Kynetx Annotate V 2.0 http://k-docs.s3.amazonaws.com/Annotate%20V%202.pdf
ruleset a169x129 {
meta {
name "Kynetx_Annotate_Local_Javascript"
description <<
Kynetx Local Javascript 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 collected as part of looking for what
// needs to be annotated on page.
function annotate_rentalcars(toAnnotate, wrapper, data) {
// In this case the data parameter has an element called
// domain that provides the domain name of the link on the
// search page.
if (data.domain == "www.enterprise.com" ||
data.domain == "www.paylesscar.com" ) {
// Here we append some html to the wrapper
// annotation element.
wrapper.append("<div style='border: 3px solid red'>Append</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.
annotate:annotate("rentals") with
annotator = <| annotate_rentalcars |>;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment