-
-
Save kwijibo/105637 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
CmdUtils.CreateCommand({ | |
name: "openvocab-property", | |
takes: {"term": noun_arb_text}, | |
homepage: "http://kwijibo.talis.com/", | |
author: { name: "Keith Alexander", email: "[email protected]"}, | |
license: "MPL", | |
description: "Brings up the form to edit or create a property named after the selected or inputed text on http://open.vocab.org. nb: propertiesmost be lower case", | |
buildUrl: function(term){ | |
var uri = "http://open.vocab.org/terms/"+term.text.replace('/ /g', ''); | |
return "http://open.vocab.org/forms/editprop?uri=" + encodeURIComponent(uri) | |
}, | |
preview: function(previewBlock, term) { | |
previewBlock.innerHTML = "finding openvocab:" + term.text ; | |
var baseURI = this.buildUrl(term); | |
jQuery.ajax({ | |
type: "GET", | |
url: baseURI, | |
datatype: "string", | |
error: function(responseData) { | |
previewBlock.innerHTML = "<em>Error:" + responseData + "</em>"; | |
}, | |
success: function(responseData) { | |
previewBlock.innerHTML = responseData; | |
jQuery("*", previewBlock).css({"fontSize":"8pt", "color": "white"}); | |
jQuery("#header, #footer, #search", previewBlock).hide(); | |
jQuery("form td *", previewBlock).css({"width": "50%"}); | |
} | |
}); | |
}, | |
execute: function(term) { | |
var uri = this.buildUrl(term); | |
Utils.openUrlInBrowser(uri); | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment