Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Fetures Lock and export #31

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ function saveWindow(browserWindow, displayName) {
// store a window object
// returns the stored window
function storeWindow(browserWindow, name, displayName) {
var savedWindow = savedWindows[name];
var locked=savedWindow?savedWindow.locked:false;
if (locked){
return;
}
browserWindow.name = name;
browserWindow.displayName = displayName;

Expand Down Expand Up @@ -211,10 +216,17 @@ function onWindowOpened(savedWindow, browserWindow) {
}


function lockWindow(name,locked){
savedWindows[name]['locked']=locked;
localStorage[name]=JSON.stringify(savedWindows[name]);
}

// removed a saved window
function deleteSavedWindow(name) {
var savedWindow = savedWindows[name];

if(savedWindow.locked){
return;
}
var id = savedWindow.id;
if (id) {
markWindowAsClosed(savedWindow);
Expand Down
69 changes: 62 additions & 7 deletions popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ li:hover {
background-color: #eee;
}

li:hover > .delete {
li:hover > .delete,li:hover > .lock {
visibility: visible;
}

.text {
display: inline;
}
Expand Down Expand Up @@ -96,11 +95,11 @@ li:hover > .delete {
background-color: #fcc;
}

.deleted > .text:hover {
.deleted > .text:hover,.lock > .text:hover {
cursor: default;
}

.deleted > .delete {
.deleted > .delete,.lock > .lock {
display: none;
}

Expand All @@ -115,25 +114,63 @@ li:hover > .delete {
margin-left: 20px;
}

.undo:hover {
.undo:hover {
cursor: pointer;
}

.lock {
background-image: url('data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22iso-8859-1%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20%20width%3D%2212px%22%20height%3D%2214px%22%20viewBox%3D%220%200%2012%2014%22%20style%3D%22enable-background%3Anew%200%200%2012%2014%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23FFF%22%20d%3D%22M11%2C6V5c0-2.762-2.239-5-5-5S1%2C2.238%2C1%2C5v1H0v8h12V6H11z%20M6.5%2C9.847V12h-1V9.847C5.207%2C9.673%2C5%2C9.366%2C5%2C9%20c0-0.553%2C0.448-1%2C1-1s1%2C0.447%2C1%2C1C7%2C9.366%2C6.793%2C9.673%2C6.5%2C9.847z%20M9%2C6H3V5c0-1.657%2C1.343-3%2C3-3s3%2C1.343%2C3%2C3V6z%22%2F%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3Cg%3E%3C%2Fg%3E%3C%2Fsvg%3E');
background-position: center center;
margin-left: 20px;
float: right;
display: inline;
visibility: hidden;
color: white;
background-color: #8b8b8b;
text-align: center;
border-radius: 10px;
width: 20px;
height: 20px;
line-height: 16px;
font-weight: bold;
position: relative;
top: 1px;
margin-left: 20px;
background-repeat: no-repeat;

}
.lock:hover {
cursor: pointer;
background-color: #444444;
}
.lock {
color: black;
background-color: #a3a3a3;
}
.locked,.locked:hover{
background-color: #111111;
display: block;
visibility: visible;
}
/* FORM */

#form {
display: none;
margin: 5px;
}

input {
input,td {
padding: 3px;
font-weight: bold;
font-size:100%;
font-size: 100%;
border: 3px solid #ccc;
border-radius: 5px;
}

label,td {
background-color: #DDD;
}

input:focus {
outline: none;
}
Expand All @@ -160,3 +197,21 @@ input:focus {
#update {
display: none;
}
table{
width:100%
}
td{
text-align: center;
width: 50%;
}
#export, label {
border: none;
color: black;
padding: 0px 5px;
cursor: pointer;
width: 50%;
}

#import {
display: none;
}
36 changes: 27 additions & 9 deletions popup.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<html>
<head>

<link id="style" rel="stylesheet" type="text/css" href="popup.css" />

<script type="text/javascript" src="popup.js"></script>
<link id="style" rel="stylesheet" type="text/css" href="popup.css"/>
<script type="text/javascript" src="saveas/filesaver.js"></script>
<script type="text/javascript" src="popup.js"></script>

</head>

Expand All @@ -12,24 +12,42 @@

<div>
<form id="form">
Save as: <input type="text" id="nameInput" />
Save as: <input type="text" id="nameInput"/>
</form>
<div id="incognitoMsg">Note: you can't save incognito windows.</div>
<ul id="savedWindowList">
<li id="template">
<span class="text">Name</span><!--
<li id="template">
<span class="text">Name</span><!--
--><span class="delete">
&times;
&times;
</span><!--
--><span class="lock">

</span><!--
--><span class="undo">
undo
</span>
</li>
</ul>
<div class="manage">
<table>
<tr>
<td>
<input type="button" id="export" value="Export"></input>
</td>
<td>
<label for="import">Import</label>
<input id="import" type="file" value="Import"/>
</td>
</tr>
</table>
</div>
<div id="footer">
<span id="updated">
<img src="new.png" /> The extension has been updated (<a href="https://chrome.google.com/extensions/detail/fpfmklldfnlcblofkhdeoohfppdoejdc" target="_blank">details</a>)<br/>
If you like this extension, please <a href="https://chrome.google.com/extensions/detail/fpfmklldfnlcblofkhdeoohfppdoejdc" target="_blank">rate it</a>. Thanks!<br/>
<img src="new.png"/> The extension has been updated (<a
href="https://chrome.google.com/extensions/detail/fpfmklldfnlcblofkhdeoohfppdoejdc" target="_blank">details</a>)<br/>
If you like this extension, please <a
href="https://chrome.google.com/extensions/detail/fpfmklldfnlcblofkhdeoohfppdoejdc" target="_blank">rate it</a>. Thanks!<br/>
</span>
Bugs or suggestions? <a href="mailto:[email protected]" target="_blank">Contact me.</a>
</div>
Expand Down
Loading