HighDots Forums  

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

Javascript JavaScript language (comp.lang.javascript)


Discuss .js file garbled and unreadable(yet it works!) in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Byron
 
Posts: n/a

Default .js file garbled and unreadable(yet it works!) - 07-05-2005 , 07:39 PM






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
  #2  
Old   
Ivo
 
Posts: n/a

Default Re: .js file garbled and unreadable(yet it works!) - 07-05-2005 , 10:16 PM






"Byron" said
Quote:
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
  #3  
Old   
Byron
 
Posts: n/a

Default Re: .js file garbled and unreadable(yet it works!) - 07-07-2005 , 05:18 PM



In article <42cb3fe2$0$66131$dbd4d001 (AT) news (DOT) wanadoo.nl>, no (AT) thank (DOT) you
says...
Quote:
"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
  #4  
Old   
Dr John Stockton
 
Posts: n/a

Default Re: .js file garbled and unreadable(yet it works!) - 07-08-2005 , 12:08 PM



JRS: In article <MPG.1d373bf9288a9ba59897e5 (AT) newshost (DOT) allthenewsgroups.c
om>, dated Thu, 7 Jul 2005 14:18:21, seen in news:comp.lang.javascript,
Byron <spamagnet (AT) dorrk (DOT) com> posted :
Quote:
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
  #5  
Old   
Thomas 'PointedEars' Lahn
 
Posts: n/a

Default Re: .js file garbled and unreadable(yet it works!) - 07-17-2005 , 03:25 AM



Byron wrote:

Quote:
[...] 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
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.