Now I'm sure some of you have heard of the incident that happened at Byron Nuclear Plant (Which I happen to live near) As well as a massive amount of earthquakes going on in the United States, and Canada. (BTW: I found this extension where you can monitor earthquakes all over the world)
Anyway with all these issues going on I wanted to watch the Nuclear plants better, and I already knew about the Radiation Network So I made a chrome extension called Radiation Map which is powered by the Radiation Network (Although I'm in no way affiliated with Radiation Network)
I made it so not just myself, but everyone can monitor Radiation Levels in the US, Japan, South America, and Europe. (I know I didn't do much work, but you see the reason)
However I have 1 problem that I can't figure out. When I have the popup open, and I'm viewing Japan's radiation levels, and when I close the popup it does back to showing the United States radiation levels. How do I make it so it stay's at where the user leaves it at, say in my case Japan in this example? (I tried content scripts, but the css, and jquery didn't load)
Manifest
{
"name": "Radiation Map",
"version": "1.0.1",
"description": "See what radiation levels are anywhere in the United States, South America, Japan, and Europe! Updated in real time every minute.",
"browser_action": {
"default_icon": "images/logo.png",
"default_title": "Radiation Map",
"popup": "index.html"
},
"icons": {
"48": "images/48x48.png",
"128": "images/128x128.png",
"256": "images/logo.png"
}
}
Popup
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/rmd.js"></script>
</head>
<body id="radiationmap">
<div id="rmlbbg"></div>
<div id="topnavradiation">
<ul id="menu">
<div id="themedrop">
<table>
<tr><td>
<button id="cus">Contiguous United States</button>
</tr></td>
<tr><td>
<button id="hawaii">Hawaii</button>
</tr></td>
<tr><td>
<button id="alaska">Alaska</button>
</tr></td>
<tr><td>
<button id="sa">South America</button>
</tr></td>
<tr><td>
<button id="japan">Japan</button>
</tr></td>
<tr><td>
<button id="europe">Europe</button>
</tr></td>
</table>
</div>
<li><button id="about">About</button></li>
<li><button id="home">Home</button></li>
<li><button id="location">Location</button></li>
</ul>
</div>
<div id="radiationmap">
<div id="cusmap">
<img src="http://www.radiationnetwork.com/GGFTPMap.jpg" width="752" height="478">
</div>
<div id="alaskamap">
<img src="http://www.radiationnetwork.com/Alaska.JPG" width="752" height="478">
</div>
<div id="hawaiimap">
<img src="http://www.radiationnetwork.com/Hawaii.JPG" width="752" height="478">
</div>
<div id="samap">
<img src="http://www.radiationnetwork.com/Paraguay.JPG" width="752" height="478">
</div>
<div id="japanmap">
<img src="http://www.radiationnetwork.com/Japan.JPG" width="752" height="478">
</div>
<div id="europemap">
<img src="http://www.radiationnetwork.com/Europe.JPG" width="752" height="478">
</div>
<table width="752">
<td><img src="images/LegendWeb.bmp"></td>
<td><img src="images/Nuclear.bmp"> Nuclear Site</td>
<td>Alert Level = 100 CPM</td>
</table>
</div>
<div id="aboutradiationmap">
Radiation Map is powered by the <a href="http://radiationnetwork.com/" target="_blank">Radiation Network</a>, and without them this extension couldn't be possible.
<p><a href="http://www.youtube.com/mikethedj4" target="_blank">Michael</a> created this extension for obvious reasons, and is in no way affiliated with the Radiation Network.</p>
<hr>
<center>Take control over your life, and stay safe!<br />
<em>Much Love!</em>
<p><a href="http://swagbucks.com/refer/mikethedj4" target="_blank"><img src="images/swagbucks.jpg"></a></p>
</center>
</div>
</body>
</html>
RMD.JS (effects to hide, and show other maps that monitor radiation levels)
$(document).ready(function() {
$('div#alaskamap, div#hawaiimap, div#samap, div#japanmap, div#europemap, div#themedrop, div#aboutradiationmap, div#rmlbbg').hide();
$('button#home').click(function() {
$('div#rmlbbg, div#aboutradiationmap').fadeOut(400);
$('div#themedrop').slideUp(400);
});
$('button#about').click(function() {
$('div#rmlbbg, div#aboutradiationmap').fadeToggle(400);
$('div#themedrop').slideUp(400);
});
$('button#location').click(function() {
$('div#themedrop').slideToggle(400);
});
$('button#cus').click(function() {
$('div#alaskamap, div#hawaiimap, div#samap, div#japanmap, div#europemap').slideUp(400);
$('div#cusmap').delay(400).slideDown(400);
});
$('button#europe').click(function() {
$('div#alaskamap, div#hawaiimap, div#samap, div#japanmap, div#cusmap').slideUp(400);
$('div#europemap').delay(400).slideDown(400);
});
$('button#japan').click(function() {
$('div#alaskamap, div#hawaiimap, div#samap, div#cusmap, div#europemap').slideUp(400);
$('div#japanmap').delay(400).slideDown(400);
});
$('button#sa').click(function() {
$('div#alaskamap, div#hawaiimap, div#cusmap, div#japanmap, div#europemap').slideUp(400);
$('div#samap').delay(400).slideDown(400);
});
$('button#alaska').click(function() {
$('div#cusmap, div#hawaiimap, div#samap, div#japanmap, div#europemap').slideUp(400);
$('div#alaskamap').delay(400).slideDown(400);
});
$('button#hawaii').click(function() {
$('div#alaskamap, div#cusmap, div#samap, div#japanmap, div#europemap').slideUp(400);
$('div#hawaiimap').delay(400).slideDown(400);
});
$('div#rmlbbg').click(function() {
$('div#rmlbbg, div#aboutradiationmap').fadeOut(400);
});
});
Jump to each solution: Restart the browser. Check potentially corrupted extensions. Verify Google Chrome sync » worked for 1 visitor (Jul 2021) Reinstall extensions.
The page is reloaded every time the pop-up opens, meaning that state won't persist automatically. You can use sessionStorage to remember the setting for the current session (or even localStorage
if you want it to survive a browser restart). Something like this:
$(document).ready(function() {
...
$('button#cus').click(function() {
$('div#alaskamap, div#hawaiimap, div#samap, div#japanmap, div#europemap').slideUp(400);
$('div#cusmap').delay(400).slideDown(400);
sessionStorage.selectedMap = "cus";
});
...
// "Click" the button corresponding to the map previously selected
var selectedMap = sessionStorage.selectedMap || "cus";
$('button#' + selectedMap).click();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With