Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening this so I can steal your ideas =P #77

Open
wants to merge 45 commits into
base: release
Choose a base branch
from

Conversation

peter-dolkens
Copy link
Member

No description provided.

paulpv added 30 commits July 2, 2018 15:30
NOTE: I no longer consider "Squadron 42" a package.
`pagesize` now seems to be fixed to `10`
@peter-dolkens peter-dolkens added the wip Work In Progress label Mar 11, 2021
Comment on lines -41 to -42
HangarXPLOR.$bulkUI.addClass(HangarXPLOR._feature.Summary);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed the BulkXPLOR hooks! :'(

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was awhile ago; I don't remember why; feel free to undo

@@ -14,6 +14,13 @@ Current features include:
* See the melt value of each item in your hangar
* Correct the name of upgraded ships for easier searching

TODO:(pv)
* Add note field for each item (so that I can mention specific plans for specific item(s))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad I'm not the only one that had this idea

Comment on lines +21 to +22
* Add ability to re-order the list on-demand and persist the order
* May be able to just use `$.cookie('HangarXPLOR.Type', value)` type of logic
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also had this idea - I approve

@@ -15,7 +15,7 @@ HangarXPLOR._callbacks = HangarXPLOR._callbacks || {};
'AOPOA': 'Aopoa',
'ARGO': 'Argo',
'BANU': 'Banu',
'CNOU': 'Consolidated',
'CNOU': 'Consolidated Outland',
'CRSD': 'Crusader',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's soooo looooong.

I should probably import this though...

@lgtm-com
Copy link

lgtm-com bot commented Mar 11, 2021

This pull request introduces 1 alert when merging fdd168e into 03fe460 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

