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

Commit

Permalink
Merge pull request #237 from IDotD/Ardenian-patch-1
Browse files Browse the repository at this point in the history
Ardenian patch 1
  • Loading branch information
Idrinth authored Jan 6, 2017
2 parents 3a78f6c + f9535af commit 5efae7c
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 34 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# IDotD
A script for dawn of the dragons, that works based on data provided to https://dotd.idrinth.de via UgUp
A script for dawn of the dragons, that works based on data provided to https://dotd.idrinth.de via UgUp.

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/e80204911a734a56a471ab9b9ac649db)](https://www.codacy.com/app/eldrim/IDotD?utm_source=github.com&utm_medium=referral&utm_content=Idrinth/IDotD&utm_campaign=Badge_Grade)
[![Code Climate](https://codeclimate.com/github/Idrinth/IDotD/badges/gpa.svg)](https://codeclimate.com/github/Idrinth/IDotD)
Expand All @@ -22,4 +22,4 @@ We prefer the usage of the [tracker](https://github.com/IDotD/Userscript/issues)

## How To Help

We can use helpers for the following: update and improve the wiki, help coding the userscript and testing any of the branches. For any of the later two have a look at the related documentation in the wiki.
We can use helpers for the following: update and improve the wiki, help coding the userscript and testing any of the branches. For any of the later two have a look at the related documentation in the [wiki](https://idotd.github.io/).
3 changes: 2 additions & 1 deletion src/mods/raids.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ idrinth.raids = {
for (var key in list) {
if ( list[key].delete ) {
delHandler ( key );
} else {//worst case: overwriting itself
} else {
//worst case: overwriting itself
idrinth.raids.list[key] = list[key];
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/mods/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ idrinth.settings = {
alarmTime: '8:0',
alarmActive: false,
bannedRaids: { },
language: 'en',
lang : null,
notification: {
mention: true,
message: true,
Expand Down Expand Up @@ -167,4 +167,4 @@ idrinth.settings = {
}
}
}
};
};
12 changes: 7 additions & 5 deletions src/mods/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ idrinth.text = {
* @returns {undefined}
*/
start: function ( ) {
var language = idrinth.settings.get ( "language" ) || window.navigator.userLanguage || window.navigator.language;
if ( language === 'en' ) {
var language = idrinth.settings.get( "lang" ) || window.navigator.userLanguage || window.navigator.language || "en";
idrinth.settings.change( "lang", language );
if ( language === "en" ) {
idrinth.text.initialized = true;
return;
}
idrinth.core.ajax.runHome ( 'lang-service/###RELOAD-VERSION###/', function ( file ) {
idrinth.core.ajax.runHome ( 'userscript-translation/'+language+'/###RELOAD-VERSION###/', function ( file ) {
/**
*
* @param {object} to
Expand All @@ -27,14 +28,15 @@ idrinth.text = {
for (var prop in from) {
if ( from.hasOwnProperty ( prop ) ) {
if ( typeof to[prop] === 'string' && typeof from[prop] === 'string' ) {
to[prop] = file[prop];
to[prop] = from[prop];
} else if ( typeof to[prop] === 'object' && typeof from[prop] === 'object' ) {
func ( to[prop], from[prop], func );
}
}
}
};
applyRecursive ( idrinth.text.data, JSON.parse ( file ), applyRecursive );
idrinth.text.initialized = true;
}, idrinth.text.start, idrinth.text.start, null, true );
},
/**
Expand Down Expand Up @@ -68,4 +70,4 @@ idrinth.text = {
};
return getSub ( idrinth.text.data, key.split ( '.' ), getSub );
}
};
};
5 changes: 5 additions & 0 deletions src/mods/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@ idrinth.ui = {
type: 'checkbox',
platforms: [ 'kongregate' ],
label: "setting.enableExtCharInfo"
},{
name: 'lang',
rType: '#input',
type: 'text',
label: "setting.lang"
}, {
name: 'minimalist',
rType: '#input',
Expand Down
12 changes: 8 additions & 4 deletions src/root.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
width:$size;
height:$size;
}
@mixin z-offset($offset) {
//make sure we are always above the default pages
z-index:10000000+$offset;
}
@import "styles/mutik.scss";
/**
* These styles modify pages changed by the script of IDotD
Expand All @@ -11,7 +15,7 @@
background: rgba(204, 204, 204, 0.9);
border-radius: 2px;
width: 200px;
z-index: 100000;
@include z-offset(0);
display: block;
box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.65);
}
Expand Down Expand Up @@ -438,7 +442,7 @@
}

#idrinth-chat {
z-index: 99999;
@include z-offset(1);
}

.idrinth-userinfo-box {
Expand All @@ -451,7 +455,7 @@
box-shadow: 3px 3px 5px rgba(255, 255, 255, 0.9);
margin: 0;
max-width: 150px;
z-index: 120000;
@include z-offset(2);
}

.idrinth-userinfo-box > li {
Expand Down Expand Up @@ -663,4 +667,4 @@ td.is-os {
height:35px;
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
}
}
45 changes: 25 additions & 20 deletions src/stable.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,6 @@ var idrinth = {
},
platform: '',
startInternal: function ( ) {
var startModules = function () {
idrinth.settings.start ( );
idrinth.ui.start ( );
idrinth.user.start ( );
idrinth.names.start ( );
idrinth.raids.start ( );
idrinth.tier.start ();
idrinth.chat.start ();
idrinth.war.start ();
};
if ( idrinth.platform === 'newgrounds' ) {
try {
var frame = document.getElementById ( 'iframe_embed' ).getElementsByTagName ( 'iframe' )[0];
Expand All @@ -136,16 +126,31 @@ var idrinth = {
}
window.setTimeout ( idrinth.newgrounds.alarmCheck, 3333 );
}
startModules ();
window.setTimeout ( function () {
idrinth.core.multibind.add ( 'click', '.clipboard-copy', function ( element, event ) {
idrinth.core.copyToClipboard.element ( element );
element.parentNode.parentNode.removeChild ( element.parentNode );
idrinth.core.log ( event + ' fired on ' + element );
} );
}, 1000 );
delete idrinth['start'];
delete idrinth['startInternal'];
idrinth.settings.start ( );
idrinth.text.start ( );
idrinth._tmp=window.setInterval(function() {
if(!idrinth.text.initialized) {
return;
}
idrinth.ui.start ( );
idrinth.user.start ( );
idrinth.names.start ( );
idrinth.raids.start ( );
idrinth.tier.start ( );
idrinth.chat.start ( );
idrinth.war.start ( );
window.clearInterval(idrinth._tmp);
delete idrinth['_tmp'];
window.setTimeout ( function () {
idrinth.core.multibind.add ( 'click', '.clipboard-copy', function ( element, event ) {
idrinth.core.copyToClipboard.element ( element );
element.parentNode.parentNode.removeChild ( element.parentNode );
idrinth.core.log ( event + ' fired on ' + element );
} );
}, 1000 );
delete idrinth['start'];
delete idrinth['startInternal'];
},123);
},
start: function ( ) {
'use strict';
Expand Down

0 comments on commit 5efae7c

Please sign in to comment.