javascript

Why is this javascript code making browser draw 50% CPU and so much memory?

I have this banner rotator code: function ban_rot() { //First preload images // counter var i = 0; // create object imageObj = new Image(); // set image list images = new Array(); images[0] = "../Graphics/adv/1.gif" images[1] = "../Graphics/adv/2.jpg" // start preloading for (i = 0; i <= im...

Use drag event to let image change will cause delay (Javascript)

Hello, everyone. I'm trying to write a web page having rotate image animation by javascript. But it will delay when I drag image, I don't know how to fix it. Can someone help? Thanks very much. This is my code: grabBeginning: function(event) { this.moveBindThis = this.grabMoving.bind(this); this.viewer.observe("mousemove", thi...

Shorten comment per rows in div

I want to shorten comments with long text and add a "... [show full post]" behind the cut text to expand the full post. Since long comments on my site usually are lists it may be the best to cut them after e.g. 5 rows inside the comment div, but without breaking the html, i.e. the p tag. <html> <head> <style type="text/css"> body {...

jQuery : trying to draw elements that snap together and break apart

I'm trying to implement some kind of very basic flow chart functionality in a div. Basically I have some boxes which by default my be joined by a little AND bubble. If I click on the bubble it will change to an OR bubble which will result in the boxes (divs) splitting. Not really to sure where to start on this any guidance much apprecia...

phonegap - lawnchair question

I'm thinking about switching from titanium developer to phonegap mainly because there is virtually zero support with titanium (their q/a section often has questions asked nearly a year ago without any answers) and the android emulators are beyond slow to launch. My only concern is the lawnchair db performance in phonegap. I've been usin...

Read Omnifocus tasks from a local HTML file

Hello, is it possible to read Omnifocus tasks from a local HTML + JavaScript file? I have found nothing so far, but maybe some weird hack exists. Best, Stefan ...

use of "setTimeout" to repeat function causes browser to display "Loading..." message

I have this banner rotator which is working fine except for one problem... This rotator here first goes through the function and when it reaches the "setTimeout" statement it triggers the "cycle" function again and again. You guys probably know that in Firefox there is a status-bar in the bottom-left corner, which says "loading" or "wa...

Create YQL for sites which do not have an API.

I plan to create a YQL open table for a site which does not have an XML/JSON based API. I plan to use HTML scrapping to get data from the site and return it to YQL. Is this possible and is any of the Open Tables similar in nature? ...

Is it possible for a JavaScript to rewrite itself?

I am developping an AJAX website. Now I've ran into some differences between Standard JavaScript and Microsoft's JavaScript dialect. For examle .textContent (standard) vs .text (microsoft) I could make two files, one for standard browsers and one for microsoft browsers, but if I make a change I need to do so twice, so, that's not an id...

need to modify this Regex to not remove a character

I have the following regexp (/\?(.*?)\&/) which when I use it in the following javascript code it removes the "?" from the replacement result. href=href.replace((/\?(.*?)\&/),"") The beginning href value is this... /ShoppingCart.asp?ProductCode=238HOSE&CouponCode=test I get this as my result right now... /ShoppingCart.aspCouponCod...

Javascript and CSS that can replace alerbox. Alert Box is so unprofessional.

Possible Duplicate: Custom alert using Javascript I want to create a confirmation message-"Do you want to proceed deleting? [Yes] or [No]". I have a table with many data rows where the delete link is clicked in a particular row, the data in the row is deleted in the database. When the user clicks the delete option, i want to ...

Is there any way to maxime an InfoWindow in Google Maps v3

The old (v2) version of Google Maps API allowed infowindows to be maximized (see this example) but I can't find any equivalent feature in v3. The same happens with tabbed infowindows too (they aren't supported anymore). Is there any way to do that (even with a plugin)? ...

Define setter for hash member in JavaScript

Hello. I have hash defined like this: var props = { id: null, title: null, status: null }; I'd like to define setter for status field (and only for it) doing it as following: props.__defineSetter__("status", function(val){ //Checking correctness of val... status = val; }); But it doesn't work :( So, what's the r...

Flexigrid: selection of rows to survive refresh

Hello, I am using flexigrid in a project and I would like to be able to keep the selected rows after the grid is refreshing. I asked the same question on the flexigrid discussion board and I got this answer: Add a click handler, save the id if the row id of the row selected. On refresh completion, select the row again (if still pres...

Support of different Javascript versions in browsers

Surfing the MDC docs here, I've noticed there are quite a few versions of javascript (1.6 to 1.8.5). I was wondering: Is there any online reference for Browser / Javascript version supported ? Is there any practical application for the use of different javascript versions ? According to MDC you need to do something like this to use th...

HTML5 canvas application (javascript) - how to detect a memory leak?

I've encountered a strange problem - application is rapidly slowing down as it runs. Only thing that springs to mind is a memory leak, but how to detect it in javascript? Are there any tools? Anyway, here's the code: function draw_ship(){ //Body var sbpaint = ctx.createLinearGradient(shipx+20,shipy,shipx+20,shipy+15);//painting ...

Greasemonkey, overriding website functions

i've been reading a lot and have been trying to get this done for about 5 hours now... so here it is I want to write a script that will override a function dummy() {$.ajax(...)}; on a website. here is how i'm trying to do it unsafeWindow.dummy = function(data){differantFunction(); $.ajax(...);}; function differantFunction(){ ... } ...

html canvas font scaling problem , text is flickering without reason

I readed many forums, but never found some analogue case. Javascript canvas font displays in a flickering fashion. The conditions appears to be: scale of the canvas is not an integer (for example setScale(0.1,0.3)) setTransform(1,0,0,1,0,0); and setScale are used widely to restore setting at every draw of new objects. Windows. In linu...

set parameter using variable in tinyMCE

I'm trying to create a plugin for tinyMCE that opens a new dialog window. The URL that it opens depends on a variable as follows: var open_url = 'http://www.mydomain.com/footnote/edit/'+ID; tinyMCE.activeEditor.windowManager.open({ url : open_url, width : 320, height : 240 }); If I just enter the URL parameter directly ...

Javascript converting example to real code issue - arrays

I'm trying to use the userBox plugin and in the example we have the following array being built: var data = [ {text: "Adam Adamson", id: "[email protected]"}, {text: "Betsy Boop", id: "[email protected]"}, {text: "Jooles Jooles", id: "[email protected]"} ]; I want to build my array at runtime using JSON data I receive from...