Anyone know JavaScript ? (Alfa related!) - Alfa Romeo Forum
You are currently unregistered, register for more features.    
General Alfa Discussion Strictly Alfa Romeo talk only!

 1Likes
  • 1 Post By cannotstop
 
Thread Tools
(Post Link) post #1 of 11 Old 07-09-17 Thread Starter
Status: skint!
AO Silver Member
 
cannotstop's Avatar
 
Join Date: Aug 2009
Location: Ireland
County: Dublin
Posts: 1,493
Garage
Anyone know JavaScript ? (Alfa related!)

What does Alfa ownership have to do with javascript ?
Simple, the workshop manual CD is written in Java and Javascript.

And that code is now outdated, wont run on Windows 7 machines, and therefore, make the manual unusable

My version of eLearn seems to be limiting itself to throwing one file up as the culprit with the error message "member not found".

Opening up the file that causes the error shows the script below:

I think that if someone was to update the code, the script would run, and hence the manual would, but alas, I know more about the backside of the moon that javascript.
Can anyone see what is wrong and fix it ?

Code:
var start;
start="0 0 734 447";


function svgBase(img)
{
		
			var a= img.getSVGDocument()
			var SVGRoot = a.getDocumentElement();
			SVGRoot.setAttribute("viewBox", start);

		
}


function svgZoom(img,f)
{
		var a= img.getSVGDocument()
		var SVGRoot = a.getDocumentElement();
		var viewbox = SVGRoot.getAttribute("viewBox");

		var coords  = viewbox.split(/ /);		
		w=(coords[2]-(-coords[0]))/2
		h=(coords[3]-(-coords[1]))/2
		if (w<0)
			{
				p=coords[2]
				coords[2]=coords[0]
				coords[0]=p
			}
		if (h<0)
			{
				p=coords[3]
				coords[3]=coords[1]
				coords[1]=p
			}
		trxx=0
		tryy=0
		coords[0]=(coords[0]*f);
		coords[1]=(coords[1]*f);
		coords[2]=(coords[2]*f);
		coords[3]=(coords[3]*f);
		w2=(coords[2]-(-coords[0]))/2
		h2=(coords[3]-(-coords[1]))/2
		tx=w-w2
		ty=h-h2
		coords[0]+=tx/2;	
		coords[2]+=tx/2;
		coords[1]+=ty/2;
		coords[3]+=ty/2;

		SVGRoot.setAttribute("viewBox", coords.join(" "));

}

function svgMove(img,x,y)
{

		var a= img.getSVGDocument();
		var SVGRoot = a.getDocumentElement();
		var viewbox = SVGRoot.getAttribute("viewBox");
		var coords  = viewbox.split(/ /);
		x=x*3
		y=y*3
		coords[0]-=x;
		coords[1]-=y;
		coords[2]-=x;
		coords[3]-=y;
		SVGRoot.setAttribute("viewBox", coords.join(" "));
		if (x<0)  svgZoom(img,0.97)
		if (x>0)  svgZoom(img,1.04)

}

2003 156 GTA Selespeed - Alfa Rosso + black multispokes, Eibach anti rollbars, Quaife ATB diff, 330mm brakes, Bilstein B12, De-cat wrapped manifolds + EQ downpipes + Ragazzon silencer, CDA intake, (carefully) removed interior & Sparco bucket seats + 6 point harness
2002/6 156 JTS Selespeed - Full Ti interior, late model camshafts, Supersprint manifolds, Ragazzon silencer
cannotstop is offline  
Sponsored Links
Advertisement
 
SGG
Status: Wanting to drive a Giulia QV
AO Member
 
Join Date: Oct 2001
Location: United Kingdom
County: Dorset
Posts: 370

Member car:

Alfa 156 GTA

That code is trying to open a SVG (scalable vector graphic) document and I think position something called 'viewbox' on the the screen. If the document is not in the file system you could get the 'member not found' error.
Are you you running this from a CD/DVD or has it been installed on your PC?
SGG is offline  
SGG
Status: Wanting to drive a Giulia QV
AO Member
 
Join Date: Oct 2001
Location: United Kingdom
County: Dorset
Posts: 370

Member car:

Alfa 156 GTA

