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 ...

learn more… | top users | synonyms

2
votes
1answer
52 views

Is my web site structured correctly?

I'm trying to get a better handle of code organization and how HTML5 (really HTML) stack works in general. I've worked mostly with ASP.NET Webforms and done some MVC as well. Let me say now, "I hate ...
1
vote
1answer
22 views

Simple inheritance with functions in subclasses [on hold]

It seems like there are many ways implementing inheritance in JavaScript. Which version do you prefer or would you suggest another solution? The code should run in IE8+ so my first version would not ...
2
votes
1answer
22 views

Parsing playlists efficiently

I have this regexp working, simple, but I feel like it may not be the best way to code it. Basically, I have a playlist separated by line breaks returned as tcp data like so: ...
2
votes
2answers
25 views

JavaScript bookmarklet with a 24 hour cache

I'm working on a bookmarklet that will be cached for 24 hours only, after that time it will be reloaded from the original source. Is there something I could improve? ...
1
vote
1answer
23 views

jQuery plugin creation and declaration for usage with $(). or $

Simple idea: just have a plugin (more a basic function). That I can use with jQuery in different ways it offers, means: ...
2
votes
1answer
28 views

Speed and ID concerns converting DOM object into JQuery objects

First of all, I am not using JQuery but Cheerio. I have never actually used JQuery in "real life" -- I started with Cheerio, which is a subset and doesn't actually work in a browser environment. ...
2
votes
0answers
34 views

Menu Bar Animation Plugin

I'm fairly new to JS/jQuery (a few months), and I think it's time to start getting involved in the community. So I wrote a little plugin. Nothing revolutionary. Really, the project is to write a ...
1
vote
1answer
29 views

Dynamically loading jQuery when it's not available or version isn't high enough

I'm writing a script for others to use on their websites. I'd like to use jQuery in this script. Because I don't have control over what frameworks people use on their sites, I need to make sure jQuery ...
5
votes
1answer
46 views

Load JSON file into model using Javascript / jQuery (deferred, asynchronous)

As a beginner I am always determined to improve myself. I've got written the following Code using jQuery that is working fine. However, I am sure that there are cleaner ways for achieving the same. ...
3
votes
1answer
32 views

Controller structure for a browser game module with filters and pagination

To get an idea of what the controller code reflects, here is a screenshot: Basically, the idea is that you print out a list of football players which you can then filter by their name, price, field ...
5
votes
1answer
61 views

Namespacing jQuery/jQueryUi into markup that I don't control

I have a project that I've been trying to get just right for the past three months and it's still not quite there yet. I'm injecting some jQuery and jQueryUi code into pages that I have no control ...
3
votes
1answer
38 views

node.js Passport Wrapper 3

First attempt was done here Second attempt was done here Huge comment at top ...
2
votes
1answer
22 views

Aggregation of a collection of object's nested array-properties

Use Case So our lead programmer loves to follow the NIH Anti-Pattern and consequently I'm not allowed to use Underscore.js and can only use Vanilla JS... and we have to support IE8. The goal is to ...
2
votes
1answer
21 views

jQuery for image swapping and some JS for text swapping

I am designing a website for a company that manages buildings/real estate. I did not have much use for a CSS library like Bootstrap or Foundation, except on one page of the website. This page ...
8
votes
1answer
36 views

Sort function to sort item numbers separated by colon

Below is my code. This is a function that will be applied as a sorting method to a grid based data set. The data in the column to be sorted can be stuff like: ...
6
votes
2answers
55 views

Three layout Gallery

I have made a gallery function, this function handles three different types of gallery, one with horizontal nav, other vertical and last one vertical with no nav. ...
4
votes
2answers
42 views

Multicriteria sort array javascript

I have an array of objects that I must sort based on two criteria. I've come up with a solution but I'd like to know if there is a better way to do it. Assume a list of devices: ...
3
votes
2answers
37 views

HTML/Attrs Tester Environment

I have a few objectives (which are working fine, but I want tips in case I can improve it). Let me try to make this as clear as possible, as this is a much larger project: There are three move ...
3
votes
1answer
57 views

Single Rotate Method

I just started coding a simulation-like application. It's about our solar system. Right now, I'm working on rotating the moon. I have this constructor ...
4
votes
1answer
44 views

Should I differentiate object types by calling methods via variables?

I have three JavaScript objects. The first one serves merely as a prototype. The other two are implementation of a specific type. ...
6
votes
1answer
43 views

Display text on video screen

The code displays a video that will play a video and then display some text on the screen at specific locations on the video screen. The code works but I would like to see if I could change ...
3
votes
1answer
55 views

Recursively reading a directory in node.js

I made a function for recursively reading a directory and it just seems kind of long and complicated. If you could take a look and tell me what's good or bad about it, that would be great. Reading ...
1
vote
0answers
13 views

Is this a correct knockout ViewModel setup?

This is my first time using knockout. I'm reading/writing a JSON file with a fair bit of nested data. I had no problem creating the ViewModel to just write to the file, but now that I'm reading the ...
3
votes
1answer
70 views

AngularJS Tab Control

I'm experimenting with angular directives, and as a proof of concept I wanted to create a basic tab control. I'd like to know if anything can be changed to be more fluid, or if I'm doing things ...
4
votes
1answer
62 views

Price Slider using jQuery UI working in Java environment to be optimised

I am working on a price slider that is for a Java environment. It is working correctly but I would like to optimise it as much as possible. Any tips/advice? ...
4
votes
1answer
26 views

Communicating between plugins whilst maintaining context in Javascript

I'm making some changes to a JavaScript plugin on a site I've been made steward over. This main plugin has it's own sub-plugins and I'm trying to make certain aspects modular. Currently, I'm ...
5
votes
1answer
32 views

