Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/
dist/
.sass-cache/
.grunt/
tests_output/
64 changes: 64 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"es5": true, // ECMAScript 5
"browser": true, // Standard browser globals e.g. `window`, `document`.
"sub": true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"bitwise": true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"immed": false, // true: Require immediate invocations to be wrapped in parens e.g.
"latedef": false, // true: Require variables/functions to be defined before being used
"newcap": false, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg": true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
"plusplus": false, // true: Prohibit use of `++` & `--`
"quotmark": false, // Quotation mark consistency
"camelcase": false, // true: Identifiers must be in camelCase
"forin": true, // true: Require filtering for..in loops with obj.hasOwnProperty()
"indent": 4, // {int} Number of spaces to use for indentation
"noempty": true, // true: Prohibit use of empty blocks
"nonew": false, // true: Prohibit use of constructors for side-effects (without assignment)
"maxparams": false, // {int} Max number of formal params allowed per function
"maxdepth": false, // {int} Max depth of nested blocks (within functions)
"maxstatements": false, // {int} Max number statements per function
"maxcomplexity": false, // {int} Max cyclomatic complexity per function
"maxlen": false, // {int} Max number of characters per line

// Relaxing
"asi": false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
"boss": false, // true: Tolerate assignments where comparisons would be expected
"debug": false, // true: Allow debugger statements e.g. browser breakpoints.
"eqnull": false, // true: Tolerate use of `== null`
"es5": false, // true: Allow ES5 syntax (ex: getters and setters)
"esnext": false, // true: Allow ES.next (ES6) syntax (ex: `const`)
"moz": false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
// (ex: `for each`, multiple try/catch, function expression…)
"evil": false, // true: Tolerate use of `eval` and `new Function()`
"expr": false, // true: Tolerate `ExpressionStatement` as Programs
"funcscope": false, // true: Tolerate defining variables inside control statements"
"globalstrict": false, // true: Allow global "use strict" (also enables 'strict')
"iterator": false, // true: Tolerate using the `__iterator__` property
"lastsemic": false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
"laxbreak": false, // true: Tolerate possibly unsafe line breakings
"laxcomma": false, // true: Tolerate comma-first style coding
"loopfunc": false, // true: Tolerate functions being defined in loops
"multistr": false, // true: Tolerate multi-line strings
"proto": false, // true: Tolerate using the `__proto__` property
"scripturl": false, // true: Tolerate script-targeted URLs
"shadow": false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
"sub": true, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
"supernew": false, // true: Tolerate `new function () { ... };` and `new Object;`

"validthis": false, // true: Tolerate using this in a non-constructor function


"globals": {
"jQuery": true,
"$": true,
"moment": true,
"pjax_config_page": true // TODO: this should not be a global
}

// TODO: Options to enable later:
// "curly": true, // true: Require {} for every new block or scope
// "eqeqeq": true, // true: Require triple equals (===) for comparison
// "undef": true, // true: Require all non-global variables to be declared (prevents global leaks)
// "strict": true, // true: Requires all functions run in ES5 Strict Mode
// "unused": true, // true: Require all defined variables be used
}
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- 0.10
notifications:
email: false
before_install: npm install -g grunt-cli
install: npm install
59 changes: 37 additions & 22 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function(grunt) {
module.exports = function (grunt) {
// Configurations
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
Expand Down Expand Up @@ -168,29 +168,23 @@ module.exports = function(grunt) {
},
jshint: {
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
globals: {
jQuery: true,
$: true,
},
ignores: [
'src/javascript/external/**/*.js',
'src/javascript/t/**/*.js',
'src/javascript/livechart/export-csv.js',
'src/javascript/livechart/highstock-exporting.js',
'src/javascript/livechart/highstock.js',
'src/javascript/base/pjax-lib.js',
'src/javascript/gtm.js'
],
jshintrc: true,
ignores: [
'src/javascript/external/**/*.js',
'src/javascript/t/**/*.js',
'src/javascript/livechart/export-csv.js',
'src/javascript/livechart/highstock-exporting.js',
'src/javascript/livechart/highstock.js',
'src/javascript/base/pjax-lib.js',
'src/javascript/base/jquery_color_animation.js',
'src/javascript/gtm.js'
],
},
all: [
'Gruntfile.js',
'src/javascript/**/*.js',
],
},
'Gruntfile.js',
'src/javascript/**/*.js'
]
},
bump: {
options: {
files: ['package.json'],
Expand All @@ -202,6 +196,24 @@ module.exports = function(grunt) {
push: false,
},
},
nightwatch: {
options: {
settings: {
"src_folders": ["src/javascript/t/nightwatch/tests/"]
},
"selenium": {
"start_process": false,
"host": "hub.browserstack.com",
"port": 80
}
}
},
shell: {
nightwatch: {
command: 'nightwatch -e chrome,firefox,ie',
cwd: './src/javascript/t/'
}
}
});

// load the plugin that will complete the task
Expand All @@ -216,7 +228,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('grunt-nightwatch');
grunt.loadNpmTasks('grunt-shell');

// Task to be performed
grunt.registerTask('test', ['jshint']);
grunt.registerTask('default', ['clean', 'compass', 'cssmin', 'concat', 'uglify', 'copy', 'gh-pages', 'watch']);
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Binary-Static
Binary-Static [![Build Status](https://travis-ci.org/borisyankov/binary-static.svg?branch=master)](https://travis-ci.org/borisyankov/binary-static)
=============

This repository contains the static Javascript and CSS content of the [Binary.com](http://www.binary.com) website.
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.2.0",
"description": "Binary.com static contents",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "grunt test"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -31,6 +31,8 @@
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.5.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-gh-pages": "^0.9.1"
"grunt-gh-pages": "^0.9.1",
"grunt-nightwatch": "^0.2.2",
"grunt-shell": "^0.7.0"
}
}
11 changes: 1 addition & 10 deletions src/javascript/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ onUnload.queue(function () {

var bo_url;

Array.prototype.exists = function (x) {
for (var i = 0; i < this.length; i++) {
if (this[i] == x) {
return true;
}
}
return false;
};

//////////////////////////////////////////////////////////////
//Purpose: To solve cross domain logged out server problem.
//Return: Hostname for this page
Expand Down Expand Up @@ -142,7 +133,7 @@ function add_click_effect_to_button() {
.delegate('.button', 'mouseout', function () {
var class_name = prefix(this.className) + '-hover';
remove_button_class($(this), class_name);
})
});
}

var make_mobile_menu = function () {
Expand Down
16 changes: 9 additions & 7 deletions src/javascript/base/inpage_popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ InPagePopup.prototype.find_element_popup_content = function(element) {
}
}
return null;
}
};

InPagePopup.prototype._ajax_request = function(callback, errback) {
conf = {};
Expand All @@ -83,7 +83,7 @@ InPagePopup.prototype._ajax_request = function(callback, errback) {
if (errback) conf.error = errback;
$.ajax(conf);
return this;
}
};

/**
* fetch contents of the inpage popup via AJAX.
Expand All @@ -101,7 +101,7 @@ InPagePopup.prototype.fetch_remote_content = function(show, before_show, after_s
if (!errback) {
errback = function(jqxhr, txt_status, err) {
throw new Error("Failed to fetch contents of the popup: " + err);
}
};
}
var run_callbacks = function (data, txt_status, jqxhr) {
if (before_show) {
Expand All @@ -114,13 +114,13 @@ InPagePopup.prototype.fetch_remote_content = function(show, before_show, after_s
};
this._ajax_request(run_callbacks, errback);
return this;
}
};

/**
* Initialize the container, set the contents and return it.
*/
InPagePopup.prototype._init_container = function() {
this.close()
this.close();
var me = this;
var container = $('<div class="inpage_popup_container"><a class="close">x</a></div>');
var content = this.element ? this.find_element_popup_content(this.element) : null;
Expand All @@ -134,7 +134,9 @@ InPagePopup.prototype._init_container = function() {
this._container = container;
container.find('.close').on('click', function() { me.close(); });
if (this.close_on_escape) {
$(document).on('keydown', function (e) { e.which == 27 && me.close(); });
$(document).on('keydown', function(e) {
if (e.which == 27) me.close();
});
}
if (this.draggable) {
handle = this.drag_handle;
Expand Down Expand Up @@ -175,7 +177,7 @@ InPagePopup.prototype.container = function() {
};

InPagePopup.prototype.show = function() {
this.container().show()
this.container().show();
return this;
};

Expand Down
6 changes: 5 additions & 1 deletion src/javascript/base/markets.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ var SubMarket = function(name, display_name, underlyings) {
var underlying_count = underlyings.length;
while(underlying_count--) {
var underlying = underlyings[underlying_count];
var underlying_object = { name: underlying['label'], symbol: underlying['value'], translated_display_name: function() { return text.localize(this.name); } };
var underlying_object = {
name: underlying['label'],
symbol: underlying['value'],
translated_display_name: function () { return text.localize(this.name); }
};
this.underlyings.push(underlying_object);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/base/menu_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var MenuContent = (function () {

if (!sub_menu_selected.length)
{
var sub_menu_selected = menu_li.find('.tm-a-2:first').addClass('a-active');
sub_menu_selected = menu_li.find('.tm-a-2:first').addClass('a-active');

if (sub_menu_selected.length)
{
Expand Down
Loading