Bible Verse Lookup

Posted by jayray, Last update almost 6 years ago

A simple JavaScript action to get selected verse and output the full text from (WEB translation). If no text is selected, the action prompts for text entry. I have recently updated the script to allow for a Random verse option and a Verse of the Day, both provided by (NIV translation).


  • script

    var verse = editor.getSelectedText(); //get selected verse
    if (!verse || verse.length == 0) { // if there was no selection, ask for one
    	var newVerse = Prompt.create();
    	newVerse.title = "Enter Verse Information";
    	newVerse.message = "No text was selected. Please enter the verse(s) below.";
    	newVerse.addTextField("verseName","Verse Name","");
    	var newSelection =;
    	var newVerseContents = newVerse.fieldValues["verseName"];
    	if (newVerse.buttonPressed == "OK" && newVerseContents != 0){
    		var verse = newVerseContents;
    		var votd = false;
    		var random = false;
    	} else {
    		var elseVerse = Prompt.create();
    		elseVerse.title = "Error: No Verse Provided";
    		elseVerse.message = "What would you like to do instead?";
    		elseVerse.addButton("Verse of the Day");
    		var elseSelection =;
    		if (elseVerse.buttonPressed == "Verse of the Day"){
    	   	var votd = true;
    	  	} else if (elseVerse.buttonPressed == "Random"){
    	  		var random = true;
    if (votd){
    	var url = "";
    } else if (random) {
    	var url = "";
    } else {
    	var url = ""+encodeURIComponent(verse)+"?verse_numbers=true"; //define url for parsing
    var http = HTTP.create(); //create HTTP object
    var response = http.request({
    	"url": url,
    	"method": "GET",
    var jsonObj = JSON.parse(response.responseText);
    if (votd || random){
    	var verse = jsonObj.verse.details.reference;
    	var text = jsonObj.verse.details.text;
    } else {
    	var text = jsonObj.text;
    var verseRange = editor.getSelectedRange(); // retrieve range of that selection


  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.