forked from dexterouslogic/super-simple-highlighter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.html
executable file
·273 lines (235 loc) · 12.1 KB
/
popup.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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<!DOCTYPE html>
<html ng-app="popupApp" ng-csp>
<head lang="en" >
<meta charset="UTF-8">
<link href="static/css/angular-csp.css" rel="stylesheet">
<link href="static/css/bootstrap.min.css" rel="stylesheet">
<link href="css/popup.css" rel="stylesheet">
<!-- <link href='http://fonts.googleapis.com/css?family=Roboto:400italic,400,300,600' rel='stylesheet' type='text/css'> -->
<script src="static/js/jquery-2.1.3.min.js"></script>
<script src="static/js/jquery.stylesheet.min.js"></script>
<script src="static/js/angular.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/purl.min.js"></script>
<script src="js/storage.js"></script>
<script src="js/stylesheet.js"></script>
<script src="js/string_utils.js"></script>
<script src="js/popup/app.js"></script>
<script src="js/popup/controllers.js"></script>
<script src="js/i18n_filters.js"></script>
</head>
<body>
<div style="min-height: 140px" class="container" ng-controller="DocumentsController">
<!--Top (not nav) http://stackoverflow.com/questions/20547819/vertical-align-with-bootstrap-3-->
<!--Header-->
<div class="row">
<div class="col-xs-5 vcenter" style="margin: 10px 0">
<h6 class="title">
{{manifest.name}}
</h6>
<!-- <span class="badge">{{docs.length}}</span> -->
<div class="dropdown" style="display: inline">
<a href="" class="dropdown-toggle caret" id="dropdownMenu1" data-toggle="dropdown"></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation">
<a role="menuitem" tabindex="-1" href="" ng-click="onClickUndoLastHighlight()">
<span class="glyphicon glyphicon-arrow-left"></span>
{{'undo' | i18n}}
<!--hotkey-->
<kbd ng-show="{{commands.undo_last_create_highlight.shortcut}}">
{{commands.undo_last_create_highlight.shortcut}}
</kbd>
</a>
</li>
<li role="presentation" class="divider"></li>
<li class="dropdown-header">{{'overview_page_title_prefix' | i18n}}</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="" ng-click="onClickOpenOverviewInNewTab()">
<span class="glyphicon glyphicon-list-alt"></span>
{{'open_overview_in_new_tab' | i18n}}
</a>
</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href=""
ng-click="onClickSaveOverview((docs | filter:search | filter:styleFilterPredicate))">
<span class="glyphicon glyphicon-save"></span>
{{'save_overview' | i18n}}
</a>
</li>
<li role="presentation" >
<a role="menuitem" tabindex="-1" href="" ng-click="onClickCopyOverview((docs | filter:search | filter:styleFilterPredicate))">
<span class="glyphicon glyphicon-copy"></span>
{{'copy_overview' | i18n}}
<!--hotkey-->
<kbd ng-show="{{commands.copy_overview.shortcut}}">
{{commands.copy_overview.shortcut}}
</kbd>
</a>
</li>
<li role="presentation" class="divider"></li>
<li role="presentation">
<a href="" role="menuitem" tabindex="-1" data-toggle="modal" data-target=".bs-example-modal-sm">
<span class="glyphicon glyphicon-remove"></span>
<span class="text-danger">{{'remove_all_highlights' | i18n}}</span>
</a>
</li>
</ul>
</div>
<!-- Count of number of documents (highlights) and number of docs actually shown -->
<div ng-hide="styleFilterHighlightDefinition == null && (search == null || search.text.length == 0)">
<small>{{filteredDocs.length}} / {{docs.length}}</small>
</div>
</div><div class="col-xs-3 vcenter">
<!-- <label for="sel1">Sort By</label> -->
<select class="form-control input-sm" id="sel1"
ng-model="sort.value" ng-change="onChangeSelectSort()">
<option value="time">{{'sort_by_time' | i18n}}</option>
<option value="location">{{'sort_by_location' | i18n}}</option>
</select>
</div><div class="col-xs-3 vcenter" style="padding-left: 0px;">
<input type="search" class="form-control input-sm search" ng-model="search.text"
placeholder="{{'placeholder_filter' | i18n}}">
</div><div class="col-xs-1 vcenter">
<div class="dropdown pull-right" style="display: inline">
<button class="btn btn-sm btn-default" type="button" id="dropdownMenu3" data-toggle="dropdown" aria-expanded="true"
ng-class="styleFilterHighlightDefinition.className"
style="box-shadow: none"
title="{{'title_filter_style' | i18n}}">
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
</button>
<!-- <a href="" class="dropdown-toggle caret" id="dropdownMenu3" data-toggle="dropdown"></a> -->
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="dropdownMenu3">
<li role="presentation" class="dropdown-header">{{'visible_style' | i18n}}</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="" ng-click="onClickStyleFilter($event, null)">
{{'visible_stylename_all' | i18n}}
<span ng-hide="styleFilterHighlightDefinition != null" class="glyphicon glyphicon-ok" aria-hidden="true"></span>
</a>
</li>
<li role="presentation" class="divider"></li>
<li ng-repeat="d in highlightDefinitions" role="presentation">
<!-- Index - title -->
<a role="menuitem" tabindex="-1" href="" ng-click="onClickStyleFilter($event, d)">
<span class="redefinition-well-sm {{highlightClassName}} {{d.className}}">{{$index + 1}}</span>
<span>{{d.title}}</span>
<span ng-hide="styleFilterHighlightDefinition.className != d.className" class="glyphicon glyphicon-ok" aria-hidden="true"></span>
</a>
</li>
</ul>
</div>
</div>
</div>
<!-- Confirmation dialog for 'remove all highlights' -->
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body">
<p>{{'confirm_remove_all_highlights' | i18n}}</p>
</div>
<!-- Add styles to footer to remove top border and padding, making it more likely to fit into the popup without clipping -->
<div class="modal-footer" style="padding-top: 0px; border-top: 0px;">
<button type="button" class="btn btn-default" data-dismiss="modal">{{'close' | i18n}}</button>
<button type="button" class="btn btn-danger" data-ng-click="onClickRemoveAllHighlights()">
{{'remove_all_highlights' | i18n}}
</button>
</div>
</div>
</div>
</div>
<!-- optional file protocol warning. Only show if url protocol is 'file' -->
<div class="row" ng-show="fileAccessRequiredWarningVisible">
<div class="col-xs-12">
<div id="file-access-required-alert" class="alert alert-warning" role="alert">
<!-- <button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
-->
<small>
{{'warning_file_access_required' | i18n}}
</small>
<button type="button" class="btn btn-warning btn-sm btn-block" data-dismiss="alert"
ng-click="onClickDismissFileAccessRequiredWarning()">
{{'ok_got_it' | i18n}}
</button>
</div>
</div>
</div>
<!--List-->
<ul class="list-unstyled">
<!--http://stackoverflow.com/questions/13813254/how-do-i-conditionally-apply-css-styles-in-angularjs-->
<!--isInDOM defaults to undefined-->
<li ng-repeat="doc in filteredDocs = (docs | filter:search | filter:styleFilterPredicate)"
id="{{doc._id}}"
class="doc" ng-class="{'not-in-dom': doc.isInDOM === false}"
ng-mouseenter="doc.hover=true" ng-mouseleave="doc.hover=false">
<!--Text and floating button-->
<div class="highlight {{doc.className}} highlight-text-container pointer"
ng-click="onClickHighlight(doc)">
<!--Delete Button-->
<button type="button" class="close" title="Remove Highlight"
ng-click="onClickRemoveHighlight($event, doc._id)">
<span aria-hidden="true">×</span>
<span class="sr-only"> {{ 'close' | i18n }}</span>
</button>
<!--text-->
<span class="highlight-text">{{doc.text.substring(0, popupHighlightTextMaxLength)}}<span
ng-show="doc.text.length > popupHighlightTextMaxLength">…
<a href="" class="more"
data-ng-click="onClickMore($event, doc)">
{{ 'more' | i18n }}
</a>
</span>
</span>
</div>
<!--InfoBar-->
<div class="actions">
<span class="date">{{ doc.date | date:'medium' }}</span>
<!--Only show these if hovering-->
<span ng-show="doc.hover">
<!--Copy-->
<a href="" ng-click="onClickCopy(doc._id)" title="{{ 'tooltip_copy_highlight' | i18n }}">
{{'copy_highlight_text' | i18n}}
</a>
<span class="separator"> // </span>
<!--Select-->
<a href="" ng-click="onClickSelect(doc)" title="{{ 'tooltip_select_highlight' | i18n }}"
class="select">
{{'select_highlight_text' | i18n}}
</a>
<span class="separator"> // </span>
<!--Speak-->
<a href="" ng-click="onClickSpeak(doc._id)" title="{{ 'tooltip_speak_highlight' | i18n }}">
{{'speak_highlight_text' | i18n}}
</a>
<!-- Definition -->
<div class="dropdown pull-right" style="display: inline">
<a href="" class="dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown">
{{'redefine_highlight' | i18n}}
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="dropdownMenu2">
<li ng-repeat="d in highlightDefinitions" role="presentation">
<!-- Index - title -->
<a role="menuitem" tabindex="-1" href="" ng-click="onClickRedefinition($event, doc, $index)">
<span class="redefinition-well-sm {{highlightClassName}} {{d.className}}">{{$index + 1}}</span>
<span>{{d.title}}</span>
<span ng-hide="doc.className != d.className" class="glyphicon glyphicon-ok" aria-hidden="true"></span>
</a>
</li>
</ul>
</div>
</span>
</div>
</li>
</ul>
<!--Remove All-->
<!--
<button id="remove-all" class="btn btn-danger pull-right" ng-click="onClickRemoveAll(doc.match)"
title="Remove every highlight from the page">
<span class="glyphicon glyphicon-remove" style="vertical-align: text-top"></span> Remove All
</button>
-->
</div>
</body>
</html>