View the DQSD CVS repository here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/

Update of /cvsroot/dqsd/dqsd/addons/genealogy
In directory usw-pr-cvs1:/tmp/cvs-serv1796/addons/genealogy

Modified Files:
        genealogy_lib.js 
Added Files:
        fiftys.xml 
Log Message:
added 50states.com search (fiftys)
updated genealogy_lib.js - added function genealogy_strip_tags to work with 
50states.com

--- NEW FILE: fiftys.xml ---
<search function="fiftys">
  <name>Fifty States</name>
  <description>
    Goto 50states.com web pages.<br/>
    <div class="helpboxDescLabels">Examples:</div>
    <table class="helpboxDescTable">
      <tr><td>fiftys mi</td></tr>
      <tr><td>fiftys district of columbia</td></tr>
    </table>
  </description>
  <link>http://www.50states.com/</link>
  <category>Genealogy</category>
  <contributor>Brent Beardsley</contributor>
  <form name="fiftysf">

  </form>
  <script src="addons/genealogy/genealogy_lib.js"></script>
  <script><![CDATA[

    function fiftys(q)
    {
      if( nullArgs("fiftys", q) )
        return false;

      var webpage = "http://www.50states.com/";;
      var links = genealogy_get_known_page_links(webpage);
      var search_place_num = genealogy_lookup_place(q);
      if (search_place_num >= 0) {
        openSearchWindow(links[search_place_num]);
      } else {
        openSearchWindow(webpage);
      }
    }
    ]]>
  </script>
</search>

Index: genealogy_lib.js
===================================================================
RCS file: /cvsroot/dqsd/dqsd/addons/genealogy/genealogy_lib.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** genealogy_lib.js    22 Aug 2002 15:29:13 -0000      1.1
--- genealogy_lib.js    8 Sep 2002 16:31:55 -0000       1.2
***************
*** 68,71 ****
--- 68,108 ----
  }
  
+ function genealogy_strip_tags(str)
+ {
+       var start = 0;
+       var end = str.length-1;
+       var retval = "";
+       var in_tag = 0;
+       var in_quotes = 0;
+       while (start <= end)
+       {
+               var ch = str.charAt(start);
+               if (in_tag) {
+                       if (ch == '>') {
+                               if (!in_quotes) {
+                                       in_tag = 0;
+                               }
+                       } else if (ch == '"') {
+                               in_quotes = (in_quotes == 1) ? 0 : 1;
+                       }
+               } else {
+                       if (ch == '<') {
+                               if (in_quotes) {
+                                       retval += ch;
+                               } else {
+                                       in_tag = 1;
+                               }
+                       } else if (ch == '"') {
+                               in_quotes = (in_quotes == 1) ? 0 : 1;
+                               retval += ch; 
+                       } else {
+                               retval += ch;
+                       }
+               }
+               start++;
+       }
+       return retval;
+ }
+ 
  function genealogy_error(msg)
  {
***************
*** 145,148 ****
--- 182,186 ----
  function genealogy_build_url(cur_url, link_url)
  {
+       genealogy_alert("cur_url="+cur_url+", link_url="+link_url);
        if (link_url.match("://")) {
                // has a protocol, etc it's ok just return it
***************
*** 228,232 ****
        var webpage_source = genealogy_get_webpage(webpage_url, search_name, 
refresh_time);
        var links_regex = new RegExp("<a href=\"(.*?)\".*?>(.*?)<\/a>", "i");
-     var remove_tags_regex = new RegExp("<(\/)?\\w+( )?[\\w\"\=\ ]*(\/)?>", "gi");
        var replace_spaces_regex = new RegExp("_");
        var replace_nothing_regex = new RegExp("\n\.");
--- 266,269 ----
***************
*** 247,251 ****
                if (link == null || link.length != 3)
                        continue;
!               var place = genealogy_trim(link[2].replace(replace_spaces_regex, " 
").replace(replace_nothing_regex, "").replace(remove_tags_regex, ""));
                if (match_regex != null) {
                        if (!place.match(match_regex))
--- 284,289 ----
                if (link == null || link.length != 3)
                        continue;
!               genealogy_alert(link[2] + " "+link[1]);
!               var place = 
genealogy_trim(genealogy_strip_tags(link[2].replace(replace_spaces_regex, " 
").replace(replace_nothing_regex, "")));
                if (match_regex != null) {
                        if (!place.match(match_regex))




-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
DQSD-CVS mailing list
https://lists.sourceforge.net/lists/listinfo/dqsd-cvs
DQSD CVS repository:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dqsd/

Reply via email to