Skip to content

Commit 73f66dd

Browse files
Merge branch 'dev'
2 parents d69411f + b39f3e1 commit 73f66dd

File tree

11 files changed

+124
-92
lines changed

11 files changed

+124
-92
lines changed

app/extension-scripts/main.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
(function () {
2-
chrome.browserAction.onClicked.addListener(function (tab) {
3-
var optionsUrl = chrome.extension.getURL('index.html');
4-
chrome.tabs.query({
5-
url: optionsUrl
6-
}, function (tabs) {
7-
if (tabs.length) {
8-
chrome.tabs.update(tabs[0].id, {
9-
active: true
10-
});
11-
} else {
12-
chrome.tabs.create({
13-
url: optionsUrl
14-
});
15-
}
2+
chrome.browserAction.onClicked.addListener(function () {
3+
chrome.runtime.openOptionsPage(function() {
4+
// do something on load
165
});
176
});
187

app/images/712.GIF

5.15 KB
Loading

app/index.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@
2727
<span class="link" ng-click="app.showAbout($event)">About</span>
2828
<span class="link" ng-click="app.showSupport($event)">Support DIM</span>
2929
<div class="my-super-awesome-loading-box" ng-show="loadingTracker.active()">
30-
<div class="spinner-wrap">
31-
<div class="sprite-spinner" style="width: 22px; height: 22px;">
32-
<img src="images/spiffygif_22x22.png" alt="" />
33-
</div>
34-
</div>
30+
<img src="images/712.GIF" style="width: 22px !important; height: 22px !important;" alt="" />
3531
</div>
3632
</div>
3733
</div>

app/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Destiny Item Manager",
4-
"version": "3.0.2",
4+
"version": "3.0.3",
55
"description": "Robust interface to manage gear, weapons, and items in destiny.",
66
"icons": {
77
"16": "icon16.png",
@@ -17,12 +17,12 @@
1717
"permissions": [
1818
"storage",
1919
"*://www.bungie.net/*",
20-
"cookies",
21-
"tabs"
20+
"cookies"
2221
],
2322
"browser_action": {
2423
"default_icon": "icon128.png"
2524
},
25+
"options_page": "index.html",
2626
"content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'",
2727
"incognito": "split",
2828
"offline_enabled": false

app/options.html

Whitespace-only changes.

app/scripts/dimApp.module.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,3 @@
1313
'ajoslin.promise-tracker'
1414
]);
1515
})();
16-
17-
18-
(function() {
19-
SpriteSpinner = function(el, options){
20-
var self = this,
21-
img = el.children[0];
22-
this.interval = options.interval || 10;
23-
this.diameter = options.diameter || img.width;
24-
this.count = 0;
25-
this.el = el;
26-
img.setAttribute("style", "position:absolute");
27-
el.style.width = this.diameter+"px";
28-
el.style.height = this.diameter+"px";
29-
return this;
30-
};
31-
SpriteSpinner.prototype.start = function(){
32-
var self = this,
33-
count = 0,
34-
img = this.el.children[0];
35-
this.el.display = "block";
36-
self.loop = setInterval(function(){
37-
if(count == 19){
38-
count = 0;
39-
}
40-
img.style.top = (-self.diameter*count)+"px";
41-
count++;
42-
}, this.interval);
43-
};
44-
SpriteSpinner.prototype.stop = function(){
45-
clearInterval(this.loop);
46-
this.el.style.display = "none";
47-
};
48-
document.SpriteSpinner = SpriteSpinner;
49-
})();
50-
51-
$(document).ready(function(){
52-
$(".sprite-spinner").each(function(i){
53-
var s = new SpriteSpinner(this, {
54-
interval:50
55-
});
56-
s.start();
57-
});
58-
});

app/scripts/loadout/dimLoadoutPopup.directive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
dimLoadoutService.getLoadouts()
5050
.then(function(loadouts) {
51-
vm.loadouts = loadouts || [];
51+
vm.loadouts = _.sortBy(loadouts, 'name') || [];
5252

5353
vm.loadouts = _.filter(vm.loadouts, function(item) {
5454
return ((item.classType === -1) || (item.classType === vm.classTypeId));
@@ -66,7 +66,7 @@
6666

6767
dimLoadoutService.getLoadouts()
6868
.then(function(loadouts) {
69-
vm.loadouts = loadouts || [];
69+
vm.loadouts = _.sortBy(loadouts, 'name') || [];
7070

7171
vm.loadouts = _.filter(vm.loadouts, function(item) {
7272
return ((item.classType === -1) || (item.classType === vm.classTypeId));

app/scripts/services/dimLoadoutService.factory.js

Lines changed: 81 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,28 @@
2424
});
2525
}
2626

27-
function processLoadout(data) {
27+
function processLoadout(data, version) {
2828
if (!_.isUndefined(data)) {
29-
_loadouts.splice(0);
29+
if (version === 'v3.0') {
30+
var ids = data['loadouts-v3.0'];
31+
_loadouts.splice(0);
3032

31-
// Remove null loadouts.
32-
data = _.filter(data, function(primitive) {
33-
return !_.isNull(primitive);
34-
});
33+
_.each(ids, function(id) {
34+
_loadouts.push(hydrate(data[id]));
35+
});
36+
} else {
37+
_loadouts.splice(0);
3538

36-
_.each(data, function(primitive) {
37-
// Add id to loadout.
38-
_loadouts.push(hydrate(primitive));
39-
});
39+
// Remove null loadouts.
40+
data = _.filter(data, function(primitive) {
41+
return !_.isNull(primitive);
42+
});
43+
44+
_.each(data, function(primitive) {
45+
// Add id to loadout.
46+
_loadouts.push(hydrate(primitive));
47+
});
48+
}
4049
} else {
4150
_loadouts = _loadouts.splice(0);
4251
}
@@ -48,14 +57,24 @@
4857

4958
// Avoids the hit going to data store if we have data already.
5059
if (getLatest || _.size(_loadouts) === 0) {
51-
chrome.storage.sync.get('loadouts-v2.0', function(data) {
52-
if (_.isUndefined(data['loadouts-v2.0'])) {
53-
chrome.storage.sync.get('loadouts', function(oldData) {
54-
processLoadout((oldData.loadouts) ? oldData.loadouts : undefined);
55-
saveLoadouts(_loadouts);
56-
})
60+
chrome.storage.sync.get(null, function(data) {
61+
// if (_.isUndefined(data['loadouts-v2.0'])) {
62+
// chrome.storage.sync.get('loadouts', function(oldData) {
63+
// processLoadout((oldData.loadouts) ? oldData.loadouts : undefined);
64+
// saveLoadouts(_loadouts);
65+
// })
66+
// } else {
67+
// processLoadout((data['loadouts-v2.0']) ? data['loadouts-v2.0'] : undefined);
68+
// }
69+
70+
if (_.has(data, 'loadouts-v3.0')) {
71+
processLoadout(data, 'v3.0');
72+
} else if (_.has(data, 'loadouts-v2.0')) {
73+
processLoadout(data['loadouts-v2.0'], 'v2.0');
74+
75+
saveLoadouts(_loadouts);
5776
} else {
58-
processLoadout((data['loadouts-v2.0']) ? data['loadouts-v2.0'] : undefined);
77+
processLoadout(undefined);
5978
}
6079

6180
deferred.resolve(_loadouts);
@@ -86,7 +105,16 @@
86105
});
87106
})
88107
.then(function(loadoutPrimitives) {
89-
chrome.storage.sync.set({ 'loadouts-v2.0': loadoutPrimitives }, function(e) {
108+
var data = {
109+
'loadouts-v3.0': []
110+
};
111+
112+
_.each(loadoutPrimitives, function(l) {
113+
data['loadouts-v3.0'].push(l.id);
114+
data[l.id] = l;
115+
});
116+
117+
chrome.storage.sync.set(data, function(e) {
90118
deferred.resolve(loadoutPrimitives);
91119
});
92120

@@ -105,6 +133,8 @@
105133
loadouts.splice(index, 1);
106134
}
107135

136+
chrome.storage.sync.remove(loadout.id.toString(), function() {});
137+
108138
return (loadouts);
109139
})
110140
.then(function(_loadouts) {
@@ -144,19 +174,48 @@
144174
var hydration = {
145175
'v1.0': hydratev1d0,
146176
'v2.0': hydratev2d0,
147-
'default': hydratev2d0
177+
'v3.0': hydratev3d0,
178+
'default': hydratev3d0
148179
}
149180

150181
// v1.0 did not have a 'version' property so if it fails, we'll assume.
151182
return (hydration[(loadout.version)] || hydration['v1.0'])(loadout);
152183
}
153184

185+
function hydratev3d0(loadoutPrimitive) {
186+
var result = {
187+
id: loadoutPrimitive.id,
188+
name: loadoutPrimitive.name,
189+
classType: (_.isUndefined(loadoutPrimitive.classType) ? -1 : loadoutPrimitive.classType),
190+
version: 'v3.0',
191+
items: {}
192+
};
193+
194+
_.each(loadoutPrimitive.items, function(itemPrimitive) {
195+
var item = _.clone(dimItemService.getItem({
196+
id: itemPrimitive.id,
197+
hash: itemPrimitive.hash
198+
}));
199+
200+
if (item) {
201+
var discriminator = item.type.toLowerCase();
202+
203+
item.equipped = itemPrimitive.equipped;
204+
205+
result.items[discriminator] = (result.items[discriminator] || []);
206+
result.items[discriminator].push(item);
207+
}
208+
});
209+
210+
return result;
211+
}
212+
154213
function hydratev2d0(loadoutPrimitive) {
155214
var result = {
156215
id: loadoutPrimitive.id,
157216
name: loadoutPrimitive.name,
158217
classType: (_.isUndefined(loadoutPrimitive.classType) ? -1 : loadoutPrimitive.classType),
159-
version: 'v2.0',
218+
version: 'v3.0',
160219
items: {}
161220
};
162221

@@ -184,7 +243,7 @@
184243
id: uuid2.newguid(),
185244
name: loadoutPrimitive.name,
186245
classType: -1,
187-
version: 'v2.0',
246+
version: 'v3.0',
188247
items: {}
189248
};
190249

@@ -209,7 +268,7 @@
209268
id: loadout.id,
210269
name: loadout.name,
211270
classType: loadout.classType,
212-
version: 'v2.0',
271+
version: 'v3.0',
213272
items: []
214273
};
215274

app/scripts/shell/dimSearchFilter.directive.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
special = 'upgraded';
6262
} else if (['titan', 'hunter', 'warlock'].indexOf(filterResult) >= 0) {
6363
special = 'classType';
64+
} else if (['dupe', 'duplicate'].indexOf(filterResult) >= 0) {
65+
special = 'dupe';
6466
}
6567

6668
tempFns.push(filterGenerator(filterResult, special));
@@ -91,6 +93,8 @@
9193
};
9294

9395
var filterGenerator = function(predicate, switchParam) {
96+
var _duplicates = {};
97+
9498
var result = function(predicate, item) {
9599
return true;
96100
};
@@ -151,7 +155,32 @@
151155
return ((item.complete === true || (!item.primStat && item.type !== 'Class') || item.type === 'Vehicle' || (item.tier === 'Common' && item.type !== 'Class')) || ((!item.xpComplete && item.hasXP) || (!item.hasXP)));
152156
};
153157
break;
154-
}
158+
}
159+
case 'dupe':
160+
{
161+
result = function(p, item) {
162+
if (!_duplicates.hasOwnProperty('dupes')) {
163+
var allItems = _.chain(dimStoreService.getStores())
164+
.map(function(store) {
165+
return store.items;
166+
})
167+
.flatten()
168+
.sortBy('hash')
169+
.value();
170+
171+
_duplicates.dupes = [];
172+
173+
for (var i = 0; i < allItems.length - 1; i++) {
174+
if (allItems[i + 1].hash == allItems[i].hash) {
175+
_duplicates.dupes.push(allItems[i].hash);
176+
}
177+
}
178+
}
179+
180+
return !_.some(_duplicates.dupes, function(hash) { return item.hash === hash; });
181+
};
182+
break;
183+
}
155184
case 'classType':
156185
{
157186
result = function(p, item) {

app/styles/main.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ body>div * {
287287
left: 0;
288288
right: 0;
289289
height: 32px;
290-
background: rgba(195, 188, 180, .9);
290+
background: rgb(195, 188, 180);
291291
color: #1a1e24;
292292
box-shadow: 0 2px 20px 2px #000;
293293
}
@@ -1096,6 +1096,8 @@ button.toast-close-button {
10961096
position: relative;
10971097
display: inline-block;
10981098
text-align: left;
1099+
width: 22px;
1100+
height: 22px;
10991101
}
11001102
.my-super-awesome-loading-box {
11011103
margin-left: 15px;

0 commit comments

Comments
 (0)