diff --git a/DynamicBibleUtility/DynamicBibleUtility.suo b/DynamicBibleUtility/DynamicBibleUtility.suo index e089bfc9..23f0459f 100644 Binary files a/DynamicBibleUtility/DynamicBibleUtility.suo and b/DynamicBibleUtility/DynamicBibleUtility.suo differ diff --git a/DynamicBibleUtility/DynamicBibleUtility/Text.cs b/DynamicBibleUtility/DynamicBibleUtility/Text.cs index 8c9053d6..71580dcb 100644 --- a/DynamicBibleUtility/DynamicBibleUtility/Text.cs +++ b/DynamicBibleUtility/DynamicBibleUtility/Text.cs @@ -24,5 +24,6 @@ namespace DynamicBibleUtility { public string txt = ""; public string str = ""; + public int i = -1; } } diff --git a/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs b/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs index cea77dfa..125ed6b1 100644 --- a/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs +++ b/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs @@ -274,129 +274,67 @@ namespace DynamicBibleUtility { Book bk = new Book(); bk.bk = el.FirstAttribute.Value.ToString(); - foreach (XElement chn in el.Descendants()) + foreach (XElement chn in el.Nodes()) { Chapter ch = new Chapter(); ch.ch = chn.FirstAttribute.Value; + foreach (XElement vs in chn.Nodes()) + { + Verse v = new Verse(); + v.vs = vs.FirstAttribute.Value; + int i = 0; + foreach (object o in vs.Nodes()) + { + Text t = new Text(); + if (o.GetType() == typeof(XElement)) + { + t.txt = ((XElement)o).Value; + if (((XElement)o).Name == "gr") + { + if (Convert.ToInt32(bk.bk) >= 40) + { + t.str = "G" + ((XElement)o).FirstAttribute.Value; + } + else + { + t.str = "H" + ((XElement)o).FirstAttribute.Value; + } + } + else if ((((XElement)o).Name.ToString().ToLower() == "style")) + { + // do nothing, because we don't care about style right now. + } + else + { + throw new Exception("Unknown Element"); + } + t.i = i++; + } + else if (o.GetType() == typeof(XText)) + { + t.txt = ((XText)o).Value; + t.i = i++; + } + else + { + throw new Exception("Unknown Element"); + } + v.words.Add(t); + } + ch.vss.Add(v); + } + bk.chs.Add(ch); + System.IO.File.WriteAllText(bk.bk.ToString() + "-"+ch.ch+".json", Serialize(ch)); } + bbl.Add(bk); + + UpdateStatus("Book: " + bk.bk + "\r\n"); } } } - - // to index, you need to iterate through every word in the bible. - /* - foreach (DynamicBible.Schemas.XMLBIBLE_BOOK bk in b.BIBLEBOOKS) - { - Book book = new Book(); - book.bk = bk.bnumber.ToString(); - foreach (DynamicBible.Schemas.XMLBIBLE_CHAPTER ch in bk.CHAPTERS) - { - Chapter chapter = new Chapter(); - chapter.ch = ch.cnumber.ToString(); - foreach (DynamicBible.Schemas.XMLBIBLE_VERSES vs in ch.VERSES) - { - Verse verse = new Verse(); - verse.vs = vs.vnumber.ToString(); - if (vs.Items != null) - { - foreach (object w in vs.Items) - { - // for each word, add an entry. - if (w.GetType() == typeof(DynamicBible.Schemas.XMLBIBLE_GR)) - { - DynamicBible.Schemas.XMLBIBLE_GR gr = ((DynamicBible.Schemas.XMLBIBLE_GR)w); - if (gr.Text != null) - { - foreach (string t in gr.Text) - { - foreach (string s in t.Split(' ')) - { - AddWordToIndex(s, bk.bnumber.ToString(), ch.cnumber.ToString(), vs.vnumber.ToString()); - } - } - } - } - else if (w.GetType() == typeof(DynamicBible.Schemas.XMLBIBLE_STYLE_ITEM)) - { - DynamicBible.Schemas.XMLBIBLE_STYLE_ITEM o = ((DynamicBible.Schemas.XMLBIBLE_STYLE_ITEM)w); - if (o.Text != null) - { - foreach (string t in o.Text) - { - foreach (string s in t.Split(' ')) - { - AddWordToIndex(s, bk.bnumber.ToString(), ch.cnumber.ToString(), vs.vnumber.ToString()); - } - } - } - if (o.gr != null) - { - DynamicBible.Schemas.XMLBIBLE_STYLE_GR gr = o.gr; - if (gr.Text != null) - { - foreach (string t in gr.Text) - { - foreach (string s in t.Split(' ')) - { - AddWordToIndex(s, bk.bnumber.ToString(), ch.cnumber.ToString(), vs.vnumber.ToString()); - } - } - } - } - if (o.STYLE != null) - { - foreach (DynamicBible.Schemas.XMLBIBLE_STYLE_STYLE so in o.STYLE) - { - if (so.Text != null) - { - foreach (string t in so.Text) - { - foreach (string s in t.Split(' ')) - { - AddWordToIndex(s, bk.bnumber.ToString(), ch.cnumber.ToString(), vs.vnumber.ToString()); - } - } - } - if (so.gr != null) - { - DynamicBible.Schemas.XMLBIBLE_STYLE_STYLE_GR gr = so.gr; - if (gr.Value != null) - { - foreach (string s in gr.Value.Split(' ')) - { - AddWordToIndex(s, bk.bnumber.ToString(), ch.cnumber.ToString(), vs.vnumber.ToString()); - } - } - } - } - } - } - } - } - if (vs.Text != null) - { - foreach (string w in vs.Text) - { - foreach (string s in w.Split(' ')) - { - if (s != null && s.Trim() != "") - { - verse.words.Add(s); - } - } - } - } - chapter.vss.Add(verse); - } - - book.chs.Add(chapter); - } - bbl.Add(book); - UpdateStatus("Book: " + bk.bnumber + ", Word Count: " + _words.Count + "\r\n"); - } - - */ + // finished. + } } } diff --git a/js/common.js b/js/common.js index 66935f59..b8c07aa9 100644 --- a/js/common.js +++ b/js/common.js @@ -127,9 +127,7 @@ function Search(sv) } } - $( "#result" ).sortable(); - $( "#result" ).disableSelection(); - + $( "#result" ).sortable({ axis: "x", handle: ".handle" }); } catch (err) {