javascript

Is designMode bad?

In a previous post that I posted here, I got responses that contentEditable and designMode are bad practices. So I switched to TinyMCE, but that uses designMode as well... is there something bad about it? Im using it for a Rich Text editor on my website fyi. ...

Javascript: remember selected range of a text

Hi, I am trying to find a way to remember/store a JScript textrange and then apply it back to a text and convert it into a selection. An example: in an iframe which is in "designmode" and contains the text "This is text inside the frame", the user hilights/selects "is text". I can read that selection by using all the available range m...

Javascript + Firebug console.log(), how to not get exceptions?

Hi everybody, I'm writing a javascript / HTML5 canvas library to provide basic GUI elements for web audio applications. There's a little demo script that creates widgets with the library and assemble them in a GUI. You can find it @ http://bitterspring.net/webshifter/ The problem is, it seems to work correctly on Chrome and on Firefox ...

Embedding an Image album from third party (imgur, picasa)

I'm looking for a free image hosting site that lets you upload/organize images by album (preferably with a massive album size), and then allows you to embed those albums into your own website/blog. Imgur allows you to create albums but it seems to be used to hotlink to single images or link to the album on their site. Also picasa allows...

DRY-er Javascript Classes

Hi, Using jQuery, this is the format of most of the classes I write in JS: $.Tabs = function(options){ var self = this; this.defaults = {}; var cfg = $.extend(true, {}, this.defaults, options); this.$elem = cfg.$elem; function _init(){ var dontInit = false; if (!cfg.$elem || !cfg.requiredProperty){ alert('missing para...

jQuery.validate may have broken Facebox pop-up

My Facebox pop-up contains a form with a submit button. I also have a second button to open an unrelated Facebox pop-up that was working before I added jQuery.validate to the project. I need to validate the email and password fields prior to being submitted. I should add that these pop-ups are loaded via external .html files. This loade...

Invoke / click a mailto link with JQuery / JavaScript

I'd like to invoke a mailto link from JavaScript - that is I'd like a method that allows me to open the email client on the users PC, exactly as if they had clicked on a normal mailto link. How can I do this? ...

A mouseover button in a post starts blinking?

I have two div-elements where one representing a post(status post) and one representing a delete-button for deletion of the post. The delete-button shall only be shown on mouseover event of div-element representing the post. It shall also be shown on mouseover event of the delete-button itself, because it lies within the post. document....

In functionally programmed javascript, is there any penalty to returning a callback rather than just calling a callback?

I do this out of habit: function process( fn ){ // Some process that builds data return fn( data ); } It is not always necessary to return the callback, and I would like to know if there is any performance hit in doing that over simply calling the callback: function process( fn ){ // Some process that builds data fn( dat...

Why are my particles drifting? ( aka Is Math.random() broken or is it my algorithm? )

Using Javascript I'm crudely simulating Brownian motion of particles, but for some reason I don't understand my particles are drifting up and to the left. The algorithm is pretty straight forward. Each particle is a div and I simply add or subtract a random number from each div's top and left position each round. I read up on Math.rand...

jQuery - clicking on one element triggers another

i have this jQuery file, but the vote_up click handler keeps conflicting with the vote_down click handler, when i click the vote_down element it changes the vote_up element: jQuery script: $(document).ready(function () { $("a.vote_up").click(function () { //get the id var the_id = this.id.split('_').pop(); /...

Reference HTML node from another element

I have this script, which I thought was relatively simple. It basically makes a tree-layout of an iframe's contents. When parts of the tree are hovered, their corresponding iframe elements are 'selected'. But it isn't working, for the life of me. Here is some quick half-pseudo code: function traverseTree(c,o){ //c = the tree subset ...

What is the best way to filter spam with JavaScript?

I have recently been inspired to write spam filters in JavaScript, Greasemonkey-style, for several websites I use that are prone to spam (especially in comments). When considering my options about how to go about this, I realize I have several options, each with pros/cons. My goal for this question is to expand on this list I have create...

Are there any more powerful XML parsers than the one built into jQuery?

I am trying to parse XML feeds from YouTube using jQuery (by doing $(xml).find(...)), but jQuery is having really hard time with those. YouTube feeds are real mess - they have bunch of namespace tags, escaped html tags with inline styles and what not. Are there any more powerful javascript XML parsers out there (preferably jQuery-compat...

Help with changing DropDown event to Radio Button triggers - javascript

Hi everyone, I have a dropdown in my form (the code was provided) and when the second option (of2) in the drop down is selected, some form elements change. It all works fine. What I want to be able to do is change the dropdown to two radio buttons instead. Having the same form changes take place on selection of the second radio button...

side navigation bar javascript help!

Hi guys, i'm struggling with display/hide text using javascript here. Here is what i wanted to achieve like the picture below: and the below is my javascript i've got: function change_display(display) { if(display.style.display=="none") { display.style.display=""; } else { display.sty...

How to split a panel in EXT-GWT?

I'm using ext-gwt and can't figure out how to split a panel so that I have 2 widgets, one on each side of the resizeable splitter, with the height of both widgets being 100% and their widths being variable. In essence, what I want is something like: ----------------------------------------- | Widget1 | Widget2 | | ...

OpenSource Script To Crop, Resize, Thumbnail, Convert Images.

I want to have a section where people after uploading their profile information can draw a square around the part that they want from the picture to be the thumbnail and all that. I'm wondering if there is anything out their with the client side (javascript) and server-side (php) so that I don't have to start from scratch! ...

web based timer

Is there anyway to create a variable speed timer in the browser that will give the exact same results for all operating systems and browsers? If I want 140 beats per minute for every user regardless of their computer speed. I've been using javascript setTimeout() and setInterval() but I think they are dependant on the speed of the compu...

what are the top js lib/framework/tool i should know?

hi, i know the basics of js the language for several years, but never had a need to go deeper than say change a style of a paragraph or do a image rollover or validate a field. am thinking going deeper with js. can anyone recommend the top 3 library or framework that you cant live without? Xah ...