0
votes
0answers
47 views

Optimizing Jquery Twitch TV Application

I'm trying to get in the habit of writing better looking code and more efficient code blocks. I wrote this Twitch TV Application which allows you to add and edit channels and it lets you know when a ...
3
votes
2answers
78 views

If statement, is the shortened version readable enough?

I have to perform an IF statement in my Javascript code. I utilised the first method shown below: (someVar1 !== "someString") && (someVar2[i].disabled = (someVar3.find("." + someVar4).length ...
1
vote
1answer
116 views

Multiple jQuery events on one element with different functions and target selectors

According to this two questions: [1] and [2] I need a way to combine these two methods of handling the event attachment in jQuery. $('selector').on({ mouseenter: function() {}, mouseleave: ...
2
votes
1answer
156 views

New at jQuery, lack of structure

My job required me to learn jQuery the last couple of weeks, but it's a mess and I do not know how to structure my code in an acceptable manner. I come from a Java and PHP background and have never ...
1
vote
0answers
226 views

Could this JavaScript / PhoneGap code be improved to use module, or other, pattern for better readability and maintainbility?

I have a PhoneGap application that I wrote some time ago. After looking Doug Crockford's video seminar JavaScript: The Good Parts (http://www.youtube.com/watch?v=hQVTIJBZook) I was just wondering if ...
1
vote
2answers
1k views

Get device orientation

Here is my code: // get orientation of device getOrientation(); // animate var num = 400; if( $('body').hasClass("landscape") ) { $('.example').animate({'bottom', 0}); } else { ...
4
votes
1answer
2k views

Pie Chart jQuery-UI plugin

I would greatly appreciate the input of any gurus out there. I have recently begun learning JavaScript and then jQuery and jQuery-UI and have thought I would take a stab at writing my own jQuery-UI ...
2
votes
2answers
589 views

JQuery Delay slideDown using Queue

So I have the task to create a function that adds some messages to the page and another to show them in last to first order with a jQuery slideDown() effect. So i came up with: (jsfiddle) ...
2
votes
3answers
447 views

Building an HTML table using JavaScript

More readable way to do this? renderHtmlTable(function(tableItems) { var tableArray,_i,item,_len; tableArray = ['<table id = sampleTable ><thead><tr>' + ...
5
votes
2answers
166 views

shorthand methods

Is it good or bad practice (or, when is it appropriate) to use shorthand methods? Lets pretend we're using jQuery here, because it has a lot of them.: jQuery.ajax() jQuery.get() jQuery.getJSON() ...
8
votes
4answers
844 views

Any tips on making this JS better?

Working on a personal project to keep different snippets/examples/small projects of mine organized. I want to make the most of my page width, so I decided to write a navigation menu that slides out. ...
10
votes
3answers
551 views

Is this code good enough? (jQuery)

I'm working on a simple star rating system, and before I move on to actually "tallying" the votes, which I figure I'll just do with $.ajax, I wanted to make sure what I've done so far has been done as ...
4
votes
2answers
248 views

Feedback welcomed on this regexp tester javascript code

I'm quite new to JavaScript, and any feedback of the following code structure and syntax is warmly welcomed. It serves this little online regexp test (still a work in progress): ...