Hi David,
> Anybody else notice that searching m-w.com with "mwd /p %s"
> (popup) stopped working correctly today? Please let me know
> if there's a fix to mwd.xml I can use.
I've attached a fixed version. I don't actually use this search, so let
me know if it's insufficient.
-Shawn
Merriam-Webster Dictionary
Search for word definitions.
Switches:
/popup - Display in popup window instead of regular browser window
Examples:
mwd idempotent
mwd /p idempotent
ReferenceLanguage
http://www.m-w.com/
http://www.m-w.com/cgi-bin/dictionary";
method="post">
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.m-w.com/cgi-bin/dictionary";, false);
xmlHttp.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
xmlHttp.send( postArgs );
}
else
{
xmlHttp.open("GET", "http://www.m-w.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><\/div>)/mig;
var results = re.exec( sBody );
if ( results != null )
{
var optionHtml = '';
var entriesFound = parseInt( results[ 2 ], 10 );
if ( isNaN( entriesFound ) )
entriesFound = 1;
var html = results[ 1 ].replace( /(src="\/)/gi, "src=\"
http://www.m-w.com/"; ).replace( /(href="\/)/gi, "href=\"
http://www.m-w.com/"; );
var html = html.replace( /
/gi, "
");
var html = html.replace( /
/gi, "
");
var html = html.replace( /javascript\:popWin\(\'/gi, "http://www.m-w.com/";);
var html = html.replace( /\'\)"\sclass="audio"/gi, "\"");
if ( entriesFound == 1 )
html = html.replace( /(Main Entry:)/, '
$1' );
else
{
html = html.replace( /(Main Entry:)/, '
$1' );
var options = /(/.exec( html );
if ( options != null )
{
var allFormVars = html.replace( /.*' );
optionHtml += '';
for ( var i = 0; i < options.length; i++ )
if ( options[ i ] != "" )
{
var words = /([^[]+)(.*)/.exec( options[ i ] );
var formVars = 'hdwd=' + options[ i ] + '&' + allFormVars;
optionHtml += '- ' + options[ i ] + '
';
}
optionHtml += '
';
}
html = html.replace( /(To select an entry, click on it\..*)
Anybody else notice that searching m-w.com with "mwd /p %s" (popup) stopped
working correctly today? Please let me know if there's a fix to mwd.xml I
can use.
Thanks!
--David
BTW, I think that aliases.txt should contain ":|mwd /p %s" by default. The
":" suffix is my favorite search.
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/___
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