Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Add ps4 option
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtextrem committed Dec 29, 2015
1 parent 84a1567 commit 6e148a3
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 47 deletions.
28 changes: 20 additions & 8 deletions src/js/background.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
+function (window) {
'use strict';
'use strict'

var chrome = window.chrome,
document = window.document

var VERSION = 0.99
var VERSION = 0.991

var flares = {
0: [128, 0, 255, 255], // Vanu
1: [0, 200, 255, 255], // NC
2: [219, 0, 0, 255], // TR
3: [255, 238, 0, 255] // NS
0: ['Vanu', [128, 0, 255, 0.6]],
1: ['NC', [0, 200, 255, 0.6]],
2: ['TR', [219, 0, 0, 0.6]],
3: ['NS', [255, 238, 0, 0.6]]
}

var serverData = {
Expand All @@ -19,7 +19,15 @@
13: 'Cobalt',
17: 'Emerald',
25: 'Briggs',
19: 'Jaeger'
19: 'Jaeger (Events)',
1000: 'Genudine (PS4US)',
1001: 'Palos (PS4US)',
1002: 'Crux (PS4US)',
1003: 'Searhus (PS4US)',
1004: 'Xelas (PS4US)',
2000: 'Ceres (PS4EU)',
2001: 'Lithcorp (PS4EU)',
2002: 'Rashnu (PS4EU)'
}

var zoneData = {
Expand Down Expand Up @@ -276,7 +284,7 @@
text: h + ':' + m
})
chrome.browserAction.setBadgeBackgroundColor({
color: flares[this.flare]
color: flares[this.flare][1]
})
}
}
Expand Down Expand Up @@ -342,6 +350,10 @@
}.bind(this)
imageObj.src = path
chrome.browserAction.setTitle({ title: this.count + ' Alerts running' })
},

returnOptions: function () {
return [serverData, flares]
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
+function (window) {
'use strict';
'use strict'

var App = function () {
chrome.storage.sync.get({ servers: {}, main: 13, lastUpdate: 0, order: [], flare: 0, hide2: 0, jaeger: 0, serverTimestamp: 0, sortOrder: null, version: 0, error: '' }, function (data) {
chrome.storage.sync.get({ servers: {}, main: 13, lastUpdate: 0, order: [], flare: 0, hide2: 0, jaeger: 0, serverTimestamp: 0, sortOrder: null, version: 0, error: '', ps4: 0 }, function (data) {
if (data.error) {
return $('.error--message').find('small').text(data.error)
}
Expand Down Expand Up @@ -69,6 +69,7 @@
var server = this.servers[key]

if ((this.hide2 && server.id !== this.main) || (!this.jaeger && server.id === 19))
if ((this.hide2 && server.id !== this.main) || (!this.jaeger && server.id === 19) || (!this.ps4 && server.id > 999))
return

var add = ''
Expand Down
60 changes: 24 additions & 36 deletions src/js/options.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,44 @@
+function (window) {
'use strict';

var servers = [
{ name: 'Connery', id: 1, status: 0 },
{ name: 'Miller', id: 10, status: 0 },
{ name: 'Cobalt', id: 13, status: 0 },
{ name: 'Emerald', id: 17, status: 0 },
{ name: 'Briggs', id: 25, status: 0 },
{ name: 'Jaeger', id: 19, status: 0 }
]

var flares = {
0: ['Vanu', [128, 0, 255, 0.6]],
1: ['NC', [0, 200, 255, 0.6]],
2: ['TR', [219, 0, 0, 0.6]],
3: ['NS', [255, 238, 0, 0.6]]
}

'use strict'

var Options = function () {
this.createHTML()
this.load()
this.bind()
chrome.runtime.getBackgroundPage(function (w) {
var opts = w.alert.returnOptions()
this.createHTML(opts[0], opts[1])
this.load()
this.bind()
}.bind(this))
}

Options.prototype = {
constructor: Options,
createHTML: function () {
createHTML: function (servers, flares) {
var option = $('<option>').val(0).text('All')
$('#notification').append(option)
$.each(servers, function (i, server) {
option = $('<option>').val(server.id).text(server.name)
for (var server in servers) {
option = $('<option>').val(server).text(servers[server])
$('#notification, #main').append(option)
})
$.each(flares, function (i, flare) {
option = $('<option>').val(i).text(flare[0]).css('background-color', 'rgba('+flare[1][0]+', '+flare[1][1]+', '+flare[1][2]+', '+flare[1][3]+')')
}
for (var flare in flares) {
option = $('<option>').val(flare).text(flares[flare][0]).css('background-color', 'rgba(' + flares[flare][1][0] + ', ' + flares[flare][1][1] + ', ' + flares[flare][1][2] + ', ' + flares[flare][1][3] + ')')
$('#flare').append(option)
})
}
},
load: function () {
chrome.storage.sync.get({ main: 13, flare: 0, notification: 13, hide: 0, hide2: 0, jaeger: 0, alwaysRemind: 0, timeRemind: 30 }, function (data) {
$('#notification > option[value='+data.notification+']').attr('selected', 'selected')
$('#flare > option[value='+data.flare+']').attr('selected', 'selected')
$('#main > option[value='+data.main+']').attr('selected', 'selected')
chrome.storage.sync.get({ main: 13, flare: 0, notification: 13, hide: 0, hide2: 0, jaeger: 0, alwaysRemind: 0, timeRemind: 30, ps4: 0 }, function (data) {
$('#notification > option[value=' + data.notification + ']').prop('selected', true)
$('#flare > option[value=' + data.flare + ']').prop('selected', true)
$('#main > option[value=' + data.main + ']').prop('selected', true)
if (data.hide)
$('#hide').attr('checked', true)
$('#hide').prop('checked', true)
if (data.hide2)
$('#hide2').attr('checked', true)
$('#hide2').prop('checked', true)
if (data.alwaysRemind)
$('#alwaysRemind').attr('checked', true)
$('#alwaysRemind').prop('checked', true)
if (data.jaeger)
$('#jaeger').attr('checked', true)
$('#jaeger').prop('checked', true)
if (data.ps4)
$('#ps4').prop('checked', true)
$('#timeRemind').val(data.timeRemind)
})
},
Expand Down
12 changes: 11 additions & 1 deletion src/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
</div>
<div class="form-group">
<label for="jaeger" class="col-md-3 control-label">Show Jaeger (event server)</label>
<label for="jaeger" class="col-md-3 control-label">Show Jaeger (Event Server)</label>
<div class="col-md-9 checkbox">
<div class="checkbox">
<label>
Expand All @@ -59,6 +59,16 @@
</div>
</div>
</div>
<div class="form-group">
<label for="ps4" class="col-md-3 control-label">Show PS4 Server</label>
<div class="col-md-9 checkbox">
<div class="checkbox">
<label>
<input type="checkbox" id="ps4"> Yes
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="alwaysRemind" class="col-md-3 control-label">Always display reminder notification</label>
<div class="col-md-9 checkbox">
Expand Down

0 comments on commit 6e148a3

Please sign in to comment.