slowe / VirtualSky

A browser-based planetarium that can be customised and embedded in web pages.
http://slowe.github.io/VirtualSky/
247 stars 94 forks source link

JavaScript Error #48

Closed UnaOmnia closed 5 years ago

UnaOmnia commented 5 years ago

I am getting this error:

Uncaught ReferenceError: S is not defined @ virtualsky.js?ver=5.0.3:3244

Which basically means the last line with the S. I will try to fix it but that is what I got out of the box.

Gloupys commented 5 years ago

Did you manage to make it work? I am having the same issue.

slowe commented 5 years ago

@UnaOmnia You'll have to give me a little more detail. Do you have an example somewhere of it not working? Are the examples working? Is the embed version working? Are you looking at a local copy? Which browser+version are you using?

Gloupys commented 5 years ago

@slowe Well not sure about him, but I am using the little tutorial here https://virtualsky.lco.global/#instructions with Chrome 71.0.3578.98 and the 0.7.0 version. I actually use it in a bigger project, as I am trying to add components on a customizable screen. I added the virtualsky.min.js script from the 0.7.0 folder into my project and copy pasted your HTML code, but I get an error regarding the S function, namely:

Uncaught ReferenceError: S is not defined at virtualsky.min.js:21

I didn't alter the given file I just followed the tutorial.

slowe commented 5 years ago

@Gloupys I have no control over the lco.global website you are using and it is at least a year or so since they updated it. The example on those old pages won't work with version 0.7.0 and that explains why you are getting issues. If you want to follow the old instructions you'll have to go back to a version before 0.7.0 (0.7.0 removed jQuery and uses a much smaller library I made as a replacement). If you'd like to use the latest version (0.7.0) you should follow the instructions on the up-to-date pages for this project at: http://slowe.github.io/VirtualSky/

Basically, you were getting S is not defined because you weren't including the stuQuery library.

UnaOmnia commented 5 years ago

dev.unaomnia.com

I got it working with an older version... I might take it from the top again before launch...

http://dev.unaomnia.com/wp-content/themes/strappress-child/js/virtualsky/virtualsky.js?ver=5.0.3

I think it is 0.6.7 or something. You can see there. I had to go into one of the older versions. I did that because I had installed the project on a demo about 6 months back just fine. So I decided an older version should work just fine the same, and it did.

You are probably right about the stuQuery part... I did not include that... I wonder if it will interfere with including the regular jquery library... the new version is better for performance?

Gloupys commented 5 years ago

I did get stuquery instead and well the error seems gone eventhough I get an "$ is not defined" one now haha it seems to be an issue with Angular, though I dont' really get why

slowe commented 5 years ago

@Gloupys If you are using jQuery in a separate-to-this thing on your page you still need to include it otherwise you'll get a $ is not defined because $ is the jQuery object. The console should probably tell you where the $ is not defined error is coming from.

@UnaOmnia As far as I'm aware my library (any version) does not interfere with jQuery. If you want to use an old version of this code, that is entirely up to you. The big change in version 0.7.0 was to slim down the initial load for the end-user from 337kB to 200kB by removing the dependency on jQuery. I also added the ability to customise the thickness of various lines and fixed the place search which was no longer working due to Yahoo deprecating their API.

As the Javascript error that this issue was opened for is not actually a bug in this project, I'm going to close this issue.

UnaOmnia commented 5 years ago

I did get stuquery instead and well the error seems gone eventhough I get an "$ is not defined" one now haha it seems to be an issue with Angular, though I dont' really get why

https://api.jquery.com/jquery.noconflict/ https://stackoverflow.com/a/29697321/3759663 https://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/

That is probably the answer for him, and for me when I update to the latest version of Virtual Sky - with stuQuery. Feel free to close but just thought that would help.

slowe commented 5 years ago

@UnaOmnia To be very clear: my library does not conflict with jQuery. However, if you remove the jQuery library, any separate-to-VirtualSky code on your page that requires jQuery will then produce a $ is not defined error. If you need jQuery for other reasons on the page you still need to include jQuery. For VirtualSky you also need to include stuQuery.

TheBlackHacker commented 3 years ago

Just include stuQuery before VirtualSky and it worked. stuQuery: https://slowe.github.io/stuquery/ image

jumpjack commented 2 years ago

Not: all examples at https://virtualsky.lco.global/#instructions are wrong because they use "$.virtualsky" in place lof "S.virtualsky" (stulibrary is a custom replacement of jquery: S refers to stuquery, $ refers to jquery).

slowe commented 2 years ago

@jumpjack The page you link to is not under my control and refers to an older version of the code. If you want instructions for the current version of the code in this repository, you'd be best to go to https://slowe.github.io/VirtualSky/ That's the page linked to from this repository.