[DEV] JQ Who is where

Mod Support

Moderators: BNa, Sekuro, 4seven

[DEV] JQ Who is where

Postby FloridaMan339 » 02 Jul 2012, 18:49

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!
Image
User avatar
FloridaMan339

Tiptop

Tiptop
 
Posts: 1
Joined: 02 Jul 2012, 12:23
Location: Florida, USA
 
Resolution: 1280x800


Re: [DEV] JQ Who is where

Postby 4seven » 02 Jul 2012, 19:52

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 ;)
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080



Re: [DEV] JQ Who is where

Postby 4seven » 09 Jul 2012, 21:59

Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Re: [DEV] JQ Who is where

Postby Rogal » 05 Sep 2012, 13:58

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
Sorry 4 my bad english...
User avatar
Rogal

Tiptop

Tiptop
 
Posts: 8
Joined: 13 Aug 2012, 12:04
 
Resolution: 1280x1024


Re: [DEV] JQ Who is where

Postby 4seven » 05 Sep 2012, 16:09

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.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Re: [DEV] JQ Who is where

Postby Rogal » 05 Sep 2012, 16:50

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
Sorry 4 my bad english...
User avatar
Rogal

Tiptop

Tiptop
 
Posts: 8
Joined: 13 Aug 2012, 12:04
 
Resolution: 1280x1024


Re: [DEV] JQ Who is where

Postby 4seven » 05 Sep 2012, 20:36

Hm, seems bad luck or template/js related.
But, also good news, v.0.0.3 is near.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Re: [DEV] JQ Who is where

Postby Rogal » 06 Sep 2012, 01:33

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
Sorry 4 my bad english...
User avatar
Rogal

Tiptop

Tiptop
 
Posts: 8
Joined: 13 Aug 2012, 12:04
 
Resolution: 1280x1024


Re: [DEV] JQ Who is where

Postby 4seven » 06 Sep 2012, 17:00

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.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Re: [DEV] JQ Who is where

Postby Rogal » 08 Sep 2012, 07:51

Thanks for your advice, I just edited my overall_header.html file and paste the code, everything works as it should ;)
Sorry 4 my bad english...
User avatar
Rogal

Tiptop

Tiptop
 
Posts: 8
Joined: 13 Aug 2012, 12:04
 
Resolution: 1280x1024

Next

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 0 guests