-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.html
236 lines (222 loc) · 7.69 KB
/
options.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE HTML>
<html>
<head>
<title>Store My Tabs</title>
<link rel="stylesheet" type="text/css" href="css/vader/jquery-ui-1.8.18.custom.css" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<style type="text/css" media="screen">
html, body {
background: #000;
color:white;
}
body {
font-family: Geneva, "MS Sans Serif", sans-serif;
color:white;
}
h2 { margin: 0; color:white;}
#container {
border: 0px solid #fff;
min-height: 500px;
margin: 10px auto;
padding: 15px 15px;
background: black;
width: 910px;
overflow: hidden;
}
/* button
---------------------------------------------- */
.button {
display: inline-block;
zoom: 1; /* zoom and *display = ie7 hack for display:inline-block */
*display: inline;
vertical-align: baseline;
margin: 0 2px;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
padding: .5em 2em .55em;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.button:hover {
text-decoration: none;
}
.button:active {
position: relative;
top: 1px;
}
/* gray */
.gray {
color: #e9e9e9;
border: solid 1px #555;
background: #6e6e6e;
background: -webkit-gradient(linear, left top, left bottom, from(#888), to(#575757));
background: -moz-linear-gradient(top, #888, #575757);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#888888', endColorstr='#575757');
}
.gray:hover {
background: #616161;
background: -webkit-gradient(linear, left top, left bottom, from(#757575), to(#4b4b4b));
background: -moz-linear-gradient(top, #757575, #4b4b4b);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#4b4b4b');
}
.gray:active {
color: #afafaf;
background: -webkit-gradient(linear, left top, left bottom, from(#575757), to(#888));
background: -moz-linear-gradient(top, #575757, #888);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#575757', endColorstr='#888888');
}
.tableLink { width: 100%; border-spacing:5;}
.tableLink a { color: #fff; }
.tableLink tr td#tableUrl a:hover { color: gray; }
/*.tableLink tr:nth-child(2n) td#tableUrl { background: #000; }*/
.tableLink td { padding: 1px 4px 1px 4px; }
.delete { text-decoration:none ; color: #fff }
#restore {font-size: 75%;color:#fff;}
.tableLink a:hover { color: #fff }
.date { width: 80px; font-size: 90%; color: #777}
#clearAll {
margin-top: 10px;
float: right; display: block;
font-size: 80%;
padding: 10px 15px}
</style>
</head>
<script type="text/javascript">
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
function bk_clear(link) {
var links = JSON.parse(localStorage['savedLinks']);
links.remove(link);
localStorage.setItem('savedLinks', JSON.stringify(links));
window.location.reload();
}
function restore(link) {
var links = JSON.parse(localStorage['savedLinks']);
var url = links[link].url;
links.remove(link);
localStorage.setItem('savedLinks', JSON.stringify(links));
window.location.reload();
chrome.tabs.create({
url: url,
active: false
});
}
function clearAll() {
var $dialog = $('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>')
.dialog({
resizable: false,
height:240,
width: 560,
modal: true,
buttons: {
"Delete all items": function() {
$( this ).dialog( "close" );
localStorage.setItem('savedLinks', JSON.stringify([]));
window.location.reload();
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
$dialog.dialog('open');
}
function saveFile(link) {
var url = links[link].url;
chrome.tabs.create({
url: url
});
}
function loadOptions() {
var links = JSON.parse(localStorage['savedLinks']);
var options = JSON.parse(localStorage['options']);
var NB_NEW_LINKS = 5;
if (!links || links.length == 0) { return; }
for (var i = links.length - 1; i >= 0; i--) {
var tableIdName = "tableLinkNew";
if ( links.length > NB_NEW_LINKS && i < links.length - NB_NEW_LINKS ) {
tableIdName = "tableLinkOld";
}
$('#'+tableIdName+' > tbody').append('<tr></tr>');
var date = new Date(links[i].date);
var date = date.getDate()+"-"+(date.getMonth()+1)+"-"+date.getFullYear();
$('#'+tableIdName+' tr:last').append('<td width="100px"><a href="" target="_blank" id="restore" class="button gray" onclick=\'restore('+i+');return false;\'>Restore</a></td>');
$('#'+tableIdName+' tr:last td:last').after('<td width="100px"><p class="date">'+date+'</p></td>');
if (options.faviconDisabled) {
$('#'+tableIdName+' tr:last').append('<td><img class="image" src="'+links[i].favicon+'", width="16" height="16"</td>');
} else {
}
$('#'+tableIdName+' tr:last td:last').after('<td id="tableUrl"><a href="'+links[i].url+'" target="_blank">'+links[i].title +'</a></td>');
$('#'+tableIdName+' tr:last').append('<td><a class="delete" href="" onclick=\'bk_clear('+i+');return false;\'>\u00D7</a></td>');
$('#plainText').append(links[i].url+'<br/>');
}
};
$(document).ready(function() {
var links = JSON.parse(localStorage['savedLinks']);
var options = JSON.parse(localStorage['options']);
if (!options) { var options = {}; }
if (!links || links.length == 0) {
$('#clearAll').hide();
}
$( "#check" ).button();
$('#check').prop("checked",!options.faviconDisabled).button("refresh");
var faviconDisabled = options.faviconDisabled;
$('#check').click (function () {
var thisCheck = $(this);
if (thisCheck.is (':checked')) {
options.faviconDisabled = false;
} else {
options.faviconDisabled = true;
}
localStorage.setItem('options', JSON.stringify(options));
});
loadOptions();
$( "#tabs" ).tabs({
event: "mouseover"
});
$( "#container" ).resizable();
});
</script>
<body>
<div id='container'>
<div id="tabs">
<ul>
<li><a href="#tabs-1">New</a></li>
<li><a href="#tabs-2">Old</a></li>
<li><a href="#tabs-3">Text</a></li>
<li><a href="#tabs-4">Options</a></li>
</ul>
<div id="tabs-1">
<table id="tableLinkNew" class="tableLink">
<tbody></tbody>
</table>
</div>
<div id="tabs-2">
<table id="tableLinkOld" class="tableLink">
<tbody></tbody>
</table>
</div>
<div id="tabs-3">
<p id="plainText"></p>
</div>
<div id="tabs-4">
<input type="checkbox" id="check" /><label for="check">Display Favicon</label>
</div>
</div>
<a href='' id='clearAll' class='button gray' onclick='clearAll();return false'>Clear All</a>
</div>
</body>
</html>