mdexter Posted June 20, 2013 Share Posted June 20, 2013 (edited) Hey all, ok I have this script below which shows our twitch.tv users who are online and offline, its a great script but we would like the function as users have asked to be able to have a popup when you hover over each users channel link. Now the popup has been suggested that it needs to be an image or snapshot of the online users twitch page. so an online user you will highlight the link and it will show a popup image of the URL page that the link links to, their twitch.tv account. And example of the function we are after is here: www.aoczone.net (top right hand corner streamers) GUYS IS THIS POSSIBLE TO ADD THAT FUNCTION TO THE BELOW CODE, sorry guys I am not a coder more of a graphics person, could someone help us out please on this one? Code for the whole script is below: __________________________________________________________________ <html> <head> <style> font-family:Verdana, Arial, Helvetica; font-size: 70%; color: #825a15; font-weight:bold; </style> <title>Streamlist</title> </head> <body> <FONT color=#825a15 face="tahoma" size="2pt"> <?php /** * @version 0.1 * @copyright © 2012/2013 Cees Middel (Avon) www.maegis.net * @Inspired by Syi http://mushroom-mayhem.com * @license GNU/GPL v3 http://www.gnu.org/licenses/gpl.html */ /** * array with all stream names i.e. www.twitch.tv/"iksf". * To add more users just add their channel names with comma seperation * This is all there is, no futher editing required */ $members = array("aoe2hdozclan","manbeast_aoe","brannin","pain1800","usk_apocalipce","resonance22"); // This variable becomes one long url with the channel names stringed up behind it // This url then fetches a json file from twitch with all the selected channels information $userGrab = "http://api.justin.tv/api/stream/list.json?channel="; //I use this array to compare with the members array. All users in this arrat are substracted from the members array and hence are //"offline" $checkedOnline = array (); foreach($members as $i =>$value){ $userGrab .= ","; $userGrab .= $value; } unset($value); //grabs the channel data from twitch.tv streams $json_file = file_get_contents($userGrab, 0, null, null); $json_array = json_decode($json_file, true); //get's member names from stream url's and checks for online members foreach($members as $i =>$value){ $title = $json_array[$i]['channel']['channel_url']; $array = explode('/', $title); $member = end($array); $viewer = $json_array[$i] ['stream_count']; onlinecheck($member, $viewer); $checkedOnline[] = signin($member); } unset($value); unset($i); //checks if player streams are online function onlinecheck($online, $viewers) { //If the variable online is not equal to null, there is a good change this person is currently streaming if ($online != null) { echo '<a href="http://www.twitch.tv/'.$online.'" target="_blank"> <strong>'.$online.'</strong></a>'; echo '  <img src="/images/online.png"><strong></strong> Online</br>'; echo '<img src="/images/viewers.png"><strong>Viewers:</strong>  ' .$viewers.'</br>'; } } //This funcion add's online channel names to the checked online array function signin($person){ if($person != null){ return $person; } else{ return null; } } ?> </font> <hr> <FONT color=#825a15 face="tahoma" size="2pt"> <?php //This part list all the people currently offline. Here the array with online users is compared with the total users. //online users are then removed from the total users array. foreach ($members as $i => $value1) { foreach($checkedOnline as $ii => $value2){ if($value1 == $value2){ unset($members[$i]); } } } //print a nice list with people that can't currently be bothered with streaming their games foreach ($members as $i => $value) { echo '<a href="http://www.twitch.tv/'.$value.'" target="_blank"> <strong>'.$value.'</strong></a>'; echo ' <img src="/images/offline.png"> <strong></strong> Offline</br>'; } ?> </font> </body> </html> ____________________________________________________________________ Edited June 20, 2013 by mdexter Quote Link to comment Share on other sites More sharing options...
computermax2328 Posted June 20, 2013 Share Posted June 20, 2013 There are a number of ways that you can achieve this, but PHP is not one of them. Onmouseover is something that you would use with javascript or jquery. Just Google it or look on Youtube. Quote Link to comment Share on other sites More sharing options...
mdexter Posted June 20, 2013 Author Share Posted June 20, 2013 Ok, so I am googling javascript onmouse over then? Sorry not sure which way to go, obviously we need to keep the code as is b ut do I google javascript onmouseover? Quote Link to comment Share on other sites More sharing options...
mdexter Posted June 20, 2013 Author Share Posted June 20, 2013 Do I add to the current code, I can see different coding for javascript etc, but not sure how to add it etc? Quote Link to comment Share on other sites More sharing options...
computermax2328 Posted June 20, 2013 Share Posted June 20, 2013 You can start by watching something like this. Someone correct me if I am wrong, but where he uses toggle you can use .hover(). Look into Jquery first of course. There is some set up in your document that will be required in order to use Jquery. Quote Link to comment Share on other sites More sharing options...
mdexter Posted June 20, 2013 Author Share Posted June 20, 2013 ok,Ill have a look at what you posted, thanks for setting me on the right direction, coding 101 thanks Quote Link to comment Share on other sites More sharing options...
mdexter Posted June 20, 2013 Author Share Posted June 20, 2013 Thanks mate, sorry I think I will pay someone to quickly do this, I am not a coder and I don't have the time to go that deep into it, I managed on my own to do a tooltip from the values set in the script its on my site: www.aoe2hdozclan.com Cheers anyway mate, appreciate your time Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 20, 2013 Share Posted June 20, 2013 Of course you need a coder! You would dare to dive into some great working code yourself? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.