Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > .js file garbled and unreadable(yet it works!)

Reply
Thread Tools

.js file garbled and unreadable(yet it works!)

 
 
Byron
Guest
Posts: n/a
 
      07-05-2005
Hi,

I need to remove some items from a Javascript drop down menu coded by
someone else. The menu is contained within a single .js file. I'm not
very fluent in javascript, but I know what it looks like and can usually
edit pre-existing code effectively.

When I open this particular .js file in either Dreamweaver (MX) or
notepad, even if I rename the extension, the code has no line breaks and
the part of it that writes the menu's html is full of squares, making it
very difficult to wade into and take out the parts I need to remove. For
example, I can't tell where one menu item stops and another one starts.
However, it still seems to work on the web site, despite all these funky
characters.

Is there a utility or editor that can properly format or parse a large
chunk of Javascript code like this:

!Partners
125px;+177px Partnersfrmt
125px;+177px EFEFEF;border-%8 4&8 4(8 4bottom:8 4 solid 
$%0px;(0px;)127;+24;>;14;normal;norma l3F3F3F-.
EFEFEF#29_ _/partners/index.aspself9px;(5px;)105px;+
14-4;%0px$Overview%0px;(22px;)127;+
24;>;14;normal;normal3F3F3F-. EFEFEF#30_
_/microsoftself9px;(5px;)105px;+14-4;%0px$Microsoft%
0px;(44px;)127;+24;>;14;normal;normal 3F3F3F-. EFEFEF#
31_ _/partners/featured/index.aspself9px;(5px;)105px;+14-
4;%0px$Featured partner%0px;(66px;)127;+
24;>;14;normal;normal3F3F3F-. EFEFEF#32_
_/partners/services.aspself9px;(5px;)105px;+14-4;%0px
$Services%0px;(86;)127;+24;>;14;norm al;normal3F3F3F-
. EFEFEF#33_ _/partners/reseller.aspself9px;(5px;)
105px;+14-4;%0px$Reseller%0px;(110px;)127;+
24;>;14;normal;normal3F3F3F-. EFEFEF#34_
_/partners/business.aspself9px;(5px;)105px;+14-4;%0px
$Business%0px;(132px;)127;+
24;>;14;normal;normal3F3F3F-. EFEFEF#35_
_/partners/technology.aspself9px;(5px;)105px;+14-4;%0px
$Technology%0px;(154px;)127;+
24;>;14;normal;normal3F3F3F-. EFEFEF#36_
_/contact/contact_partners.aspself9px;(5px;)105px;+14-4;%
0px$Contact!


It's much much longer than that, but you get the idea.

What's up?

Thanks.
 
Reply With Quote
 
 
 
 
Ivo
Guest
Posts: n/a
 
      07-06-2005
"Byron" said
> I need to remove some items from a Javascript drop down menu coded
> by someone else. <snip> the code has no line breaks and
> the part of it that writes the menu's html is full of squares, making it
> very difficult to wade into and take out the parts I need to remove. For
> example, I can't tell where one menu item stops and another one starts.
> However, it still seems to work on the web site, despite all these funky
> characters.
>
> $Technology%0px;(154px;)127;+
> 24;>;14;normal;normal3F3F3F-. EFEFEF#36_
> _/contact/contact_partners.aspself9px;(5px;)105px;+14-4;%
> 0px$Contact!
>
> It's much much longer than that, but you get the idea.
> What's up?


The original author was probably working on a different platform than you
are. His or her linebreaks and who knows what other characters render as
those funky squares when viewed on your system. IIRC this happens when
translating from Linux to Windows. See if you can find out the name of the
menuwriting function, then load a page which uses it into your browser, and
type in the addressbar:

javascript: document.open( 'text/plain' ); document.write( functionname );

That should give the complete code, correctly encoded for your system.

hth - if not, can you post the url to the .js file here?
ivo
http://4umi.com/web/javascript/



 
Reply With Quote
 
 
 
 
Byron
Guest
Posts: n/a
 
      07-07-2005
In article <42cb3fe2$0$66131$>,
says...
> "Byron" said
> > <snip>
> > $Technology%0px;(154px;)127;+
> > 24;>;14;normal;normal3F3F3F-. EFEFEF#36_
> > _/contact/contact_partners.aspself9px;(5px;)105px;+14-4;%
> > 0px$Contact!
> >
> > It's much much longer than that, but you get the idea.
> > What's up?

>
> The original author was probably working on a different platform than you
> are. His or her linebreaks and who knows what other characters render as
> those funky squares when viewed on your system. IIRC this happens when
> translating from Linux to Windows. See if you can find out the name of the
> menuwriting function, then load a page which uses it into your browser, and
> type in the addressbar:
> javascript: document.open( 'text/plain' ); document.write( functionname );
> That should give the complete code, correctly encoded for your system.
> hth - if not, can you post the url to the .js file here?
> ivo
> http://4umi.com/web/javascript/



Thanks ivo. That partially helped, but there's so much within the .js
file that I need to reformat, that the command you gave me only helped
with a fraction of it. It looks like its divided into many functions and
subfunctions. Anyway to run a command like that on an entire js file?
 
Reply With Quote
 
Dr John Stockton
Guest
Posts: n/a
 
      07-08-2005
JRS: In article < ups.c
om>, dated Thu, 7 Jul 2005 14:18:21, seen in news:comp.lang.javascript,
Byron <> posted :
>
>Thanks ivo. That partially helped, but there's so much within the .js
>file that I need to reformat, that the command you gave me only helped
>with a fraction of it. It looks like its divided into many functions and
>subfunctions. Anyway to run a command like that on an entire js file?


Try opening the .js file in better editors; if it looks OK, save it,
perhaps after making an unimportant change to "dirty" it.
Otherwise, run it through, for example, MiniTrue; example 14 of the Help
should do what is needed.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:http://www.idiotsdelight.net/minitrue/> Update hope?
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      07-17-2005
Byron wrote:

> [...] Anyway to run a command like that on an entire js file?


Use an editor capable of handling UNIX line breaks, like Metapad or
any Eclipse plugin. Even Microsoft Wordpad can be used to read such
text files.


PointedEars
--
#define QUESTION ((bb) || !(bb))
// William Shakespeare (if he would have been a hacker )
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_python.so is garbled mod_python.so is garbled blbmdsmith Python 1 12-14-2006 12:15 AM
File name is displayed Garbled in "File download dialog box" =?Utf-8?B?SWJyYWhpbS4=?= ASP .Net 0 08-12-2006 06:44 AM
dvd movies sounds is garbled? need a Codec? old and new dvd player! lbbss Computer Support 4 08-14-2005 10:23 AM
Garbled Display after SP2 Installed - Please help!! =?Utf-8?B?VGhlYQ==?= Microsoft Certification 3 05-02-2005 04:07 PM
file image uploaded to a webserver appears garbled after upload. Nishi Bhonsle Java 2 09-01-2004 10:59 AM



Advertisments