Skip to content

Commit

Permalink
update to be an actual chrome extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Shearer committed Jul 8, 2015
1 parent 79ad59e commit 009a1c5
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 439 deletions.
Binary file removed poe_ext.crx
Binary file not shown.
30 changes: 15 additions & 15 deletions poe_ext/assets/css/poe.css
@@ -1,33 +1,33 @@

@font-face{
font-family:'FontinSmallCaps';
src:url('http://webcdn.pathofexile.com/font/fontin-smallcaps-webfont.eot');
src:local("☺"),url('http://webcdn.pathofexile.com/font/fontin-smallcaps-webfont.woff') format("woff"),url('http://webcdn.pathofexile.com/font/fontin-smallcaps-webfont.ttf') format("truetype"), url('http://webcdn.pathofexile.com/font/fontin-smallcaps-webfont.svg#webfontSCusr8QL') format("svg");
src:url('https://webcdn.pathofexile.com/font/fontin-smallcaps-webfont.eot');
src:local("☺"),url('https://webcdn.pathofexile.com/font/fontin-smallcaps-webfont.woff') format("woff"),url('https://webcdn.pathofexile.com/font/fontin-smallcaps-webfont.ttf') format("truetype"), url('https://webcdn.pathofexile.com/font/fontin-smallcaps-webfont.svg#webfontSCusr8QL') format("svg");
font-weight:normal;
font-style:normal;
}

@font-face{
font-family:'FontinRegular';
src:url('http://webcdn.pathofexile.com/font/fontin-regular-webfont.eot');
src:local("☺"),url('http://webcdn.pathofexile.com/font/fontin-regular-webfont.woff') format("woff"),url('http://webcdn.pathofexile.com/font/fontin-regular-webfont.ttf') format("truetype"),url('http://webcdn.pathofexile.com/font/fontin-regular-webfont.svg#webfontOAeglf7d') format("svg");
src:url('https://webcdn.pathofexile.com/font/fontin-regular-webfont.eot');
src:local("☺"),url('https://webcdn.pathofexile.com/font/fontin-regular-webfont.woff') format("woff"),url('https://webcdn.pathofexile.com/font/fontin-regular-webfont.ttf') format("truetype"),url('https://webcdn.pathofexile.com/font/fontin-regular-webfont.svg#webfontOAeglf7d') format("svg");
font-weight:normal;
font-style:normal;
}


@font-face{
font-family:'FontinItalic';
src:url('http://webcdn.pathofexile.com/font/fontin-italic-webfont.eot');
src:local("☺"),url('http://webcdn.pathofexile.com/font/fontin-italic-webfont.woff') format("woff"),url('http://webcdn.pathofexile.com/font/fontin-italic-webfont.ttf') format("truetype"),url('http://webcdn.pathofexile.com/font/fontin-italic-webfont.svg#webfontEqJqoBxP') format("svg");
src:url('https://webcdn.pathofexile.com/font/fontin-italic-webfont.eot');
src:local("☺"),url('https://webcdn.pathofexile.com/font/fontin-italic-webfont.woff') format("woff"),url('https://webcdn.pathofexile.com/font/fontin-italic-webfont.ttf') format("truetype"),url('https://webcdn.pathofexile.com/font/fontin-italic-webfont.svg#webfontEqJqoBxP') format("svg");
font-weight:normal;
font-style:normal;
}

