mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 15:30:14 -04:00
1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
function bookName(a){var b=new Array;b[0]="";b[1]="Genesis";b[2]="Exodus";b[3]="Leviticus";b[4]="Numbers";b[5]="Deuteronomy";b[6]="Joshua";b[7]="Judges";b[8]="Ruth";b[9]="1 Samuel";b[10]="2 Samuel";b[11]="1 Kings";b[12]="2 Kings";b[13]="1 Chronicles";b[14]="2 Chronicles";b[15]="Ezra";b[16]="Nehemiah";b[17]="Esther";b[18]="Job";b[19]="Psalm";b[20]="Proverbs";b[21]="Ecclesiastes";b[22]="Song of Songs";b[23]="Isaiah";b[24]="Jeremiah";b[25]="Lamentations";b[26]="Ezekiel";b[27]="Daniel";b[28]="Hosea";b[29]="Joel";b[30]="Amos";b[31]="Obadiah";b[32]="Jonah";b[33]="Micah";b[34]="Nahum";b[35]="Habakkuk";b[36]="Zephaniah";b[37]="Haggai";b[38]="Zechariah";b[39]="Malachi";b[40]="Matthew";b[41]="Mark";b[42]="Luke";b[43]="John";b[44]="Acts";b[45]="Romans";b[46]="1 Corinthians";b[47]="2 Corinthians";b[48]="Galatians";b[49]="Ephesians";b[50]="Philippians";b[51]="Colossians";b[52]="1 Thessalonians";b[53]="2 Thessalonians";b[54]="1 Timothy";b[55]="2 Timothy";b[56]="Titus";b[57]="Philemon";b[58]="Hebrews";b[59]="James";b[60]="1 Peter";b[61]="2 Peter";b[62]="1 John";b[63]="2 John";b[64]="3 John";b[65]="Jude";b[66]="Revelation";return b[a]}function Reference(a){a=a.toLowerCase().trim();var b=new Object;var c=a.substring(0,a.search(/\w\s+\d/i)+1);if(c.search(/\b(genesis|gen|ge|gn)\b/i)!=-1){this.book=1;this.bookname="Genesis";this.longbookname="Genesis";this.lastchapter=50}if(c.search(/\b(exodus|ex|exo|exod|exd)\b/i)!=-1){this.book=2;this.bookname="Exodus";this.longbookname="Exodus";this.lastchapter=40}if(c.search(/\b(leviticus|lev|le|levi|lv)\b/i)!=-1){this.book=3;this.bookname="Leviticus";this.longbookname="Leviticus";this.lastchapter=27}if(c.search(/\b(numbers|num|nu|numb|number)\b/i)!=-1){this.book=4;this.bookname="Numbers";this.longbookname="Book_of_Numbers";this.lastchapter=36}if(c.search(/\b(deuteronomy|deut|de|dt|deu)\b/i)!=-1){this.book=5;this.bookname="Deuteronomy";this.longbookname="Deuteronomy";this.lastchapter=34}if(c.search(/\b(joshua|josh|jos)\b/i)!=-1){this.book=6;this.bookname="Joshua";this.longbookname="Book_of_Joshua";this.lastchapter=24}if(c.search(/\b(judges|jud|ju|jdg|judg)\b/i)!=-1){this.book=7;this.bookname="Judges";this.longbookname="Book_of_Judges";this.lastchapter=21}if(c.search(/\b(ruth|ru)\b/i)!=-1){this.book=8;this.bookname="Ruth";this.longbookname="Book_of_Ruth";this.lastchapter=4}if(c.search(/\b(1|i|1st|first)\s*(samuel|sa|sam|sml)\b/i)!=-1){this.book=9;this.bookname="1 Samuel";this.longbookname="First_Samuel";this.lastchapter=31}if(c.search(/\b(2|ii|2nd|second|sec)\s*(samuel|sa|sam|sml)\b/i)!=-1){this.book=10;this.bookname="2 Samuel";this.longbookname="Second_Samuel";this.lastchapter=24}if(c.search(/\b(1|i|1st|first)\s*(kings|king|kgs|kn|k|ki)\b/i)!=-1){this.book=11;this.bookname="1 Kings";this.longbookname="First_Kings";this.lastchapter=22}if(c.search(/\b(2|ii|2nd|second|sec)\s*(kings|king|kgs|kn|k|ki)\b/i)!=-1){this.book=12;this.bookname="2 Kings";this.longbookname="Second_Kings";this.lastchapter=25}if(c.search(/\b(1|i|1st|first)\s*(chronicles|chron|ch|chr)\b/i)!=-1){this.book=13;this.bookname="1 Chronicles";this.longbookname="First_Chronicles";this.lastchapter=29}if(c.search(/\b(2|ii|2nd|second|sec)\s*(chronicles|chron|ch|chr)\b/i)!=-1){this.book=14;this.bookname="2 Chronicles";this.longbookname="Second_Chronicles";this.lastchapter=36}if(c.search(/\b(ezra|ez|ezr)\b/i)!=-1){this.book=15;this.bookname="Ezra";this.longbookname="Book_of_Ezra";this.lastchapter=10}if(c.search(/\b(nehemiah|neh|ne|nehamiah)\b/i)!=-1){this.book=16;this.bookname="Nehemiah";this.longbookname="Book_of_Nehemiah";this.lastchapter=13}if(c.search(/\b(esther|est|es|esth)\b/i)!=-1){this.book=17;this.bookname="Esther";this.longbookname="Book_of_Esther";this.lastchapter=10}if(c.search(/\b(job|jo|jb)\b/i)!=-1){this.book=18;this.bookname="Job";this.longbookname="Book_of_Job";this.lastchapter=42}if(c.search(/\b(psalms|ps|psa|psalm|psm)\b/i)!=-1){this.book=19;this.bookname="Psalm";this.longbookname="Psalm";this.lastchapter=150}if(c.search(/\b(proverbs|prov|pr|pro|proverb|prv|prvbs)\b/i)!=-1){this.book=20;this.bookname="Proverbs";this.longbookname="Book_of_Proverbs";this.lastchapter=31}if(c.search(/\b(ecclesiastes|eccl|ecc|eccles|ec|ecl|ecclesiaste)\b/i)!=-1){this.book=21;this.bookname="Ecclesiastes";this.longbookname="Ecclesiastes";this.lastchapter=12}if(c.search(/\b(song\sof\ssolomon|song\sof\ssongs|sos|ss|son|so|song|songs)\b/i)!=-1){this.book=22;this.bookname="Song of Solomon";this.longbookname="Song_of_Solomon";this.lastchapter=8}if(c.search(/\b(isaiah|is|is|isah|isai|ia)\b/i)!=-1){this.book=23;this.bookname="Isaiah";this.longbookname="Book_of_Isaiah";this.lastchapter=66}if(c.search(/\b(jerimiah|jeremiah|jer|je|jere)\b/i)!=-1){this.book=24;this.bookname="Jeremiah";this.longbookname="Book_of_Jeremiah";this.lastchapter=52}if(c.search(/\b(lamentations|lam|la|lamentation)\b/i)!=-1){this.book=25;this.bookname="Lamentations";this.longbookname="Book_of_Lamentations";this.lastchapter=5}if(c.search(/\b(ezekiel|eze|ez|ezk|ezek)\b/i)!=-1){this.book=26;this.bookname="Ezekiel";this.longbookname="Book_of_Ezekiel";this.lastchapter=48}if(c.search(/\b(daniel|dan|dn|dl|da)\b/i)!=-1){this.book=27;this.bookname="Daniel";this.longbookname="Book_of_Daniel";this.lastchapter=12}if(c.search(/\b(hosea|hos|ho)\b/i)!=-1){this.book=28;this.bookname="Hosea";this.longbookname="Book_of_Hosea";this.lastchapter=14}if(c.search(/\b(joel|joe|jl)\b/i)!=-1){this.book=29;this.bookname="Joel";this.longbookname="Book_of_Joel";this.lastchapter=3}if(c.search(/\b(amos|am|amo)\b/i)!=-1){this.book=30;this.bookname="Amos";this.longbookname="Book_of_Amos";this.lastchapter=9}if(c.search(/\b(obadiah|oba|ob|obad)\b/i)!=-1){this.book=31;this.bookname="Obadiah";this.longbookname="Book_of_Obadiah";this.lastchapter=1}if(c.search(/\b(jonah|jnh|jon)\b/i)!=-1){this.book=32;this.bookname="Jonah";this.longbookname="Book_of_Jonah";this.lastchapter=4}if(c.search(/\b(micah|mic|mi)\b/i)!=-1){this.book=33;this.bookname="Micah";this.longbookname="Book_of_Micah";this.lastchapter=7}if(c.search(/\b(nahum|nah|na)\b/i)!=-1){this.book=34;this.bookname="Nahum";this.longbookname="Book_of_Nahum";this.lastchapter=3}if(c.search(/\b(habakkuk|hab|ha|habakuk)\b/i)!=-1){this.book=35;this.bookname="Habakkuk";this.longbookname="Book_of_Habakkuk";this.lastchapter=3}if(c.search(/\b(zephaniah|zeph|zep)\b/i)!=-1){this.book=36;this.bookname="Zephaniah";this.longbookname="Book_of_Zephaniah";this.lastchapter=3}if(c.search(/\b(haggia|hag|hg|haggai)\b/i)!=-1){this.book=37;this.bookname="Haggai";this.longbookname="Book_of_Haggai";this.lastchapter=2}if(c.search(/\b(zechariah|zech|zch|zec)\b/i)!=-1){this.book=38;this.bookname="Zechariah";this.longbookname="Book_of_Zechariah";this.lastchapter=14}if(c.search(/\b(malachi|mal)\b/i)!=-1){this.book=39;this.bookname="Malachi";this.longbookname="Book_of_Malachi";this.lastchapter=4}if(c.search(/\b(matthew|mt|matt|mat)\b/i)!=-1){this.book=40;this.bookname="Matthew";this.longbookname="Gospel_of_Matthew";this.lastchapter=28}if(c.search(/\b(mark|mrk|mk|mr)\b/i)!=-1){this.book=41;this.bookname="Mark";this.longbookname="Gospel_of_Mark";this.lastchapter=16}if(c.search(/\b(luke|lu|lke|luk|lk)\b/i)!=-1){this.book=42;this.bookname="Luke";this.longbookname="Gospel_of_Luke";this.lastchapter=24}if(c.search(/\b(john|jn|jhn)\b/i)!=-1){this.book=43;this.bookname="John";this.longbookname="Gospel_of_John";this.lastchapter=21}if(c.search(/\b(acts|ac|act)\b/i)!=-1){this.book=44;this.bookname="Acts";this.longbookname="Acts_of_the_Apostles";this.lastchapter=28}if(c.search(/\b(romans|rom|ro|rm|roman)\b/i)!=-1){this.book=45;this.bookname="Romans";this.longbookname="Epistle_to_the_Romans";this.lastchapter=16}if(c.search(/\b(1|i|1st|first)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i)!=-1){this.book=46;this.bookname="1 Corinthians";this.longbookname="First_Epistle_to_the_Corinthians";this.lastchapter=16}if(c.search(/\b(2|ii|2nd|second|sec)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i)!=-1){this.book=47;this.bookname="2 Corinthians";this.longbookname="Second_Epistle_to_the_Corinthians";this.lastchapter=13}if(c.search(/\b(galatians|galatian|galations|gal|ga|gala|galation|galat)\b/i)!=-1){this.book=48;this.bookname="Galatians";this.longbookname="Epistle_to_the_Galatians";this.lastchapter=6}if(c.search(/\b(ephesians|eph|ep|ephes|ephe|ephs)\b/i)!=-1){this.book=49;this.bookname="Ephesians";this.longbookname="Epistle_to_the_Ephesians";this.lastchapter=6}if(c.search(/\b(philippians|phi|phil|ph|philip)\b/i)!=-1){this.book=50;this.bookname="Philippians";this.longbookname="Epistle_to_the_Philippians";this.lastchapter=4}if(c.search(/\b(colossians|col|co|colossian|colos|coloss)\b/i)!=-1){this.book=51;this.bookname="Colossians";this.longbookname="Epistle_to_the_Colossians";this.lastchapter=4}if(c.search(/\b(1|i|1st|first)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i)!=-1){this.book=52;this.bookname="1 Thessalonians";this.longbookname="First_Epistle_to_the_Thessalonians";this.lastchapter=5}if(c.search(/\b(2|ii|2nd|second|sec)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i)!=-1){this.book=53;this.bookname="2 Thessalonians";this.longbookname="Second_Epistle_to_the_Thessalonians";this.lastchapter=3}if(c.search(/\b(1|i|1st|first)\s*(timothy|tim|ti|timoth|tm)\b/i)!=-1){this.book=54;this.bookname="1 Timothy";this.longbookname="First_Epistle_to_Timothy";this.lastchapter=6}if(c.search(/\b(2|ii|2nd|second|sec)\s*(timothy|tim|timoth|tm)\b/i)!=-1){this.book=55;this.bookname="2 Timothy";this.longbookname="Second_Epistle_to_Timothy";this.lastchapter=4}if(c.search(/\b(titus|tit)\b/i)!=-1){this.book=56;this.bookname="Titus";this.longbookname="Epistle_to_Titus";this.lastchapter=3}if(c.search(/\b(philemon|phlmn|phl|phm|phile|philem)\b/i)!=-1){this.book=57;this.bookname="Philemon";this.longbookname="Epistle_to_Philemon";this.lastchapter=1}if(c.search(/\b(hebrews|heb|he|hebrew)\b/i)!=-1){this.book=58;this.bookname="Hebrews";this.longbookname="Epistle_to_the_Hebrews";this.lastchapter=13}if(c.search(/\b(james|jam|ja|jas|jms|jame|jm)\b/i)!=-1){this.book=59;this.bookname="James";this.longbookname="Epistle_of_James";this.lastchapter=5}if(c.search(/\b(1|i|1st|first)\s*(peter|pe|pet|pete|pt|p)\b/i)!=-1){this.book=60;this.bookname="1 Peter";this.longbookname="First_Epistle_of_Peter";this.lastchapter=5}if(c.search(/\b(2|ii|2nd|second|sec)\s*(peter|pe|pet|pete|pt|p)\b/i)!=-1){this.book=61;this.bookname="2 Peter";this.longbookname="Second_Epistle_of_Peter";this.lastchapter=3}if(c.search(/\b(1|i|1st|first)\s*(john|jn|jo)\b/i)!=-1){this.book=62;this.bookname="1 John";this.longbookname="First_Epistle_of_John";this.lastchapter=5}if(c.search(/\b(2|ii|2nd|second|sec)\s*(john|jn|jo)\b/i)!=-1){this.book=63;this.bookname="2 John";this.longbookname="Second_Epistle_of_John";this.lastchapter=1}if(c.search(/\b(3|iii|3rd|third)\s*(john|jn|jo)\b/i)!=-1){this.book=64;this.bookname="3 John";this.longbookname="Third_Epistle_of_John";this.lastchapter=1}if(c.search(/\b(jude|jud|ju)\b/i)!=-1){this.book=65;this.bookname="Jude";this.longbookname="Epistle_of_Jude";this.lastchapter=1}if(c.search(/\b(revelation|rev|re|revelations|rv)\b/i)!=-1){this.book=66;this.bookname="Revelation";this.longbookname="Book_of_Revelations";this.lastchapter=22}var d=new RegExp(c,"gi");var e=a.match(d);a=a.replace(d,"").trim();if(a.match(/\-/)!=null){var f=a.split("-")[0].trim();var g=a.split("-")[1].trim();if(f.match(/\:/)!=null){this.startchapter=f.split(":")[0].trim();this.startverse=f.split(":")[1].trim()}else{this.startchapter=f.trim();this.startverse=1}if(g.match(/\:/)!=null){this.endchapter=g.split(":")[0].trim();this.endverse=g.split(":")[1].trim()}else{if(e.length==2||f.match(/\:/)==null){this.endchapter=g.trim();this.endverse="*"}else{this.endchapter=this.startchapter;this.endverse=g.trim()}}}else{if(a.match(/\:/)!=null){this.startchapter=a.split(":")[0].trim();this.endchapter=a.split(":")[0].trim();this.startverse=a.split(":")[1].trim();this.endverse=a.split(":")[1].trim();}else{this.startchapter=a.trim();this.endchapter=a.trim();this.startverse=1;this.endverse="*"}}if(this.endchapter>this.lastchapter){this.endchapter=this.lastchapter}if(this.startchapter>this.endchapter){this.startchapter=this.endchapter}if(this.startchapter==this.endchapter&&this.startverse>this.endverse&&this.endverse!="*"){this.endverse=this.startverse}}String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};String.prototype.rtrim=function(){return this.replace(/\s+$/,"")} |