javascript

Auto refresh when new user comes online

Hello. I have a table in the database which includes all active users. I then have a user list which needs refreshing to see who is the latest users online. Whats the best way to tackle this? The user list is always just who is in the active_users table. Thanks for reading. ...

Disable page redirects using Greasemonkey

A website I wish to tweak is using window.location in order to redirect specific users to a blocking page. That website is doing it in plain <script> tag, so it is impossible to bypass it by overriding the onload event using document.body.setAttribute('onload','');. Is there another way to inject my code to the page without using Firef...

Exclude debug javascript code during minification

I'm looking into different ways to minify my javascript code including the regular JSMin, Packer, and YUI solutions. I'm really interested in the new Google Closure Compiler, as it looks exceptionally powerful. I noticed that Dean Edwards packer has a feature to exclude lines of code that start with three semicolons. This is handy to e...

How can I paste an image from the clipboard into a web form?

I found this question, but the question is about how to get an image from the clip board into a wyziwyg editor! My question is "How can I paste an image from the clipboard into a field (what field is not that big issue as long as it works)", and then sent to the server. Jira has this functionality, so it should be possible! Any ideas ...

Javascript and Twitter API rate limitation? (Changing variable values in a loop)

Hello, I have adapted an script from an example of http://github.com/remy/twitterlib. It´s a script that makes one query each 10 seconds to my Twitter timeline, to get only the messages that begin with a musical notation. It´s already working, but I don´t know it is the better way to do this... The Twitter API has a rate limit of 150 I...

how to stop a javascript loop for a particular interval of time?

i am using javascript for loop, to loop through a particular array and alert it's value. I want that after every alert it should stop for 30 seconds and then continue...till the end of loop. my code goes here.. for(var i=0; i<valArray.lenght; i++) { alert("The value ="+valArray[i]); //stop for 30seconds.. ...

View list of all JavaScript variables in Google Chrome Console

Hello everyone. In Firebug the DOM tab shows a list of all your public variables and objects. In Chrome's console you have to type the name of the public variable or object you want to explore. Is there a way - or at least a command - for Chrome's console to display a list all the public variables and objects? It will save a lot of typi...

iframe widget: know which domains are iframing the canvas?

If i have a php generated widget canvas and site's using the widget iframe it with $_GET parameters, is there anyway to get the domain that's making the request to my canvas page (javascript/php?)? ie - stop people using my widget that don't have permission... ...

How to execute code everytime url changes

I'm making an ajax site. How would I go about executing some javascript every time the url changes. Say when "/#page/aboutus/" changes to "/#page/news/". I want users to be able to bookmark ajax-pages. ...

javascript accordion - tracking time question

Hey all, I was reading up on this javascript tutorial: http://www.switchonthecode.com/tutor...ccordion-menus Basically, it shows you how to create an accordion using pure javascript, not jquery. All made sense to me until the actual part of tracking the animation. He says "Because of all that, the first thing we do in the animation func...

Calling a function of en external javascript file

Hello. In general... How can I make a call on a function of an external javascript file? More specific... In the head tag i have <script type="text/javascript" src="JScript/FontSize.js"></script> The external javascript file, (that i would like to call) FontSize.js contains the following functions. function checkCookie() funct...

Accessing items at deeper levels using children() in jQuery

Hi, I want to access a simple button in an unknown nested level of a container. Using container.children('button') allows me to access buttons in the first level, i.e.: <div> <button>test</button> </div> Trying to use the same with the following construct: <div> <div> <button>test</button> </div> </div> .. fails, because the...

re-trigger the same tab index event

Hi, i am using Jquery UI tabs , to trigger show event i use following statement $tabs.tabs('select',1); after this code executes a tab is set to #tabs-1 but i am failed to re trigger the same event on same tab when #tabs-1 is already shown. so how to re-trigger the same tab event. ...

How to launch game using a 'Launch' button in the website?

It is an online game, I need to develop a 'Launch' button on the game site to launch the client side game. I have seen this in several online games like this one. How can this be done? Note: I am using ASP.NET to develop the website. ...

How do I select all of the elements in a list that have children, using jQuery?

I have an arbitrarily deep list, like so: <ul> <li></li> <li> <ul> <li></li> <li> <ul> <li></li> <li></li> </ul> </li> </ul> </li> Using jQuery, how can I select every li in the list that is not a leaf node. In other words, I want to select all of the li elements that have children ULs. Th...

Why did this new line just show up on my google maps

i am using the google maps API (v3). I just realized that a new line showed up at the bottom of my map that says: Map Data 2010 AND, AfriGIS (Pty) Ltd, Europa Technologies, Inva, Geosysternas SRL, Maplink . . . . How do i get rid of this? Its longer than my map so it gets truncated and looks weird, is there any way to fix this (if th...

Display one div if nothing is selected

I use this javascript to display different div classes upon selection. I need to display one div class if nothing is selected, for example when page is loaded, and that replace it with one of the divs according to the selection... <script type="text/javascript"><!-- var lastDiv = ""; function showDiv(divName) { // hide last ...

fileupload validation by java script

i want to restrict pdf file on file upload control i want java script for that i want to apply that java script in file upload event ...

Google Map API V3 geocoder not showing the correct place

I am upgrading my codes from Google Map API V2 to V3. In V2, I used GlocalSearch to get the latitude and longitude for the given address. In V3, I saw google.maps.Geocoder() and try to get the similar detail. However, the lat & long given by the V3 function is not accurate. Pls see the following screenshot here: My codes for V3 are...

Cross browser div center alignment using CSS

What is the easiest way to align a div whose position is relative horizontally and vertically using CSS ? The width and the height of the div is unknown, i.e. it should work for every div dimension and in all major browsers. I mean center alignment. I thought to make the horizontal alignment using: margin-left: auto; margin-right: auto...