Bible Verses
From OpenSocial Directory
|
| ||||||||||||||||||||
Image:Example.jpg==Reviews==
Add a Review
Template:Bible Verses Reviews
[edit] Comments
| Leave a comment |
|---|
Get Inspired
"Build something for yourself" they say, and this is what I did when I made Bible Verses. I get much-needed daily exposure to scripture and usually find something inspiring while browsing the Bible and reading other users' prayers. Sometimes prayers are funny, sometimes solemn, but all are very interesting. There are so many stories being told in just a few words... and I try to read all the prayers and send good wishes to people, but its already getting so busy, its hard to keep up. Very exciting!!
comment posted by: Barry Welch (Wed Apr 02 2008 23:49:01 GMT-0500 (Central Daylight Time))
"Build something for yourself" they say, and this is what I did when I made Bible Verses. I get much-needed daily exposure to scripture and usually find something inspiring while browsing the Bible and reading other users' prayers. Sometimes prayers are funny, sometimes solemn, but all are very interesting. There are so many stories being told in just a few words... and I try to read all the prayers and send good wishes to people, but its already getting so busy, its hard to keep up. Very exciting!!
comment posted by: Barry Welch (Wed Apr 02 2008 23:49:01 GMT-0500 (Central Daylight Time))
[edit] Code
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs
title="Bible Verses"
icon="http://www.joshuaslist.com/images/cross_logo.gif"
description="Play the Bible Verses quiz and challenge your friends. Post a prayer and share it with your friends. Post your favorite bible passages to your profile and scrapbook."
summary="Play the Bible Verses quiz and challenge your friends. Post a prayer and share it with your friends. Post your favorite bible passages to your profile and scrapbook."
author="Barry Welch"
author_email="barry@calendarhub.com"
screenshot="http://www.joshuaslist.com/images/screen.gif"
thumbnail="http://www.joshuaslist.com/images/bible_app_logo_with_text_below.gif"
author_location="Wichita, KS"
author_affiliation=""
title_url="http://www.joshuaslist.com"
directory_title="Bible Verses">
<Require feature="opensocial-0.7" />
<Require feature="views"/>
<Require feature="dynamic-height" />
<Require feature="skins"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<style type="text/css">
// Orkut
#search {
FONT-SIZE: 13px;
COLOR: #000;
FONT-FAMILY: Arial;
BACKGROUND-COLOR: #fff;
}
#search .content {
PADDING-RIGHT: 10px;
PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px;
PADDING-TOP: 28px;
}
#search .bottom {
PADDING-RIGHT: 0px;
DISPLAY: block;
PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px; MARGIN: 0px; LINE-HEIGHT: 13px; PADDING-TOP: 0px; HEIGHT: 13px;
}
#search_nav {
Z-INDEX: 1;
LEFT: 140px;
POSITION: absolute;
TOP: 45px;
}
#search .button {
FLOAT: left;
MARGIN: 0px 5px 0px 0px;
CURSOR: pointer;
}
#search .button SPAN {
DISPLAY: none;
}
#search_nav .current {
HEIGHT: 37px;
}
#search BUTTON {
PADDING-RIGHT: 0px;
PADDING-LEFT: 0px;
//RIGHT: 55px;
//#RIGHT: 40px;
//_RIGHT: 40px;
LEFT: 635px;
BACKGROUND: none transparent scroll repeat 0% 0%;
PADDING-BOTTOM: 0px;
MARGIN: 0px;
WIDTH: 130px;
CURSOR: pointer;
BORDER-TOP-STYLE: none;
PADDING-TOP: 0px;
BORDER-RIGHT-STYLE: none;
BORDER-LEFT-STYLE: none;
POSITION: absolute;
TOP: 72px;
HEIGHT: 45px;
BORDER-BOTTOM-STYLE: none;
}
#search BUTTON.search {
BACKGROUND: url(http://www.joshuaslist.com/images/search_go.gif) no-repeat 0px 0px;
}
.question_text {
COLOR: #6188cd;
font-family: arial;
font-size: 13px;
font-weight: bold;
}
#search_for_answers {
BACKGROUND: url(http://www.joshuaslist.com/images/search_for_answers.gif) no-repeat 0px 0px;
WIDTH: 225px;
HEIGHT: 32px;
}
#search_form .top {
BACKGROUND: url(http://www.joshuaslist.com/images/input_search_top.gif) no-repeat 0px 0px;
}
#search_form {
PADDING-RIGHT: 0px;
PADDING-LEFT: 0px;
BACKGROUND: url(http://www.joshuaslist.com/images/input_search_middle.gif) repeat-y 0px 0px;
PADDING-BOTTOM: 0px;
MARGIN: 0px 0px 0px 0px;
PADDING-TOP: 0px;
WIDTH: 500px;
POSITION: relative;
}
#post_a_prayer_input {
PADDING-RIGHT: 10px;
PADDING-LEFT: 1px;
FONT-SIZE: 18px;
BACKGROUND: none transparent scroll repeat 0% 0%;
PADDING-BOTTOM: 0px;
MARGIN: 0px 0px -1px;
MARGIN-RIGHT: 20px;
OVERFLOW: hidden;
WIDTH: 450px;
BORDER-TOP-STYLE: none;
PADDING-TOP: 0px;
FONT-FAMILY: Arial;
BORDER-RIGHT-STYLE: none;
BORDER-LEFT-STYLE: none;
HEIGHT: 24px;
BORDER-BOTTOM-STYLE: none;
color: #aaa;
}
#top_scores_box{
width: 295px;
}
#post_a_prayer_notinput {
PADDING-RIGHT: 0px;
PADDING-LEFT: 10px;
FONT-SIZE: 18px;
BACKGROUND: none transparent scroll repeat 0% 0%;
PADDING-BOTTOM: 0px;
MARGIN: 0px 0px -1px;
OVERFLOW: hidden;
WIDTH: 135px;
BORDER-TOP-STYLE: none;
PADDING-TOP: 0px;
FONT-FAMILY: Arial;
BORDER-RIGHT-STYLE: none;
BORDER-LEFT-STYLE: none;
HEIGHT: 24px;
BORDER-BOTTOM-STYLE: none;
color: black;
}
.comment_textarea{
FONT-FAMILY: Arial;
FONT-SIZE: 11px;
}
#search_form .bottom {
BACKGROUND: url(http://www.joshuaslist.com/images/input_search_bottom.gif) no-repeat 0px 0px;
HEIGHT: 11px;
}
{
overflow-y: hidden;
overflow-x: hidden;
}
#body{
overflow-y: hidden;
overflow-x: hidden;
}
#app_wide{
font-family: Verdana,Arial,san-serif;
overflow-y: hidden;
overflow-x: hidden;
}
#canvas_app{
padding: 8px;
overflow-y: hidden;
overflow-x: hidden;
}
#profile_app{
}
#canvas_post_a_prayer_controls{
}
#bible_quiz{
margin-top: 0px;
}
#bible_verse_of_the_day{
margin-top: 8px;
}
#browse{
margin-top: 8px;
}
#canvas_favorites{
margin-top: 8px;
}
#canvas_favorites_verses_container{
background-color: #d5e3f5;
padding: 8px;
}
.prayer{
font-weight: bold;
font-family: Arial;
}
.comments{
}
.comment_item{
}
.comment_item_text{
margin-top: 5px;
}
.post_a_prayer_left_col{
width: 470px;
}
.post_a_prayer_right_col{
background-color: #c4d8f2;
width: 300px;
padding: 8px;
border: 1px solid #ccc;
}
#app_wide_prayer_feed{
}
.app_inner{
padding: 0px 0px 0px 0px;
}
.title{
font-weight: bold;
}
.even{
background-color: #d5e3f5;
}
.odd{
background-color: #e5eff9;
}
.note{
color: #777;
font-weight: plain;
}
.small_note{
color: #777;
font-weight: plain;
}
a{
color:#02679c;
text-decoration:none;
}
a:hover{
color:#00344f;
text-decoration:underline;
}
a:visited{
color:#02679c;
}
ul.intabs{
list-style: none;
height:25px;
margin:0;
padding:0;
}
ul.intabs li{
background-image: url(http://img2.orkut.com/img/castro/tabnotsel_r.gif);
background-repeat:no-repeat;
background-position:right;
margin-right:5px;
line-height:25px;
font-weight:700;
padding-right:6px;
float:left;
list-style-type: none;
color: #deeef6;
}
ul.intabs li.sel{
background-image: url(http://img4.orkut.com/img/castro/tabsel_r.gif);
}
ul.intabs li .ltab{
background-image: url(http://img3.orkut.com/img/castro/tabnotsel_l.gif);
width:6px;
height:25px;
background-position:left;
background-repeat:no-repeat;
float:left;
}
ul.intabs li.sel .ltab{
background-image: url(http://img1.orkut.com/img/castro/tabsel_l.gif);
width:6px;
height:25px;
background-position:left;
background-repeat:no-repeat;
float:left;
}
.delivery_schedule{
background-color: #d9e6f7;
border: solid gray 1px;
padding:15px;
width: 250px;
}
.form_area{
padding:15px;
border: 1px solid #ccc;
}
.smalltext{
font-size: 11px;
}
.medtext{
font-size: 15px;
}
.largetext{
font-size: 17px;
}
.bigtext{
font-size: 54px;
}
.countdown_display{
color: #5887c3;
}
.init_quiz_display{
color: #5887c3;
}
.big_button{
}
.left{
float: left;
}
.right{
float: right;
}
.clear{
clear: both;
}
.field{
margin-right: 8px;
}
.field60{
width: 60px;
}
.field80{
width: 80px;
}
.field120{
width: 120px;
}
.field140{
width: 140px;
}
.bold{
font-weight: bold;
}
.attention{
color: #ee5500;
}
#countdown_target{
color: #5887c3;
}
</style>
<script type="text/javascript">
// Domain Canvas (Orkut Doesnt support so not used) Preview
var domain_relative_links = [["hi5.com", "/apps/displayAppCanvas.do?appId=4552", "/apps/entry/www.joshuaslist.com/specifications/latest?view=preview&from=devhome&"],
["orkut.com", "/Application.aspx?uid=1869511445073537195&appId=846335625144", "/AppInfo.aspx?appId=846335625144"]];
var owner;
var viewer;
var owner_friends = new Array;
var token;
var app_lang;
var app_domain;
var favorites = new Array;
var base_url = "http://www.joshuaslist.com/";
var platform_url = "http://sandbox.orkut.com";
var replaceme_text = "Click here to add comments";
var app_name = "Bible Verses";
var enter_verse_here_text = "add a prayer here"; // If you change it, you have to change the textarea onclick parameter below as well
var bible_fetch_yet = false;
var prayerWords = [];
var prayerWordsCurrentPage = 0;
var prayerWordsPerPage = 6;
// Common request params
var req_params = {};
req_params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM;
req_params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
req_params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.NONE;
//////////////////////////////
// Quiz Question Timer Vars //
//////////////////////////////
//var timer_period = 30;
//var countdown_timer_id = null;
var question_countdown_timer_id = null;
var question_time_left_timer_id = null;
var countdown_val = 3;
var time_left_var = 30;
var quiz_is_active_tab = false;
// Scrolling prayers
var scrollingPrayerList = [["World peace", "http://"],["End to hunger", "http://"],["End of war", "http://"],["Troops overseas", "http://"],["Successful ventures", "http://"],["Family health", "http://"],["My friends", "http://"],["My employer", "http://"],["Post-a-prayer", "http://"]];
var collections = [["The Old Testament", [["Genesis", [31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,55,32,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26]],["Exodus", [22,25,22,31,23,30,25,32,35,29,10,51,22,31,27,36,16,27,25,26,36,31,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38]],["Leviticus", [17,16,17,35,19,30,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34]],["Numbers", [54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,50,13,32,22,29,35,41,30,25,18,65,23,31,40,16,54,42,56,29,34,13]],["Deuteronomy", [46,37,29,49,33,25,26,20,29,22,32,32,18,29,23,22,20,22,21,20,23,30,25,22,19,19,26,68,29,20,30,52,29,12]],["Joshua", [18,24,17,24,15,27,26,35,27,43,23,24,33,15,63,10,18,28,51,9,45,34,16,33]],["Judges", [36,23,31,24,31,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,25]],["Ruth", [22,23,18,22]],["1 Samuel", [28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,15,23,29,22,44,25,12,25,11,31,13]],["2 Samuel", [27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,33,43,26,22,51,39,25]],["1 Kings", [53,46,28,34,18,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,53]],["2 Kings", [18,25,27,44,27,33,20,29,37,36,21,21,25,29,38,20,41,37,37,21,26,20,37,20,30]],["1 Chronicles", [54,55,24,43,26,81,40,40,44,14,47,40,14,17,29,43,27,17,19,8,30,19,32,31,31,32,34,21,30]],["2 Chronicles", [17,18,17,22,14,42,22,18,31,19,23,16,22,15,19,14,19,34,11,37,20,12,21,27,28,23,9,27,36,27,21,33,25,33,27,23]],["Ezra", [11,70,13,24,17,22,28,36,15,44]],["Nehemiah", [11,20,32,23,19,19,73,18,38,39,36,47,31]],["Esther", [22,23,15,17,14,14,10,17,32,3]],["Job", [22,13,26,21,27,30,21,22,35,22,20,25,28,22,35,22,16,21,29,29,34,30,17,25,6,14,23,28,25,31,40,22,33,37,16,33,24,41,30,24,34,17]],["Psalms", [6,12,8,8,12,10,17,9,20,18,7,8,6,7,5,11,15,50,14,9,13,31,6,10,22,12,14,9,11,12,24,11,22,22,28,12,40,22,13,17,13,11,5,26,17,11,9,14,20,23,19,9,6,7,23,13,11,11,17,12,8,12,11,10,13,20,7,35,36,5,24,20,28,23,10,12,20,72,13,19,16,8,18,12,13,17,7,18,52,17,16,15,5,23,11,13,12,9,9,5,8,28,22,35,45,48,43,13,31,7,10,10,9,8,18,19,2,29,0,7,8,9,4,8,5,6,5,6,8,8,3,18,3,3,21,26,9,8,24,13,10,7,12,15,21,10,20,14,9,6]],["Proverbs", [33,22,35,27,23,35,27,36,18,32,31,28,25,35,33,33,28,24,29,30,31,29,35,34,28,28,27,28,27,33,31]],["Ecclesiastes", [18,26,22,16,20,12,29,17,18,20,10,14]],["Song of Solomon", [17,17,11,16,16,13,13,14]],["Isaiah", [31,22,26,6,30,13,25,22,21,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,12,25,24]],["Jeremiah", [19,37,25,31,31,30,34,22,26,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34]],["Lamentations", [22,22,66,22,22]],["Ezekiel", [28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,49,32,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35]],["Daniel", [21,49,30,37,31,28,28,27,27,21,45,13]],["Hosea", [11,23,5,19,15,11,16,14,17,15,12,14,16,9]],["Joel", [20,32,21]],["Amos", [15,16,15,13,27,14,17,14,15]],["Obadiah", [21]],["Jonah", [17,10,10,11]],["Micah", [16,13,12,13,15,16,20]],["Nahum", [15,13,19]],["Habakkuk", [17,20,19]],["Zephaniah", [18,15,20]],["Haggai", [15,23]],["Zechariah", [21,13,10,14,11,15,14,23,17,12,17,14,9,21]],["Malachi", [14,17,18,6]]]],["The New Testament", [["Matthew",
[25,23,17,25,48,34,29,34,38,42,30,50,58,36,39,28,27,35,30,34,46,46,39,51,46,75,66,20]],["Mark", [45,28,35,41,43,56,37,38,50,52,33,44,37,72,47,20]],["Luke", [80,52,38,44,39,49,50,56,62,42,54,59,35,35,32,31,37,43,48,47,38,71,56,53]],["John", [51,25,36,54,47,71,53,59,41,42,57,50,38,31,27,33,26,40,42,31,25]],["Acts", [26,47,26,37,42,15,60,40,43,48,30,25,52,28,41,40,34,28,41,38,40,30,35,27,27,32,44,31]],["Romans", [32,29,31,25,21,23,25,39,33,21,36,21,14,23,33,27]],["1 Corinthians", [31,16,23,21,13,20,40,13,27,33,34,31,13,40,58,24]],["2 Corinthians", [24,17,18,18,21,18,16,24,15,18,33,21,14]],["Galatians", [24,21,29,31,26,18]],["Ephesians", [23,22,21,32,33,24]],["Philippians", [30,30,21,23]],["Colossians", [29,23,25,18]],["1 Thessalonians", [10,20,13,18,28]],["2 Thessalonians", [12,17,18]],["1 Timothy", [20,15,16,16,25,21]],["2 Timothy", [18,26,17,22]],["Titus", [16,15,15]],["Philemon", [25]],["Hebrews", [14,18,19,16,14,20,28,13,28,39,40,29,25]],["James", [27,26,18,17,20]],["1 Peter", [25,25,22,19,14]],["2 Peter", [21,22,18]],["1 John", [10,29,24,21,21]],["2 John", [13]],["3 John", [14]],["Jude", [25]],["Revelation", [20,29,22,11,14,17,17,13,21,11,19,17,18,20,8,21,18,24,21,15,27,21]]]]];
var top_tabs = ["favorites_tab", "popular_passages_tab", "browse_tab", "bible_quiz_tab", "search_tab", "post_a_prayer_tab", "home_tab", "profile_tab", "bible_verse_of_the_day_tab"];
var tab_elems = ["canvas_favorites", "popular_passages", "browse", "bible_quiz", "search", "post_a_prayer", "home", "profile", "bible_verse_of_the_day"];
var post_a_prayers_view_elems = ["canvas_post_a_prayer_my_prayers", "canvas_post_a_prayer_my_friends_prayers", "canvas_post_a_prayer_me_and_my_friends_prayers"];
setLoadingStatus('[Loading]');
_IG_RegisterOnloadHandler(function() {
if (isPreview()){
getElem('loading').style.display='none';
getElem('preview').style.display='';
} else {
app_lang = gadgets.util.getUrlParameters().lang;
app_domain = opensocial.getEnvironment().getDomain();
setLoadingStatus('[Fetching user data]');
var owner_friends_params={};
owner_friends_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 1000;
//owner_friends_params[opensocial.DataRequest.PeopleRequestFields.FILTER] = opensocial.DataRequest.FilterType.HAS_APP;
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER), "owner");
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER), "viewer");
req.add(req.newFetchPeopleRequest("OWNER_FRIENDS", owner_friends_params), "owner_friends");
req.send(function(dataResponse){
// Set the logo link at the bottom right
setPicLogoLink();
setLoadingStatus('[Extracting user data]');
var i=0;
// Get the app ower
owner = dataResponse.get("owner").getData();
viewer = dataResponse.get("viewer").getData();
dataResponse.get("owner_friends").getData().each(function(person) {
owner_friends[i]=[person.getId(),person.getDisplayName(),person.getField(opensocial.Person.Field.THUMBNAIL_URL),person.getField(opensocial.Person.Field.EMAIL)];
i++;
}); // End friends iteration
// Go ahead and show the profile layout quickly if this is a profile view
if(isProfile()){
getElem('loading').style.display='none';
setLoadingStatus('');
document.getElementById('profile_app').style.display='';
adjh();
}
setLoadingStatus('[Registering App Instance]');
remote_register(function(){
if(isCanvas()){
getElem('loading').style.display='none';
setLoadingStatus('');
document.getElementById('canvas_app').style.display='';
if(!isViewerAllowedToSubmitOnCanvas()){
getElem('quiz_question_and_friends_scores_box').style.display='none';
getElem('canvas_post_a_prayer_controls').style.display='none';
getElem('browse_tab').style.display='none';
getElem('browse').style.display='none';
getElem('bible_verse_of_the_day_tab').style.display='none';
getElem('bible_verse_of_the_day').style.display='none';
getElem('canvas_post_a_prayer_daily_verse_container').style.display='none';
var nodes = document.getElementsByName('my_span');
for(var q=0; q<nodes.length; q++){
nodes[q].innerHTML = owner.getDisplayName()+"'s";
}
} else {
if(isHi5()){
playingBibleQuizActivity(owner);
}
}
}
switch_tabs('bible_quiz_tab', 'bible_quiz');
adjh();
}); // End of Registration
}); // End of Get Friends & Owner
}
}); // End of _IG_RegisterOnloadHandler
function getCanvasLink(){
var link;
for(var i=0; i<domain_relative_links.length; i++){
if(app_domain == domain_relative_links[i][0]){
link = domain_relative_links[i][1];
break;
}
}
return link;
}
function getAppInfoLink(){
var link;
for(var i=0; i<domain_relative_links.length; i++){
if(app_domain == domain_relative_links[i][0]){
link = domain_relative_links[i][2];
break;
}
}
return link;
}
// Returns true if the current context is the canvas
function isCanvas() {
return ( gadgets.views.getCurrentView().getName() == "canvas");
}
function isPreview(){
return ( gadgets.views.getCurrentView().getName() == "preview");
}
// Returns true if the current context is the profile
function isProfile() {
return ( gadgets.views.getCurrentView().getName() == "profile" );
}
function setSkin() {
document.write('<style type="text/css">');
document.write('.main {');
bgColor = gadgets.skins.getProperty(gadgets.skins.Property.BG_COLOR);
if(bgColor) {
document.write('background-color:' + bgColor + ';');
}
document.write('}');
document.write('</style>');
}
function remote_register(callback){
friends_guids = getFriendGuids();
remote_fetch_favorites(function(fav_data){
setLoadingStatus('[Extracting favorites]');
extract_favorites(fav_data);
adjh();
callback();
}, owner.getId(), friends_guids);
}
function change_collection(){
document.getElementById("my_content_area").innerHTML = "<br/> Please select a book & chapter";
populate_books_for_selected_collection();
populate_chapters_for_selected_book();
// Get the chapter for the current selections
fetch_chapter();
}
function change_book(){
populate_chapters_for_selected_book();
// Get the chapter for the current selections
fetch_chapter();
}
function change_chapter(){
// Get the chapter for the current selections
fetch_chapter();
}
function next_chapter(){
collection_select= document.getElementById("collections");
book_select = document.getElementById("books");
chapter_select = document.getElementById("chapters");
// If at the very end of the text
if(collection_select.selectedIndex == collection_select.options.length-1 &&
book_select.selectedIndex == book_select.options.length-1 &&
chapter_select.selectedIndex == chapter_select.options.length-1){
collection_select.selectedIndex = 0;
populate_books_for_selected_collection();
book_select.selectedIndex = 0;
populate_chapters_for_selected_book();
chapter_select.selectedIndex = 0;
// If at the end of the collection
} else if(book_select.selectedIndex == book_select.options.length-1 &&
chapter_select.selectedIndex == chapter_select.options.length-1){
collection_select.selectedIndex += 1;
populate_books_for_selected_collection();
book_select.selectedIndex = 0;
populate_chapters_for_selected_book();
chapter_select.selectedIndex = 0;
// If at the end of the book
} else if(chapter_select.selectedIndex == chapter_select.options.length-1){
book_select.selectedIndex += 1;
populate_chapters_for_selected_book();
chapter_select.selectedIndex = 0;
} else {
chapter_select.selectedIndex += 1;
}
// Get the chapter for the current selections
fetch_chapter();
}
function previous_chapter(){
collection_select= document.getElementById("collections");
book_select = document.getElementById("books");
chapter_select = document.getElementById("chapters");
// If at the very beginning of the text
if(collection_select.selectedIndex == 0 &&
book_select.selectedIndex == 0 &&
chapter_select.selectedIndex == 0){
collection_select.selectedIndex = collection_select.options.length-1;
populate_books_for_selected_collection();
book_select.selectedIndex = book_select.options.length-1;
populate_chapters_for_selected_book();
chapter_select.selectedIndex = chapter_select.options.length-1;
// If at the beginning of the collection
} else if(book_select.selectedIndex == 0 &&
chapter_select.selectedIndex == 0){
collection_select.selectedIndex -= 1;
populate_books_for_selected_collection();
book_select.selectedIndex = book_select.options.length-1;
populate_chapters_for_selected_book();
chapter_select.selectedIndex = chapter_select.options.length-1;
// If at the beginning of the book
} else if(chapter_select.selectedIndex == 0){
book_select.selectedIndex -= 1;
populate_chapters_for_selected_book();
chapter_select.selectedIndex = chapter_select.options.length-1;
} else {
chapter_select.selectedIndex -= 1;
}
// Get the chapter for the current selections
fetch_chapter();
}
function getClassName(obj) {
if (typeof obj != "object" || obj === null) return false;
return /(\w+)\(/.exec(obj.constructor.toString())[1];
}
function fetch_chapter(){
collection_select_elem = document.getElementById("collections");
var collection_num = collection_select_elem.options[collection_select_elem.selectedIndex].value;
book_select_elem = document.getElementById("books");
var book_num = book_select_elem.options[book_select_elem.selectedIndex].value;
chapter_select_elem = document.getElementById("chapters");
var chapter_num = chapter_select_elem.options[chapter_select_elem.selectedIndex].value;
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&collection_num="+collection_num+"&book_num="+book_num+"&chapter_num="+chapter_num;
var url = base_url+"chapters/fetch_chapter";
gadgets.io.makeRequest(url, function(xmlData){
xmlData = xmlData.data;
var itemList = xmlData.getElementsByTagName("verse");
var verseArray = new Array;
var indy=0;
for(var i=0; i<itemList.length; i++){
var nodeList = itemList.item(i).childNodes;
var commentsArray = new Array;
var verse_text = "";
var verse_num = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if (node.nodeName == "collection-num") {
collection_num = node.firstChild.nodeValue;
}
if (node.nodeName == "book-num") {
book_num = node.firstChild.nodeValue;
}
if (node.nodeName == "chapter-num") {
chapter_num = node.firstChild.nodeValue;
}
if (node.nodeName == "text") {
verse_text = node.firstChild.nodeValue;
}
if (node.nodeName == "verse-num") {
verse_num = node.firstChild.nodeValue;
}
if (node.nodeName == "comments"){
extract_verse_comments(node.childNodes, commentsArray);
}
}
verseArray[indy++]=[verse_text, collection_num, book_num, chapter_num, verse_num, commentsArray];
}
var html = "";
for(var i=0; i<verseArray.length; i++){
verse_text = verseArray[i][0];
collection_num = verseArray[i][1];
book_num = verseArray[i][2];
chapter_num = verseArray[i][3];
verse_num = verseArray[i][4];
comments_section_id = "browse_bible_"+collection_num+"_"+book_num+"_"+chapter_num+"_"+verse_num;
html += "<div id=\""+collection_num+"_"+book_num+"_"+chapter_num+"_"+(i+1)+"\" style='padding: 5px 0px 5px 0px; border-bottom: 1px solid #ccc;'>";
html += " <div class='left "+getEvenOrOddClass(i, true)+"' style='width: 600px'>";
html += " <div>";
html += " <b>"+verse_num+"</b> <span id=\"verse_text_"+collection_num+"_"+book_num+"_"+chapter_num+"_"+(i+1)+"\">"+verse_text+"</span>";
html += " </div>";
html += " <div id='"+comments_section_id+"' style='padding: 8px'>";
html += " "+generate_verse_comments_box(comments_section_id, verseArray[i][5], collection_num, book_num, chapter_num, verse_num, false);
html += " </div>";
html += " </div>";
html += " <div class='clear'></div>";
html += "</div>";
}
document.getElementById("my_content_area").innerHTML = html;
bible_fetch_yet = true;
adjh();
}, req_params);
}
function populate_books_for_selected_collection(){
collection_select= document.getElementById("collections");
book_select= document.getElementById("books");
book_select.length=0;
var books = getBooks(collection_select.options[collection_select.selectedIndex].value);
for(var i=0; i<books.length; i++){
var bk_title = books[i][0];
book_select.options[book_select.options.length]=new Option(bk_title, i+1, false, false);
}
}
function populate_chapters_for_selected_book(){
collection_select= document.getElementById("collections");
book_select= document.getElementById("books");
chapter_select = document.getElementById("chapters");
chapter_select.length=0;
// Select the first chapter
var chapters = getChapters(collection_select.options[collection_select.selectedIndex].value, book_select.options[book_select.selectedIndex].value);
for(var i=0; i<chapters.length; i++){
var ch_title = 'Chapter '+(i+1);
chapter_select.options[chapter_select.options.length]=new Option(ch_title, i+1, false, false);
}
}
function getBooks(collection_num){
return collections[collection_num-1][1];
}
function getChapters(collection_num, book_num){
ch = collections[collection_num-1][1][book_num-1][1];
return ch;
}
function delay_add_favorite(collection_num, book_num, chapter_num, verse_num){
setTimeout("add_favorite('"+collection_num+"', '"+book_num+"', '"+chapter_num+"', '"+verse_num+"')", 500)
}
function add_favorite(collection_num, book_num, chapter_num, verse_num){
friends_guids = getFriendGuids();
remote_add_favorite(function(fav_data){
extract_favorites(fav_data);
// Do nothing, we just stored it
//is_fav_elem_id = collection_num+"_"+book_num+"_"+chapter_num+"_"+verse_num+"_is_fav";
//fav_link_elem_id = collection_num+"_"+book_num+"_"+chapter_num+"_"+verse_num+"_fav_link";
//document.getElementById(fav_link_elem_id).style.display='none';
//document.getElementById(is_fav_elem_id).style.display='';
adjh();
}, collection_num, book_num, chapter_num, verse_num, viewer.getId(), friends_guids);
}
function remote_add_favorite(callback, collection_num, book_num, chapter_num, verse_num, g_uid, friends_guids){
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&collection_num="+collection_num+"&book_num="+book_num+"&chapter_num="+chapter_num+"&verse_num="+verse_num+"&g_uid="+g_uid+"&friends_guids="+friends_guids;
var url = base_url+"users/add_favorite";
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
favoriteVerseActivity(viewer, collection_num, book_num, chapter_num, verse_num);
}, req_params);
}
function remote_fetch_favorites(callback, g_uid, friends_guids){
var name = escape(owner.getDisplayName());
var picture_url = escape(owner.getField(opensocial.Person.Field.THUMBNAIL_URL));
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&g_uid="+g_uid+"&friends_guids="+friends_guids+"&name="+name+"&picture_url="+picture_url;
var url = base_url+"users/fetch_favorites";
gadgets.io.makeRequest(url, function(xmlData){
setLoadingStatus('[Received favorites data]');
callback(xmlData.data);
}, req_params);
}
function getFriendGuids(){
friends_guids = "";
for(var i=0; i<owner_friends.length; i++){
friends_guids += owner_friends[i][0]+"";
if(i<owner_friends.length-1){
friends_guids += ",";
}
}
//alert(owner_friends);
//alert(friends_guids);
return friends_guids;
}
function extract_favorites(fav_data){
var ownerFavoriteVersesHTML = get_owner_favorites_html(fav_data.getElementsByTagName("owner-favorites"));
var dailyVerses = fav_data.getElementsByTagName("daily-inspiring-verses");
if (isCanvas()){
var friendsFavoriteVersesHTML = get_friend_favorites_html(fav_data.getElementsByTagName("friends-favorites"));
document.getElementById("favorite_verses").innerHTML=ownerFavoriteVersesHTML;
document.getElementById("friends_favorite_verses").innerHTML=friendsFavoriteVersesHTML;
document.getElementById("canvas_daily_verse").innerHTML = extract_daily_verse(dailyVerses, 'on_daily_verse_', false);
document.getElementById("canvas_favorites_daily_verse").innerHTML = extract_daily_verse(dailyVerses, 'on_favorites_', false);
document.getElementById("canvas_post_a_prayer_daily_verse").innerHTML = extract_daily_verse(dailyVerses, 'on_post_a_prayer_', true);
// Extract prayers (used in canvas only)
extract_prayers(fav_data);
} else {
document.getElementById("profile_my_prayers").innerHTML=profile_extract_my_prayers(fav_data);
document.getElementById("profile_favorite_verses").innerHTML=ownerFavoriteVersesHTML;
document.getElementById("profile_verse_of_the_day").innerHTML=extract_daily_verse(dailyVerses);
document.getElementById("profile_bible_quiz").innerHTML=profile_extract_quiz_scores(fav_data.getElementsByTagName("scholar-rank"), fav_data.getElementsByTagName("total-points"));
}
}
function profile_extract_my_prayers(fav_data){
var html = "";
var prayerAry = [];
var feeds_item_tag_and_update_elements=[['my-prayer-feed-item', 'canvas_post_a_prayer_my_prayers', true, 'LARGE', true]];
for(var feeds_index=0; feeds_index<feeds_item_tag_and_update_elements.length; feeds_index++){
var prayer_items = fav_data.getElementsByTagName(feeds_item_tag_and_update_elements[feeds_index][0]);
index = 0;
for(var i=0; i<prayer_items.length; i++){
var nodeList = prayer_items.item(i).childNodes;
var prayer_id = "";
var prayer_guid = "";
var prayer_name = "";
var prayer_pic_url = "";
var prayer_text = "";
var prayer_date = "";
var commentsAry = [];
var prayerPartnersAry = [];
var wellWishersAry = [];
comment_index = 0;
prayer_partner_index = 0;
well_wisher_index = 0;
for (var n = 0; n < nodeList.length; n++) {
var node = nodeList.item(n);
if(node.firstChild != null){
if (node.nodeName == "prayer-id") {
prayer_id = node.firstChild.nodeValue;
}
if (node.nodeName == "prayer-guid") {
prayer_guid = node.firstChild.nodeValue;
}
if (node.nodeName == "prayer-name") {
prayer_name = unescape(node.firstChild.nodeValue);
}
if (node.nodeName == "prayer-pic-url") {
prayer_pic_url = node.firstChild.nodeValue;
}
if (node.nodeName == "prayer-text") {
prayer_text = unescape(node.firstChild.nodeValue);
}
if (node.nodeName == "prayer-date") {
prayer_date = node.firstChild.nodeValue;
}
}
}
prayerAry[index++]=[prayer_guid, prayer_name, prayer_pic_url, prayer_text, prayer_date, commentsAry, prayer_id];
}
if(prayerAry.length>0){
html+=" <div style='border-bottom: 1px solid black; color: #777;'>";
html+=" <div class='left medtext bold'>";
html+=" My Prayers";
html+=" </div>";
if(prayerAry.length>2){
html+=" <div id='hidden_next_my_prayers_link' class='right'>";
html+=" <a href=\"javascript:void(0)\" onclick=\"getElem('hidden_next_my_prayers_link').style.display='none';getElem('hidden_next_my_prayers').style.display=''; adjh(); return false;\">Show All "+prayerAry.length+" Prayers</a>";
html+=" </div>";
}
html+=" <div class='clear'></div>";
html+=" </div>";
for(i=0; i<prayerAry.length; i++){
if(i==2 && prayerAry.length > 2){
html+= "<div id='hidden_next_my_prayers' style='display: none;'>";
}
html+= " <div style='padding-bottom: 5px;'>";
html+= " "+prayerAry[i][1]+" is praying for <b>"+prayerAry[i][3]+"</b> <span class=\"small_note smalltext\">- Posted "+prayerAry[i][4]+"</span>";
html+= " </div>";
if(prayerAry.length > 2 && i==prayerAry.length-1){
html+= "</div>";
}
}
} else {
html+=" <div style='border-bottom: 1px solid black; color: #777;'>";
html+=" <div class='left medtext bold'>";
html+=" My Prayers";
html+=" </div>";
html+=" <div class='clear'></div>";
html+=" </div>";
html+= "<div>";
html+= owner.getDisplayName()+" has not added any prayers yet.";
html+= "</div>";
}
}
return html;
}
function profile_extract_quiz_scores(rank_elem, score_elem){
html = "<div style='border-bottom: 1px solid black; color: #777;'>";
html+= " <div class='left medtext bold'>";
html+= " Bible Quiz";
html+= " </div>";
html+= " <div class='clear'></div>";
html+= "</div>";
html+= "<div>";
html+= " <div class='bold'>";
html+= " "+rank_elem.item(0).firstChild.nodeValue;
html+= " </div>";
html+= " <div>";
html+= " "+score_elem.item(0).firstChild.nodeValue + " points";
html+= " </div>";
html+= "</div>";
return html
}
function extract_daily_verse(dailyVerses, prefix, hide_comment_link){
var dvList = new Array;
var dailyVerseHTML = "";
var dailyCommentaryHTML = "";
var verseArray = new Array;
if(dailyVerses.item(0) != null){
dvList = dailyVerses.item(0).childNodes;
}
var verseIndex = 0;
for(var i=0; i<dvList.length; i++){
if (dvList.item(i)!=null && dvList.item(i).nodeName == "verse") {
var nodeList = dvList.item(i).childNodes;
var verseCommentsArray = new Array;
var collection_num = "";
var book_num = "";
var chapter_num = "";
var verse_num = "";
var verse_text = "";
var commentary = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if (node.firstChild!=null){
if (node.nodeName == "collection-num") {
collection_num = node.firstChild.nodeValue;
}
if (node.nodeName == "book-num") {
book_num = node.firstChild.nodeValue;
}
if (node.nodeName == "chapter-num") {
chapter_num = node.firstChild.nodeValue;
}
if (node.nodeName == "verse-num") {
verse_num = node.firstChild.nodeValue;
}
if (node.nodeName == "text") {
verse_text = node.firstChild.nodeValue;
}
if (node.nodeName == "commentary") {
commentary = unescape(node.firstChild.nodeValue);
}
if (node.nodeName == "comments") {
extract_verse_comments(node.childNodes, verseCommentsArray);
}
}
}
verseArray[verseIndex++]=[verse_text, collection_num, book_num, chapter_num, verse_num, commentary, verseCommentsArray];
}
}
if(isCanvas()){
for(var i=0; i<verseArray.length; i++){
var verse_comment_section_id = prefix+'daily_verse_comment_'+collection_num+'_'+book_num+'_'+chapter_num+'_'+verse_num;
dailyVerseHTML += "<div>";
dailyVerseHTML += " <div>";
dailyVerseHTML += " "+verseArray[i][0];
dailyVerseHTML += " [<i>from "+get_book_name(verseArray[i][1], verseArray[i][2])+" "+verseArray[i][3]+":"+verseArray[i][4]+"]</i>";
dailyVerseHTML += " </div>";
dailyVerseHTML += " <div id='"+verse_comment_section_id+"' style='padding: 8px'>";
dailyVerseHTML += " "+generate_verse_comments_box(verse_comment_section_id, verseArray[i][6], collection_num, book_num, chapter_num, verse_num, hide_comment_link);
dailyVerseHTML += " </div>";
dailyVerseHTML += "</div>";
dailyVerseHTML += "<br/>";
}
} else {
if(verseArray.length>0){
dailyVerseHTML+=" <div style='border-bottom: 1px solid black; color: #777;'>";
dailyVerseHTML+=" <div class='left medtext bold'>";
dailyVerseHTML+=" Verse of the Day";
dailyVerseHTML+=" </div>";
if(verseArray.length>2){
dailyVerseHTML+=" <div id='hidden_next_daily_verses_link' class='right'>";
dailyVerseHTML+=" <a href=\"javascript:void(0)\" onclick=\"getElem('hidden_next_daily_verses_link').style.display='none';getElem('hidden_next_daily_verses').style.display=''; adjh(); return false;\">Show All "+verseArray.length+" Verses</a>";
dailyVerseHTML+=" </div>";
}
dailyVerseHTML+=" <div class='clear'></div>";
dailyVerseHTML+=" </div>";
for(i=0; i<verseArray.length; i++){
if(i==2 && verseArray.length > 2){
dailyVerseHTML+= "<div id='hidden_next_daily_verses' style='display: none;'>";
}
dailyVerseHTML+= " <div style='padding-bottom: 5px;'>";
dailyVerseHTML+= " <b>"+get_book_name(verseArray[i][1], verseArray[i][2])+" "+verseArray[i][3]+":"+verseArray[i][4]+"</b> "+verseArray[i][0];
dailyVerseHTML+= " </div>";
if(verseArray.length > 2 && i==verseArray.length-1){
dailyVerseHTML+= "</div>";
}
}
} else {
dailyVerseHTML+=" <div style='border-bottom: 1px solid black; color: #777;'>";
dailyVerseHTML+=" <div class='left medtext bold'>";
dailyVerseHTML+=" Verse of the Day";
dailyVerseHTML+=" </div>";
dailyVerseHTML+=" <div class='clear'></div>";
dailyVerseHTML+=" </div>";
dailyVerseHTML+= "<div>";
dailyVerseHTML+= " No daily verse today.";
dailyVerseHTML+= "</div>";
}
}
return dailyVerseHTML;
}
function extract_verse_comments(commentNodes, verseCommentsArray){
var indy = 0;
for(var d=0; d<commentNodes.length; d++){
if(commentNodes.item(d)!=null && commentNodes.item(d).childNodes.length>0){
cmnt = commentNodes.item(d).childNodes;
var comment_text = "";
var commenter_guid = "";
var commenter_name = "";
var commenter_picurl = "";
var commenter_profileurl = "";
var comment_date = "";
for(var e=0; e<cmnt.length; e++){
var nde = cmnt.item(e);
if(nde != null && nde.firstChild != null){
if (nde.nodeName == "comment-text") {
comment_text = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "commenter-guid") {
commenter_guid = nde.firstChild.nodeValue;
}
if (nde.nodeName == "commenter-name") {
commenter_name = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "commenter-picurl") {
commenter_picurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "commenter-profileurl") {
commenter_profileurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "comment-date") {
comment_date= nde.firstChild.nodeValue;
}
}
}
verseCommentsArray[indy++] = [comment_text, commenter_guid, commenter_name, commenter_picurl, comment_date, commenter_profileurl];
}
}
}
function generate_verse_comments_box(comments_section_id, commentsArray, collection_num, book_num, chapter_num, verse_num, hide_comment_link){
var html = "";
comment_input_id = comments_section_id+"_input";
hide_comments_link_id = comments_section_id+"_comments_hide_link";
more_comment_items_id = comments_section_id+"_more_comment_items";
add_fav_link = comments_section_id+'_add_fav_link';
is_fav_msg = comments_section_id+'_is_fav_msg';
toggle_show_comments_id = comments_section_id+'_toggle_show';
toggle_hide_comments_id = comments_section_id+'_toggle_hide';
html += "<div>";
html += " <div>";
if(!hide_comment_link){
html += " <span id='"+toggle_show_comments_id+"'>";
var comments_link_text = "";
if(commentsArray.length > 0){
comments_link_text = "View Comments ("+commentsArray.length+")";
}
if(commentsArray.length == 0 && isViewerAllowedToSubmitOnCanvas){
comments_link_text = "Add Comment";
}
html += " <a href=\"javascript:void(0)\" style='text-decoration: underline;' onclick=\"getElem('"+comments_section_id+"_hidden').style.display=''; getElem('"+toggle_hide_comments_id+"').style.display='';getElem('"+toggle_show_comments_id+"').style.display='none'; adjh(); return false;\">"+comments_link_text+"</a>";
html += " </span>";
html += " <span id='"+toggle_hide_comments_id+"' style='display: none;'>";
html += " <a href=\"javascript:void(0)\" style='text-decoration: underline;' onclick=\"getElem('"+comments_section_id+"_hidden').style.display='none'; getElem('"+toggle_hide_comments_id+"').style.display='none';getElem('"+toggle_show_comments_id+"').style.display=''; adjh(); return false;\">"+comments_link_text+"</a>";
html += " </span>";
}
if(is_favorite(collection_num, book_num, chapter_num, verse_num)){
if(!hide_comment_link && isViewerAllowedToSubmitOnCanvas()){
html += " | ";
}
html += " <span style='color: #1e9db2;'>";
html += " ** Favorite **";
html += " </span>";
} else {
if(isViewerAllowedToSubmitOnCanvas()){
if(!hide_comment_link){
html += " | ";
}
html += " <span id='"+add_fav_link+"'>";
html += " <a href=\"javascript:void(0)\" style='text-decoration: underline;' onclick=\"getElem('"+add_fav_link+"').style.display='none'; getElem('"+is_fav_msg+"').style.display=''; delay_add_favorite('"+collection_num+"', '"+book_num+"', '"+chapter_num+"', '"+verse_num+"'); return false;\">I like this!</a>";
html += " </span>";
html += " <span id='"+is_fav_msg+"' style='display: none; color: #1e9db2;'>";
html += " ** Favorite **";
html += " </span>";
}
}
html += " </div>";
html += " <div id='"+comments_section_id+"_hidden' style='display: none;'>";
if(isViewerAllowedToSubmitOnCanvas()){
html += " <div>";
var input_size = "width: 375px;";
//if(hide_comment_link){
// input_size = "width: 275px;";
//}
html += " <textarea id=\""+comment_input_id+"\" "+replaceable_text_events(replaceme_text, comment_input_id)+" style=\"color: #aaa; "+input_size+"\" class=\"comment_textarea\">"+replaceme_text+"</textarea>";
html += " <br/><input value=\"Post comment\" type='button' onclick=\"if(document.getElementById('"+comment_input_id+"').value!=replaceme_text){this.disabled=true; this.value='Please wait...';} submit_verse_comment('"+comments_section_id+"', '"+comment_input_id+"', '"+collection_num+"', '"+book_num+"', '"+chapter_num+"', '"+verse_num+"', "+hide_comment_link+");\" />";
html += " </div>";
}
for(var i=0; i<commentsArray.length; i++){
//if(i==2){
// html += "<div id='"+hide_comments_link_id+"'>";
// html += " <a href=\"javascript:void(0)\" onclick=\"document.getElementById('"+more_comment_items_id+"').style.display='';document.getElementById('"+hide_comments_link_id+"').style.display='none';adjh(); return false;\">Show more comments ("+commentsArray.length+")</a></b>";
// html += "</div>";
// html += "<div id='"+more_comment_items_id+"' style='display: none;'>";
//}
html += " <div style='margin-top: 5px'>";
html += " <div class='left'>";
html += " "+link_to_profile_with_image(commentsArray[i][1], commentsArray[i][3], 'height: 32px; width: 32px;');
html += " </div>";
var comment_size = "width: 275px; margin-left: 8px;";
//if(hide_comment_link){
// comment_size = "width: 250px; margin-left: 4px;";
//}
html += " <div class='left smalltext' style='margin-left: 4px; "+hide_comment_link+"'>";
html += " <div>";
html += " "+link_to_profile_with_text(commentsArray[i][1], commentsArray[i][2])+" wrote, "+commentsArray[i][4]+":</i>";
html += " </div>";
html += " <div class='comment_item_text' style=\"margin-top: 5px;\">";
html += " "+unescape_html(commentsArray[i][0]);
html += " </div>";
html += " </div>";
html += " <div class='clear'></div>";
html += " </div>";
//if(commentsArray.length > 2 && i==commentsArray.length-1){
// html += "</div>";
//}
}
html += " </div>";
html += "</div>";
return html;
}
function isViewerAllowedToSubmitOnCanvas(){
if (viewer == null){
return false;
} else {
return owner.getId() == viewer.getId();
}
}
function submit_verse_comment(update_section_id, input_id, collection_num, book_num, chapter_num, verse_num, hide_comment_link){
comment_text = escape(getElem(input_id).value);
remote_submit_verse_comment(function(xmlData){
var verseCommentsArray = new Array;
var commentNodes = xmlData.getElementsByTagName('comment');
extract_verse_comments(commentNodes, verseCommentsArray);
getElem(update_section_id).innerHTML=generate_verse_comments_box(update_section_id, verseCommentsArray, collection_num, book_num, chapter_num, verse_num, hide_comment_link);
// Show the hidden div after the update
getElem(update_section_id+'_hidden').style.display='';
adjh();
}, update_section_id, comment_text, collection_num, book_num, chapter_num, verse_num);
}
function remote_submit_verse_comment(callback, update_section_id, comment, collection_num, book_num, chapter_num, verse_num){
g_uid = viewer.getId();
name = escape(viewer.getDisplayName());
pic_url = escape(viewer.getField(opensocial.Person.Field.THUMBNAIL_URL));
profile_url = escape(viewer.getField(opensocial.Person.Field.PROFILE_URL));
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&guid="+g_uid+"&name="+name+"&pic_url="+pic_url+"&profile_url="+profile_url+"&collection_num="+collection_num+"&book_num="+book_num+"&chapter_num="+chapter_num+"&verse_num="+verse_num+"&text="+comment;
var url = base_url+"users/add_verse_comment";
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
commentedOnVerseActivity(viewer, collection_num, book_num, chapter_num, verse_num);
}, req_params);
}
function is_favorite(collection_num, book_num, chapter_num, verse_num){
var is_a_favorite = false;
for(y=0; y<favorites.length; y++){
if((favorites[y][1] == collection_num) && (favorites[y][2] == book_num) && (favorites[y][3] == chapter_num) && (favorites[y][4] == verse_num+"")){
is_a_favorite = true;
}
}
return is_a_favorite;
}
function get_owner_favorites_html(ownerFavs){
favorites = new Array; // Don't mess with the global favorites
var itemList = new Array;
if(ownerFavs.item(0)!=null){
itemList = ownerFavs.item(0).childNodes;
}
var html = "";
index = 0;
for(var i=0; i<itemList.length; i++){
if (itemList.item(i).nodeName == "favorite") {
var nodeList = itemList.item(i).childNodes;
var commentsArray = new Array;
var favorite_id = "";
var collection_num = "";
var book_num = "";
var chapter_num = "";
var verse_num = "";
var verse_text = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if (node.nodeName == "favorite-id") {
favorite_id = node.firstChild.nodeValue;
}
if (node.nodeName == "collection-num") {
collection_num = node.firstChild.nodeValue;
}
if (node.nodeName == "book-num") {
book_num = node.firstChild.nodeValue;
}
if (node.nodeName == "chapter-num") {
chapter_num = node.firstChild.nodeValue;
}
if (node.nodeName == "verse-num") {
verse_num = node.firstChild.nodeValue;
}
if (node.nodeName == "text") {
verse_text = node.firstChild.nodeValue;
}
if (node.nodeName == "comments") {
extract_verse_comments(node.childNodes, commentsArray);
}
}
favorites[index++] = [favorite_id, collection_num, book_num, chapter_num, verse_num, get_book_name(collection_num, book_num), verse_text, commentsArray];
}
}
if (isCanvas()){
if(favorites.length>0){
for(i=0; i<favorites.length; i++){
collection_num = favorites[i][1];
book_num = favorites[i][2];
chapter_num = favorites[i][3];
verse_num = favorites[i][4];
comments_section_id = "my_favorites_comments_"+collection_num+"_"+book_num+"_"+chapter_num+"_"+verse_num;
html += "<div id=\"canvas_favorite_"+favorites[i][0]+"\">";
html += " <div style=\"margin-top: 8px\">";
html += " <div class='left' style='width: 100px; text-align: right;'>";
html += " <b>"+favorites[i][5]+"<br/>"+favorites[i][3]+":"+favorites[i][4]+"</b>";
html += " </div>";
html += " <div class='left' style='width: 525px; padding-left: 10px;'>";
html += " <div>";
html += " "+favorites[i][6];
html += " </div>";
html += " <div>";
html += " <div id='"+comments_section_id+"' style='padding: 8px;'>";
html += " "+generate_verse_comments_box(comments_section_id, favorites[i][7], collection_num, book_num, chapter_num, verse_num, false);
html += " </div>";
html += " </div>";
html += " </div>";
html += " <div style=\"clear: both;\"></div>";
html += " </div>";
html += "</div>";
}
} else {
html += "<p>";
html += owner.getDisplayName()+" hasn't picked any favorites yet.";
html += "</p>";
}
} else {
if(favorites.length>0){
html+=" <div style='border-bottom: 1px solid black; color: #777;'>";
html+=" <div class='left medtext bold'>";
html+=" My Favorite Verses";
html+=" </div>";
if(favorites.length>2){
html+=" <div class='right'>";
html+=" <a href=\"javascript:void(0)\" onclick=\"getElem('hidden_next_favorite_verses').style.display=''; this.style.display='none'; adjh(); return false;\">Show Prayers ("+favorites.length+")</a>";
html+=" </div>";
}
html+=" <div class='clear'></div>";
html+=" </div>";
for(i=0; i<favorites.length; i++){
if(i==2 && favorites.length > 2){
html += "<div id='hidden_next_favorite_verses' style='display: none;'>";
}
html += " <div style='padding-bottom: 5px;'>";
html += " <b>"+favorites[i][5]+" "+favorites[i][3]+":"+favorites[i][4]+"</b> "+favorites[i][6];
html += " </div>";
if(favorites.length > 2 && i==favorites.length-1){
html += "</div>";
}
}
} else {
html+=" <div style='border-bottom: 1px solid black; color: #777;'>";
html+=" <div class='left medtext bold'>";
html+=" My Favorite Verses";
html+=" </div>";
html+=" <div class='clear'></div>";
html+=" </div>";
html += "<div>";
html += " No favorites chosen yet.";
html += "</div>";
}
}
return html;
}
function get_friend_favorites_html(friendsFavs){
var friends = new Array;
var friendsList = new Array;
if(friendsFavs.item(0)!=null){
friendsList = friendsFavs.item(0).childNodes;
}
var friendex = 0;
for (var hh=0; hh<friendsList.length; hh++){
var itemList = friendsList.item(hh).childNodes;
var favorites = new Array;
var guid = "";
var pic_url = "";
var name = "";
var index = 0;
for(var i=0; i<itemList.length; i++){
if (itemList.item(i).nodeName == "guid") {
guid = itemList.item(i).firstChild.nodeValue;
}
if (itemList.item(i).nodeName == "pic-url") {
pic_url = itemList.item(i).firstChild.nodeValue;
}
if (itemList.item(i).nodeName == "name") {
name = unescape(itemList.item(i).firstChild.nodeValue);
}
if (itemList.item(i).nodeName == "favorite") {
var nodeList = itemList.item(i).childNodes;
var commentsArray = new Array;
var favorite_id = "";
var collection_num = "";
var book_num = "";
var chapter_num = "";
var verse_num = "";
var verse_text = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if (node.nodeName == "favorite-id") {
favorite_id = node.firstChild.nodeValue;
}
if (node.nodeName == "collection-num") {
collection_num = node.firstChild.nodeValue;
}
if (node.nodeName == "book-num") {
book_num = node.firstChild.nodeValue;
}
if (node.nodeName == "chapter-num") {
chapter_num = node.firstChild.nodeValue;
}
if (node.nodeName == "verse-num") {
verse_num = node.firstChild.nodeValue;
}
if (node.nodeName == "text") {
verse_text = node.firstChild.nodeValue;
}
if (node.nodeName == "comments") {
commentNodes = node.childNodes;
var indy = 0;
for(var d=0; d<commentNodes.length; d++){
cmnt = commentNodes.item(d).childNodes;
var comment_text = "";
var commenter_guid = "";
var commenter_name = "";
var commenter_picurl = "";
var comment_date = "";
for(var e=0; e<cmnt.length; e++){
var nde = cmnt.item(e);
if(nde != null && nde.firstChild != null){
if (nde.nodeName == "comment-text") {
comment_text = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "commenter-guid") {
commenter_guid = nde.firstChild.nodeValue;
}
if (nde.nodeName == "commenter-name") {
commenter_name = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "commenter-picurl") {
commenter_picurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "comment-date") {
comment_date= nde.firstChild.nodeValue;
}
}
}
commentsArray[indy++] = [comment_text, commenter_guid, commenter_name, commenter_picurl, comment_date];
}
}
}
favorites[index++] = [favorite_id, collection_num, book_num, chapter_num, verse_num, get_book_name(collection_num, book_num), verse_text, commentsArray];
}
}
friends[friendex++] = [guid, pic_url, name, favorites];
}
var html = "";
for(var hh=0; hh<friends.length; hh++){
var favorites = friends[hh][3];
html += "<div>";
html += " <div class='left' style='width: 80px; text-align: right'>";
html += " <div>";
html += " "+link_to_profile_with_image(friends[hh][0], friends[hh][1], 'height: 50px; width: 50px;');
html += " </div>";
html += " <div>";
html += " "+friends[hh][2];
html += " </div>";
html += " </div>";
html += " <div class='left' style='width: 320px; margin-left: 5px;'>";
for(i=0; i<favorites.length; i++){
html += " <div>";
html += " <div>";
html += " "+favorites[i][6]+" [<i>from "+favorites[i][5]+" "+favorites[i][3]+":"+favorites[i][4]+"</i>]";
html += " </div>";
html += " <div style='padding: 5px 5px 5px 10px'>";
for(var y=0; y<favorites[i][7].length; y++){
html += " <div style='margin-top: 8px'>";
html += " <div class='left'>";
html += " "+link_to_profile_with_image(favorites[i][7][y][1], favorites[i][7][y][3], 'height: 32px; width: 32px;');
html += " </div>";
html += " <div class='left' style='padding-left: 5px;'>";
html += " <div>";
html += " <i>"+favorites[i][7][y][2]+" wrote, "+favorites[i][7][y][4]+":</i>";
html += " </div>";
html += " <div style='margin-top: 5px;'>";
html += " "+unescape_html(favorites[i][7][y][0]);
html += " </div>";
html += " </div>";
html += " <div class='clear'></div>";
html += " </div>";
}
html += " </div>";
html += " </div>";
}
html += " </div>";
html += " <div class='clear'></div>";
html += "</div>";
html += "<br/>";
}
return html;
}
/**************************************/
/* Prayer functions */
/**************************************/
function submit_prayer(){
var friends_guids = getFriendGuids();
var prayer_str = document.getElementById('post_a_prayer_input').value;
if (prayer_str == enter_verse_here_text || prayer_str == ""){
alert('You must enter a prayer first');
} else {
remote_submit_prayer(function(xmlData){
document.getElementById('post_a_prayer_input').value='';
extract_prayers(xmlData);
adjh();
}, viewer.getId(), friends_guids, prayer_str);
}
}
function remote_submit_prayer(callback, g_uid, friends_guids, prayer_str){
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&g_uid="+g_uid+"&friends_guids="+friends_guids+"&prayer="+escape(prayer_str);
var url = base_url+"users/add_prayer";
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
postedPrayerActivity(viewer, prayer_str);
if(isHi5()){
opensocial.requestShareApp(opensocial.DataRequest.Group.VIEWER_FRIENDS, opensocial.newMessage("Invite friends who will pray along with you!"));
}
}, req_params);
}
function extract_prayers(xmlData){
//////////////////////////////////////////
// Extract Prayer Words //
//////////////////////////////////////////
var prayer_words = xmlData.getElementsByTagName("prayer-word");
// Update the global prayer words list and reset the page
prayerWords = [];
prayerWordsCurrentPage = 0;
index = 0;
for(var i=0; i<prayer_words.length; i++){
var nodeList = prayer_words.item(i).childNodes;
var prayer_word = "";
for (var n = 0; n < nodeList.length; n++) {
var node = nodeList.item(n);
if(node.firstChild != null){
if (node.nodeName == "word") {
prayer_word = unescape(node.firstChild.nodeValue);
}
}
}
prayerWords[index++] = prayer_word;
}
// Set the prayer words page to the first page
setPrayerWordsPage(0);
//////////////////////////////////////////
// Extract friends and app-wide prayers //
//////////////////////////////////////////
// Tag Id, Id to update, Allow Display Comments?, Image Sz, Full?
var feeds_item_tag_and_update_elements=[['my-prayer-feed-item', 'canvas_post_a_prayer_my_prayers', 'LINKS_AND_COMMENTS', 'LARGE', true],
['friend-prayer-feed-item', 'canvas_post_a_prayer_my_friends_prayers', 'LINKS_AND_COMMENTS', 'LARGE', true],
['me-and-friends-prayer-feed-item', 'canvas_post_a_prayer_me_and_my_friends_prayers', 'LINKS_AND_COMMENTS', 'LARGE', true],
['app-wide-prayer-feed-item', 'app_wide_prayer_feed', 'LINKS_ONLY', 'SMALL', false]];
for(var feeds_index=0; feeds_index<feeds_item_tag_and_update_elements.length; feeds_index++){
var prayer_items = xmlData.getElementsByTagName(feeds_item_tag_and_update_elements[feeds_index][0]);
var prayerAry = [];
index = 0;
for(var i=0; i<prayer_items.length; i++){
var nodeList = prayer_items.item(i).childNodes;
var prayer_id = "";
var prayer_guid = "";
var prayer_name = "";
var prayer_pic_url = "";
var prayer_text = "";
var prayer_date = "";
var commentsAry = [];
var prayerPartnersAry = [];
var wellWishersAry = [];
comment_index = 0;
prayer_partner_index = 0;
well_wisher_index = 0;
for (var n = 0; n < nodeList.length; n++) {
var node = nodeList.item(n);
if(node.firstChild != null){
if (node.nodeName == "prayer-id") {
prayer_id = node.firstChild.nodeValue;
}
if (node.nodeName == "prayer-guid") {
prayer_guid = node.firstChild.nodeValue;
}
if (node.nodeName == "prayer-name") {
prayer_name = unescape(node.firstChild.nodeValue);
}
if (node.nodeName == "prayer-pic-url") {
prayer_pic_url = node.firstChild.nodeValue;
}
if (node.nodeName == "prayer-text") {
prayer_text = unescape(node.firstChild.nodeValue);
}
if (node.nodeName == "prayer-date") {
prayer_date = node.firstChild.nodeValue;
}
if (node.nodeName == "comments") {
commentNodes = node.childNodes;
for(var d=0; d<commentNodes.length; d++){
cmnt = commentNodes.item(d).childNodes;
var comment_text = "";
var commenter_guid = "";
var commenter_name = "";
var commenter_picurl = "";
var comment_date = "";
for(var e=0; e<cmnt.length; e++){
var nde = cmnt.item(e);
if(nde != null && nde.firstChild != null){
if (nde.nodeName == "comment-text") {
comment_text = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "commenter-guid") {
commenter_guid = nde.firstChild.nodeValue;
}
if (nde.nodeName == "commenter-name") {
commenter_name = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "commenter-picurl") {
commenter_picurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "comment-date") {
comment_date= nde.firstChild.nodeValue;
}
}
}
if (commenter_guid != ""){
commentsAry[comment_index++] = [comment_text, commenter_guid, commenter_name, commenter_picurl, comment_date];
}
}
}
if (node.nodeName == "prayer-partners") {
prayerPartnerNodes = node.childNodes;
for(var d=0; d<prayerPartnerNodes.length; d++){
ppn = prayerPartnerNodes.item(d).childNodes;
var pp_guid = "";
var pp_name = "";
var pp_picurl = "";
var pp_date = "";
for(var e=0; e<ppn.length; e++){
var nde = ppn.item(e);
if(nde != null && nde.firstChild != null){
if (nde.nodeName == "pp-guid") {
pp_guid = nde.firstChild.nodeValue;
}
if (nde.nodeName == "pp-name") {
pp_name = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "pp-picurl") {
pp_picurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "pp-date") {
pp_date= nde.firstChild.nodeValue;
}
}
}
if (pp_guid != ""){
prayerPartnersAry[prayer_partner_index++] = [pp_guid, pp_name, pp_picurl, pp_date];
}
}
}
if (node.nodeName == "well-wishers") {
wellWisherNodes = node.childNodes;
for(var d=0; d<wellWisherNodes.length; d++){
wwn = wellWisherNodes.item(d).childNodes;
var ww_guid = "";
var ww_name = "";
var ww_picurl = "";
var ww_date = "";
for(var e=0; e<wwn.length; e++){
var nde = wwn.item(e);
if(nde != null && nde.firstChild != null){
if (nde.nodeName == "ww-guid") {
ww_guid = nde.firstChild.nodeValue;
}
if (nde.nodeName == "ww-name") {
ww_name = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "ww-picurl") {
ww_picurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "ww-date") {
ww_date= nde.firstChild.nodeValue;
}
}
}
if (ww_guid != ""){
wellWishersAry[well_wisher_index++] = [ww_guid, ww_name, ww_picurl, ww_date];
}
}
}
}
}
prayerAry[index++]=[prayer_guid, prayer_name, prayer_pic_url, prayer_text, prayer_date, commentsAry, prayer_id, prayerPartnersAry, wellWishersAry];
}
html = "";
if(feeds_item_tag_and_update_elements[feeds_index][3]=='SMALL'){
prayer_font = "font-size: 11px;";
posted_date_font = "font-size: 11px; font-weight: plain;";
image_size = "width: 32px; height: 32px;";
top_margin = 'margin-top: 4px;';
max_table_width = "275px;"
} else { // Assume large
prayer_font = ""; // Default to css class def
posted_date_font = " font-weight: plain;"; // Default to css class def
image_size = "width: 64px;";
top_margin = 'margin-top: 7px;';
max_table_width = ""
}
if(prayerAry.length == 0){
html += "<div style=\"top_margin\">";
html += " <b>No prayers found</b>";
html += "</div>";
}
for(var i=0; i<prayerAry.length; i++){
html += "<div style=\""+top_margin+"; width: 100%; "+getPaddingAndBorderForComment(feeds_item_tag_and_update_elements[feeds_index][4])+"\" class="+getEvenOrOddClass(i, feeds_item_tag_and_update_elements[feeds_index][4])+" >";
html += " <table style='width: 100%;'>";
html += " <tr style=\"vertical-align: top;\">";
html += " <td >";
html += " "+link_to_profile_with_image(prayerAry[i][0], prayerAry[i][2], image_size);
html += " </td>";
html += " <td>";
html += " <div class=\"prayer medtext\" style=\""+prayer_font+"\">";
html += " "+link_to_profile_with_text(prayerAry[i][0], prayerAry[i][1])+" is praying for "+link_to_prayer_info(prayerAry[i][3])+" <span class=\"small_note smalltext\" style=\""+posted_date_font+"\">- Posted "+prayerAry[i][4]+"</span>";
html += " </div>";
// If allow/display links-and-comments or just links
if(feeds_item_tag_and_update_elements[feeds_index][2] == 'LINKS_AND_COMMENTS' || feeds_item_tag_and_update_elements[feeds_index][2] == 'LINKS_ONLY'){
comment_area_id = feeds_item_tag_and_update_elements[feeds_index][1]+"_prayer_comments_"+prayerAry[i][6];
comment_input_id = feeds_item_tag_and_update_elements[feeds_index][1]+"_prayer_input_"+prayerAry[i][6];
more_comment_items_id = feeds_item_tag_and_update_elements[feeds_index][1]+"_more_prayer_comment_items_"+prayerAry[i][6];
hide_comments_link_id = feeds_item_tag_and_update_elements[feeds_index][1]+"_hide_comments_"+prayerAry[i][6];
html += " <div class=\"comments smalltext\" id=\""+comment_area_id+"\" style=\"margin-left: 5px; margin-top: 5px;\">";
if(isViewerAllowedToSubmitOnCanvas()){
html += " <div>";
html += " <div>";
// Todo remove this NEW! text
if(feeds_item_tag_and_update_elements[feeds_index][2] == 'LINKS_ONLY'){
html += "<span style='color: red; font-weight: bold;'>New!</span> ";
}
html += " <span id='"+comment_area_id+"_pray_with_link'>";
html += " <a href=\"#\" onclick=\"show_sent('"+comment_area_id+"_pray_with_link', '"+comment_area_id+"_thanks_for_prayer'); submit_pray_with('"+prayerAry[i][6]+"', '"+prayerAry[i][1]+"', '"+comment_area_id+"', '"+comment_input_id+"', '"+more_comment_items_id+"', '"+hide_comments_link_id+"', '"+feeds_item_tag_and_update_elements[feeds_index][2]+"');\">Pray along ("+prayerAry[i][7].length+")</a>";
for(var s=0; (s<(prayerAry[i][7].length/5)) && (s < 25); s++){
html += "<span><img src='"+base_url+"images/star.gif' style='margin-bottom: -2px;'></span>";
}
html += " </span>";
html += " <span id='"+comment_area_id+"_thanks_for_prayer' style='display: none; background-color: yellow;'>";
html += " Thanks!";
html += " </span>";
html += " | ";
html += " <span id='"+comment_area_id+"_send_good_wishes_link'>";
html += " <a href=\"#\" onclick=\"show_sent('"+comment_area_id+"_send_good_wishes_link', '"+comment_area_id+"_thanks_for_good_wishes'); submit_wish_well('"+prayerAry[i][6]+"', '"+prayerAry[i][1]+"', '"+comment_area_id+"', '"+comment_input_id+"', '"+more_comment_items_id+"', '"+hide_comments_link_id+"', '"+feeds_item_tag_and_update_elements[feeds_index][2]+"');\">Send good wishes ("+prayerAry[i][8].length+")</a>";
for(var s=0; (s<(prayerAry[i][8].length/5)) && (s < 25); s++){
html += "<span><img src='"+base_url+"images/star.gif' style='margin-bottom: -2px;'></span>";
}
html += " </span>";
html += " <span id='"+comment_area_id+"_thanks_for_good_wishes' style='display: none; background-color: yellow;'>";
html += " Sent your wishes";
html += " </span>";
html += " </div>";
html += " </div>";
// If allows comments
if(feeds_item_tag_and_update_elements[feeds_index][2] == 'LINKS_AND_COMMENTS'){
html += " <div style=\"margin-top: 5px;\">";
html += " <textarea id=\""+comment_input_id+"\" "+replaceable_text_events(replaceme_text, comment_input_id)+" style=\"color: #aaa; width: 375px;\" class=\"comment_textarea\">"+replaceme_text+"</textarea>";
html += " <br/><input value=\"Post comment\" type='button' onclick=\"if(document.getElementById('"+comment_input_id+"').value!=replaceme_text){this.disabled=true; this.value='Please wait...';} submit_prayer_comment('"+prayerAry[i][6]+"', '"+prayerAry[i][1]+"', '"+comment_area_id+"', '"+comment_input_id+"', '"+more_comment_items_id+"', '"+hide_comments_link_id+"');\" />";
html += " </div>";
}
}
html += " <div>";
if (prayerAry[i][5].length > 0){
for(var j=0; j<prayerAry[i][5].length; j++){
if(j==2){
html += " <div id='"+hide_comments_link_id+"'>";
html += " <a href=\"#\" onclick=\"document.getElementById('"+more_comment_items_id+"').style.display='';document.getElementById('"+hide_comments_link_id+"').style.display='none';adjh();\">Show more comments ("+prayerAry[i][5].length+")</a></b>";
html += " </div>";
html += " <div id='"+more_comment_items_id+"' style='display: none;'>";
}
html += " <div style=\"margin-top: 8px\">";
html += " <table style='"+max_table_width+"'>";
html += " <tr style=\"vertical-align: top;\">";
html += " <td>";
html += " "+link_to_profile_with_image(prayerAry[i][5][j][1], prayerAry[i][5][j][3], 'height: 32px; width: 32px;');
html += " </td>";
html += " <td>";
html += " <div class='comment_item smalltext'>";
html += " <div>";
html += " <i>"+prayerAry[i][5][j][2]+" wrote, "+prayerAry[i][5][j][4]+":</i>";
html += " </div>";
html += " <div class=\"comment_item_text\">";
html += " "+unescape_html(prayerAry[i][5][j][0]);
html += " </div>";
html += " </div>";
html += " </td>";
html += " </tr>";
html += " </table>";
html += " </div>";
if(prayerAry[i][5].length > 2 && j==prayerAry[i][5].length-1){
html += " </div>";
}
}
html += " </div>";
}
html += " </div>";
html += " </div>";
html += " </div>";
}
html += " </td>";
html += " </tr>";
html += " </table>";
html += "</div>";
}
document.getElementById(feeds_item_tag_and_update_elements[feeds_index][1]).innerHTML=html;
}
}
function setPrayerWordsPage(page){
prayerWordsHTML = "";
if(page != 0){
prayerWordsHTML += "<a href=\"javascript:void(0)\" onclick=\"setPrayerWordsPage("+(page-1)+");adjh();return false;\"><<</a> ";
}
for(var i = prayerWordsPerPage*page; i<prayerWords.length && i<(prayerWordsPerPage*(page+1)); i++){
prayerWordsHTML += " <a id='prayer_word_"+i+"' href=\"javascript:void(0)\" onclick=\"getElem('prayer_word_"+i+"').style.fontWeight='bold';getElem('post_a_prayer_input').value=getElem('prayer_word_"+i+"').innerHTML;getElem('prayer_word_"+i+"').style.fontWeight='100';getElem('post_a_prayer_input').focus();adjh();return false;\" style='text-decoration: underline;'>"+prayerWords[i]+"</a>";
if((i+1)<prayerWords.length && (i+1)<(prayerWordsPerPage*(page+1))){
prayerWordsHTML += ',';
}
}
if(prayerWordsPerPage*(page+1) < prayerWords.length){
prayerWordsHTML += " <a href=\"javascript:void(0)\" onclick=\"setPrayerWordsPage("+(page+1)+");adjh(); return false;\">>></a>";
}
getElem('ticker_tape').innerHTML = prayerWordsHTML;
}
function getEvenOrOddClass(i, show_background){
/*if(show_background){
return_class = 'odd';
if((i%2) == 0){
return_class = 'even';
}
return return_class;
} else {
return '';
}*/
return '';
}
function getPaddingAndBorderForComment(full){
if (full){
return "padding-bottom: 8px; padding-top: 5px; border-bottom: 1px solid #ccc;";
} else {
return "padding-bottom: 4px; padding-top: 3px;";
}
}
function submit_prayer_comment(prayer_id, org_prayer_name, comment_area_id, comment_input_id, more_comment_items_id, hide_comments_link_id){
comment_text = document.getElementById(comment_input_id).value;
if (comment_text == replaceme_text){
alert('You must enter a comment first');
} else {
document.getElementById(comment_input_id).value=replaceme_text;
remote_submit_prayer_comment(function(xmlData){
extract_only_prayer_comments(xmlData, prayer_id, org_prayer_name, true, comment_area_id, comment_input_id, more_comment_items_id, hide_comments_link_id, 'COMMENTS_AND_LINKS');
adjh();
}, prayer_id, comment_text);
}
}
function remote_submit_prayer_comment(callback, prayer_id, comment_text){
g_uid = viewer.getId();
name = escape(viewer.getDisplayName());
pic_url = escape(viewer.getField(opensocial.Person.Field.THUMBNAIL_URL));
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&g_uid="+g_uid+"&prayer_id="+prayer_id+"&name="+name+"&comment="+escape(comment_text)+"&pic_url="+pic_url;
var url = base_url+"users/add_prayer_comment";
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
//commentedOnPostedPrayerActivity(viewer, 'orig_prayer', 'prayer_poster_profile_url', 'prayer_poster_pic_url', 'prayer_poster_name');
}, req_params);
}
function submit_pray_with(prayer_id, org_prayer_name, comment_area_id, comment_input_id, more_comment_items_id, hide_comments_link_id, comment_section_display_type){
setTimeout("remote_submit_pray_with(function(xmlData){ extract_only_prayer_comments(xmlData, '"+prayer_id+"', '"+org_prayer_name+"', false, '"+comment_area_id+"', '"+comment_input_id+"', '"+more_comment_items_id+"', '"+hide_comments_link_id+"', '"+comment_section_display_type+"'); adjh();}, '"+prayer_id+"')", 2000);
}
function remote_submit_pray_with(callback, prayer_id){
g_uid = viewer.getId();
name = escape(viewer.getDisplayName());
pic_url = escape(viewer.getField(opensocial.Person.Field.THUMBNAIL_URL));
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&g_uid="+g_uid+"&prayer_id="+prayer_id+"&name="+name+"&pic_url="+pic_url;
var url = base_url+"users/add_prayer_partner";
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
prayWithActivity(viewer, 'orig_prayer', 'prayer_poster_profile_url', 'prayer_poster_pic_url', 'prayer_poster_name');
}, req_params);
}
function submit_wish_well(prayer_id, org_prayer_name, comment_area_id, comment_section_display_type){
setTimeout("remote_submit_wish_well(function(xmlData){ extract_only_prayer_comments(xmlData, '"+prayer_id+"', '"+org_prayer_name+"', false, '"+comment_area_id+"', '"+comment_input_id+"', '"+more_comment_items_id+"', '"+hide_comments_link_id+"', '"+comment_section_display_type+"'); adjh();}, '"+prayer_id+"')", 2000);
}
function remote_submit_wish_well(callback, prayer_id){
g_uid = viewer.getId();
name = escape(viewer.getDisplayName());
pic_url = escape(viewer.getField(opensocial.Person.Field.THUMBNAIL_URL));
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&g_uid="+g_uid+"&prayer_id="+prayer_id+"&name="+name+"&pic_url="+pic_url;
var url = base_url+"users/add_well_wisher";
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
//sendGoodWishesActivity(viewer, 'orig_prayer', 'prayer_poster_profile_url', 'prayer_poster_pic_url', 'prayer_poster_name');
}, req_params);
}
function show_sent(link_elem_id, message_elem_id){
getElem(link_elem_id).style.display='none'; getElem(message_elem_id).style.display='';
adjh();
//setTimeout("getElem('"+link_elem_id+"').style.display=''; getElem('"+message_elem_id+"').style.display='none';", 3000);
}
function extract_only_prayer_comments(xmlData, prayer_id, org_prayer_name, show_expanded, comment_area_id, comment_input_id, more_comment_items_id, hide_comments_link_id, comment_section_display_type){
var commentNodes = xmlData.getElementsByTagName("comment");
var prayerPartnerNodes = xmlData.getElementsByTagName("prayer-partner");
var wellWisherNodes = xmlData.getElementsByTagName("well-wisher");
commentsAry = [];
prayerPartnerAry = [];
wellWisherAry = [];
index = 0;
html = "";
for(var d=0; d<commentNodes.length; d++){
cmnt = commentNodes.item(d).childNodes;
var comment_text = "";
var commenter_guid = "";
var commenter_name = "";
var commenter_picurl = "";
var comment_date = "";
for(var e=0; e<cmnt.length; e++){
var nde = cmnt.item(e);
if(nde != null && nde.firstChild != null){
if (nde.nodeName == "comment-text") {
comment_text = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "commenter-guid") {
commenter_guid = nde.firstChild.nodeValue;
}
if (nde.nodeName == "commenter-name") {
commenter_name = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "commenter-picurl") {
commenter_picurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "comment-date") {
comment_date= nde.firstChild.nodeValue;
}
}
}
if (commenter_guid != ""){
commentsAry[index++] = [comment_text, commenter_guid, commenter_name, commenter_picurl, comment_date];
}
}
// Reset index
index = 0;
for(var d=0; d<prayerPartnerNodes.length; d++){
ppn= prayerPartnerNodes.item(d).childNodes;
var pp_guid = "";
var pp_name = "";
var pp_picurl = "";
var pp_date = "";
for(var e=0; e<ppn.length; e++){
var nde = ppn.item(e);
if(nde != null && nde.firstChild != null){
if (nde.nodeName == "pp-guid") {
pp_guid = nde.firstChild.nodeValue;
}
if (nde.nodeName == "pp-name") {
pp_name = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "pp-picurl") {
pp_picurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "pp-date") {
pp_date= nde.firstChild.nodeValue;
}
}
}
if (pp_guid != ""){
prayerPartnerAry[index++] = [pp_guid, pp_name, pp_picurl, pp_date];
}
}
// Reset index
index = 0;
for(var d=0; d<wellWisherNodes.length; d++){
wwn= wellWisherNodes.item(d).childNodes;
var ww_guid = "";
var ww_name = "";
var ww_picurl = "";
var ww_date = "";
for(var e=0; e<wwn.length; e++){
var nde = wwn.item(e);
if(nde != null && nde.firstChild != null){
if (nde.nodeName == "ww-guid") {
ww_guid = nde.firstChild.nodeValue;
}
if (nde.nodeName == "ww-name") {
ww_name = unescape(nde.firstChild.nodeValue);
}
if (nde.nodeName == "ww-picurl") {
ww_picurl = nde.firstChild.nodeValue;
}
if (nde.nodeName == "ww-date") {
ww_date= nde.firstChild.nodeValue;
}
}
}
if (ww_guid != ""){
wellWisherAry[index++] = [ww_guid, ww_name, ww_picurl, ww_date];
}
}
html += " <div>";
html += " <div>";
// Todo remove this NEW! text
if(comment_section_display_type == 'LINKS_ONLY'){
html += "<span style='color: red; font-weight: bold;'>New!</span> ";
}
html += " <span id='"+comment_area_id+"_pray_with_link'>";
html += " <a href=\"#\" onclick=\"show_sent('"+comment_area_id+"_pray_with_link', '"+comment_area_id+"_thanks_for_prayer'); submit_pray_with('"+prayer_id+"', '"+org_prayer_name+"', '"+comment_area_id+"', '"+comment_input_id+"', '"+more_comment_items_id+"', '"+hide_comments_link_id+"', '"+comment_section_display_type+"');\">Pray along ("+prayerPartnerAry.length+")</a>";
for(var s=0; (s<(prayerPartnerAry.length/5)) && (s < 25); s++){
html += "<span><img src='"+base_url+"images/star.gif' style='margin-bottom: -2px;'></span>";
}
html += " </span>";
html += " <span id='"+comment_area_id+"_thanks_for_prayer' style='display: none; background-color: yellow;'>";
html += " Thanks!";
html += " </span>";
html += " | ";
html += " <span id='"+comment_area_id+"_send_good_wishes_link'>";
html += " <a href=\"#\" onclick=\"show_sent('"+comment_area_id+"_send_good_wishes_link', '"+comment_area_id+"_thanks_for_good_wishes'); submit_wish_well('"+prayer_id+"', '"+org_prayer_name+"', '"+comment_area_id+"', '"+comment_input_id+"', '"+more_comment_items_id+"', '"+hide_comments_link_id+"', '"+comment_section_display_type+"');\">Send good wishes ("+wellWisherAry.length+")</a>";
for(var s=0; (s<(wellWisherAry.length/5)) && (s < 25); s++){
html += "<span><img src='"+base_url+"images/star.gif' style='margin-bottom: -2px;'></span>";
}
html += " </span>";
html += " <span id='"+comment_area_id+"_thanks_for_good_wishes' style='display: none; background-color: yellow;'>";
html += " Sent your wishes";
html += " </span>";
html += " </div>";
html += " </div>";
// If allowed to add comments
if(comment_section_display_type == 'COMMENTS_AND_LINKS'){
html += " <div style=\"margin-top: 5px;\">";
html += " <textarea id='"+comment_input_id+"' "+replaceable_text_events(replaceme_text, comment_input_id)+" style=\"color: #aaa; width: 375px;\" class=\"comment_textarea\">"+replaceme_text+"</textarea>";
html += " <br/><input value='Post comment' type='button' onclick=\"if(document.getElementById('"+comment_input_id+"').value!=replaceme_text){this.disabled=true; this.value='Please wait...';} submit_prayer_comment('"+prayer_id+"', '"+org_prayer_name+"', '"+comment_area_id+"', '"+comment_input_id+"', '"+more_comment_items_id+"', '"+hide_comments_link_id+"');\" />";
html += " </div>";
}
for(var i=0; i<commentsAry.length; i++){
if(i==2){
html += "<div id='"+hide_comments_link_id+"'>";
html += " <a href=\"javascript:void(0)\" onclick=\"document.getElementById('"+more_comment_items_id+"').style.display='';document.getElementById('"+hide_comments_link_id+"').style.display='none';adjh(); return false;\">Show more comments ("+commentsAry.length+")</a></b>";
html += "</div>";
html += "<div id='"+more_comment_items_id+"' style='display: none;'>";
}
html += " <div style='margin-top: 5px'>";
html += " <div class='left'>";
html += " "+link_to_profile_with_image(commentsAry[i][1], commentsAry[i][3], 'height: 32px; width: 32px;');
html += " </div>";
html += " <div class='left smalltext' style='width: 275px; margin-left: 8px;'>";
html += " <div>";
html += " "+link_to_profile_with_text(commentsAry[i][1], commentsAry[i][2])+" wrote, "+commentsAry[i][4]+":</i>";
html += " </div>";
html += " <div class='comment_item_text' style=\"margin-top: 5px;\">";
html += " "+unescape_html(commentsAry[i][0]);
html += " </div>";
html += " </div>";
html += " <div class='clear'></div>";
html += " </div>";
if(commentsAry.length > 2 && i==commentsAry.length-1){
html += "</div>";
}
}
document.getElementById(comment_area_id).innerHTML=html;
adjh();
}
/**************************************/
/* END Prayers */
/**************************************/
/**************************************/
/* Search functions */
/**************************************/
function submit_search(search_type, query_str){
remote_search(function(xmlData){
extract_search_results(xmlData);
document.getElementById('search_input').value='';
adjh();
}, owner.getId(), search_type, query_str);
}
function remote_search(callback, g_uid, search_type, query_str){
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&search_type="+search_type+"&q="+query_str;
var url = base_url+"verses/search";
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
}, req_params);
}
function extract_search_results(xmlData){
var matchingVerses = xmlData.getElementsByTagName("verse");
var matchingVerseAry = [];
index = 0;
for(var i=0; i<matchingVerses.length; i++){
var nodeList = matchingVerses.item(i).childNodes;
var collection_num = "";
var book_num = "";
var chapter_num = "";
var verse_num = "";
var verse_text = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if (node.nodeName == "collection-num") {
collection_num = node.firstChild.nodeValue;
}
if (node.nodeName == "book-num") {
book_num = node.firstChild.nodeValue;
}
if (node.nodeName == "chapter-num") {
chapter_num = node.firstChild.nodeValue;
}
if (node.nodeName == "verse-num") {
verse_num = node.firstChild.nodeValue;
}
if (node.nodeName == "text") {
verse_text = node.firstChild.nodeValue;
}
}
matchingVerseAry[index++] = [collection_num, book_num, chapter_num, verse_num, verse_text];
}
var html = "<div>";
for(var i=0; i<matchingVerseAry.length; i++){
html += "<div>";
html += " "+matchingVerseAry[i][4]+" [<i>from "+get_book_name(matchingVerseAry[i][0], matchingVerseAry[i][1])+" "+matchingVerseAry[i][2]+":"+matchingVerseAry[i][3]+"</i>]";
html += "</div>";
}
html += "</div>";
document.getElementById('search_results').innerHTML=html;
}
/**************************************/
/* END Search functions */
/**************************************/
/**************************************/
/* Bible Quiz Functions */
/**************************************/
function get_next_quiz_question(qqid, ans, type){
document.getElementById('quiz_continue_button').disabled=true;
document.getElementById('quiz_continue_button_msg').innerHTML="Next verse coming up...";
friends_guids = getFriendGuids();
remote_fetch_quiz_question(function(xmlData){
extract_quiz_question(xmlData);
document.getElementById('quiz_continue_button').disabled=false;
document.getElementById('quiz_continue_button_msg').innerHTML="";
var a_button = getElem('quiz_a_button');
var b_button = getElem('quiz_b_button');
var c_button = getElem('quiz_c_button');
a_button.disabled=false;
b_button.disabled=false;
c_button.disabled=false;
adjh();
}, qqid, ans, type, friends_guids);
}
function adjh(){
gadgets.window.adjustHeight();
setTimeout("gadgets.window.adjustHeight()", 100);
}
function remote_fetch_quiz_question(callback, qqid, ans, fetch_type, friends_guids){
var url = base_url+"quizzes/get_next_question";
var params;
// fetch_type can be a GET, ANS, or SKIP
if (qqid === null){
params = "nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&g_uid="+owner.getId()+"&fetch_type="+fetch_type+"&friends_guids="+friends_guids;
} else {
var t = getElem('qz_t').innerHTML;
params = "nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain+"&g_uid="+owner.getId()+"&fetch_type="+fetch_type+"&friends_guids="+friends_guids+"&qqid="+qqid+"&ans="+ans+"&t="+t;
}
req_params[gadgets.io.RequestParameters.POST_DATA]=params;
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
}, req_params);
}
function extract_quiz_question(xmlData){
// LAST QUESTION //////////////////////////////
var lastQuestion = xmlData.getElementsByTagName("last-question");
var nodeList = lastQuestion.item(0).childNodes;
var question = "";
var got_it_right = "";
var right_answer = "";
var answer_explanation = "";
var improved_rank = "";
var improved_to_rank = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if (node.nodeName == "question") {
question = node.firstChild.nodeValue;
}
if (node.nodeName == "got-it-right") {
got_it_right = node.firstChild.nodeValue;
}
if (node.nodeName == "right-answer") {
right_answer = node.firstChild.nodeValue;
}
if (node.nodeName == "answer-explanation") {
answer_explanation = node.firstChild.nodeValue;
}
if (node.nodeName == "improved-rank") {
improved_rank = node.firstChild.nodeValue;
}
if (node.nodeName == "improved-to-rank") {
improved_to_rank = node.firstChild.nodeValue;
}
}
// NEXT QUESTION //////////////////////////////
var nextQuestion = xmlData.getElementsByTagName("next-question");
var nodeList = nextQuestion.item(0).childNodes;
var question = "";
var answer_a= "";
var answer_b = "";
var answer_c = "";
var qqid = "";
var crans = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if(node.firstChild!=null){
if (node.nodeName == "question") {
question = node.firstChild.nodeValue;
}
if (node.nodeName == "answer-a") {
answer_a = node.firstChild.nodeValue;
}
if (node.nodeName == "answer-b") {
answer_b = node.firstChild.nodeValue;
}
if (node.nodeName == "answer-c") {
answer_c = node.firstChild.nodeValue;
}
if (node.nodeName == "qqid") {
qqid = node.firstChild.nodeValue;
}
if (node.nodeName == "crans") {
crans = node.firstChild.nodeValue;
}
}
}
// USER SCORES //////////////////////////////
var userScores = xmlData.getElementsByTagName("user-scores");
var nodeList = userScores.item(0).childNodes;
var scholar_rank = "";
var total_points = "";
var points_to_next_rank = "";
var best_streak = "";
var current_streak = "";
var total_questions_answered = "";
var total_answers_correct = "";
var pct_correct = "";
var avg_answer_time = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if(node.firstChild != null){
if (node.nodeName == "scholar-rank") {
scholar_rank = node.firstChild.nodeValue;
}
if (node.nodeName == "total-points") {
total_points = node.firstChild.nodeValue;
}
if (node.nodeName == "points-to-next-rank") {
points_to_next_rank = node.firstChild.nodeValue;
}
if (node.nodeName == "best-streak") {
best_streak = node.firstChild.nodeValue;
}
if (node.nodeName == "current-streak") {
current_streak = node.firstChild.nodeValue;
}
if (node.nodeName == "total-questions-answered") {
total_questions_answered = node.firstChild.nodeValue;
}
if (node.nodeName == "total-answers-correct") {
total_answers_correct = node.firstChild.nodeValue;
}
if (node.nodeName == "pct-correct") {
pct_correct = node.firstChild.nodeValue;
}
if (node.nodeName == "avg-answer-time") {
avg_answer_time = node.firstChild.nodeValue;
}
}
}
// Top Scorers //////////////////////////////
var topScores = xmlData.getElementsByTagName("top-scorer");
var top_scores = [];
var index = 0;
var number_ranking = 1;
for(var i=0; i<topScores.length; i++){
var nodeList = topScores.item(i).childNodes;
var pic_url = "";
var name = "";
var score = "";
var ranking = "";
var guid = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if(node.firstChild != null){
if (node.nodeName == "pic-url") {
pic_url = node.firstChild.nodeValue;
}
if (node.nodeName == "name") {
name = unescape(node.firstChild.nodeValue);
}
if (node.nodeName == "score") {
score = node.firstChild.nodeValue;
}
if (node.nodeName == "ranking") {
ranking = node.firstChild.nodeValue;
}
if (node.nodeName == "guid") {
guid = node.firstChild.nodeValue;
}
}
}
if(index!=0){
if(top_scores[index-1][2] != score){
number_ranking++;
}
}
top_scores[index++] = [pic_url, name, score, ranking, guid, number_ranking];
}
// Friends Scorers //////////////////////////////
var friendScores = xmlData.getElementsByTagName("friend-score");
var friend_scores = [];
index = 0;
for(var i=0; i<friendScores.length; i++){
var nodeList = friendScores.item(i).childNodes;
var pic_url = "";
var name = "";
var score = "";
var ranking = "";
var guid = "";
for (var n = 0; n < nodeList.length ; n++) {
var node = nodeList.item(n);
if(node.firstChild != null){
if (node.nodeName == "pic-url") {
pic_url = node.firstChild.nodeValue;
}
if (node.nodeName == "name") {
name = unescape(node.firstChild.nodeValue);
}
if (node.nodeName == "score") {
score = node.firstChild.nodeValue;
}
if (node.nodeName == "ranking") {
ranking = node.firstChild.nodeValue;
}
if (node.nodeName == "guid") {
guid = node.firstChild.nodeValue;
}
}
}
friend_scores[index++] = [pic_url, name, score, ranking, guid];
}
set_score_box(scholar_rank, total_points, points_to_next_rank, best_streak, current_streak, total_questions_answered, total_answers_correct, pct_correct, avg_answer_time);
set_top_scores_box(top_scores);
set_friends_scores_box(friend_scores);
set_question_box(question, answer_a, answer_b, answer_c, qqid, crans);
start_countdown(countdown_val);
if(improved_rank == "true"){
rankedUpActivity(owner, improved_to_rank);
}
}
/**************************************/
/* END Bible Quiz Functions */
/**************************************/
/**************************************/
/* Daily verses */
/**************************************/
function fetch_random_inspiring_daily_verse(){
remote_fetch_random_inspiring_daily_verse(function(xmlData){
var dailyVerses = xmlData.getElementsByTagName("daily-inspiring-verses");
document.getElementById("canvas_daily_verse").innerHTML=extract_daily_verse(dailyVerses, 'new_random_inspiring_on_daily_verse_', false);
document.getElementById("canvas_favorites_daily_verse").innerHTML=extract_daily_verse(dailyVerses, 'new_random_inspiring_on_favorites_', false);
document.getElementById("canvas_post_a_prayer_daily_verse").innerHTML=extract_daily_verse(dailyVerses, 'new_random_inspiring_on_post_a_prayer_', true);
adjh();
});
}
function remote_fetch_random_inspiring_daily_verse(callback){
req_params[gadgets.io.RequestParameters.POST_DATA]="nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain;
var url = base_url+"users/get_next_inspiring_verse";
gadgets.io.makeRequest(url, function(xmlData){
callback(xmlData.data);
}, req_params);
}
/**************************************/
/* END Daily verses */
/**************************************/
function update_top_favorites(){
_IG_FetchContent(base_url+"verses/most_popular?nothing="+Math.random()+"&lang="+app_lang+"&domain="+app_domain, function (response) {
document.getElementById("popular_passages").innerHTML = response;
adjh();
});
}
function encode_favorites(){
var str = "";
for(var i=0; i<favorites.length; i++){
str += favorites[i][0]+"_"+favorites[i][1]+"_"+favorites[i][2]+"_"+favorites[i][3]+"::::"+favorites[i][4]+"::::"+favorites[i][5];
if(i<favorites.length-1){
str += "--::--";
}
}
return str;
}
function setPicLogoLink(){
var html = "";
html += "<div class='left'>";
html += " <a href='"+getAppInfoLink()+"'>";
html += " <img src='http://www.joshuaslist.com/images/bible_app_logo_no_add_profile_text.gif' style='border: none;' />";
html += " </a>";
html += "</div>";
html += "<div class='class'></div>";
getElem('app_logo_link').innerHTML=html;
getElem('app_logo_link').style.display='';
}
function get_book_name(collection_num, book_num){
return collections[collection_num-1][1][book_num-1][0];
}
function get_verse_text(collection_num, book_num, chapter_num, verse_num){
elem_id = "verse_text_"+collection_num+"_"+book_num+"_"+chapter_num+"_"+verse_num;
return document.getElementById(elem_id).innerHTML;
}
function link_to_profile_with_text(guid, name){
return name;
//return "<a href=\"#\" onclick=\"window.parent.location.href='"+platform_url+"/Profile.aspx?uid="+guid+"'\">"+name+"</a>";
}
function link_to_profile_with_image(guid, src_url, image_style){
return get_image(src_url, image_style);
//return "<a href=\"#\" onclick=\"window.parent.location.href='"+platform_url+"/Profile.aspx?uid="+guid+"'\"><img src=\""+src_url+"\" style=\""+image_style+"\"/></a>";
}
function get_image(url, style){
if(url.indexOf("nophoto") == -1){
return "<img src=\""+url+"\" style=\""+style+"\" />";
} else {
return "<img src='http://barrywelch.net/nophoto.jpg' style=\""+style+"\" />";
}
}
function link_to_prayer_info(prayer_text){
return "<a href=\"javascript:void(0)\" onclick=\"getElem('post_a_prayer_input').value='"+prayer_text+&q