Comment on lines 31 to 88
HangarXPLOR.GetDownloadItems = function() {
var $target = $(HangarXPLOR._selected.length > 0 ? HangarXPLOR._selected : HangarXPLOR._filtered);
// console.log('GetDownloadItems $target', JSON.stringify($target));
return $target.map(function() {
var $pledge = this;
var pledge = {};
pledge.name = $('.js-pledge-name', $pledge).val();
pledge.id = $('.js-pledge-id', $pledge).val();
pledge.cost = $('.js-pledge-value', $pledge).val();
pledge.lti = $('.title:contains(Lifetime Insurance)', $pledge).length > 0;
pledge.date = $('.date-col:first', $pledge).text().replace(/created:\s+/gi, '').trim();
pledge.warbond = pledge.name.toLowerCase().indexOf('warbond') > -1;
var item = {};
item.id = $pledge.pledgeId;
item.cost = $pledge.meltValue;
item.lti = $pledge.hasLTI;
item.date = $('.date-col:first', $pledge).text().replace(/created:\s+/gi, '').trim();
item.warbond = $pledge.isWarbond;
item.giftable = $pledge.isGiftable;
item.pledge = $pledge.displayName;
item.package = $pledge.isPackage ? 1 : 0;

return $('.kind:contains(Ship)', this).parent().map(function() {
var $ship = this;
var ship = {};
ship.manufacturer = $('.liner span', $ship).text();
ship.manufacturer = _manufacturerShortMap[ship.manufacturer] || ship.manufacturer;
ship.name = $('.title', $ship).text();
ship.name = ship.name.replace(/^\s*(?:Aegis|Anvil|Banu|Drake|Esperia|Kruger|MISC|Origin|RSI|Tumbril|Vanduul|Xi'an)[^a-z0-9]+/gi, '');
ship.name = ship.name.replace(/^\s*(?:Aegis|Anvil|Banu|Drake|Esperia|Kruger|MISC|Origin|RSI|Tumbril|Vanduul|Xi'an)[^a-z0-9]+/gi, '');
ship.lti = pledge.lti;
ship.warbond = pledge.warbond;
ship.package_id = pledge.id;
ship.pledge = pledge.name;
ship.pledge_date = pledge.date;
ship.cost = pledge.cost;
return ship;
}).get()
}).sort(function(a, b) { return a.manufacturer == b.manufacturer ? (a.name < b.name ? -2 : 2) : (a.manufacturer < b.manufacturer ? -1 : 1); }).get();
if (this.isUpgrade) {
// console.log('GetDownloadItems $pledge', JSON.stringify($pledge));
var parts = /^(.+?) - (.+?)( - .+)? \(\d+\)$/m.exec(item.pledge)
// console.log('GetDownloadItems parts', JSON.stringify(parts));
item.type = parts[1];
item.manufacturer = 'N/A';
item.name = parts[2];
return item;
} else {
return $('.kind:contains(Ship)', this).parent().map(function() {
var $ship = this;
// console.log('GetDownloadItems $ship', JSON.stringify($ship));
var ship = Object.assign({}, item);
item.cost = 0; // Don't report cost for remaining ships in this Package/Combo
item.package = 0; // Don't report package for remaining ships in this Package/Combo
ship.type = 'Ship';
ship.manufacturer = $('.liner span', $ship).text();
ship.manufacturer = _manufacturerShortMap[ship.manufacturer] || ship.manufacturer;
ship.name = $('.title', $ship).text();
ship.name = HangarXPLOR.CleanShipName(ship.name);
ship.name = ship.name.replace(/^\s*(?:Aegis|Anvil|Banu|Drake|Esperia|Kruger|MISC|Origin|RSI|Tumbril|Vanduul|Xi'an)[^a-z0-9]+/gi, '');
return ship;
})
// Sort any inner ships by manufacturer and then name
.sort(function(a, b) {
if (a.manufacturer < b.manufacturer) {
return -1
}
if (a.manufacturer > b.manufacturer) {
return 1
}
if (a.name < b.name) {
return -1
}
if (a.name > b.name) {
return 1
}
return 0;
})
.get()
}
})
.get();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have to run locally to see the impact of this I think

Comment on lines 114 to 128
return [
'"' + item.pledge + '"',
'"' + item.type + '"',
'"' + item.manufacturer + '"',
'"' + item.name + '"',
item.id,
item.cost,
'"' + item.date + '"',
item.lti,
item.warbond,
item.package,
item.giftable
]
.join(',')
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much easier to read

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even nicer if I had used template literals

Comment on lines +4 to +40
function OverrideMarginsAndPaddings() {
var temp;

temp = $('#contentbody');
temp.css('padding-bottom', '15px');

temp = $('#contentbody > div');
temp.css('padding-left', '15px');
temp.css('padding-right', '15px');
temp.css('max-width', 'none');

temp = $('#billing > div.content.clearfix > div.sidenav');
temp.css('width', '330px');

temp = $('#billing > div.content.clearfix > div.inner-content');
temp.css('padding-left', '330px');

temp = $('#billing > div.content.clearfix > div.sidenav > ul > li.active > a > span.bg');
temp.css('width', '275px');

temp = $('#billing');
temp.css('padding', '15px');
temp.css('padding-top', '30px');

temp = $('#billing > div.content.clearfix');
temp.css('padding-top', '15px');
temp.css('padding-bottom', '15px');

temp = $('#billing .inner-content .top > .separator');
temp.css('margin-top', '10px');
temp.css('margin-bottom', '10px');

temp = $('#billing .content h3');
temp.css('margin-top', '10px');
temp.css('margin-bottom', '10px');
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh - I'll have to peek at these improvements...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be undesirable, but it makes much better use of my 21:9 monitor

{ Value: 'All', Text: 'All Types', Class: 'first', Selected: HangarXPLOR._type == 'All' },
{ Value: 'HasShip', Text: 'All Ships', Selected: HangarXPLOR._type == 'HasShip' },
{ Value: 'HasShipOrIsUpgradeOrIsAddOn', Text: 'All Ships & Upgrades & Add Ons', Selected: HangarXPLOR._type == 'HasShipOrIsUpgradeOrIsAddOn' },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had these at one stage, but the list got very long...

I'm thinking about making it configurable similar to the ribbon bars in office.

Comment on lines 86 to 89
HangarXPLOR._type = value; HangarXPLOR.SaveSettings();
HangarXPLOR.Render();
HangarXPLOR.RefreshPager();
/* HangarXPLOR.ResetBulkUI(); */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should clean this up

Comment on lines +98 to +100
HangarXPLOR._sort = value; HangarXPLOR.SaveSettings();
HangarXPLOR.Render();
HangarXPLOR.RefreshPager();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs this cleaning

Comment on lines 12 to 166
pledgeName = pledgeName.replace(/Discount Pack/i, 'Pack');
pledgeName = pledgeName.replace(/Tumbril Cyclone LTI Presale/i, 'Tumbril Cyclone - LTI');
pledgeName = pledgeName.replace(/^(Aegis Dynamics Idris Corvette|Aegis Dynamics Retaliator Heavy Bomber|Anvil Gladiator Bomber|Banu Merchantman|Captured Vanduul Fighter|Drake Interplanetary Caterpillar|Idris Corvette|MISC Freelancer|MISC Starfarer Tanker|ORIGIN M50 Interceptor|RSI Aurora LN|RSI Aurora LX|RSI Constellation|ORIGIN 350R Racer|Xi'An Scout - +Khartu)( - LTI)?$/i, 'Standalone Ship - $1$2');
pledgeName = pledgeName.replace(/^(Digital )?(Advanced Hunter|Arbiter|Bounty Hunter|Colonel|Cutlass|Freelancer|Mercenary|Pirate|Rear Admiral|Scout|Specter|Weekend Warrior)( - LTI)?$/i, 'Package - $1$2$3');
pledgeName = pledgeName.replace(" ", " ").trim();
// TODO: Add pre-processing for Reliant Variants Here if required

// Package - Mustang Omega : AMD Edition
// 1 Year Imperator Reward - 15% Coupon: SSSSSSSSSS
// Greycat PTV

return pledgeName;
}

HangarXPLOR.CleanShipName = function(shipName)
{
shipName = shipName.replace('Origin 600i Exploration Module', 'Origin 600i');
shipName = shipName.replace('M50 Interceptor', 'M50');
shipName = shipName.replace('M50', 'M50 Interceptor');
shipName = shipName.replace('Hornet F7C', 'F7C Hornet');
return shipName;
}

HangarXPLOR.CleanComboShips = function(comboShips, debug)
{
comboShips.each(function (index, value) {
if (debug) {
console.log('CleanComboShips comboShips[' + index + ']=', value);
}
var comboShip = $(this)
if (debug) {
console.log('CleanComboShips comboShip BEFORE', comboShip);
}
var comboShipName = comboShip.text();
if (debug) {
console.log('CleanComboShips comboShipName BEFORE', comboShipName);
}
comboShipName = HangarXPLOR.CleanComboShipName(comboShipName);
if (debug) {
console.log('CleanComboShips comboShipName AFTER', comboShipName);
}
comboShip[0].textContent = comboShipName;
if (debug) {
console.log('CleanComboShips comboShip AFTER', comboShip);
}
})
}

HangarXPLOR.CleanComboShipName = function(comboShipName)
{
comboShipName = comboShipName.replace('Tumbril Cyclone-TR', 'Tumbril Cyclone TR');
return comboShipName;
}

// Apply a pre-defined filter to a list of items
HangarXPLOR.ProcessItem = function()
{
// Pre-cache raw markup
if (HangarXPLOR._fromCache != true) HangarXPLOR._raw.push(this.outerHTML);

// Preprocess Tumbril Cyclone
$('.without-images .title:contains(Tumbril Cyclone)', this).each(function() {
var $tumbril = $(this);
var name = $tumbril.text().trim();
if (name == "Tumbril Cyclone") name = "Tumbril Cyclone-RN";

if (name != "Tumbril Cyclone-AA" &&
name != "Tumbril Cyclone-TR" &&
name != "Tumbril Cyclone-RN" &&
name != "Tumbril Cyclone-RC") return;

var $block = $tumbril.closest('.content-block1');
var $images = $('.with-images', $block);
if ($images.length == 0) {
$block.prepend($('<div />').addClass('also-contains').text("Also Contains"));
$block.prepend($images = $('<div />').addClass('with-images'));
}

var cyclone = {
"Tumbril Cyclone-RN": "/media/ao2p3pw2e7k94r/subscribers_vault_thumbnail/Tumbril-Buggy-Piece-01-Showroom-V009.jpg",
"Tumbril Cyclone-TR": "/media/cmq3rwpo5ghpvr/subscribers_vault_thumbnail/Tumbril-Buggy-Piece-04-Desert-V012.jpg",
"Tumbril Cyclone-RC": "/media/w3vw5498xb25mr/subscribers_vault_thumbnail/Tumbril-Buggy-Piece-05-Rocky-Beach-Sport-Fin.jpg",
"Tumbril Cyclone-AA": "/media/n6535dpiwv2pgr/subscribers_vault_thumbnail/Tumbril-Buggy-Piece-06-Lagoon-V011.jpg",
};

var $item = $('<div />').addClass('item').append(
$('<div />').addClass('image').css({ 'background-image': 'url("' + cyclone[name] + '")' }),
$('<div />').addClass('text').append(
$('<div />').addClass('title').text(name),
$('<div />').addClass('kind').text("Ship"),
$('<div />').addClass('liner').append("Tumbril (", $('<span />').text("TMBL"), ")")
)
);
$images.prepend($item);
$tumbril.parent().remove();
// Preprocessing Begin
// Tumbril Cyclone
$('.without-images .title:contains(Tumbril Cyclone)', this).each(function(index, value) {
//console.log('ProcessItem PreProcessTumbrilCyclone index=' + index + ', value=', value);
HangarXPLOR.PreProcessTumbrilCyclone($(this));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bad idea to convert different chunks of the cleaning code into discrete functions

@Petosiris
Copy link

I don' understand what you mean in the subject description of this issue, @peter-dolkens. Obviously @paulpv does but even after his input I don't understand it better. Do you mean we should submit progress in forked branches here, or just ideas/wishlists? Please explain.

@paulpv
Copy link

paulpv commented Mar 19, 2021

@Petosiris I think @peter-dolkens just wants a branch in his repo where he can work out of and pick and choose which of my changes he might want to take or improve upon.

@Petosiris
Copy link

@paulpv - I see, you got yourself a private project issue thread! ;)
Thanks for the reply.

@peter-dolkens
Copy link
Member Author

@Petosiris HangarXPLOR is actually getting a major refactor/rewrite.

@paulpv had considerable changes in his fork, which I thought were worth reviewing while I work on https://github.com/dolkensp/HangarXPLOR/compare/v2

Am working together with a few other developers in the SC community to consolidate on a more unified naming scheme that will allow for greater interoperability between our different platforms (e.g. FleetView)

@Petosiris
Copy link

Petosiris commented Mar 21, 2021

Sounds good, @peter-dolkens!

@lgtm-com
Copy link

lgtm-com bot commented Jun 8, 2021

This pull request introduces 1 alert when merging b7e445a into d9c5c6c - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jun 8, 2021

This pull request introduces 1 alert when merging a72cca8 into d9c5c6c - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@paulpv
Copy link

paulpv commented Jun 9, 2021

@peter-dolkens You may also want to check out https://github.com/paulpv/HangarXPLOR/tree/buyback where I am finally getting around to experimenting with mutating the Buy Back Pledges items. It definitely is not thought out very far, but so far it functions to do what I mostly want it to do; hide pledges that I know I will never want to buyback. The current version does not persist any settings in this area, so if you refresh the page you start over. But it is a start.

@paulpv
Copy link

paulpv commented Nov 18, 2022

@peter-dolkens With IAE 2952 here, I opened this up again and see you have made nice progress on your new release branch.

I don't mind keeping my fork's master branch around, but I am going to start using your release branch exclusively and stop using my fork (as always, I reserve the right to make future changes on my fork ;) ; I have a fresh one now at https://github.com/NightVsKnight/HangarXPLOR that I will be using exclusively from here on out)

Is this PR useful anymore or should it be close?

And, to be blunt, I am nowadays mostly using CCU Game for managing my Hangar.
I still do use HangarXPLOR for when I visit my actual hangar, and when I do it still seems invaluable to me, but using CCU Game minimizes the times that I have to directly visit my hangar nowadays.

Thank you for all of your hard work!

My in-game name(s) are knight55, night55, and NightVsKnight, so feel free to add me as a friend and maybe we'll see each other in the 'verse!

o7

@peter-dolkens
Copy link
Member Author

peter-dolkens commented Nov 19, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip Work In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants