Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #331 from IDotD/simplify
Browse files Browse the repository at this point in the history
Simplify+Tests
  • Loading branch information
Idrinth authored Sep 12, 2018
2 parents abc79d5 + e569b1d commit 4eae24a
Show file tree
Hide file tree
Showing 28 changed files with 1,138 additions and 931 deletions.
22 changes: 17 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
language: node_js
node_js:
- "7"
cache:
directories:
- "node_modules"
node_js: "node"
git:
depth: 3
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libstdc++-4.9-dev
before_script:
- npm install
- npm install codeclimate-test-reporter codacy-coverage istanbul -g
script:
- istanbul cover "./node_modules/mocha/bin/_mocha" --report lcovonly --print detail -- --recursive --reporter spec
after_success:
- codeclimate-test-reporter < ./coverage/lcov.info
- codacy-coverage < ./coverage/lcov.info
74 changes: 0 additions & 74 deletions karma.conf.js

This file was deleted.

29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,35 @@
"description": "A script for dawn of the dragons, that works based on data provided to https://dotd.idrinth.de via UgUp",
"main": "src/stable.js",
"directories": {
"test": "test"
"lib": "./src",
"test": "./test"
},
"scripts": {
"test": "./node_modules/karma/bin/karma start karma.conf.js",
"test-watch": "./node_modules/karma/bin/karma start karma.conf.js --auto-watch"
"test": "./node_modules/mocha/bin/mocha -R test/**/*.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Idrinth/IDotD.git"
"url": "git+https://github.com/IDotD/Userscript.git"
},
"keywords": [
"dotd",
"idrinth",
"script",
"userscript",
"dotd"
"dawn of the dragons"
],
"author": "Björn Büttner",
"author": {
"name": "Björn Büttner",
"url": "https://github.com/Idrinth"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/Idrinth/IDotD/issues"
"url": "https://github.com/IDotD/Userscript/issues"
},
"homepage": "https://github.com/Idrinth/IDotD#idotd",
"homepage": "https://idotd.github.io",
"devDependencies": {
"jasmine": "^2.5.3",
"jasmine-core": "^2.5.2",
"karma": "^1.3.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-spec-reporter": "0.0.26"
"mocha": "^5",
"chai": "^4.1",
"rewire": "^4"
}
}
26 changes: 13 additions & 13 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
window.location.host === "web1.dawnofthedragons.com" ||
window.location.host === "dotd-web1.5thplanetgames.com"
) {
var f = function() {
console.log("s");
window.idrinth = {};
window.idrinth.add= function(data) {
var s = document.createElement("script");
s.appendChild(document.createTextNode(data));
document.getElementsByTagName("head")[0].appendChild(s);
};
let f = function() {
window.idrinth = {
add: function(data) {
let s = document.createElement("script");
s.appendChild(document.createTextNode(data));
document.getElementsByTagName("head")[0].appendChild(s);
}
};
window.addEventListener(
"message",
function(event) {
try {
var data = JSON.parse(event.data);
let data = JSON.parse(event.data);
if (
!data ||
data.to !== "idotd" ||
Expand All @@ -63,13 +63,13 @@
false
);
};
var sc = document.createElement("script");
let sc = document.createElement("script");
sc.setAttribute("id", "idotd-loader");
sc.appendChild(document.createTextNode('('+f.toString()+'());'));
document.getElementsByTagName("head")[0].appendChild(sc);
return;
}
var sc = document.createElement("script");
let sc = document.createElement("script");
sc.setAttribute(
"src",
"https://dotd.idrinth.de/static/userscript/" + GM_info.script.version + "/"
Expand All @@ -78,9 +78,9 @@
sc.setAttribute("async", "async");
sc.errorCounter = 0;
sc.errorFunction = function() {
var self = document.getElementById("idotd-loader");
let self = document.getElementById("idotd-loader");
self.parentNode.removeChild(self);
var sc = document.createElement("script");
let sc = document.createElement("script");
sc.onerror = self.onerror;
sc.errorCounter = self.errorCounter + 1;
sc.errorFunction = self.errorFunction;
Expand Down
Loading

0 comments on commit 4eae24a

Please sign in to comment.