vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Implementing JS script within forum? (Snow Effect) (https://vborg.vbsupport.ru/showthread.php?t=323993)

Inked_Mono 12-08-2016 09:56 PM

Implementing JS script within forum? (Snow Effect)
 
Hey, everyone! I'm just wondering what the best way to implement as JS script I have would be. The JS itself is currently being hosted off the FTP titled "snow.js", and I've tried sticking the following in many different places (footer and header included);

< script src="./snow.js" >< /script >

For whatever reason, I can't seem to get it to load. Also, something to sort of keep in mind is I have the following assigned as a div:

Code:

<div id="particles-js"></div>
and the following CSS:

Code:

#particles-js {
            position: absolute;
            width: 100%;
            height: 780px;
            left: 0;
            top: 0;
            opacity: 0.9;
        }

The main page URL for the site is as follows, which currently contains the snow effect I'm trying to get on the forum;

https://www.os-scape.com/

Could anybody help?

MarkFL 12-08-2016 10:17 PM

Try the following in your footer template:

Locate:

PHP Code:

        {vb:raw template_hook.footer_javascript

And directly below, add:

PHP Code:

        script type="text/javascript" src="snow.js" >< /script 

Personally, I would add this via a plugin so all styles get it, but go with that for now.

Dave 12-08-2016 10:25 PM

According to the developer console errors, it happens because it can't find a div with classname "particles-js-canvas-el". This might happen because of conflicting JavaScript files. For example vBulletin's JavaScript files may not work properly with the snow.js JavaScript.

Inked_Mono 12-09-2016 01:37 AM

Quote:

Originally Posted by MarkFL (Post 2579262)
Try the following in your footer template:

Locate:

PHP Code:

        {vb:raw template_hook.footer_javascript

And directly below, add:

PHP Code:

        script type="text/javascript" src="snow.js" >< /script 

Personally, I would add this via a plugin so all styles get it, but go with that for now.

Hey Mark,

Ended up giving that a shot to no avail! I would totally consider making it a plugin, however that's a bit beyond me and not actually too necessary as we only use the same them (yeaaah, for now even for mobile version). Thank you though!

Quote:

Originally Posted by Dave (Post 2579264)
According to the developer console errors, it happens because it can't find a div with classname "particles-js-canvas-el". This might happen because of conflicting JavaScript files. For example vBulletin's JavaScript files may not work properly with the snow.js JavaScript.

Hey Dave,

I think you might be right! After trying Mark's idea above, I'm all out of options. I think I might play around with it for a bit longer and see if I can't figure something else out, or start a hunt for a predesigned snow plugin. Thank you!

MarkFL 12-09-2016 01:44 AM

Yes, if you only have one active style, then the template hack is fine, although with a plugin, you can turn it on and off without touching your template.

If you want, send the login credentials to an admin account to your site via PM to me, and I will be glad to take a look and see if I can get it to work. :)

Inked_Mono 12-09-2016 02:52 AM

Quote:

Originally Posted by MarkFL (Post 2579266)
Yes, if you only have one active style, then the template hack is fine, although with a plugin, you can turn it on and off without touching your template.

If you want, send the login credentials to an admin account to your site via PM to me, and I will be glad to take a look and see if I can get it to work. :)

Hey there, Mark!

I sent a PM containing as much information as I thought you may have needed. As mentioned within, if you need anything else please let me know and I'd be more than happy to provide it! Thanks!

the one 12-09-2016 08:14 AM

i have this code below

PHP Code:

<script type="text/javascript" src="clientscript/snowstorm.js"></script

I added that to the bottom of my headinclude template and works for me.Hope you get it sorted.

MarkFL 12-09-2016 08:50 AM

Quote:

Originally Posted by the one (Post 2579271)
i have this code below

PHP Code:

<script type="text/javascript" src="clientscript/snowstorm.js"></script

I added that to the bottom of my headinclude template and works for me.Hope you get it sorted.

I found the JS file online, and uploaded it to the OP's server, and added the script via a plugin, and it works right out of the box with no additional HTML needed.

Inked_Mono, if you don't like this particular effect, simply delete the plugin titled "Add Snowstorm" and delete the file "clientscript/snowstorm.js" from your server. :)

Inked_Mono 12-09-2016 06:05 PM

Quote:

Originally Posted by MarkFL (Post 2579273)
I found the JS file online, and uploaded it to the OP's server, and added the script via a plugin, and it works right out of the box with no additional HTML needed.

Inked_Mono, if you don't like this particular effect, simply delete the plugin titled "Add Snowstorm" and delete the file "clientscript/snowstorm.js" from your server. :)

Thank you so much for your help! I know it was quite the struggle. As mentioned in the PM, you need only let me know the answer to what I was offering.

Cheers!


All times are GMT. The time now is 02:41 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01156 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete