JavaScript - Check If Users Liked And Shared?
Does someone know what the JavaScript for checking if an user have "liked" and "shared" on Facebook?
As far as I know, you can not check if they've shared, but only if they've clicked the button. I don't know if you can make them like to view, but it would be nice to get that piece of code too, if obtainable. I'm going to use it for a website where you have to "like" a fb page shown, and have to share the website. If someone can provide it, I'd also like a guide on timers /foldager Similar TutorialsI am looking for a multi-user whiteboard (for personal use) similar to the one at http://www.danga.com/misc/jsdraw/xmlhttp.html. I have already tried Google. There are alot of them out there but non available for download to run on my site.
Hello everyone I am new to JS and it has been years since I worked with JAVA or HTML but I'm getting back into it for a pet project of mine and could really use some help getting past this small problem in front of me. ok so here is my issue: I have an HTML page that will read information from Cells in an MS Excel spreadsheet then will write them to the screen. This works if I run it localy and use the direct path like C:\MyFolder\ExcelFile.xls BUT if I try and access the MS Excel spreadsheet from a shared network drive like \\TheComputerName\MyFolder\ExcelFile.xls the JS will not read the file. SO... I tried to leave the HTML file and the Excel file localy and then tried to open teh HTML file from a shared computer like \\TheComputerName\MyFolder\MyWebFile.html but that wouldn't work ether. NOW my question to you guys is how can I get my HTML file to read the Excel file from a Network Shared location... ....AND.... ....How do open the HTML file from a Shared computer (while still correctly reading the Excel Spreadsheet) Please help (and use small words and code for my little brain) and thank you. PS I was wondering if this could even be done in JS, I was wondering if I need to do this in PHP instead which I have NO idea at all. how to search through siblings for shared attributes I have a a long list of links and I suppose Im going to apply a number of classes to each one [describing a number of attributes for each] and I want to do a conditional search probably in javascript/jquery so that when i hover over one of the links I highlight its relatives - those that have the same attributes. What Im having trouble wrapping my head around is the idea of classes to ID these custom attributes. The attributes are coming from a database converted to XML. In my Javascript I essentially want to say that for each link should the user mouseover or mouseclick for each of its sibling links if its sibling link share its attributes style or highlight these compliant siblings a certain way how do I do the 'if statement' without spelling out every possible attribute entry? I know in plain OOP Java how I could test for this but in that scenario I have access to these entries as fields in an object's instantiation. Help? thanks so much in advance On this webpage http://www.corkdiscos.com/testimonials.html i have a like button. when a user clicks like a comment box appears. when i unlike the button the comment box disappears this is ok but when a user has already liked the facebook page and comes to my webpage the comment box does not show. so im looking for a piece of javascript to check if a user has like the button on my page and if so to show the comment box. please check my source code of the website http://www.corkdiscos.com/testimonials.html to see what i have so far. any help would be greatly appreciated Hi guys. I'm working a bunch of pre existing code on a CMS. Just after a quick fix. Doing a show/hide thing on a particular div somewhere on the page depending if a checkbox is ticked or not. Currently there is 3 checkboxes that are dynamically added through the CMS. Here's simplified version of the form: Code: <form id="simplesearch" name="simplesearch"> <input type="checkbox" onclick='showhidefield(this.value)' name="meta_data_array_search_criteria[custom_profile_type][]" value="5" class="input-checkboxes" /> <input type="checkbox" onclick='showhidefield(this.value)' name="meta_data_array_search_criteria[custom_profile_type][]" value="4" class="input-checkboxes" /> </form> And here's the javascript I was playing with. Code: function showhidefield(id) { if(document.simplesearch.meta_data_array_search_criteria[custom_profile_type][''].checked) { document.getElementById("profile_fields_wrapper_" + id).style.visibility = "visible"; } else { document.getElementById("profile_fields_wrapper_" + id).style.visibility = "hidden"; } } Problem I'm having is how do i do a check to see if those checkboxes are checked in the javascript with those name arrays? How do i separate them? 'm guessing I have to loop through them or something?Hopefully that make senses - it's late here and I'm losing the plot Any pointers would be gratefully welcomed Hi, I'm just wondering if I can do a check on my page to determine if users have javascript enabled, and if not, redirect them to a different webpage. My site requires javascript, and without it, all the jquery popup boxes and stuff overlap, so I'd rather the user just not see any of that at all. Either that or provide me with an alternative way of coding a web application in a browser. Suppose I create a nifty web application that runs in your browser for which there is currently high market demand, but for some reason competitors have all overlooked it. I am sure that if I simply implemented it in regular JavaScript for all to see, it would not be long before competitors catch on and steal the concept from me (loosely speaking, in a way that doesn't violate copyright). However, I can delay my competitors if I can find a way to conceal the code. But JavaScript is not readily concealable, and there are always simple ways to reveal it by common methods suggested by people. Is anybody clever enough to suggest a solution for me? I wish to have a user list updated every 20 seconds or so with the users that are still online. I have the time(); stored in the database with their usernames, how do i get this uaing JavaScript. Perhaps this wouldn't even be Javascript, but here's my question. Is there a script that would direct Opera users past the front page of a web site (that uses flash) to the home page? For instance, a site I'm building as a favor to a church has a flash intro page that is fine with every browser but Opera. (Opera doesn't respond to Autoplay but places a large "Play" button where the flash is located.) On this particular page, the flash movie ends with an "Enter" instruction and is a hyperlink to the "home" page, so if an Opera user clicks that button, they're still not going to see the flash but are going to arrive at the "home" page. Is there a way to not even present them with the flash page, but to send them straight to the home page? I'd appreciate any assistance. I have a program written in Javascript (saved as an HTML file that I run from my desktop by launching it in IE) which works fine on my system. Running IE 8 in Vista on one system and XP on another. When I launch the file, I get warning in the information bar: "To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX cntrols that could access your computer. Click here for optons..." I actually WANT this warning. When I click through it to accept, the program works fine. But about half of the people that I share this program with are not getting this warning, and it appears that the javascript never runs. At first I thought it was something in Windows 7, because two of the users were running on that OS, and I've found a number of issues described online about having problems running scripts in IE8/Win7. But the latest user is also running Vista, like me. His security settings are set to the default, Medium-High. But he's still not getting the script/ActiveX warning in the message bar. Anyone know how we can enable that warning? Thanks! I was wondering, could you have more than one username and password for the Username and Password II script? and if so, could you tell me how?
I frequent a forum that has a pretty large community. There are a few users there I don't particularly care for. I would like to make a Greasemonkey compatible javascript code that would allow me to completely erase their posts from the page. What I want to happen is that every time Code: <li class="kpost-username"> <a rel="nofollow" title="" href="/index.php/component/kunena/profile/userid-80?Itemid=0" class="kwho-user">Rolepgeek</a> </li> appears it deletes the parent <table class="kmsg"> node. I know that I can find each of those code snippets with Code: document.getElementById('kpost-usernmae') however I am not sure how I would go about defining if it includes Code: <li class="kpost-username"> <a rel="nofollow" title="" href="/index.php/component/kunena/profile/userid-80?Itemid=0" class="kwho-user">Rolepgeek</a> </li> or not, nor am I sure on how to tell the code to delete the parent <table class="kmsg"> node when it does include it. I've been messing around a bit with some code, and I understand the general idea of how it should work, however I do not know the syntax in order to get it to work. Any help would be appreciated. HTML to a full post: Code: <table class="kmsg"> <tbody> <tr> <td class="kprofile-top"> <ul id="kpost-profiletop"> <li class="kpost-smallicons"> <span title="Gender: Unknown" class="kicon-profile kicon-profile-gender-unknown"></span> <a title="Click here to send a private message to this user." href="/index.php/component/uddeim/?task=new&recip=80&Itemid=213"><span alt="Click here to send a private message to this user." class="kicon-profile kicon-profile-pm"></span></a> <br> <div> <span class="kpost-userposts">Posts:334</span> </div> </li> <li class="kpost-personal"> Chaos will consume all... </li> <li class="kpost-avatar"> <a rel="nofollow" title="" href="/index.php/component/kunena/profile/userid-80?Itemid=0" class="kwho-user"><span class="kavatar"><img style="max-width: 72px; max-height: 72px" alt="" src="http://thekingdomsmc.com/media/kunena/avatars/resized/size72/users/avatar80.jpg" class="kavatar vbavnparnxybaoekjwjh"></span></a> </li> <li class="kpost-username"> <a rel="nofollow" title="" href="/index.php/component/kunena/profile/userid-80?Itemid=0" class="kwho-user">Rolepgeek</a> </li> <li class="kpost-userrank"> Merchant </li> <li class="kpost-userrank-img"> <img alt="" src="http://thekingdomsmc.com/components/com_kunena/template/default/images/ranks/rank3.gif"> </li> <li><span class="kicon-button kbuttononline-yes"><span class="online-yes"><span>NOW ONLINE</span></span></span></li> <li class="kpost-karma"> <span class="kmsgkarma"> Karma: -9 <a rel="nofollow" title="" href="/index.php/component/kunena/4-off-topic/karma/userid-80?do=decrease&pid=13229&0409ea1d6b1360d1a0a24ee6206c0bf4=1&Itemid=0"><span title="Smite" border="0" alt="Karma-" class="kkarma-minus"> </span></a> <a rel="nofollow" title="" href="/index.php/component/kunena/4-off-topic/karma/userid-80?do=increase&pid=13229&0409ea1d6b1360d1a0a24ee6206c0bf4=1&Itemid=0"><span title="Applaud" border="0" alt="Karma+" class="kkarma-plus"> </span></a> </span> </li> </ul> </td> </tr> <tr> <td class="kmessage-top"> <div class="kmsgbody"> <div class="kmsgtext"> Yeah. And it would be pointless, seeing as how I won't. </div> </div> <div style="display: none" class="kreply-form" id="kreply13229_form"> <form enctype="multipart/form-data" name="postform" method="post" action="/index.php/component/kunena/post?Itemid=0"> <input type="hidden" value="13229" name="parentid"> <input type="hidden" value="4" name="catid"> <input type="hidden" value="post" name="action"> <input type="hidden" value="1" name="0409ea1d6b1360d1a0a24ee6206c0bf4"> <input type="hidden" value="Shigan" name="authorname"> <input type="text" value=" To all non-bronies." maxlength="50" class="inputbox" size="35" name="subject"><br> <textarea cols="60" rows="6" name="message" class="inputbox"></textarea><br> <input type="checkbox" value="1" name="subscribeMe"> <i>Check this box to be notified of replies to this topic.</i> <br> <input type="submit" title="Click here to submit your message" value="Submit" name="submit" class="kbutton kreply-submit"> <input type="reset" title="Click here to cancel your message" value="Cancel" name="cancel" class="kbutton kreply-cancel"> <small>Note: BBcode and smileys are still usable.</small> </form> </div> </td> </tr> <tr> <td class="kbuttonbar-top"> <div> <div class="kmsgsignature"> With Order, come entropy,<br> With Life, comes death,<br> With Light, comes shadow.<br> <br> <div style="text-align: center">If one does not know Chaos, one does not realize the potential within themselves.</div> </div> </div> <div class="kmessage-editmarkup-cover"> <span class="kmessage-informmarkup"><a rel="nofollow" title="" href="/index.php/component/kunena/4-off-topic/13229-re-to-all-non-bronies/report?Itemid=0">Report to moderator</a></span> </div> <div class="kmessage-buttons-cover"> <div class="kmessage-buttons-row"> <a id="kreply13229" rel="nofollow" title="Quick Reply" href="/index.php/component/kunena/4-off-topic/13229-re-to-all-non-bronies/post?do=reply&Itemid=0" class="kicon-button kbuttoncomm btn-left kqreply"><span class="reply"><span>Quick Reply</span></span></a> <a rel="nofollow" title="Reply" href="/index.php/component/kunena/4-off-topic/13229-re-to-all-non-bronies/post?do=reply&Itemid=0" class="kicon-button kbuttoncomm btn-left"><span class="reply"><span>Reply</span></span></a> <a rel="nofollow" title="Quote" href="/index.php/component/kunena/4-off-topic/13229-re-to-all-non-bronies/post?do=quote&Itemid=0" class="kicon-button kbuttoncomm btn-left"><span class="quote"><span>Quote</span></span></a> </div> </div> <div class="kpost-thankyou"> <a rel="nofollow" title="I want to thank you for this message!" href="/index.php/component/kunena/4-off-topic/thankyou?pid=13229&0409ea1d6b1360d1a0a24ee6206c0bf4=1&Itemid=0" class="kicon-button kbuttonuser btn-left"><span class="thankyou"><span>Thank You</span></span></a></div> </td> </tr> </tbody> </table> Hi everyone, first time on these forums. I've installed a WordPress plugin that displays which users are currently online, as a widget on the side-panel of my website, www.mi6gaming.com . There's some problems, however. When using the default code, all the members display correctly and load quickly, but there's no limit to the ammount of users displayed, so it goes on for about 30 members, and then it just starts to overlap and it looks ridiculous. Here is the download link to view any of the files: http://wordpress.org/extend/plugins/...-online/stats/ See screenshot of what i'm talking about: http://i.imgur.com/JYPGQ.png When I change "0" to a certain number, say 5, what that does is it will constantly display 5 members at any given time, and any other members who are currently online will be displayed on top of that. So say I'm a visitor to the website, I will see the 5 most recent people online, and if anyone else logs on during that time, it will display them as being online on top of the other 5 most recently online people. But, this isn't working correctly. It only shows, for some reason, a specific 5 people all the time and does not update whenever somebody else is logged in. So anytime you visit the website, it always shows the same 5 people and the last time they were logged in, even if other people were logged in more recently than them. See screenshot: http://i.imgur.com/CBE53.png So; when I have the code set at 0, it displays everyone correctly and updates on time, but it doesn't cap off and it's too long and overlaps. When I have it set at 5, it stays fixated on 5 people all the time and updates the times THEY were last online, and it shows who is online at the present time, but you have to be on the same page for 45 seconds to be able to see "who's online" right then, whereas when it's at 0, everything is instant and flawless, except for not stopping. Is there any way to add code to prevent it from loading X ammount of users, and to limit it to a certain number? That would likely be the simplest answer. Here is the code: .css Code: .wpwhosonline-row { float: none; width: auto; height: 33px; padding-bottom: 10px; padding-top: 5px; } .wpwhosonline-row > img { float: left; margin-right: 1ex; } .wpwhosonline-active > span { font-weight: bold; color: green; } .wpwhosonline-recent > span { } .wpwhosonline-ancient > span { font-style: italic; color: red; } /* kubrick style follows */ #sidebar ul li.widget_wpwhosonline ul li:before { content: none; } .php Code: <?php /* Plugin Name: Who's Online Plugin URI: http://www.plymouth.edu/ Description: Sidebar widget to log when a user was last online Version: 0.5.1 Author: Adam Backstrom Author URI: http://blogs.bwerp.net/ License: GPL2 */ /* Copyright 2011 Adam Backstrom <adam@sixohthree.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ function wpwhosonline_enqueue() { add_action( 'wp_head', 'wpwhosonline_pageoptions_js', 20 ); wp_enqueue_script( 'wpwhosonline', plugins_url('wp-whos-online.js', __FILE__), array('jquery'), 1 ); wp_enqueue_style( 'wpwhosonline_css', plugins_url('wp-whos-online.css', __FILE__), null, 1 ); } add_action('wp_enqueue_scripts', 'wpwhosonline_enqueue'); // our own ajax call add_action( 'wp_ajax_wpwhosonline_ajax_update', 'wpwhosonline_ajax_update' ); // hook into p2 ajax calls, if they're there add_action( 'wp_ajax_prologue_latest_posts', 'wpwhosonline_update' ); add_action( 'wp_ajax_prologue_latest_comments', 'wpwhosonline_update' ); /** * Update a user's "last online" timestamp. */ function wpwhosonline_update() { if( !is_user_logged_in() ) return null; global $user_ID; update_user_meta( $user_ID, 'wpwhosonline_timestamp', time() ); }//end wpwhosonline_update add_action('template_redirect', 'wpwhosonline_update'); /** * Echo json listing all authors who have had their "last online" timestamp updated * since the client's last update. */ function wpwhosonline_ajax_update() { global $wpdb; // update timestamp of user who is checking wpwhosonline_update(); $load_time = strtotime($_GET['load_time'] . ' GMT'); $users = wpwhosonline_recents( "meta_value=$load_time" ); if( count($users) == 0 ) { die( '0' ); } $now = time(); $latest = 0; $return = array(); foreach($users as $user) { $row = array(); $last_online_ts = get_user_meta( $user->ID, 'wpwhosonline_timestamp', true ); if( $last_online_ts > $latest ) $latest = $last_online_ts; $row['user_id'] = $user->ID; $row['html'] = wpwhosonline_user( $last_online_ts, $user ); $row['timestamp'] = $last_online_ts; $return[] = $row; } echo json_encode( array('users' => $return, 'latestupdate' => gmdate('Y-m-d H:i:s', $latest)) ); exit; } function wpwhosonline_pageoptions_js() { global $page_options; ?><script type='text/javascript'> // <![CDATA[ var wpwhosonline = { 'ajaxUrl': "<?php echo esc_js( admin_url('admin-ajax.php') ); ?>", 'wpwhosonlineLoadTime': "<?php echo gmdate( 'Y-m-d H:i:s' ); ?>", 'getwpwhosonlineUpdate': '0', 'isFirstFrontPage': "<?php echo is_home(); ?>" }; // ]]> </script><?php } function wpwhosonline_usersort( $a, $b ) { $ts_a = get_user_meta( $a->ID, 'wpwhosonline_timestamp', true ); $ts_b = get_user_meta( $b->ID, 'wpwhosonline_timestamp', true ); if( $ts_a == $ts_b ) { return 0; } return ($ts_a < $ts_b) ? 1 : -1; } function wpwhosonline_recents( $args = array() ) { $args = wp_parse_args( $args, array( 'meta_key' => 'wpwhosonline_timestamp', 'orderby' => 'wpwhosonline_timestamp', 'order' => 'DESC', 'meta_value' => time() - 604800, // 1 week 'meta_compare' => '>', 'count_total' => false, 'number' => 0 )); $users = get_users( $args ); foreach( $users as $user ) { // grab all these values, or you'll anger usort by modifying // an array mid-execution. get_user_meta( $user->ID, 'wpwhosonline_timestamp', true ); } usort( $users, 'wpwhosonline_usersort' ); return $users; } function wpwhosonline_list_authors() { $users = wpwhosonline_recents(); $html = '<ul class="wpwhosonline-list">'; foreach( $users as $user ) { $last_online_ts = get_user_meta( $user->ID, 'wpwhosonline_timestamp', true ); $item = wpwhosonline_user( $last_online_ts, $user ); $class = wpwhosonline_class( $last_online_ts ); $item = '<li id="wpwhosonline-' . $user->ID . '" class="wpwhosonline-row ' . $class . '" data-wpwhosonline="' . esc_attr( $last_online_ts ) . '">' . $item . '</li>'; $html .= $item; } $html .= '</ul>'; echo $html; } function wpwhosonline_user( $last_online_ts, $user ) { $avatar = get_avatar( $user->user_email, 32 ); $name = $user->display_name; $link = '<a href="' . get_author_posts_url( $user->ID, $user->user_nicename ) . '" title="' . esc_attr( sprintf(__("Posts by %s"), $user->display_name) ) . '">' . $name . '</a>'; // this should always exist; we queried using this meta if( ! $last_online_ts ) { continue; } $now = time(); if( $now - $last_online_ts < 120 ) { $last_online = 'Online now!'; } else { $last_online = human_time_diff( $now, $last_online_ts ) . ' ago'; } $last_online_title = date_i18n( get_option('date_format') . ' ' . get_option('time_format'), $last_online_ts ); if( $last_online ) { $last_online = '<span title="Last online: ' . esc_attr( $last_online_title ) . '">' . $last_online . '</a>'; } return $avatar . $link . '<br>' . $last_online; } function wpwhosonline_class( $lastonline ) { $diff = time() - $lastonline; if( $diff > 7200 ) { return 'wpwhosonline-ancient'; } elseif( $diff > 600 ) { return 'wpwhosonline-recent'; } else { return 'wpwhosonline-active'; } } function widget_wpwhosonline_init() { // Check for the required plugin functions. This will prevent fatal // errors occurring when you deactivate the dynamic-sidebar plugin. if ( !function_exists('wp_register_sidebar_widget') ) return; // This is the function that outputs the Authors code. function widget_wpwhosonline($args) { extract($args); echo $before_widget . $before_title . "Users" . $after_title; ?> <ul> <?php wpwhosonline_list_authors(); ?> </ul> <?php echo $after_widget; } // This registers our widget so it appears with the other available // widgets and can be dragged and dropped into any active sidebars. wp_register_sidebar_widget( 'widget_wpwhosonline', "Who's Online", 'widget_wpwhosonline' ); } // Run our code later in case this loads prior to any required plugins. add_action('plugins_loaded', 'widget_wpwhosonline_init'); .js Code: /* Copyright (C) 2011 Adam Backstrom <adam@sixohthree.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ jQuery(function($) { /* * Update author "last online" timestamps */ function getwpwhosonline(){ toggleUpdates(); var queryString = wpwhosonline.ajaxUrl +'?action=wpwhosonline_ajax_update&load_time=' + wpwhosonline.wpwhosonlineLoadTime + '&frontpage=' + wpwhosonline.isFirstFrontPage; ajaxCheckAuthors = $.getJSON(queryString, function(response){ if(typeof response.latestupdate != 'undefined') { wpwhosonline.wpwhosonlineLoadTime = response.latestupdate; for(var i = 0; i < response.users.length; i++) { var current = response.users[i], $o = $('#wpwhosonline-' + current.user_id); console.dir(current.user_id, current.timestamp); if( $o.length == 0 ) { $o = $('<li/>').attr('id', 'wpwhosonline-' + current.user_id). addClass( 'wpwhosonline-row wpwhosonline-active' ). prependTo( '.wpwhosonline-list' ); console.log($o); } $o.html( current.html ). data('wpwhosonline', current.timestamp); } } console.log('Done'); }); toggleUpdates(); updateRecents(); }; // from http://snippets.dzone.com/posts/show/5925 function formatDate(formatDate, formatString) { if(formatDate instanceof Date) { var months = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); var yyyy = formatDate.getFullYear(); var yy = yyyy.toString().substring(2); var m = formatDate.getMonth(); var mm = m < 10 ? "0" + m : m; var mmm = months[m]; var d = formatDate.getDate(); var dd = d < 10 ? "0" + d : d; var h = formatDate.getHours(); var hh = h < 10 ? "0" + h : h; var n = formatDate.getMinutes(); var nn = n < 10 ? "0" + n : n; var s = formatDate.getSeconds(); var ss = s < 10 ? "0" + s : s; formatString = formatString.replace(/yyyy/i, yyyy); formatString = formatString.replace(/yy/i, yy); formatString = formatString.replace(/mmm/i, mmm); formatString = formatString.replace(/mm/i, mm); formatString = formatString.replace(/m/i, m); formatString = formatString.replace(/dd/i, dd); formatString = formatString.replace(/d/i, d); formatString = formatString.replace(/hh/i, hh); formatString = formatString.replace(/h/i, h); formatString = formatString.replace(/nn/i, nn); formatString = formatString.replace(/n/i, n); formatString = formatString.replace(/ss/i, ss); formatString = formatString.replace(/s/i, s); return formatString; } else { return ""; } } function updateRecents(){ var now = Math.round(new Date().getTime()/1000.0); var active = 120; // 2 minutes var recent = 600; // 10 minutes var ancient = 7200; // 2 hours $('.wpwhosonline-row').each(function(){ var $o = $(this); var since, oclass, remove; var last = $o.data('wpwhosonline'); since = now - last; if(since > ancient) { oclass = "wpwhosonline-ancient"; remove = "wpwhosonline-recent wpwhosonline-active"; } else if(since > recent) { oclass = "wpwhosonline-recent"; remove = "wpwhosonline-ancient wpwhosonline-active"; } else { oclass = "wpwhosonline-active"; remove = "wpwhosonline-ancient wpwhosonline-recent"; // no longer active; remove "Online now!' text if(since > active && $o.text() == 'Online now!' ) { var theDate = new Date(last * 1000); $o.text( formatDate(theDate, 'dd mmm yyyy HH:MM:ss') ); } } $o.addClass( oclass ).removeClass( remove ); }); } function toggleUpdates() { if (0 == wpwhosonline.getwpwhosonlineUpdate) { wpwhosonline.getwpwhosonlineUpdate = setInterval(getwpwhosonline, 30000); } else { clearInterval(wpwhosonline.getwpwhosonlineUpdate); wpwhosonline.getwpwhosonlineUpdate = '0'; } } toggleUpdates(); updateRecents(); }); I have recentley decided to move from prototype to DOJO. I have the latest 1.3.2 and i am having problems accessing the themepage.html They tell you in their documents that you can install it on the server, place the files on the server or install it locally. So i installed it in my files on site. They tell you to go to: "http://your-webpage.com/js/dojo-1.3.2/dijit/themes/themeTester.html" when looking locally through my files their isn't a page like that. What page should i look at to view the widgets? Thank you for any help. Hi Javascript Gurus, I've made a webpage which displays a list of timeslots in GMT time, and also conveniently displays the GMT times in the clients local time, depending on the timezone they have on their comp. The output on my computer (Melbourne +10 GMT) is perfect. It even anticipates a future Daylight Savings change. It looks like this: Code: Option 1: Saturday 24th Oct 20:00 GMT = YOUR time: Sunday, October 25, 2009 7:00:00 AM Option 2: Saturday 24th Oct 22:00 GMT = YOUR time: Sunday, October 25, 2009 9:00:00 AM Option 3: Saturday 24th Oct 24:00GMT = YOUR time: Sunday, October 25, 2009 11:00:00 AM Option 4: Sunday 25th Oct 20:00GMT = YOUR time: Monday, October 26, 2009 7:00:00 AM Option 5: Sunday 25th Oct 22:00 GMT = YOUR time: Monday, October 26, 2009 9:00:00 AM Option 6: Sunday 25th Oct 24:00 GMT = YOUR time: Monday, October 26, 2009 11:00:00 AM BUT when I switch my computer to a North American, or European time (to test) the Saturday times are one hour later than the Sunday ones!?! Here's an example (Central US time -6 GMT): Code: Option 1: Saturday 24th Oct 20:00 GMT = YOUR time: Saturday, October 24, 2009 3:00:00 PM Option 2: Saturday 24th Oct 22:00 GMT = YOUR time: Saturday, October 24, 2009 5:00:00 PM Option 3: Saturday 24th Oct 24:00GMT = YOUR time: Saturday, October 24, 2009 7:00:00 PM Option 4: Sunday 25th Oct 20:00GMT = YOUR time: Sunday, October 25, 2009 2:00:00 PM Option 5: Sunday 25th Oct 22:00 GMT = YOUR time: Sunday, October 25, 2009 4:00:00 PM Option 6: Sunday 25th Oct 24:00 GMT = YOUR time: Sunday, October 25, 2009 6:00:00 PM Daylight Savings happens in the US in November, so what's going on? thanks, Andrew K I had a thread on here earlier in which one of you helped me immensely. As I mentioned in that thread, I know very little about javascript. The code I was given basically handles one user, and does it very well. I have since attended a meeting in which I was asked to have multiple users on one page. For example: My current code handles the following: Name - Hours - series of radio button choices. My updated request is the following: Name - Hours - series of radio button choices Name - Hours - series of radio button choices Name - Hours - series of radio button choices Name - Hours - series of radio button choices etc. up to 15 total users. I have tried to adjust the javascript, but with my lack of knowledge in this area I keep breaking it. Any help would again be greatly appreciated, here is my code: Code: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Jared Daily Sales Goal Calculation Worksheet</title> </head> <script type="text/javascript"> var IE = navigator.appName == "Microsoft Internet Explorer"; var nSets = ""; var answeredQ = []; function advanceTo(nextQ,nQ){ var currAns = answeredQ[nQ.name.replace(/q/,"")-1]; if (currAns != "-" && currAns != nQ.value) { var nFloor = nQ.parentNode.parentNode.id.replace(/f/,"")-1; for (i=0; i<nSets.length; i++) { if (i > nFloor) { nSets[i].style.display = "none"; } } } nSets[nextQ-1].style.display = ""; answeredQ[nQ.name.replace(/q/,"")-1] = nQ.value; } function init(){ nSets = document.forms[0].getElementsByTagName('fieldset'); for (i=1; i<nSets.length; i++) { nSets[i].style.display = "none"; answeredQ[answeredQ.length] = "-"; } } IE ? attachEvent('onload', init, false) : addEventListener('load', init, false); </script> <style type="text/css"> body {background-color: #ffffff; margin-top: 60px;} fieldset {border: 0px} td { font-family:Arial, Helvetica, sans-serif; font-size:12px;} h1 { font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold;} </style> <body> <cfform action="" method="post"> <!--- Header ---> <table border="1"> <tr> <td> <table align="left"> <tr bgcolor="#E5E5E5"> <td>Name</td> <td>Hours</td> <td colspan="4"></td> </tr> <!--- Emp 1 ---> <tr bgcolor="#ffffff"> <td valign="top"><input name="" size="10"></td> <td valign="top"><input name="" size="10"></td> <td valign="top"> <fieldset id="f1"> <!-- Question 1 --> <label><input type="radio" name="e1q1" value="Diamond1" onclick="advanceTo(2,this)">Diamond</label> <label><input type="radio" name="e1q1" value="Perimeter1" onclick="advanceTo(3,this)">Perimeter</label> </fieldset> </td> <td valign="top"> <fieldset id="f2"> <!-- Question 2 --> |<label><input type="radio" name="e1q2" value="GM1">GM</label> <label><input type="radio" name="e1q2" value="AGM1">AGM</label> <label><input type="radio" name="e1q2" value="DDM1">DDM</label> <label><input type="radio" name="e1q2" value="FT1" onclick="advanceTo(4,this)">Full Time</label> <label><input type="radio" name="e1q2" value="PT1" onclick="advanceTo(4,this)">Part Time</label> </fieldset> </td> <td valign="top"> <fieldset id="f3"> <!-- Question 3 --> <label><input type="radio" name="e1q3" value="PDM">PDM</label> <label><input type="radio" name="e1q3" value="RL">RL</label> <label><input type="radio" name="e1q3" value="FT1" onclick="advanceTo(4,this)">Full Time</label> <label><input type="radio" name="e1q3" value="PT1" onclick="advanceTo(4,this)">Part Time</label> </fieldset> </td> <td valign="top"> <fieldset id="f4"> <!-- Question 4 --> |<label><input type="radio" name="e1q4" value="Tenured1">Tenured</label> <label><input type="radio" name="e1q4" value="NonTenured1">Under 2 Years</label> </fieldset> </td> </tr> </table> </td></tr></table> </cfform> </body> </html> I have a page up with an iframe that's approximately 300px by 405px. When I load up the site in FF and IE, it frames just fine. However, in Chrome and Opera the iframe is shifted upwards and is off-frame. I've tried looking for a solution to center the iframe correctly. Someone said to make a php code that loads 2 different iframes depending on browser (1 iframe for IE/FF and another frame for OP/CH). I have no knowledge of php coding, so I couldn't get it to work. So now, I think I'm limited to redirecting users based on browser type. If the user is using FF or IE, I'll redirect them to my original page. If they're using some other browser, I'll redirect them to a different page without the iframe. I've tried to set up a redirector, but it has trouble distinguishing between FF and Chrome. It treats them exactly the same. Does anyone have any advice on what to do? I've done tons of searching for what seems to be such a small problem. Someone please enlighten me. Hello, I'm currently working on http://footytweets.co.uk and would like to add an input field to my twitter feed widgets, which allows users to change which twitter account tweets are dispalyed. An example is here; https://twitter.com/about/resources/...widget_profile You can see in the example how you can enter a different twitter user account, then hit 'test settings', leading to related twees being displayed. I can see how to do it but Im a super novice at JS so thought Id ask for assistance . Any code help is very much appreciated. Thx I have a text input box that resets to blank when the user enters an alpha character, it also checks for the number 0 as it has to be greater than 0 too... when I submit the form it is blank the variable changes to blank (as I use parseInt to convert it to an integer at a later stage) What can I do to check and see if it is NaN value? (I've tried isNaN() and it did not do what I wanted it to) |