Glenn Carr wrote:

>"WinHttp.WinHttpRequest.5" isn't a valid CLSID on my machine.  Try this...
>
>
>var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
>xmlHttp.open( "GET", "http://www.dqsd.net";, false );
>xmlHttp.send();
>var response = xmlHttp.responseText;
>  
>

Very useful piece of code...I wondered if I could make up a 
DictionaryPop-like search for any site and sure enough...still needs 
some work so I don't really wanna post to CVS since theres probably a 
lot of changes to make yet but here's a preview... I didn't bother to 
take out my links but you can customize it however.

How much could we do if we did a "POST" instead of a "GET" in that? 
Could we run any search (and switches) in a popup window optionally?

Also, someone familiar with RegExps and the XML parser, it might be a 
good idea to remove the images since they don't work without some sort 
of <base> tag in the header... You might even want to clean up 
dictionary.com's or Acronym Finder's output.

and I think a default header is being applied by the displayPopupMessage 
output html along with the loaded website's. Would the cleanest way to 
get around this be to add an option to the function to disable that or 
create a new function which displays exact HTML?

Popup-width (and maybe height) preference might not be a bad idea as 
well. What do you all think?

-Thad
<search function="anypop">
  <name>AnyPop</name>
  <description>Load any website and pop it up in a window from the taskbar.<br/>
      <div class="helpboxDescLabels">Usage:</div>
        <table class="helpboxDescTable">
           <tr><td>anypop [{/dic | /af | /news | /gg | /as}]</td></tr>
       </table>
  </description>

  <category>Functions</category>
  <contributor>Thad Kerosky</contributor>8:00 AM 9/30/2002
  <dqsd_version>
      <majorhi>3</majorhi>
      <majorlo>0</majorlo>
      <minorhi>0</minorhi>
      <minorlo>25</minorlo>
  </dqsd_version>
  <script><![CDATA[
 
    function anypop(q)
    {
    
      var apURL;  
      var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  
      if( nullArgs("anypop", q) )
        apURL= "http://www.alterslash.org";
        //return false;
      else
      {
        var args = parseArgs(q, "dic, af, news, gg, as");
        
        if( args.switches.length > 0 )
        {
          for( var j=0; j<args.switches.length; j++ )
          {
            switch( args.switches[j].name )
            {
              case "dic":
                apURL = "http://www.dictionary.com/search?q="+ args.q;
                break;
              case 'af':
                apURL = "http://www.acronymfinder.com/af-query.asp?String=exact&Acronym="; + args.q;
                break;
              case "news":
                apURL = "http://news.google.com";;
                break;
              case "gg":
                apURL = "http://www.google.com/search?q="; + args.q;
                break;
              case "as":
                apURL = "http://www.alterslash.org";;
                break;              
            }
          }
        }
      }
      xmlHttp.open( "GET", apURL, false );
      xmlHttp.send();
      var response = xmlHttp.responseText;
      displayPopupMessage(response);
    }
  ]]></script>
</search>

Reply via email to