Re: [DQSD-Users] Latest mwd search

2008-02-26 Thread David Blume
Wow.  No sooner do I send that out than I find a class of words that don't
parse correctly for the popup.

mwd /p declare

doesn't work.  I made it work by changing one of the regular expressions in
mwd.xml like so:

@@ -96,7 +96,7 @@
   var windowW = 500;

   var sBody = xmlHttp.responseText.replace( /[\r\n]/gi,  );
-  var re = /(div\sclass=entry\smisc(.+)\/div\/div)/mig;
+  var re =
/(div\sclass=entry\smisc(.+)[\/span|\/div]\/div)/mig;
   var results = re.exec( sBody );
   if ( results != null )
   {

I don't know if that's the right way to handle this situation though.
Wonder if the (.+) should be greedy or not, too...

--David

On Mon, Feb 25, 2008 at 8:54 AM, David Blume [EMAIL PROTECTED] wrote:

 Even since that last one that was mailed out, another change was
 required.  (Not using m-w.com)  Enclosed with this message is what I have
 in my sandbox.

 --David

 On Mon, Feb 25, 2008 at 8:26 AM, Glenn Carr [EMAIL PROTECTED] wrote:

   Does anyone have the latest update to the mwd.xml search?  Or was there
  even one?  I'm noticing that the regular mwd search isn't working for me,
  and I thought I remembered someone doing some work on the popup version of
  mwd, and sending it out as an attachment. ... ?
 
 
  -
  This SF.net email is sponsored by: Microsoft
  Defy all challenges. Microsoft(R) Visual Studio 2008.
  http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
  ___
  To unsubscribe visit:
  https://lists.sourceforge.net/lists/listinfo/dqsd-users
  DQSD-Users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/[EMAIL
   PROTECTED]
  http://sourceforge.net/mailarchive/forum.php?forum_id=8601
 
 

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
To unsubscribe visit:
https://lists.sourceforge.net/lists/listinfo/dqsd-users
DQSD-Users@lists.sourceforge.net
http://sourceforge.net/mailarchive/forum.php?forum_id=8601


Re: [DQSD-Users] Latest mwd search

2008-02-26 Thread Glenn Carr
Well, it works, and right now, that's good enough for me.  I've committed
it.


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Blume
Sent: Tuesday, February 26, 2008 3:44 AM
To: DQSD users mailing list
Subject: Re: [DQSD-Users] Latest mwd search


Wow.  No sooner do I send that out than I find a class of words that don't
parse correctly for the popup.

mwd /p declare

doesn't work.  I made it work by changing one of the regular expressions in
mwd.xml like so:

@@ -96,7 +96,7 @@
   var windowW = 500;
 
   var sBody = xmlHttp.responseText.replace( /[\r\n]/gi,  );
-  var re = /(div\sclass=entry\smisc(.+)\/div\/div)/mig;
+  var re =
/(div\sclass=entry\smisc(.+)[\/span|\/div]\/div)/mig;
   var results = re.exec( sBody );
   if ( results != null )
   {

I don't know if that's the right way to handle this situation though.
Wonder if the (.+) should be greedy or not, too...

--David


On Mon, Feb 25, 2008 at 8:54 AM, David Blume [EMAIL PROTECTED] wrote:


Even since that last one that was mailed out, another change was required.
(Not using m-w.com)  Enclosed with this message is what I have in my
sandbox.

--David


On Mon, Feb 25, 2008 at 8:26 AM, Glenn Carr [EMAIL PROTECTED] wrote:


Does anyone have the latest update to the mwd.xml search?  Or was there even
one?  I'm noticing that the regular mwd search isn't working for me, and I
thought I remembered someone doing some work on the popup version of mwd,
and sending it out as an attachment. ... ?

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
To unsubscribe visit:
https://lists.sourceforge.net/lists/listinfo/dqsd-users
https://lists.sourceforge.net/lists/listinfo/[EMAIL PROTECTED]
rceforge.net 
DQSD-Users@lists.sourceforge.net
http://sourceforge.net/mailarchive/forum.php?forum_id=8601





-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
To unsubscribe visit:
https://lists.sourceforge.net/lists/listinfo/dqsd-users
DQSD-Users@lists.sourceforge.net
http://sourceforge.net/mailarchive/forum.php?forum_id=8601


Re: [DQSD-Users] Latest mwd search

2008-02-25 Thread David Blume
Even since that last one that was mailed out, another change was required.
(Not using m-w.com)  Enclosed with this message is what I have in my
sandbox.

--David

On Mon, Feb 25, 2008 at 8:26 AM, Glenn Carr [EMAIL PROTECTED] wrote:

  Does anyone have the latest update to the mwd.xml search?  Or was there
 even one?  I'm noticing that the regular mwd search isn't working for me,
 and I thought I remembered someone doing some work on the popup version of
 mwd, and sending it out as an attachment. ... ?

 -
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2008.
 http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
 ___
 To unsubscribe visit:
 https://lists.sourceforge.net/lists/listinfo/dqsd-users
 DQSD-Users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/[EMAIL
  PROTECTED]
 http://sourceforge.net/mailarchive/forum.php?forum_id=8601


search function=mwd
  nameMerriam-Webster Dictionary/name
  description
Search for word definitions.
div class=helpboxDescLabelsSwitches:/div
table class=helpboxDescTable
  trtd/popup/tdtd - /tdtdDisplay in popup window instead of regular browser window/td/tr
/table
div class=helpboxDescLabelsExamples:/div
table class=helpboxDescTable
  trtdmwd idempotent/td/tr
  trtdmwd /p idempotent/td/tr
/table
  /description
  categoryReferencecategoryLanguage/category/category
  linkhttp://www.merriam-webster.com//link
  
  form name=mwdf
action=http://www.merriam-webster.com/cgi-bin/dictionary;
method=post
input type=hidden name=book value=Dictionary/
input type=hidden name=va/
  /form
  
  script![CDATA[
function mwd(q)
{
  var args = parseArgs(q, popup);
  if ( typeof mwdDisplayInPopup == undefined )
mwdDisplayInPopup = 0;
  if ( (args.switches.length  0) || (mwdDisplayInPopup != 0) )
  {
mwdx(args.q) // Display in popup window
  }
  else
  {
if( nullArgs(mwd,q) )
  return false;

document.mwdf.va.value = args.q;
submitForm(mwdf); // Display in regular browser window
  }
}

function mwdx(q)
{
  var extraArgDelim = '\1';
  var listOption = false;
  var p = q.search( extraArgDelim );
  if ( p = 0 )
  {
postArgs = unescape( q.substr( p + 1 ) );
listOption = true;
q = q.substr( 0, p );
  }

  try
  {
var xmlHttp = new ActiveXObject(Microsoft.XmlHttp);
if ( listOption )
{
  xmlHttp.open(POST, http://www.merriam-webster.com/cgi-bin/dictionary;, false);
  xmlHttp.setRequestHeader( Content-Type, application/x-www-form-urlencoded );
  xmlHttp.send( postArgs );
}
else
{
  xmlHttp.open(GET, http://www.merriam-webster.com/dictionary/; + q, false);
  xmlHttp.send();
}
  }
  catch ( e )
  {
alert( e.description );
return;
  }
  
  if ( q == '' )
  {
if ( typeof dictPopup != 'undefined'  dictPopup_ring.length  0 )
{
  if ( --dictPopup_sp  0 )
dictPopup_sp = dictPopup_ring.length - 1;

  var prev = dictPopup_ring[ dictPopup_sp ];
  dictPopup.document.body.innerHTML = prev.html;
  dictPopup.show(prev.x, prev.y, prev.width, prev.height, dictPopup.document.body);
}
else
{
  nullArgs(mwd,q)
}
return;
  }

  var windowW = 500;

  var sBody = xmlHttp.responseText.replace( /[\r\n]/gi,  );
  var re = /(div\sclass=entry\smisc(.+)\/div\/div)/mig;
  var results = re.exec( sBody );
  if ( results != null )
  {
var html = results[ 1 ].replace( /(src=\/)/gi, src=\http://www.merriam-webster.com/; ).replace( /(href=\/)/gi, href=\http://www.merriam-webster.com/; );
var html = html.replace( /span\sclass=sense_break\//gi, br/);
var html = html.replace( /span\sclass=sense\_label\sstart/gi, br/br/span);
var html = html.replace( /javascript\:popWin\(\'\//gi, http://www.merriam-webster.com/;);
var html = html.replace( /\'\)\sclass=audio/gi, \);

var optionHtml = '';
var numOfEntriesRegex = /form name=entry  method=post action=\/dictionary(Entries [0-9]+ to [0-9]+ of )?([0-9]+)( entries found)?/.exec( sBody );
var entriesFound = 1;
if (numOfEntriesRegex != null)
  entriesFound = parseInt( numOfEntriesRegex[ 2 ], 10 );

if ( entriesFound  1 )
{
  var entryFormHTML = /(form name=entry.*?\/form)/.exec( sBody );
  if ( entryFormHTML != null )
  {
var options = /(option.*)\/select/.exec( entryFormHTML[1] );
if ( options != null )
{
  var allFormVars = entryFormHTML[1].replace(