----- Original Message -----
From: "Shawn K. Hall" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: RE: [DQSD-Users] Failed to parse
Date: Wed, 3 Nov 2004 18:03:33 -0800

> 
> Hi Don,
>  
> > > Here's the code to put into DQSD:
> > >   vbsx :document.body.outerHTML
> > 
> > If you are saying to type this into the search bar,
> > I did and nothing happens.
> 
> Try it again - this time come into your email program and CTRL+V -
> or "Edit > Paste" what the script above put onto your clipboard -
> into the email.
> 
> Regards,
> 
> Shawn K. Hall
> http://ReliableAnswers.com/
> 
> '// ========================================================
>     Very funny, Scotty. Now beam down my clothes.
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> To unsubscribe visit:
> https://lists.sourceforge.net/lists/listinfo/dqsd-users
> [EMAIL PROTECTED]
> http://sourceforge.net/mailarchive/forum.php?forum_id=8601
> 
> 
Shawn
I finally got it. I am not sure how many lines this is, I think around 300.
Don




<BODY scroll=no onload=strt()><DIV id=delaymsg style="DISPLAY: none"></DIV>
<SCRIPT type=text/jscript>

// register key press hooks so addons, etc can handle keypresses
function registerKeypressHook( keypressHook )
{
  if ( typeof keypressHooks == 'undefined' )
    keypressHooks = new Array();

  keypressHooks.push( keypressHook );
}

// def() called when the user hits "enter" in the textbox
function def()
{
  // handle things like !! and !foo
  if (!recent()) return false;

  // grab the contents
  var t = document.deff.q.value;

  // store the query in the windows autocomplete cache (MSKB:Q329156)
  window.external.AutoCompleteSaveForm(deff);

  // Major hack!  Due to 'constructor' being a property of every object, we can't
  // just test for it in the associative 'searches' array later without a
  // script error.
  if (/^\s*constructor\b/.test(t) )
  {
    performsearch(defaultsearch,t);
    return false;
  };

  // question mark only: show help
  if (t == "?")         { about(); return false; }

  // exclamation mark only: refresh
  if (t == "!")         { reload(); return false; }

  if (t == "clrhist")         { clearHistory(); return false; }

  // Shutdown DQSD and kick the explorer to unload us
// The world's not ready for this one yet...
  if(t == "quitdqsd")   { shutdown(); return false; }

  if(t == "refreshicons")   { refreshIcons(); return false; }

  // anything below adds something to the history
  addhist(t);

  setTimeout( "checkWebForUpdate()", checkForUpdateDelay );

  // detect special commands
  if (!special(t))
  {
    // detect translations
    if (translate(t)) return false;

    // detect URLs, filenames, etc to open directly
    if (direct(t)) return false;

    // detect strings that look like phone numbers
    if ((typeof autodetect_phone) == 'function' && autodetect_phone(t)) return false;

    // detect strings that look like currency conversions
    if ((typeof autodetect_currency) == 'function' && autodetect_currency(t)) return 
false;

    // detect math expressions
    if (mathexp(t)) return false;
  }

  // try to execute a shortcut - this should perform the default search
  if (shortcut(t)) return false;

  // if there isn't a user-defined default search, fall back to built-in defaultsearch 
variable
  performsearch(null, t);

  return false;
}