After a bit of research I think it might be a browser issue. Later browsers Chrome / IE11+ / firefox can throw 'member not found' errors with the getSVGDocument() method/function. Seems to be a timing issue, it tries to work with the document before it has fully loaded -hence 'member not found'. If you have an old laptop/PC around which has IE7 /8/9 it may work fine.
I have seen some code suggestions to fix this issue mainly adding a setTimeOut() method to delay the getSVGDocument() executing before its loaded.
SGG is offline  
(Post Link) post #4 of 11 Old 07-09-17 Thread Starter
Status: skint!
AO Silver Member
 
cannotstop's Avatar
 
Join Date: Aug 2009
Location: Ireland
County: Dublin
Posts: 1,493
Garage
eLearn, i should have mentioned, is its own browser.
ie, it opens up in a stand alone app, and loads the HTML files inside it:
Screenshot here:
https://i.imgur.com/xurI9OO.png

I have installed the app fully with its own installer, but that has not gotten me anywhere, unfortunately.
cannotstop is offline  
Status: BORED
 
David P's Avatar
 
Join Date: Aug 2003
Location: Ireland
County: Cork
Posts: 85,426
Garage
As an alternative if you can't sort out the Java issue what about setting up a virtual computer using something like VM Ware Workstation 10 running Windows XP as a solution, not ideal I know but it should work.
David P is offline  
(Post Link) post #6 of 11 Old 08-09-17 Thread Starter
Status: skint!
AO Silver Member
 
cannotstop's Avatar
 
Join Date: Aug 2009
Location: Ireland
County: Dublin
Posts: 1,493
Garage
Quote:
Originally Posted by David P View Post
As an alternative if you can't sort out the Java issue what about setting up a virtual computer using something like VM Ware Workstation 10 running Windows XP as a solution, not ideal I know but it should work.
Thanks, but wholy moly that woould be in-efficient!
That would be like driving an Alfa by having it on the back of a trailer while driving a VW diesel :P
cannotstop is offline  
Status: Gormless [email protected]*
AO Gold Member
 
Paddy OPlastic's Avatar
 
Join Date: Feb 2014
Location: Ireland
County: Cork
Posts: 8,465

Member car:

Alfa GT JTD 2004

I have the GT eLearn manual running fine on Windows 10.
Paddy OPlastic is offline  
Status: BORED
 
David P's Avatar
 
Join Date: Aug 2003
Location: Ireland
County: Cork
Posts: 85,426
Garage
Quote:
Originally Posted by cannotstop View Post
Thanks, but wholy moly that woould be in-efficient!
That would be like driving an Alfa by having it on the back of a trailer while driving a VW diesel :P
It's a bit of a last resort option alright
David P is offline  
SGG
Status: Wanting to drive a Giulia QV
AO Member
 
Join Date: Oct 2001
Location: United Kingdom
County: Dorset
Posts: 370

Member car:

Alfa 156 GTA

Quote:
Originally Posted by cannotstop View Post
eLearn, i should have mentioned, is its own browser.
ie, it opens up in a stand alone app, and loads the HTML files inside it:
Screenshot here:
https://i.imgur.com/xurI9OO.png

I have installed the app fully with its own installer, but that has not gotten me anywhere, unfortunately.
Something worth trying would be to right-click the eLearn icon and select 'run as administrator'. Could possibly be permissions issue blocking the file its requesting in the code.
SGG is offline  
Status: -
AO Silver Member
 
Oldie's Avatar
 
Join Date: Feb 2014
Location: United Kingdom
County: Argyll and Bute
Posts: 1,274
Quote:
Originally Posted by cannotstop View Post
Thanks, but wholy moly that woould be in-efficient!
That would be like driving an Alfa by having it on the back of a trailer while driving a VW diesel :P
I use Oracle's Virtual Box to run XP on my Win 7 laptop for the workshop manual and a couple of other programs that won't run on anything later than XP or Vista.

Works fine with no performance issues.
Oldie is offline  
(Post Link) post #11 of 11 Old 08-09-17 Thread Starter
Status: skint!
AO Silver Member
 
cannotstop's Avatar
 
Join Date: Aug 2009
Location: Ireland
County: Dublin
Posts: 1,493
Garage
I just tried it, and have to say, yes it does work
Thanks lads!

Still would be nice to make is run native, but.. alas...
David P likes this.
cannotstop is offline  
Reply

Go Back   Alfa Romeo Forum > Misc Lounges > Community Discussions > General Alfa Discussion

Tags
alfa , javascript , related

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page



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

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

 
For the best viewing experience please update your browser to Google Chrome