1. SwordWeb
  2. SWEB-12

Clicking on a word sometimes results in other extra words being highlighted


    • Type: Bug Bug
    • Status: Open (View Workflow)
    • Priority: Major Major
    • Resolution: Unresolved
    • Labels:


      Example 1

      Search for "ouc" (Symbol) = "ουχ" (Unicode) in the Byzantine/Majority Text (2000), or go directly to http://www.crosswire.org/study/wordsearchresults.jsp?mod=Byz&searchTerm=%CE%BF%CF%85%CF%87. Click on the first "ou" = "ου" in the first search result Matthew 6:26. Then the following are also highlighted: "oV" = "ος" in Matt 20:26, "en" = "εν" in Luke 22:26 and "amhn" = "αμην" in John 6:26.

      The HTML source shows that each word is enclosed within a tag of the form
      <span class="clk" onclick="p('G','3756','26_Byz8','PRT-N','','Byz');" > ου</span>
      "26_Byz8" identifies it as verse 26 word 8, so colorLemmas() in swordweb.js can only distinguish between words in the same chapter. Therefore all other search results that are the 26th verse will have the 8th word highlighted.

      Example 2

      Go to http://www.crosswire.org/study/wordsearchresults.jsp?mod=KJV&searchTerm=Paul&start=120 and click on "God" in Rom 1:1. The HTML for that is
      <span class="clk" onclick="p('G','2316','1_TR10','N-DSM','','KJV');">God</span>
      The differences between these two examples and what I understand from http://crosswire.org/svn/swordweb/trunk/webapp/wordsearchresults.jsp lead me to believe that the insufficient information is due to getRenderText() in the module itself.


      If the problem is with the module itself, I think it would be good to change it as soon as possible otherwise it may be more troublesome in the future. I suggest each word by uniquely indexed by "[text][book][chapter][verse][word]" (for example, "Byz_Matt_6_26_8".

      Also, I think it is better to avoid using global variables for communication between functions. wd() could be removed and colorLemmas() could be replaced with the following code. The commented lines are the original while my code is between "Start" and "End"

      function colorLemmas(wordnum, key, morph, augment) {
      if (augment != true) {
      for (i = 0; i < curspans.length; i++)

      { curspans[i].className=''; }

      curspans.length = 0;

      spans = document.getElementsByTagName('span');
      for (i = 0; i < spans.length; i++) {
      ocf = spans[i].getAttribute('onclick');
      if (ocf) {
      oc = ocf.toString();
      fb = oc.indexOf('p(');
      if (fb >= 0) {
      fe = oc.indexOf(')', fb);
      // wdf = 'wd'+oc.substring(fb+1, fe+1);
      // wdata = eval(wdf);
      /* Start */
      var wdata = eval("["+oc.substring(fb+2,fe)+"]");
      var mod = wdata[0];
      var wd_strong = wdata[1];
      var wd_morph = wdata[2];
      var wd_wnum = wdata[3];
      /* End */
      if (wd_wnum == wordnum)

      { curspans[curspans.length] = spans[i]; spans[i].className='curWord'; }

      else if (wd_strong == key) {
      if (wd_morph == morph)

      { curspans[curspans.length] = spans[i]; spans[i].className='sameLemmaMorph'; }


      { curspans[curspans.length] = spans[i]; spans[i].className='sameLemma'; }



        There are no comments yet on this issue.


          • Assignee:
            David Lim
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: