Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2013, 12:43 AM
anymvs anymvs is offline
 
Join Date: Jul 2012
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [Solved]CSS & JavaScript via function

Hello guys am working with google <script async> the whole situatios

so, google below refers to the following::

:source:

HTML Code:
<script>
var node = document.createElement('script');
node.type = 'text/javascript';
node.async = true;
node.src = 'example.js';
// Now insert the node into the DOM, perhaps using insertBefore()
</script>
So I have convert the above java according to google as,

HTML Code:
<script type="text/javascript">
var fcb_js = document.createElement('script');
fcb_js.type = 'text/javascript';
fcb_js.async = true;
fcb_js.src = '/clientscript/vbulletin_facebook.js?v={vb:raw vboptions.simpleversion}';
var fcb_var = document.getElementsByTagName('script')[0];  
fcb_var.parentNode.insertBefore(fcb_js, fcb_var);
</script>
or

HTML Code:
<script type="text/javascript">
(function() {
var test = document.createElement('script'); 
test.type = 'text/javascript'; 
test.async = true;
test.src ='/clientscript/vbulletin_facebook.js?v={vb:raw vboptions.simpleversion}';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(test, s); })();
</script>
Now my problem is that, vbulletin_facebook.js is loading correctly but, I can't connect with facebook as guest or as a member... Now I assume that has an if statement of facebook java, later than the actual statement of vbulletin variable.. Again this seems wrong, because I didn't change any range of any variables instead of actual java architecture, if I try to load the .js normally is working correct...

Any ideas??

Note:: any kind of page tester that I test my forum seems to detect the vbulletin_facebook.js at the same position as with the standard code... md5.js and vbulletin-markert.js
are loaded and seems to work fine, and css files such as additional.css etc are not tested yet but I think may have a problem with that too!!!

Thank you !!
Reply With Quote
  #2  
Old 01-16-2013, 05:29 AM
anymvs anymvs is offline
 
Join Date: Jul 2012
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*SOLVED*

It's working as below:
HTML Code:
<script type="text/javascript">
(function() {
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
s.type = 'text/javascript';
s.async = true;
s.src = '/clientscript/vbulletin-core.js?v={vb:raw vboptions.simpleversion}';
s1.parentNode.insertBefore(s, s1);
})(); 
</script>
facebook java doesn't work with the following function, probably because the js of facebook it's call via vb raw before the main code so function is loaded normall but connectivity avoided.!!

If you want to use the defer js, for all your java files used above code. if your using cdn it will not work, so you need to replace the source with the exactly address, for example::
Code:
'http://pullzone-anymvs.netdna-cdn.com/clientscript/vbulletin-core.js?v={vb:raw vboptions.simpleversion}'
at the end if you have cache control you must remove the query from the actual js file, so need to remove
?v={vb:raw vboptions.simpleversion} from all your js file after you enable cache header..

Note: This is working for me and it's a good idea to used it especially if your running on a simple hosting. it will not make your side load 10 times faster but it will reduce the time load of js files at all, especially for users that they use IE as browsing.

TIP:
load your css files as
HTML Code:
<link rel="stylesheet" type="text/css" href="http://pullzone-anymvs.netdna-cdn.com/clientscript/vbulletin_css/style00014l/additional.css" />
don't used vb raw variables, are very lag and have no sense!!
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 08:14 PM.


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.03456 seconds
  • Memory Usage 2,176KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (5)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete