Skip to content

Commit

Permalink
v0.1.2: Wraps IFRAME access in a try/catch to avoid cross-origin exce…
Browse files Browse the repository at this point in the history
…ptions

Adds mocha_phantomjs tests
Linted with ESLint
Split test/test.html into test-blocker.html and test-no-blocker.html
Building .js.map file via UglifyJS
  • Loading branch information
nicjansma committed Mar 13, 2015
1 parent e231625 commit d6c28f6
Show file tree
Hide file tree
Showing 23 changed files with 372 additions and 2,489 deletions.
4 changes: 4 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"directory": "test/vendor",
"color" : false
}
45 changes: 45 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"rules": {
// enabled over default
"valid-jsdoc": [1, {
"requireReturn": false,
"prefer": {
"return": "returns"
}
}],
"guard-for-in": 2,
"no-div-regex": 2,
"no-else-return": 2,
"no-eq-null": 2,
"no-floating-decimal": 2,
"no-self-compare": 2,
"no-void": 2,
"radix": 2,
"wrap-iife": 2,
"no-mixed-requires": 2,
"no-new-require": 2,
"no-path-concat": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": false }],
"comma-style": [2, "last"],
"consistent-this": [2, "that"],
"no-inline-comments": 2,
"no-lonely-if": 2,
"no-multiple-empty-lines": [1, {"max": 1}],
"no-nested-ternary": 2,
"space-after-function-name": [2, "never"],
"space-after-keywords": 1,
"space-before-blocks": 1,
"space-in-brackets": 1,
"space-in-parens": 1,
"space-unary-ops": 1,
"spaced-line-comment": 1,
"max-len": [1, 120, 4],

//
// Disabled
//

// disabled for use of _jQuery
"no-underscore-dangle": 0
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.project
.settings/
npm-debug.log
/eslint.xml
/test/*.tap
/test/vendor
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
language: node_js
node_js:
- "0.12"
- "0.11"
- "0.10"
before_install: npm install -g grunt-cli
before_install:
- npm install -g grunt-cli bower
- bower install
108 changes: 71 additions & 37 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,63 @@
/*eslint-env node*/
/*eslint-disable camelcase*/
module.exports = function(grunt) {
"use strict";

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pkg: grunt.file.readJSON("package.json"),
clean: {
options: {},
build: ["test/*.tap", "test/coverage"]
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> v<%= pkg.version %> */\n'
banner: "/*! <%= pkg.name %> v<%= pkg.version %> */\n",
mangle: true,
sourceMap: true
},
build: {
src: 'src/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.min.js'
src: "src/<%= pkg.name %>.js",
dest: "dist/<%= pkg.name %>.min.js"
}
},
jshint: {
files: [ 'src/**/*.js', 'test/**/*.js' ],
options: {
bitwise: true,
camelcase: true,
curly: true,
eqeqeq: true,
forin: true,
immed: true,
indent: 4,
latedef: true,
newcap: true,
noempty: true,
nonew: true,
quotmark: true,
jquery: true,
undef: true,
unused: true,
strict: true,
trailing: true,
browser: true,
node: true,
white: false,
globals: {
define: true,
window: true
eslint: {
console: {
src: [
"*.js",
"src/**/*.js",
"test/*.js"
]
},
build: {
options: {
"output-file": "eslint.xml",
"format": "jslint-xml",
"silent": true
},
src: [
"Gruntfile.js",
"src/**/*.js",
"test/*.js"
]
}
},
mocha_phantomjs: {
all: {
options: {
urls: [
"http://localhost:4002/test/test-no-blocker.html"
],
reporter: "tap",
output: "test/mocha.tap"
}
}
},
connect: {
server: {
options: {
port: 4002,
base: "."
}
}
}
Expand All @@ -45,14 +66,27 @@ module.exports = function(grunt) {
//
// Plugins
//
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-mocha-phantomjs");
grunt.loadNpmTasks("gruntify-eslint");

//
// Tasks
//
grunt.registerTask('default', ['jshint', 'uglify']);
grunt.registerTask('lint', ['uglify']);
grunt.registerTask('travis', ['jshint']);
grunt.registerTask('all', ['jshint', 'uglify']);
};
grunt.registerTask("test", ["test:mocha"]);
grunt.registerTask("test:mocha", ["connect", "mocha_phantomjs"]);

grunt.registerTask("lint", ["eslint:console"]);
grunt.registerTask("lint:build", ["eslint:build"]);

grunt.registerTask("build", ["uglify"]);

//
// Task Groups
//
grunt.registerTask("default", ["lint", "build"]);
grunt.registerTask("travis", ["test", "lint"]);
grunt.registerTask("all", ["clean", "test", "lint:build", "build"]);
};
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Nic Jansma, http://nicj.net
Copyright (c) 2015 Nic Jansma, http://nicj.net

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# adblock-detector.js

v0.1.1
v0.1.2

Copyright 2014 Nic Jansma
Copyright 2015 Nic Jansma

[http://nicj.net](http://nicj.net)

Expand Down Expand Up @@ -207,4 +207,5 @@ The tests are run manually. You should load the `test.html` in your browser of
## Version History
* v0.0.1 - 2014-03-22: Initial version
* v0.1.1 - 2014-04-08: Detects Remove It Permanently (Firefox addon)
* v0.1.1 - 2014-04-08: Detects Remove It Permanently (Firefox addon)
* v0.1.2 - 2015-03-12: Wraps IFRAME access in a try/catch to avoid cross-origin exceptions
10 changes: 7 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adblock-detector",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/nicjansma/adblock-detector.js",
"authors": [
"Nic Jansma <nic@nicj.net>"
Expand All @@ -13,14 +13,18 @@
"adblocker"
],
"dependencies": {
"jquery": ">= 1.9.0"
"jquery": "~2.1.3"
},
"devDependencies": {
"expect": "~0.3.1",
"mocha": "~2.1.0",
"jquery.cookie": "~1.4.1"
},
"license": "MIT",
"ignore": [
"**/.*",
"Gruntfile.js",
"deps",
"dist",
"node_modules",
"bower_components",
"test"
Expand Down
4 changes: 0 additions & 4 deletions deps/jquery-1.11.0.min.js

This file was deleted.

40 changes: 0 additions & 40 deletions deps/jquery.cookie.js

This file was deleted.

70 changes: 0 additions & 70 deletions deps/nodeunit.css

This file was deleted.

Loading

0 comments on commit d6c28f6

Please sign in to comment.