javascript

Why does window.innerWidth returns 477px even if the window has a smaller width?

When I resize the browser window to a lower width than 477px, window.innerWidth or window.getSize().x (using mootools) still returns 477px. Anyone ever had that problem? What's going on here? The problem occurs in Firefox and Chrome. ...

Youtube url tester with hyphens

Hi all, this is how i normally check for youtube url validity using javascript. It works great but fails for urls with "-" before the video id eg http://www.youtube.com/watch?v=-pIaQpwYEjY Any remedy available as I'm not well versed with regex var matches = $('#as_url').val().match(/^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=\w+)(?...

How to use Public API?

I came across a jQuery lightbox plug-in called PrettyPhoto. Seems very interesting. At the bottom of documentation I noticed a section about Public API, which I paste in its entirety below: Version 2.5 introduced an easy to use API. You can now open prettyPhoto from anywere. The public API functions are the following: $.prettyPhoto...

specify filetype for FlashGet's download command with JavaScript

Consider a web page with of links to files. FlashGet's normal operation is by right-clicking, and selecting from the context menu. I want to make it easy to launch FlashGet, and make a selection of file type to my desired file type without downloading any other resources being linked to. For example, my desired file type is .rar , and...

JSONP not receiving any callback?

Trying to make a JSONP request to yellowapi (Yellow Pages), even specifying a callback is giving me the "invalid label" error. Here is what I have so far: $.ajax({ dataType: 'jsonp', cache : false, url: "http://api.sandbox.yellowapi.com/FindBusiness/", data : "apikey="+testingPurposes+"&what="+what+"&where="+where+" &fmt=JSON&pg...

How to request different domain with Ajax in jQuery

I need to make a request to a different domain with Ajax in jQuery! Should I use iframe? Edited: On facebook.com working chat, with few different domain name? GET http:// www.facebook.com/ajax/presence/reconnect.php?__a=1&reason=6&iframe_loaded=false&post_form_id=23be2df75b74a0bcb61358814c56ba4f 200 OK GET http://0.50.channel.facebo...

How do I get the list of mutual friends on Facebook using their API?

I am trying to get a list of mutual friends of myself and another user but none of the API I found in the documentation works. Either I get some weird permission errors that I can only get my friends list and no other user or I get the following error: Fatal error: Call to a member function friends_getMutualFriends() on a non-object in ...

passing data from javascript to php using Jquery.

Hi everyone. Maybe this question has been asked before but I am struggling in doing this. I have got a php file which does not include any piece of php code (might be in the future),it includes just javascript and some html. What I want to do is clicking a button in this php file to send some amount of data to another php file. put it ...

Base64 decode from Buffer to Buffer efficiently in node (node.js)

I currently have a python and C version of wsproxy (WebSockets to plain TCP socket proxy) in noVNC. I would like to create a version of wsproxy using node.js. A key factor (and the reason I'm not just using existing node WebSocket code) is that until the WebSocket standard has binary encoding, all traffic between wsproxy and the browser/...

JavaScript regular expression help

Hi, everyone. I've got a string looks like var s = "2qf/tqg4/ad(d=d,s(f)d)" And I've got another string var n = "abc = /fd/dsf/sdf/a.doc, " What I want to do is insert n after the first '(' So it will look like "2qf/tqg4/ad(abc = /fd/dsf/sdf/a.doc, d=d,s(f)d)" Thanks very much!!! ...

Google API Authentication

Using the Google Javascript API I am trying to authenticate myself (locally) to create a new event in my calendar. However, I get an error (see below) stating that my "next" parameter is bad or missing when I execute the log-in portion of the script. I am following the data api interactive samples for "Create a single event". Update 1: ...

space after function in visual studio ide

How can I set up the designed in visual studio to put a space after my javascript functions? At present when I press the return key I get this var myfunc = function() { .... }; When I want this var myfunc = function () { .... }; Know its a setting somewhere but cant find it - will help with my JSlinting! ...

any possibility to call C# function with javascript ?

I wrote an office addin and with which there is a function : openFile(String path) and in the office addin I embed a browser object and with that I can embed a webpage on the office addin, and now I hope I can call the C# function "openFile" and pass in a path in the webpage with javascript, and let office open the designated file for me...

please help onjquery hover

Hi, I have two divs. Say div1 and div2. By default div2 is invisible. When the user hovers over div1, I need to display div2. Now if the div2 is hovered then i need to keep displaying this div2 (even if div1 is no longer hovered), otherwise reset the div2's visibility to hidden. How do I keep div2 visible while hovered? ...

Javascript regular expression needed

Here is the format of the css I'm trying to edit using jquery. /*8d*/ .class{color:#444444;} /*5d*/ .class{background-color:#444444;} /*3f*/ .class{color:#444444;} /*9d*/ .class{color:#444444;} I want to replace several entire lines within using Regular Expressions. For example, How do I select line 5d the replace with "/*5d*/ .new{bo...

Select text just like "Ctrl+A" when clicking the text?

I just want to select the text in a paragraph when I click or double click the "p" tag.Not highlight,just like using mouse to make a select area to choose text to be selected! thank you very much!! I am so sorry! It is about a web page function.I have several paragraph and *.rar file link address on the page, and I want to select all...

Javascript conflict causing page not to display in ie

The following page will not display in ie. http://dl.dropbox.com/u/6957663/muchWorth.html I believe it has to do with the javasscript I implemented but I'm not sure. Is there some file encoding I am missing? I am on ubuntu linux in gedit. ...

How do I block the UI using JQuery UI?

I've been using this plugin to block the UI: http://jquery.malsup.com/block/ The plugin works excellently, it's just that I'd be enormously surprised if jQuery UI didn't do such a thing already, given that it must do effectively the same thing for it's Dialog feature. How does one block the UI using JQuery UI? ...

How to move an entire group of objects with Javascript

I am trying to move everything contained within the div id "tile", to the center of the web browser. By default the CSS is undefined and it appears on the left side of the browser. What I would like to do is move the entire div to the center using javascript when the button "move" is clicked. The html is shown directly below, and the a...

Swapping two items in a javascript array

Possible Duplicate: Javascript swap array elements I have a array like this: this.myArray = [0,1,2,3,4,5,6,7,8,9]; Now what I want to do is, swap positions of two items give their positions. For example, i want to swap item 4 (which is 3) with item 8 (which is 7) Which should result in: this.myArray = [0,1,2,7,4,5,6,3,8,9]...