Page 1 of 3

[DEV] JQ Who is where

PostPosted: 02 Jul 2012, 18:49
by FloridaMan339
If you already have a mod loading jquery.min.js, how would you change the code?
Would changing
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
to
!window.jQuery && document.write;
work?

or do I need to change it some other way? I am a total newbie in coding.

Had to join your forum so I wouldn't lose your talents now that phpBB stupidly banned you.
If you ever write your own forum software, just let me know! I'll switch in a minute!

Re: [DEV] JQ Who is where

PostPosted: 02 Jul 2012, 19:52
by 4seven
Just leave the mod code in styles/prosilver/template/index_body.html, bcs. this code loads the jquery core only, if its not loaded anyway ;)

Re: [DEV] JQ Who is where

PostPosted: 09 Jul 2012, 21:59
by 4seven

Re: [DEV] JQ Who is where

PostPosted: 05 Sep 2012, 13:58
by Rogal
Hi, again me, and again problem with my Artoida Helion Theme...

4seven wrote:Just leave the mod code in styles/prosilver/template/index_body.html, bcs. this code loads the jquery core only, if its not loaded anyway ;)


In overall_header i have declared jQ
Code: Select all
 <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>


and in index_body I have deleted this:
Code: Select all

<script type="text/javascript">
// <![CDATA[ 
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
// ]]>     
</script>


so it should work but it is not. on prosilver MOD works perfectly..

sorry 4 my bad english

Re: [DEV] JQ Who is where

PostPosted: 05 Sep 2012, 16:09
by 4seven
better reverse the intention.

remove this in overall_header.html

Code: Select all
 <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>

and put this there instead

Code: Select all

<script type="text/javascript">
// <![CDATA[ 
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
// ]]>     
</script>

and remove this

Code: Select all

<script type="text/javascript">
// <![CDATA[ 
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
// ]]>     
</script>

from index_body.html.

Re: [DEV] JQ Who is where

PostPosted: 05 Sep 2012, 16:50
by Rogal
nope, still the same + MOD mChat stop working.

It is working only when i completely delete from overall_header.html my declaration of jQ ... but then others MOD's using jQ not working

Re: [DEV] JQ Who is where

PostPosted: 05 Sep 2012, 20:36
by 4seven
Hm, seems bad luck or template/js related.
But, also good news, v.0.0.3 is near.

Re: [DEV] JQ Who is where

PostPosted: 06 Sep 2012, 01:33
by Rogal
I can't wait for new release :)


btw at the moment I found the solution:

in overall_header.html file i have my jQ declaration:
Code: Select all
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>

right after the <head> code


and before </head> code in overall_header.html and remove this part from index_body.html
Code: Select all

<!-- IF S_DISPLAY_ONLINE_LIST || U_VIEWONLINE -->
<
script type="text/javascript">
// <![CDATA[
 
$(document).ready(function() { 
     <!-- IF 
S_DISPLAY_ONLINE_LIST -->
     $(
'#who_is_online_total').load('{ROOT_PATH}who_is_online_total.php?sid={SESSION_ID}', {dol '{S_DISPLAY_ONLINE_LIST}'});
     $(
'#who_is_online_reg').load('{ROOT_PATH}who_is_online_reg.php?sid={SESSION_ID}', {dol '{S_DISPLAY_ONLINE_LIST}'});
     <!-- ENDIF -->
     <!-- IF 
U_VIEWONLINE -->
     $(
'#who_is_where').load('{ROOT_PATH}who_is_where.php?sid={SESSION_ID}');
     <!-- ENDIF -->
     var 
refreshId setInterval(function() {
     <!-- IF 
S_DISPLAY_ONLINE_LIST -->
     $(
'#who_is_online_total').load('{ROOT_PATH}who_is_online_total.php?sid={SESSION_ID}', {dol '{S_DISPLAY_ONLINE_LIST}'});
     $(
'#who_is_online_reg').load('{ROOT_PATH}who_is_online_reg.php?sid={SESSION_ID}', {dol '{S_DISPLAY_ONLINE_LIST}'});
     <!-- ENDIF -->
     <!-- IF 
U_VIEWONLINE -->
     $(
'#who_is_where').load('{ROOT_PATH}who_is_where.php?sid={SESSION_ID}');
     <!-- ENDIF -->
     }, 
2000);
   $.
ajaxSetup({ cachefalse });
 });
// ]]>
</script>
<!-- ENDIF -->



If you can't go left... go right ;) thx for help

Re: [DEV] JQ Who is where

PostPosted: 06 Sep 2012, 17:00
by 4seven
Fine that it works now. Multiple (and old) jquery and crappy jq/js codings often makes problems.
Because of that i build up to 99% codes, which works always with (latest) jquery/full_or_min.js
and i code all modules (mostly) completely by myself.

Also i use always this code to prevent multiple includes:

Code: Select all
    <script type="text/javascript">
    // <![CDATA[ 
    !window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
    // ]]>     
    </script>

Means, if not loaded, load. Otherwise, do nothing.

Re: [DEV] JQ Who is where

PostPosted: 08 Sep 2012, 07:51
by Rogal
Thanks for your advice, I just edited my overall_header.html file and paste the code, everything works as it should ;)