forked from TehJumpingJawa/poe_ext
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to be an actual chrome extension
- Loading branch information
Nick Shearer
committed
Jul 8, 2015
1 parent
79ad59e
commit 009a1c5
Showing
9 changed files
with
92 additions
and
439 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.