// detect and strip suffix or prefix and call function
function shortcut(t)
{
  // look for matching commands first
  var search = null;
  var term = null;
  var result = t.match(/^(\w+)\b/)
  if (result)
  {
    if (aliases[result[1]])
    {
      search = aliases[result[1]];
      term = t.slice(result[1].length);
    }
  }

  // then look for longest matching punctuation prefix
  if (!search)
  {
    result = t.match(/^([EMAIL PROTECTED]&\*()\-=\+{}\[\];:'<>,\.\/\?]+)/);
    if (result)
    {
      for (var subs = result[1].length; subs>0; subs--)
      {
        search = aliases[result[1].slice(0, subs)];
        if (search)
        {
          term = t.slice(subs);
          break;
        }
      }
    }
  }

  // then look for longest matching punctuation suffix
  if (!search)
  {
    result = t.match(/([EMAIL PROTECTED]&\*()\-=\+{}\[\];:'<>,\.\/\?]+)$/);
    if (result)
    {
      for (var subs = result[1].length; subs>0; subs--)
      {
        search = aliases[result[1].slice(-subs)];
        if (search)
        {
          term = t.slice(0, -subs);
          break;
        }
      }
    }
  }

  // no match, look for empty shortcut
  if (!search && aliases[""])
  {
    search = aliases[""];
    term = t;
  }

  // no match, no dice
  if (!search)
    return false;

  // search is there, but disabled
  if (!searches[search].enabled)
    return false;

  // execute search
  performsearch(search, term);
  return true;
}


function performsearch(fname, term)
{
  // if the specified search does not exist (ie. no default search), set to 
defaultsearch
  if (!fname)
  {
    if (!defaultsearch || !searches[defaultsearch]) // bad defaultsearch variable 
(e.g., old localprefs.js) -> use gg instead of failing
       fname = "gg";
    else
       fname = defaultsearch;
  }

  term = term.replace(/^\s+/g, '').replace(/\s+$/g, '')       // strip out leading and 
trailing spaces
  if (searches[fname])
    searches[fname].fun(term);
  else
  {
    try
        {
      if (fname.match(/\(.*\)/)) {
        // function with parameters specified
        eval(fname);
      } else {
        // just function no parameters
        eval(fname + "()");
      }
    }
        catch(e)
        {
        alert('An error (' + e + '/' + e.description + ') occurred while trying to run 
the search "'+fname+'"');
        }
  }
}


// a way of executing a specific search while adding the right symbol to the history
function mnu(text, alias)
{
  var fn = (alias ? alias : text);
  var search = trimWhitespace(fn + ' ' + document.deff.q.value); // trim 
leading/trailing whitespace
  if (searches[fn])
    addhist( search );
  performsearch( text, document.deff.q.value );
}

function containsalias(s, t)
{
  if (t.length >= s.length)
  {
    if (s.match(/^[a-zA-Z]+$/))
    {
      if (t.match("^" + s + "\\b"))
        return true;
    }
    else if (t.slice(t.length-s.length) == s)
    {
      return true;
    }
    else if (t.slice(0, s.length) == s)
    {
      return true;
    }
  }
  return false;
}

// detect specials
function special(t)
{
  for (var i = 0; i < specialaliasarray.length; i++)
  {
    if (containsalias(specialaliasarray[i], t))
    {
      return true;
    }
  }
  return false;
}

// detect URLs, local filenames, etc to open directly
function direct(t)
{
  // detect strings that look like URLs or filenames
  var prot = new 
RegExp("^\\s*((http://|https://|ftp://)([\\-a-z0-9]+\\.)*[\\-a-z0-9]+" +
                        "|[a-z]:($|\\\\)" +
                        "|\\\\\\\\[\\w]+[\\w\$]*($|\\\\($|[\\w\$\&]+($|\\\\))))", "i");
  if (prot.exec(t))
  {
    openSearchWindow(t);
    return true;
  }

  // detect strings that look like DNS names
  var re = new RegExp("^\\s*(?:(www|ftp)\.(?:[\\-a-z0-9]+\\.)+[\\-a-z0-9]+(?:/\\S*)?" +
                      
"|(?:[\\-a-z0-9]+\\.)+(?:com|net|org|edu|gov|mil|int|arpa|info|biz|name|museum|coop|aero|pro|[a-z]{2})(?:/\\S*)?)$",
 "i");

  var res = t.match(re);
  if (res)
  {
    openSearchWindow( (("ftp" == res[1].toLowerCase()) ? "ftp://"; : "http://";) + 
t.replace( /^\s(.*)/, "$1") );
    return true;
  }
  return false;
}

// handle onkeypress: cut-copy-paste, ctrl-n, ctrl-p for next and previous
// we need to do this because for some reason it's not done for us when
// we're docked in the taskbar!
function okp()
{
  // Reset override each time
  reuseBrowserWindowModeOverride = reuseBrowserWindowMode;

  // Search the command history.  Hold down shift with the key to search
  // forward.
  if (window.event.keyCode == 2)
  {
    histsearch( document.deff.q.value, window.event.shiftKey );
    return false;
  }
  searchPrefix = ''; // reset the search command history search

  var retval = false;
  switch(window.event.keyCode)
  {
    // Return
    case 13:
      if (window.event.shiftKey)
      {
        reuseBrowserWindowModeOverride = 0; // If they hold down the shift key, open a 
new window
      }
      def();
      break;

    // ctrl-enter just like IE's address bar - Joel's suggestion
    case 10:
      var origt = document.deff.q.value;
      var t = origt;

      // trim leading and trailing whitespace and punctuation
      t = t.replace(/[EMAIL PROTECTED]&\*()\-=\+{}\[\];:'<>,\.\/\?]*/, '')
           .replace(/[EMAIL PROTECTED]&\*()\-=\+{}\[\];:'<>,\.\/\?]*$/, '');

      // append .com if it looks like it needs it
      dns = new 
RegExp("^([\\-a-z0-9]+\\.)+(com|net|org|edu|gov|mil|int|arpa|info|biz|name|museum|coop|aero|pro|[a-z]{2})(/\S*)?$",
 "i");

      if (!dns.exec(t))
      {
        var slashpos = t.indexOf('/');
        if (slashpos < 0) slashpos = t.length;
        t = t.substr(0, slashpos) + ".com" + t.substr(slashpos);
      }

-- 
_______________________________________________
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id065&op=click
_______________________________________________
To unsubscribe visit:
https://lists.sourceforge.net/lists/listinfo/dqsd-users
[EMAIL PROTECTED]
http://sourceforge.net/mailarchive/forum.php?forum_id†01

Reply via email to