Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

174 lines (147 sloc) 4.381 kb
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--
* Filename: popup.html
* More info, see: gpme.js
*
* Web: http://huyz.us/google-plus-me/
* Source: https://github.com/huyz/google-plus-me
* Author: Huy Z http://huyz.us/
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<style>
body {
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif !important;
font-size: 14px;
line-height: 21px;
color: #333;
}
code, pre, textarea, tt {
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif !important;
font-size: 12px;
line-height: 18px;
color: black;
white-space: pre-wrap;
word-wrap: break-word;
}
a { text-decoration: underline; color: #537d7b }
a:visited { text-decoration: underline; color: #537d7b }
a:hover { text-decoration: underline; color: #a34d32 }
.header {
background-color: #2D2D2D;
color: white;
font-weight: bold;
padding: 3px 5px;
text-align: center;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.container {
margin: 10px 15px;
}
.author {
font-weight: normal;
font-size: 12px;
display: inline-block;
width: 100%;
text-align: right;
}
.options {
width: 200px;
margin: 5px;
}
.actions {
margin: 5px;
}
#status {
margin: 5px;
height: 20px;
color: green;
}
</style>
<script type="text/javascript" charset="utf-8">
// Saves options to localStorage.
function saveOptions() {
var mode = 'expanded';
var radios = document.getElementsByName('gpme_options_mode');
for (var radio in radios) {
if (radios[radio].checked) {
mode = radios[radio].value;
break;
}
}
localStorage.setItem('gpme_options_mode', mode);
// Send update to all tabs
broadcast({action: 'gpmeModeOptionUpdated', mode: mode});
notifyUser("Option saved.");
}
// Restores select box state to saved value from localStorage, after
// filling in localStorage from content script
function restoreOptions() {
var mode = localStorage.getItem('gpme_options_mode');
var radios = document.getElementsByName('gpme_options_mode');
for (var radio in radios) {
radios[radio].checked = mode == radios[radio].value;
}
}
function resetAll() {
// Clear our localStorage
for (var i in localStorage) {
if (i.indexOf('gpme_') == 0)
localStorage.removeItem(i);
}
// Re-default to expanded, as in background.js
localStorage.setItem('gpme_options_mode', 'expanded');
restoreOptions();
// Clear the content scripts' localStorage
broadcast({action: 'gpmeResetAll'});
notifyUser('Resetting G+me.');
}
function notifyUser(msg) {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.innerHTML = msg;
setTimeout(function() {
status.innerHTML = '';
}, 1000);
}
// Broadcast message to all tabs
function broadcast(request, callback) {
chrome.windows.getAll({populate: true}, function(windows) {
windows.forEach(function(w) {
w.tabs.forEach(function(tab) {
if (tab.url.match(/^https?:\/\/plus\.google\.com\//))
chrome.tabs.sendRequest(tab.id, request, callback);
});
});
});
}
</script>
</head>
<body onload="restoreOptions()">
<div class="header">
G+me<br/>
<span class="author">by <a href="http://huyz.us/" target=_blank>Huy Z</a></span>
</div>
<div class="container">
<div class="options">
Show posts in: <br />
<input id="gpme_options_mode_expanded" type="radio" name="gpme_options_mode" value="expanded" / >expanded mode<br />
<input id="gpme_options_mode_list" type="radio" name="gpme_options_mode" value="list" / >list mode (max. 1 open)<br />
<button onclick="saveOptions()" style="margin-top: 5px">Save</button>
</div>
<div class="actions">
<a href="#" onclick="resetAll();">Reset G+me</a>
</div>
<pre id="status">
</pre>
</div>
</body>
</html>
<!-- Local Variables: -->
<!-- coding: utf-8 -->
<!-- End: -->
<!-- vim:set ai et sts=4 sw=4 tw=0: -->
Jump to Line
Something went wrong with that request. Please try again.