@font-face{
font-family:'FontinBold';
src:url('http://webcdn.pathofexile.com/font/fontin-bold-webfont.eot');
src:local("☺"),url('http://webcdn.pathofexile.com/font/fontin-bold-webfont.woff') format("woff"),url('http://webcdn.pathofexile.com/font/fontin-bold-webfont.ttf') format("truetype"),url('http://webcdn.pathofexile.com/font/fontin-bold-webfont.svg#webfontvK7dhkXe') format("svg");
src:url('https://webcdn.pathofexile.com/font/fontin-bold-webfont.eot');
src:local("☺"),url('https://webcdn.pathofexile.com/font/fontin-bold-webfont.woff') format("woff"),url('https://webcdn.pathofexile.com/font/fontin-bold-webfont.ttf') format("truetype"),url('https://webcdn.pathofexile.com/font/fontin-bold-webfont.svg#webfontvK7dhkXe') format("svg");
font-weight:normal;
font-style:normal;
}
Expand All @@ -48,7 +48,7 @@
text-align: center;
color: #EFEFEF;
z-index: 1500;
background: url('http://webcdn.pathofexile.com/image/game_ui/hover_background.png?1302486915')
background: url('https://webcdn.pathofexile.com/image/game_ui/hover_background.png?1302486915')
}
.itemGemPopup {
z-index: 1450
Expand Down Expand Up @@ -364,7 +364,7 @@
.itemIcon .socket, .itemIcon .socket img
{
width: 47px;
height: 47px;
height: 47px;
}
.itemIcon .socketWithGem img
{
Expand All @@ -373,7 +373,7 @@
}
.itemIcon .socketHover img
{
top: -50px;
top: -50px;
}
.sockets
{
Expand Down
45 changes: 45 additions & 0 deletions poe_ext/assets/js/injector.js
@@ -0,0 +1,45 @@

var navLink = $('<li><a href="#">Stash Management</a></li>');

var homeNav = $('li#nav-home').find('div.dropDown ul');



navLink.click(function(){

var userName = $('span.profile-link').text();

if (!userName) {

alert('You don\'t appear to be logged in!');

} else {

var mainUrl = chrome.extension.getURL("main.html");

$.getJSON(chrome.extension.getURL("manifest.json"), function(manifest){

$.get(mainUrl).success(function(main){
main = main.replace(/(href|src)="\//ig,'$1="' + chrome.extension.getURL(""));

main = main.replace(/<\/body>/,
'<script>' +
'window.accountName = \'' + userName + '\';' +
'$(\'#version\').html("Version: ' + manifest.version + '");' +
'</script>' +
'</body>');

var w = window.open();


w.document.write(main);
w.document.close();

});
});
}

});

homeNav.append(navLink);

51 changes: 5 additions & 46 deletions poe_ext/assets/js/loader.js
Expand Up @@ -20,12 +20,8 @@ var oMods = {};
var oCalc = {};




$(document).ready(function(){

getVersion();

postThrottle = new Throttle(35000,25);

// initialise the local browser db, once going, start loading data...
Expand Down Expand Up @@ -231,7 +227,7 @@ function getChars() {

var deferred = new $.Deferred();

$.post(getEndpoint('get-characters'))
$.post(getEndpoint('get-characters'), {accountName: accountName})
.done(function(data) {
if (data) {
deferred.resolve(data);
Expand All @@ -249,34 +245,7 @@ function getChars() {


}
/*
function getChars() {
var deferred = new $.Deferred();
$.get('http://www.pathofexile.com/')
.done(function(data) {

var regexp = new RegExp(/CHARACTERS_DATA=(\{.+?\});/g);
var aMatch = regexp.exec(data);
if (aMatch) {
var cdata = JSON.parse(aMatch[1]);
deferred.resolve(cdata);
} else {
deferred.reject();
}
})
.fail(function(){
deferred.reject();
})
;
return deferred.promise();
}
*/

function initPage(){

Expand Down Expand Up @@ -313,7 +282,7 @@ function initPage(){
$('#output').html('');
$('#rareList').html('');

if (league != '') {
if (league !== '') {
setCache('last-league',league);
loadLeagueData(league, false);
}
Expand All @@ -323,16 +292,6 @@ function initPage(){
}


function getVersion() {

$.getJSON('manifest.json',function(manifest){
$('#version').html("Version: " + manifest.version);
});

}



function PromiseGroup() {

var self = this;
Expand Down Expand Up @@ -681,7 +640,7 @@ function responseToItems(response, location) {


function getEndpoint(method) {
return "http://www.pathofexile.com/character-window/" + method;
return "https://www.pathofexile.com/character-window/" + method;
}


Expand All @@ -703,7 +662,7 @@ function getCharItems(charName) {

var thisChar = charName;

postThrottle.queue( function() { return $.post(getEndpoint('get-items'), {character: thisChar}) } )
postThrottle.queue( function() { return $.post(getEndpoint('get-items'), {character: thisChar, accountName: accountName}) } )
.done(function(oData){
// add char data to cache
oData.charName = thisChar;
Expand Down Expand Up @@ -739,7 +698,7 @@ function getStashPage(league,index) {
// cache miss
.fail(function(){

postThrottle.queue(function() { return $.post(getEndpoint('get-stash-items'), {league: league, tabIndex: index, tabs: index === 0 ? 1 : 0}) })
postThrottle.queue(function() { return $.post(getEndpoint('get-stash-items'), {league: league, accountName: accountName, tabIndex: index, tabs: index === 0 ? 1 : 0}) })

.done(function (stashResp) {

Expand Down

0 comments on commit 009a1c5

Please sign in to comment.