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

Commit

Permalink
Merge pull request #200 from Idrinth/idrinth
Browse files Browse the repository at this point in the history
Idrinth
  • Loading branch information
Idrinth authored Oct 11, 2016
2 parents 7a54cd2 + 5e16bf7 commit 3535724
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 156 deletions.
2 changes: 0 additions & 2 deletions languages/en.json

This file was deleted.

101 changes: 101 additions & 0 deletions src/languages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"chat": {
"actions": {
"banUser": "Ban User",
"makeMod": "Make Moderator",
"makeAdmin": "Make Admin",
"makeUser": "Make User",
"close": "Close",
"invite": "Invite to Chat ",
"createChat": "Create Chat",
"joinChat": "Join Chat",
"createAddChat": "Click to create additional chat",
"copyIdPasswort": "Copy Password&Id",
"deleteRoom": "Delete Room",
"leaveRoom": "Leave Room"
},
"texts": {
"settings": "More settings at ",
"account": "Account",
"title": "Chat",
"creditEmoticon": "Emoticons provided by ",
"optional": "This part of the script is optional, so logging in is unneeded for raid catching etc.",
"invalid": "This should not be the data for logging in on the related gaming site and the login does not need to match your ingame name - you can set a display name after the registration.",
"offline": "Not logged in, click to login/register"
},
"error": {
"modify": "Can't modify that user at the moment",
"create": "Can't create at the moment",
"join": "Joining didn't work",
"login": "Login failed in an unexpected way",
"unknown": "The given username for dotd.idrinth.de is unknown, do you want to register it there?"
},
"notification": {
"mention": "chat-mention notifications?",
"raid": "chat-raid notifications?",
"message": "chat-message notifications?"
}
},
"default": "Unexpected error occurred. Please contact script developers (https://github.com/Idrinth/IDotD).",
"land": {
"lack": "You lack gold to buy any more buildings at the moment.",
"hour": " gold per hour each",
"calc": "Calculate",
"avaible": "Avaible Gold"
},
"tier": {
"search": "Enter Boss' Name",
"diff": {
"normal": "Normal",
"hard": "Hard",
"legend": "Legend",
"night": "Nightmare"
},
"tag": "Tag to screen-top",
"maxBoxes": "There is no space for another tier-box at the moment, please close one first."
},
"raids": {
"lastJoined": "Last raids joined",
"clear": "Clear Raids",
"disableJoining": "Disable joining for ",
"clickCopy": "click to copy raid link",
"imports": {
"manually": "Import all manually",
"favs": "Import favs manually",
"restart": "Restart Raidjoin"
},
"disableSpecific": "Disable Autojoining for specific raids"
},
"button": {
"ok": "Ok",
"cancel": "Cancel",
"reloadGame": "Reload game",
"reloadScript": "Reload Script",
"refreshFBGameLogin": "Refresh Facebook Game Login",
"ngRaidJoin": "NG Raid Join(slow!)",
"disableTimedAutoJoin": "disable timed Autojoin",
"enableTimedAutoJoin": "enable timed Autojoin"
},
"setting": {
"enableExtCharInfo": "Enable extended Characterinformation?",
"minimLayout": "Minimalist Layout",
"moveSettingLeft": "Move settings left",
"warBottomPage": "Show war at the bottom of the page",
"useGoldEfficiently": "Check to try and use up the gold as efficient as possible - uncheck to only use the most efficient buy in the land buy calculator",
"tenBuildOnce": "Buy 10 Buildings at once?(Rec)",
"extCharInfoDuration": "Milliseconds until the extended Characterinformation disappears",
"joiningDuration": "Seconds needed to load the game for joining",
"enableChat": "Enable chat(needs script reload)",
"enableFavRequest": "Enable Auto-Raid-Request for Favorites?",
"favIdToJoin": "FavoriteIds to join (separate multiple by comma)",
"worldserver": "Worldserver?"
},
"ui": {
"settingInfo": "This script will always import the raids you manually set to be imported on the website and if it's enabled it will also import all raids matched by one of the faved searches provided.",
"maxPopupsFrame": "Maximum Popups/Frames for joining raids",
"timeAutoJoin": "Time to automatically join raids slowly(reloads game multiple times). Format is [Hours]:[Minutes] without leading zeros, so 7:1 is fine, 07:01 is not",
"getFavFrom": "Get your search-favorites from ",
"raidsearch": "Idrinth's Raidsearch",
"reloadGameFail": "The game couldn't be reloaded"
}
}
26 changes: 13 additions & 13 deletions src/mods/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ idrinth.chat = {
children: [
{
type: 'h1',
content: idrinth.text.get ( "chat.ui.chat" )
content: idrinth.text.get ( "chat.texts.title" )
},
{
type: 'p',
Expand All @@ -596,7 +596,7 @@ idrinth.chat = {
children: [
{
type: 'h2',
content: idrinth.text.get ( "chat.ui.account" )
content: idrinth.text.get ( "chat.texts.account" )
},
{
type: 'p',
Expand All @@ -617,15 +617,15 @@ idrinth.chat = {
children: [
{
type: 'h2',
content: idrinth.text.get ( "chat.ui.joinChat" )
content: idrinth.text.get ( "chat.actions.joinChat" )
},
{
type: 'ul',
css: 'settings',
children: [
makeInput ( 'Chat-ID' ),
makeInput ( 'Chat-Password' ),
makeButton ( 'chat.ui.createAddChat', "idrinth.chat.add()" )
makeButton ( 'chat.actions.createAddChat', "idrinth.chat.add()" )
]
}
]
Expand All @@ -635,14 +635,14 @@ idrinth.chat = {
children: [
{
type: 'h2',
content: idrinth.text.get ( "chat.ui.createChat" )
content: idrinth.text.get ( "chat.actions.createChat" )
},
{
type: 'ul',
css: 'settings',
children: [
makeInput ( "Name" ),
makeButton ( 'chat.ui.createAddChat', "idrinth.chat.create()" )
makeButton ( 'chat.actions.createAddChat', "idrinth.chat.create()" )
]
}
]
Expand All @@ -651,7 +651,7 @@ idrinth.chat = {
children: [
{
type: '#text',
content: idrinth.text.get ( "chat.ui.moreSettings" )
content: idrinth.text.get ( "chat.text.settings" )
},
{
type: 'a',
Expand All @@ -677,7 +677,7 @@ idrinth.chat = {
children: [
{
type: '#text',
content: idrinth.text.get ( "chat.ui.creditEmoticon" )
content: idrinth.text.get ( "chat.creditEmoticon" )
},
{
type: 'a',
Expand Down Expand Up @@ -839,7 +839,7 @@ idrinth.chat = {
return;
}
if ( !data.success && data.message && data['allow-reg'] ) {
idrinth.core.confirm ( idrinth.text.get ( "chat.message.unknown" ), 'idrinth.chat.register();' );
idrinth.core.confirm ( idrinth.text.get ( "chat.error.unknown" ), 'idrinth.chat.register();' );
return;
}
if ( !data.success && data.message ) {
Expand Down Expand Up @@ -872,29 +872,29 @@ idrinth.chat = {
css: 'idrinth-hovering-box',
children: [ {
css: 'clipboard-copy',
content: idrinth.text.get ( "chat.ui.copyIdPasswort" ),
content: idrinth.text.get ( "chat.actions.copyIdPasswort" ),
type: 'li',
attributes: [ {
name: 'data-clipboard-text',
value: element.getAttribute ( 'title' )
} ]
}, {
content: idrinth.text.get ( "chat.ui.leaveRoom" ),
content: idrinth.text.get ( "chat.actions.leaveRoom" ),
type: 'li',
attributes: [ {
name: 'onclick',
value: 'idrinth.chat.useroptions(' + element.getAttribute ( 'data-id' ) + ',' + idrinth.chat.self + ',\'Leave\');this.parentNode.parentNode.removeChild(this.parentNode);'
} ]
}, {
content: idrinth.text.get ( "chat.ui.deleteRoom" ),
content: idrinth.text.get ( "chat.actions.deleteRoom" ),
type: 'li',
attributes: [ {
name: 'onclick',
value: 'idrinth.core.ajax.runHome(\'chat-service/delete/' + element.getAttribute ( 'data-id' ) + '/\',idrinth.core.alert,idrinth.core.alert,idrinth.core.alert);this.parentNode.parentNode.removeChild(this.parentNode);'
} ]
}, {
type: 'li',
content: idrinth.text.get ( "chat.ui.close" ),
content: idrinth.text.get ( "chat.actions.close" ),
attributes: [ {
name: 'onclick',
value: 'this.parentNode.parentNode.removeChild(this.parentNode);'
Expand Down
2 changes: 1 addition & 1 deletion src/mods/land.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ idrinth.land = {
}
var results = baseCalculator ( getRequirements () );
if ( Object.keys ( results ).length === 0 ) {
idrinth.core.alert ( idrinth.text.get ( "land.lackGold" ) );
idrinth.core.alert ( idrinth.text.get ( "land.lack" ) );
}
putResults ( results );
},
Expand Down
1 change: 1 addition & 0 deletions src/mods/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ idrinth.settings = {
alarmTime: '8:0',
alarmActive: false,
bannedRaids: { },
language: 'en',
notification: {
mention: true,
message: true,
Expand Down
121 changes: 15 additions & 106 deletions src/mods/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ idrinth.text = {
/**
* Loads language specific code and signals it's readyness by setting
* idrinth.text.initialized to true
* @method start
* @returns {undefined}
*/
start: function () {
start: function ( ) {
var language = idrinth.settings.language || window.navigator.userLanguage || window.navigator.language;
if ( language === 'en' ) {
idrinth.text.initialized = true;
return;
}
idrinth.core.ajax.runHome ( '', function ( file ) {
idrinth.core.ajax.runHome ( 'lang-service/###RELOAD-VERSION###/', function ( file ) {
/**
*
* @param {object} to
Expand All @@ -38,117 +37,27 @@ idrinth.text = {
applyRecursive ( idrinth.text.data, JSON.parse ( file ), applyRecursive );
}, idrinth.text.start, idrinth.text.start, null, true );
},
data: {
chat: {
actions:{
banUser: 'Ban User',
makeMod: 'Make Moderator',
makeAdmin: 'Make Admin',
makeUser: 'Make User'
},
ui: {
close: 'Close',
invite: 'Invite to Chat ',
account: 'Account',
chat: 'Chat',
createChat: 'Create Chat',
joinChat: 'Join Chat',
createAddChat: "Click to create additional chat",
creditEmoticon: 'Emoticons provided by ',
copyIdPasswort: 'Copy Password&Id',
moreSettings: 'More settings at ',
deleteRoom: 'Delete Room',
leaveRoom: 'Leave Room'
},
message: {
optional: 'This part of the script is optional, so logging in is unneeded for raid catching etc.',
invalid: 'This should not be the data for logging in on the related gaming site and the login does not need to match your ingame name - you can set a display name after the registration.',
offline: "Not logged in, click to login/register",
unknown: 'The given username for dotd.idrinth.de is unknown, do you want to register it there?'
},
error: {
modify: 'Can\'t modify that user at the moment',
create: 'Can\'t create at the moment',
join: 'Joining didn\'t work',
login: 'Login failed in an unexpected way'
},
notification: {
mentionNotis: 'chat-mention notifications?',
raidNotis: 'chat-raid notifications?',
messageNotis: 'chat-message notifications?'
}
},
default: 'Unexpected error occurred. Please contact script developers'
+ ' (https://github.com/Idrinth/IDotD).',
land: {
lackGold: 'You lack gold to buy any more buildings at the moment.'
},
tier: {
diff: {
normal: 'Normal',
hard: 'Hard',
legend: 'Legend',
night: 'Nightmare'
},
tagTop: 'Tag to screen-top',
maxBoxes: 'There is no space for another tier-box at the moment, please close one first.',
disableJoining: 'Disable joining for '
},
ui: {
button: {
ok: 'Ok',
cancel: 'Cancel',
reloadGame: 'Reload game',
clearRaids: 'Clear Raids',
reloadScript: 'Reload Script',
refreshFBGameLogin: 'Refresh Facebook Game Login',
ngRaidJoin: 'NG Raid Join(slow!)',
calc: 'Calculate',
disableTimedAutoJoin: 'disable timed Autojoin',
enableTimedAutoJoin: 'enable timed Autojoin'
},
imports:{
manually:'Import all manually',
favs:'Import favs manually',
restart:'Restart Raidjoin'
},
lastRaidsJoined: 'Last raids joined:',
enterBossName: 'Enter Boss\' Name',
settingInfo: 'This script will always import the raids you manually set to be imported on the website and if it\'s enabled it will also import all raids matched by one of the faved searches provided.',
maxPopupsFrame: 'Maximum Popups/Frames for joining raids',
timeAutoJoin: 'Time to automatically join raids slowly(reloads game multiple times). Format is [Hours]:[Minutes] without leading zeros, so 7:1 is fine, 07:01 is not',
getFavFrom: 'Get your search-favorites from ',
raidsearch: 'Idrinth\'s Raidsearch',
goldHour: ' gold per hour each',
availGold: 'Avaible Gold',
clickCopy: 'click to copy raid link',
reloadGameFail: 'The game couldn\'t be reloaded',
setting: {
enableExtCharInfo: 'Enable extended Characterinformation?',
minimLayout: 'Minimalist Layout',
moveSettingLeft: 'Move settings left',
warBottomPage: 'Show war at the bottom of the page',
useGoldEfficiently: 'Check to try and use up the gold as efficient as possible - uncheck to only use the most efficient buy in the land buy calculator',
tenBuildOnce: 'Buy 10 Buildings at once?(Rec)',
extCharInfoDuration: 'Milliseconds until the extended Characterinformation disappears',
joiningDuration: 'Seconds needed to load the game for joining',
enableChat: 'Enable chat(needs script reload)',
enableFavRequest: 'Enable Auto-Raid-Request for Favorites?',
favIdToJoin: 'FavoriteIds to join (separate multiple by comma)',
worldserver: 'Worldserver?',
disableAutoJoinSpecific: 'Disable Autojoining for specific raids'
}
}
},
/**
* See languages/en.json for an example
* @type {object}
*/
data: JSON.parse ( '###LANG###' ),
/**
* returns the translation of a provided key or an error-message if no
* matching translation is found
* @param string key
* @returns {string}
*/
get: function ( key ) {
/**
*
* @param {object} obj
* @param {Array} keys
* @param {function} func
* @returns {string}
*/
var getSub = function ( obj, keys, func ) {
var key = keys.shift ();
var key = keys.shift ( );
if ( obj.hasOwnProperty ( key ) ) {
if ( keys.length > 0 ) {
return func ( obj[key], keys, func );
Expand Down
Loading

0 comments on commit 3535724

Please sign in to comment.