gpt4 book ai didi

google-chrome - Chrome 扩展简单弹出窗口不会保持在最后状态

转载 作者:行者123 更新时间:2023-12-04 07:57:37 26 4
gpt4 key购买 nike

现在我相信你们中的一些人已经听说过发生在 Byron Nuclear Plant 的事件。 (我碰巧住在附近)以及美国和加拿大发生的大量地震。 ( 顺便说一句 :我找到了 this 扩展,您可以在其中监测世界各地的地震)

无论如何,随着所有这些问题的发生,我想更好地观看核电站,而且我已经知道 Radiation Network所以我做了一个名为 Radiation Map 的 chrome 扩展由 Radiation Network 提供支持(虽然我与 Radiation Network 没有任何关系)

我做到了,不仅仅是我自己,而且每个人都可以监测美国、日本、南美和欧洲的辐射水平。 (我知道我没有做太多工作,但你明白原因)

但是,我有 1 个我无法弄清楚的问题。当我打开弹出窗口时,我正在查看日本的辐射水平,当我关闭弹出窗口时,它会返回显示美国的辐射水平。我如何使它保持在用户离开它的地方,在我的例子中说日本? (我尝试了内容脚本,但是 css 和 jquery 没有加载)

舱单

{
"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"
}
}

弹窗

<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 (隐藏和显示其他监测辐射水平的 map 的效果)

$(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);
});

});

最佳答案

每次弹出窗口打开时都会重新加载页面,这意味着该状态不会自动保持。您可以使用 sessionStorage 来记住当前 session 的设置(如果您希望它在浏览器重启后继续存在,甚至可以使用 localStorage)。像这样的东西:

$(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();
});

关于google-chrome - Chrome 扩展简单弹出窗口不会保持在最后状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9089793/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com