[EMAIL PROTECTED] wrote:

>Hi Thad,
>
>On Mon, 30 Sep 2002 20:54:19 -0400, you [Thad Kerosky] wrote:
>
>}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.
>
>Neat!  All we (read somebody) have to do now is tame it...
>
>  
>
    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?


I just decided to make a separate function, displayPopupHTML(html) in 
AnyPop for now. It makes the searches and regular sites look much better 
(with the exception of AlterSlash...donno about that one).

I'm having trouble getting atomica working, have to look at it 
later...and when you give it an URL it has to be complete or it errors 
out...theres probably some code in DQSD already to take non-complete 
urls and make them formal but I'm not sure where it's at.

I changed the width of the popup in my function too, I have plenty of 
screen real estate so it's set a little higher than before but you can 
tweak that to whats best for your system.

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) )
        var doNothing; //hmm
      else
      {
        var args = parseArgs(q, "dic, af, news, gg, as, atm");
        if( args.switches.length == 1 )
        {
          switch( args.switches[0].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;
              case "atm":
                apURL = "http://lookup.atomica.com/atomica/query.pl?s="; + args.q +";cbid=;fw=-1;bRegistered=1;gwp=0";
                break;
           }
        }
        else
           apURL = args.q;
      }
      xmlHttp.open( "GET", apURL, false );
      xmlHttp.send();
      var response = xmlHttp.responseText;
      //alert(response);
      displayPopupHTML(response);
    }
    
    function displayPopupHTML( html)
    {
      var dqsdMessagePopup = window.createPopup();
      var windowW = 500;
      var dqsdMessagePopup = window.createPopup();
      var dqsdMessagePopupBody = dqsdMessagePopup.document.body;
      dqsdMessagePopupBody.innerHTML = html;
      dqsdMessagePopup.document.body.style.border="outset 2px";
      //dqsdMessagePopup.document.body.style.background='menu';
      dqsdMessagePopup.document.body.style.overflowY='auto';
    
      // Temporatily show the popup to determine the proper final
      // height for the popup.
      dqsdMessagePopup.show(0, 0, windowW, 0);
      var windowH = dqsdMessagePopupBody.scrollHeight + 40;
      dqsdMessagePopup.hide();
    
      // Put a cap on the popup height
      windowH = windowH > window.screen.height-100 ? window.screen.height-100 : windowH;
    
      dqsdMessagePopup.show((buttonalign == "left" ? 0 : document.body.clientWidth - windowW), -windowH, windowW, windowH, document.body);
    }

  ]]></script>
</search>

Reply via email to