ECMAScript (commonly referred to as JavaScript) is primarily used for scripting web-pages but also has several embedded forms and stand-alone interpreters / JIT engines. Use this tag for questions regarding ECMAScript 5 or 6 and its dialects / implementations: JavaScript, JScript, etc., excluding ...
1
vote
1answer
33 views
Light, custom CMS for a site
I'm working on a light, custom CMS for my site and I am trying to use Ajax calls for most of the server-side interaction. I am still pretty new to web development, so if I am breaking any conventions ...
3
votes
0answers
22 views
Organize JavaScript for video player controls
I have a small piece of code, and the problem is that I don't know how to organize it. There are tons of tutorials about JS code organization but I feel that those are for large scale apps. Also, I'm ...
2
votes
0answers
15 views
Remove sections of content from Quora.com
I wrote a Chrome browser extension to hide Top Content posts from Quora, which bother users following too few topics.
A user's feed in Quora.com starts as a list of posts relevant to the user, ...
3
votes
1answer
34 views
Drawing a color wheel… faster?
Using the following code, I am able to neatly draw a color wheel, however, performance is barely acceptable on a high end machine. Now, I know some tricks I could employ to make it run far more ...
0
votes
0answers
10 views
Object doesn't support this property or method IE 8 Issue [on hold]
Here is my code.
IE 8 results in an object doesn't support this property or method.
I'm using jQuery 1.11 and everything is defined in the head. Works great in all browsers except IE8
...
3
votes
1answer
31 views
Transparent encryption of HTML5 storage engine(s)
I am looking for feedback and possible suggestions regarding a piece of JS code that performs transparent symmetric encryption/decryption of user specified data using the HTML5 ...
2
votes
1answer
22 views
AngularJS project with modular structure
I've created a modular structure for my Angular application.
The main idea is to have a folder of modules which may be reusable later by simple copying them to the new project. With help of Gulp I ...
2
votes
1answer
25 views
Clarification on jQuery global variables in external files and scope
Now that I've used it a lot, I think I'm starting to get the hang of jQuery and its capabilities. One thing I'm still unclear about is how global variables are initiated and used, and when the ...
3
votes
1answer
37 views
Property management
I was looking to see if anyone could help me come up with a cleaner/DRY methods in duplicate of doing something like this?
I would like to get the features that repeats in the 2 controllers to ...
4
votes
3answers
133 views
Simple image gallery
I have a simple gallery that hides and shows images. It works fine, however, I am not satisfied with my approach, and my code seems redundant. Can you check my code and give a better idea on how I can ...
-1
votes
0answers
16 views
-1
votes
1answer
53 views
When a radio button is clicked, disable some search fields
The table has 4 search types and 4 radio buttons; when one radio button is clicked, other fields should be disabled. The JavaScript code seems repetitive. How can I improve it?
JavaScript
...
0
votes
1answer
27 views
A function which collates data from various API calls. Help on design-pattern
Help on the appropriate design pattern for this.
Program details:
A scheduled script that fetches all the data from various framework-based API's - ...
2
votes
0answers
11 views
Jasmine Unit tests for simple toggle class
Using Javascript/jQuery I created simple toggle and started writing unit tests for it using Jasmine. Am not sure however if I should be testing for things like e.g. ...
2
votes
0answers
27 views
Convert Object Keys according to Table/Map object
I have implemented a recursive function that converts an object's keys according to another lookup table/map. You are able to convert back and forth using the 3rd ...
3
votes
2answers
46 views
Flexible presentation of a user's name based on a combination of available properties
The goal is to add a new displayValue property to each object depending on what it has available out of Firstname, ...
4
votes
3answers
286 views
2
votes
1answer
24 views
JavaScript library for cookie information
I've always struggled to write JavaScript code that I thought of as great and "correct" code. And I've struggled to find good information on how to do it.
Recently I was given a task at work to write ...
2
votes
2answers
14 views
Insert JSON data into rendered template after AJAX call
I have an already rendered template and I want to update it with some JSON data I obtain via AJAX.
The template as it is before rendering looks like this (using ...
2
votes
2answers
51 views
Regex to select the last components of a file path
I have a regex sequence that will take the end of a file path and select it for me for example:
...
10
votes
2answers
166 views
Basic block building game
I've spent the last weekend working on this basic block building game, which I'm quite proud of. I do think it can be improved in many places though, e.g, performance issues due to my badly designed ...
6
votes
4answers
73 views
Extraction of numbers from currency string
I have the following code; whereas currency and views are in reality many JSON objects from an SAP export, that I can not rely ...
3
votes
1answer
14 views
Secure authentication using JavaScript module pattern and an AJAXified modal window
This code is not live, but for brevity I'll write as though it is.
When a user clicks any element with the class name js-modalOpen, for example:
...
1
vote
0answers
46 views
Multiple-choice quiz using ReactJS
I'm trying to build a multiple-choice quiz using ReactJS. When the Submit button is clicked, I want to give immediate feedback by changing the text 'input' color (green/red). Right now, it feels like ...
2
votes
0answers
28 views
Controller that works with several factories, has a couple different “states” and needs to update several $scope vars
I have a controller that has gotten a little out of hand. This is my first AngularJS project and I am using it as a learning experience... but I feel like I am doing some things wrong.
This ...
5
votes
1answer
32 views
Reading the contents at three URLs using Promises
I'm learning promises and now I'm trying to figure out if something in this code can be improved. This code is expected 3 urls and then async parallel calls should be done. When all requests are ...
3
votes
1answer
30 views
Objects/closures for storing movie information
I'm currently in the process of learning JavaScript and what it has to offer. I thought writing a simple web app that would allow me to add/remove/show my favorite movies would be a nice learning ...
6
votes
3answers
144 views
Airflow calculator
I have started to learn JavaScript over the last few weeks. I have gone through most of the Head First JavaScript Programming book and it has been fantastic. I highly recommend it!
Anyways, I found a ...
1
vote
1answer
31 views
2
votes
2answers
39 views
Optimizing jQuery addclass / removeclass on scroll
I have a scroll event and add class and remove classes for different elements. As you can see the code is a bit big. Is this method ok or is there a more efficient one?
I mean, you can see that there ...
4
votes
2answers
138 views
JSON conversion to single quotes
The JSON standard uses double quotes for key names and string values, such as the following:
{"one":1,"two":"two"}
However, the current project I am working on ...
0
votes
0answers
10 views
Creating drilldown series for highcharts using underscore.js [closed]
I have got an array with object where each object contains information about school and business area like this:
...
5
votes
2answers
58 views
Equal heights in pure JS
I'm pushing myself to learn pure JavaScript, so this morning I wrote an equal heights script in jQuery and then converted it to JavaScript. It works, but I'm using two ...
-2
votes
0answers
15 views
2
votes
2answers
40 views
Function to validate date format
I have this JavaScript function which checks if the format has 'yyyy' and replaces 'yy' with 'y':
...
4
votes
1answer
69 views
Simple math facts game
I've made a simple game for testing math facts (think practice for elementary school-age kids). It displays a random addition, subtraction, multiplication, or division problem, and feedback on if the ...
-2
votes
0answers
24 views
Sharing HTML view between PHP and Javascript [closed]
So I have a page which first of all lists a quasi-table made up of divs. This is dynamically generated with PHP.
Each "row" has a container DIV then within that are a number of div's that are used as ...
-1
votes
0answers
16 views
Write Code to Run Timer Backwards/Countdown [closed]
I'd like to alter the following code to run the timer backwards? Any tips you can provide are much appreciated!
Here's the JFiddle: http://jsfiddle.net/x5Lx6o9d/41/
0
votes
0answers
19 views
How to go about completing this beginner's JavaScript exercise? [closed]
I am a newbie to JavaScript and would be very grateful for some guidance in accomplishing the following task (which has three parts) as I keep getting stuck. I think there are probably multiple ways ...
8
votes
1answer
135 views
Markdown to HTML, again
I made another markdown parser. (original, this one on github). Look, I'm not crazy (sorta), I just like making markdown parsers…
...
0
votes
1answer
11 views
Concisely handling both arrays and Backbone.Collection as parameter
I've got a Backbone.Collection which looks like this:
...
2
votes
1answer
25 views
The best way to place callback definition [closed]
In JavaScript we can write callback definition in many different ways:
Definition after usage:
...
-1
votes
0answers
28 views
Is it good to have lot of small functions to remove redundancy [closed]
I have a lot of repetition in my code, for instance, a lot of repetition like variable z.
...
6
votes
1answer
75 views
Navigation bar built from fetched JSON data
I have finally been able to create my little navigation plugin in an object-oriented way that reads the li from a JSON file.
Now, is my code efficient? Especially, ...
1
vote
0answers
9 views
NodeJS ReadableStream _read implementation, ArticleReader with changing dates
I have a NodeJS stream.Readable, ArticleReader. It's job is to read articles, Meantime I have to give it a date to signify the ...
3
votes
2answers
23 views
Function that groups rows returned from SQL DB
I have a data set returned from an SQL database contained below, as you can see all data remains the same apart from one property, "name_alt".
...
5
votes
1answer
150 views
Sliders library
I have completed working on my own pure JavaScript Slider library and would like to get some input from other developers. I would like to know how you would improve the code in any way.
...
1
vote
1answer
34 views
Using both setInterval and setTimeout for simple image carousel
I have a really basic image carousel that I just wrote.
Basically I'm trying to keep it as small and light weight as possible, but I get the feeling that I've gotten way off the beaten path of how ...
1
vote
0answers
18 views
Utility Library and Underscore Mixin - 2
After addressing all issues in the previous post I've re-factored the
code. I'm looking for a code review on the code below.
...
2
votes
2answers
48 views
Change the navigation ul li based on the clicked country
I'm trying to create a very simple jQuery plugin in the object-oriented way. Now, I'm not sure whether the code I produced is correct and efficient OO programming. The plugin's aim is to change the ...