Tagged Questions
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 ...
2
votes
0answers
20 views
JavaScript AJAX page flipper
I rarely see this kind of navigating on the web. But basically I load all the content in the background and then flip pages as needed while loading user specific data via ajax.
Are there any ...
1
vote
0answers
9 views
Set the direction a Sprite faces based on its velocity
I'm learning Phaser, and decided to make a Mario-type clone. I'm writing a function that ensures the sign of the Sprites horizontal scale matches the sign of it's velocity. For a Sprite that's ...
1
vote
0answers
20 views
Compiler for grond, a language-in-the-making
I'm working on a language called grond (see it on GitHub); the compiler is so small it is included in this post.
My gut tells me that this code is awful, but it works. I am hesitant to change things ...
-2
votes
0answers
19 views
Tracker to track time spent on a website in JavaScript [on hold]
This is a stripped down version of the functionality I'm building. It's going to start tracking estimated time spent of a user on a page. It's going to start at the 5th second and gradually increase ...
0
votes
0answers
24 views
Dynamic create items in view
This script is for creating / selecting / deleting items dynamically. As I am at the beginning of my studies. I wonder if this is the best way to do this.
JavaScript
...
-2
votes
0answers
15 views
Javascript model class, should I refactor it using methods in prototype? [on hold]
Usually I am using code below as boilerplate for my JavaScript models (jquery plugin or knockout one). Looking to bootstrap sources (and many other) I see that it uses methods definition in object's ...
2
votes
1answer
55 views
Editing HTML based on instructions in a data structure
My getExtend() function, which will be included via require.js, has two inputs and one output:
HTML file content
config object which determine how to ...
-5
votes
0answers
21 views
Returning a resolved promise from the error handler of a catch block in one of the promises in Promise.all [on hold]
I'm looking at this piece of code and whilst it works, it feels wrong to me. I'm wondering if I am looking at an anti-pattern?
The code starts with two promises, ...
-2
votes
0answers
9 views
week by week countdown, need a process for php to store information to mysql db [on hold]
I have this script and i need to go with php to store the infos to the db, and a form to setup the countdown date for my users. thanks!
Script:
...
-2
votes
0answers
31 views
Wanting a better MVC to Javascript pattern to get Resource Files from C# mvc into Javascript [on hold]
Currently Resource Files in asp.net mvc c# are the typical file.resx
MVC controller method:
...
1
vote
2answers
114 views
My favorite privacy settings
I'm looking for general feedback on this module. Here is what it handles on the page:
This is a private "class" meaning none of its properties are available outside of it.
...
4
votes
2answers
67 views
Adding links to tags on StackExchange sites
This Greasemonkey script adds links to tags on StackExchange sites which allow for activating, deactivating and ignoring favorite and related tags by using UI components.
Since JavaScript is not my ...
1
vote
1answer
28 views
Custom form validation using jQuery
Recently I have been doing a bit of work with Contact Form 7 and Wordpress. I've begun looking at form validation using ...
0
votes
2answers
31 views
delegate click event on document
I'm adding an onclick listener to the whole document then checking the source of the click. If the source of the click contains the attribute data-widget I want to ...
1
vote
1answer
20 views
Node module to fetch/post API data
I'm fairly new to JavaScript and Node and am wondering if I'm on the right track.
Module file:
...
4
votes
2answers
64 views
Parse HTML to modify it
I'm using the following code to parse html, This code is working but since I'm new to JavaScript and working in alone project I would appreciate if you can give me some tips and feedback how can I ...
4
votes
2answers
16 views
Window-size-dependent content toggler for an HTML form
I had to build a responsive component which allows the user to display specific content in a page. I called it the contentToggler.
Here is my component in action
...
0
votes
1answer
37 views
PHP's array_diff in JavaScript
I shall make a JavaScript-function which does the same as PHP's array_diff:
http://php.net/manual/de/function.array-diff.php
Because it is intended to use the function as a (internal) ...
-1
votes
0answers
12 views
MultiTouch HTML [on hold]
I would like to know if it is possible for MultiTouch to be implemented on HTML.
Scenario like this:
...
-2
votes
0answers
16 views
What's wrong with my jQuery code? [on hold]
Developing an application in Laravel, i am working on the invoice section with the help of jQuery.Actually everything works fine but when i added the below jQuery code then my page do nothing via ...
3
votes
0answers
75 views
Color slider for different gradients
I am creating a color slider, and I'm trying to make the slider's background-color a dynamic gradient. I've successfully did it, but I feel this can be done in a ...
3
votes
1answer
183 views
Generators in Javascript; Project Euler #2
I'm trying to learn javascript using project euler and I decided to try to force myself to learn about generators in javascript using problem number 2 which asks us to: ...
1
vote
0answers
39 views
Transforming a parts catalog into a different data structure
The entire purpose of this code is to arrange the data that was dumped into CommRef_ into the required structure of ResObj.
The ...
0
votes
1answer
31 views
merging json object
Hi I am trying to merging json objects which has common value.
This is original JSON
...
-1
votes
1answer
54 views
JavaScript Brainfuck interpreter
I wrote a Brainfuck interpreter in JavaScript, however it is quite buggy and I can't figure out what I'm doing wrong. It works for programs I've written, but fails on most programs I find on the ...
1
vote
0answers
30 views
Angular validation function for a user creation form
I have to make a user creation wizard, there are 3 steps to achieve the insertion of a new user, so every step I have have a validation function to enable the next step.
As a first step for the ...
0
votes
0answers
13 views
The Same Behavior for Boolean and Exception
The following code uses a boolean preference active: In the active state, it does an operation which could throw an exception. On this exception, it does fall back ...
2
votes
2answers
75 views
Integer to English challenge
I have a challenge, which is to create a JavaScript function that turns a given number into the string representation. For example:
console.log(inToEnglish(15)) ...
1
vote
4answers
70 views
Diff Two Arrays - return the symmetric difference of the two arrays
This is my challenge using JavaScript -> Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both. In other words, return the symmetric ...
0
votes
1answer
16 views
iframe play & thumbnail function
This is quite a simple function, but I just wanted some opinions on it, like is this the correct way to run a function and check if an element exists or not?
...
0
votes
0answers
22 views
4
votes
0answers
43 views
Recorder for keyboard and mouse events
I'm building an event recorder. So far the code looks clean but I feel I'm missing something that can make this code even better.
Is composition a better solution? If yes, how can I do it properly in ...
3
votes
1answer
65 views
Sudoku solver in JavaScript
I decided to learn JavaScript and what better way than wrestling with a Sudoku solver. I'm guessing there are (many?) optimizations that I missed. I'm thinking of adding a generator also, but this for ...
0
votes
1answer
53 views
Wikipedia search using the JSON API
I ask to you. What I could do better in my code or logic?
This my example on Codepen -> Wikipedia Search
...
0
votes
0answers
18 views
Running actions on button click
If the user clicks a button, I need to run the following actions:
Show and hide div
Add and remove attributes
Add and remove CSS class
We archive the same but I'm not sure this is the correct ...
-1
votes
0answers
9 views
jQuery - Add/remove class when height changes [closed]
I reached an issue when trying to add Class if div's height has changed (it's a responsive website project).
My Javascript:
...
1
vote
1answer
26 views
Secret Santa random pair allocator
Please review my Secret Santa random pair allocator written in JavaScript. Random pairs will be generated every time you run the code.
Input data is hardcoded for now (line # ...
0
votes
1answer
21 views
Balanced parenthesis string checker
Please review my balanced parenthesis string checker code below.
I would love to know how to improve my algorithm and if you have any other feedback.
...
1
vote
0answers
24 views
Basic animation in Typescript
I decided to play around with doing my own super-basic animation. For a previous Javascript project, I needed the ability to flash an element. The code below is the result of me attempting to ...
-1
votes
0answers
15 views
Return a list of data made from an Ajax/HTTP in the order they were called [migrated]
Is there a way to get your data back in the order in which you called your AJAX requests, without using promises, also no synchronous code or jQuery, but simply pure javascript?
I'm quite familiar ...
-4
votes
0answers
14 views
how to connect liaison API lapi.ocx with php page [closed]
I have sample code in VB but I don't know how to connect it to a PHP page, send commands, receive the result from sita servers, analyze the answers and show the result.
Here is the sample code in VB:
...
-1
votes
0answers
14 views
How can I finish building out a PJAX “driver”? [closed]
I'm not much of a javascript developer, and am building out a PJAX "driver" that requires 0 interaction, and easy manipulation of a website, so how would I improve this function, and make it work ...
4
votes
2answers
59 views
Fancy checkbox for web pages
I just finished creating a fancy checkbox and am hoping for some tips to help improve my code, as I am still learning.
...
-2
votes
0answers
10 views
Sorting out array of parent child relations where two children share a parent from an array and display it using div [closed]
I have the following data which gets served from a neo4j query, The data that gets sent back is in the format
...
2
votes
2answers
67 views
sum, range and rangeSum functions
Forgive me if this is too simple, but I'm a beginner trying to learn and understand. I came across an exercise to create these three basic functions, and this is what I came up with.
Any glaring ...
2
votes
1answer
34 views
Regrouping JSON object
I wrote a JavaScript source which regrouping by new key i.e. following JSON to the other:
...
2
votes
0answers
25 views
Node.JS HTTP shortcut wrapper
The Node.JS HTTP and HTTPS modules only provide .get shortcut function, unlike AngularJS's $http which provides them all. I went ...
1
vote
0answers
22 views
NodeJS Configuration Exporter
I have created a NodeJS script that I will be using to export front-end configuration details from my Zabbix installation, which will then be sent to my secondary (backup) Zabbix installation to keep ...
0
votes
0answers
13 views
Manipulate original DOM in React.js
As an introduction, I would like to have my inputs validated with the built-in validation HTML5 attributes, e.g. use pattern for text input. So this is my sample code that implements that.
Is it ...
0
votes
0answers
10 views
Nested values copies from one object to another
Here is a nodejs code that copies values from one object (submitted from a firm) to a model object.
Model:
...