AngularFire Tic Tac Toe Game

I am building a Tic Tac Toe game with AngularJS and making it online playable with AngularFire. The Tic Tac Toe logic is all there so this question concerns Angularfire a little bit more. I want to ...
6
votes
1answer
71 views

Balancing Accounts Daily

I've written it for an assessment. It works but my assessment also requires a peer to review it in terms of how it could be improved, how it rates as a piece of JavaScript, etc, any comments would be ...
3
votes
1answer
68 views

Scraping reviews from Google Play using JavaScript

What I'm trying to do: Get user input for Google Play App page. e.g. https://play.google.com/store/apps/details?id=jp.scn.android Scrape 100 reviews from Google Play App and organize them into an ...
5
votes
1answer
82 views

BBCode to HTML converter using functional programming

I was inspired to write a BBCode to HTML converter as I'm currently learning functional programming. I wanted achieve functional cohesion. jsFiddle I'd like feedback on: structuring of the code. ...
2
votes
1answer
26 views

consolidate table td and th query

I have two statements that look like this: $('table tr td:nth-child(' + columnNumber + ')').toggle(); $('table tr th:nth-child(' + columnNumber + ')').toggle(); ...
1
vote
1answer
33 views

Optimize jQuery code includes autocomplete function for different input box with different autocomplete content

I have this code below for autocomplete feature of several inputTextbox. The input box also share same class".wikiInput". When user typed something in either of them, a relevant autocomplete dropdown ...
7
votes
2answers
347 views

My first accumulators

Notes I'm working my way through SICP, and as I got very confused by the section on folds, I decided to try to implement foldr in scheme and javascript to understand how it works differently with ...
4
votes
2answers
47 views

Accessible tabbed UI

I've started working on a script that turns sections with headings into a tabbed interface. The repo is at https://github.com/derekjohnson/tabs and a demo at http://derekjohnson.github.io/tabs/ It ...
4
votes
3answers
358 views

Basic JavaScript OOP model object

I'm relatively new to JavaScript OOP and would like to know the best practice when doing a simple object such as a Model. Here's a piece of code representing class named "Child". What I'm asking for ...
2
votes
2answers
41 views

Interupt redirect to catch potential newsletter signup

This is a piece of code I am working on to reuse in a few places on various websites. It is used to capture name and email addresses for people interesting in registering for something, we want to ...
5
votes
3answers
83 views

Converting KML/XML to Javascript

So, I have the boundaries of every states in the US, from the google map KML file. This KML file is actually a XML file. I'm converting this file to a JS file compatible with google map in order to ...
11
votes
6answers
5k views

Is my AI solution to Untrusted Game considered logical or “ethical”?

I am applying to a university to study Computational Linguistics, and as I read, it would be recommended to have a background in Artificial Intelligence. The Admission board asked me to prepare a ...
3
votes
1answer
107 views

Seeding a file with fake records - doing concurrent updates

I need to seed a database with user data. When trying to write records to a file using sqlite3 with node, I tried writing the logic in a naive manner, without any error checks - but it was failing ...
2
votes
2answers
35 views

Is it ok to have NaN while comparing fields in JavaScript?

I am comparing two integer values, but there is chance of parseInt giving NaN. I would like to know if I need to do any additional checks. ...
6
votes
1answer
68 views

Plan to make a small game - got a hang of canvas and made a cube fly around

I'm planning to make a small game for learning purposes. So far, I've got the hang of the canvas element and using the context to draw things on it, as well as object notation and classes in ...
4
votes
1answer
59 views

Reducing code duplication in a geometric function

Given a large bounding rectangle ("envelope"), a list of points, and a maximal aspect ratio, the goal is to find a rectangle within the envelope, whose aspect ratio is bounded within the given aspect ...
3
votes
1answer
38 views

Horrible nested if statement for changing CSS based on RadioButton selection

I'm writing away for this website, and I've come into a problem. I need to display only one td based on the corresponding radio button pressed. However, there are ...
4
votes
1answer
47 views

Smoothen page transition for mobile devices

I have next/previous buttons on my site and all they do is slide sections of the site from left to right and vice versa, it is smooth and looks good on a desktop but on mobile devices it is a bit slow ...
5
votes
2answers
48 views

Adding a bulk of items in the middle of a sparse array

I'd like to add a bulk of items into a sparse array, starting at a certain index. I came along this requirement in order to accomplish client side pagination while not retrieving all data from server ...
3
votes
1answer
79 views

Google Maps Javascript API v3: Sorting Markers with Check Boxes

Recently I built a map with custom markers (pins) and a sorting function to display each by type (Member, Supplier, Prospect, New Member). The HTML (check boxes wired up with ...
4
votes
3answers
63 views

New Game - Am I going down the right path for DOM manipulation?

I find myself using a lot of .find functions within what I'm developing. The reason being that I need to run this same function on a TON of different characters ...
5
votes
1answer
44 views

Dynamic matrix in web browser

Today, my project was to make a matrix in my web browser. It is really slow, so help with optimizing it would be nice. It runs slow on my PC, yet alone my iPod 4 which this is going to be for. ...
1
vote
2answers
75 views

What are practical issues using this code with common JavaScript libraries?

I'm not a JavaScript programmer. I have next to no idea about "what's out there" of libraries and so on. Therefore it's not unlikely that the referred to Windows HTML Application (HTA) code here, ...
3
votes
1answer
42 views

Testing async API calls using Jasmine 2.0

I'm upgrading my project from YouTube's V2 API to their V3 API. I'm also taking the time to upgrade to Jasmine 2.0 since I already need to look at my test cases. Here's a couple of test cases and the ...