viewerjs-rails 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/app/assets/javascripts/pdf.worker.js +85404 -39091
- data/app/assets/javascripts/viewerjs/ODFViewerPlugin.js +7 -6
- data/app/assets/javascripts/viewerjs/PDFViewerPlugin.js.erb +1 -1
- data/app/assets/javascripts/viewerjs/PluginLoader.js +0 -1
- data/app/assets/javascripts/viewerjs/compatibility.js +403 -383
- data/app/assets/javascripts/viewerjs/pdf.js +7202 -7216
- data/app/assets/javascripts/viewerjs/pdf_find_bar.js +135 -133
- data/app/assets/javascripts/viewerjs/pdf_find_controller.js +291 -289
- data/app/assets/javascripts/viewerjs/text_layer_builder.js +327 -327
- data/app/assets/javascripts/viewerjs/ui_utils.js +181 -181
- data/app/assets/javascripts/viewerjs/{viewer.js → viewer.js.erb} +19 -19
- data/app/assets/javascripts/viewerjs/webodf.js +11863 -606
- data/app/assets/stylesheets/ODFViewerPlugin.css.scss +1 -1
- data/app/assets/stylesheets/PDFViewerPlugin.css.scss +18 -13
- data/app/assets/stylesheets/example.local.css.scss +6 -12
- data/app/assets/stylesheets/viewer.css.scss +36 -36
- data/lib/viewerjs/rails/version.rb +1 -1
- data/lib/viewerjs/view_helpers.rb +63 -54
- metadata +2 -2
@@ -1,15 +1,15 @@
|
|
1
1
|
.page {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
margin: 7px auto 7px auto;
|
3
|
+
position: relative;
|
4
|
+
overflow: hidden;
|
5
|
+
background-clip: content-box;
|
6
|
+
background-color: white;
|
7
|
+
|
8
|
+
box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
|
9
|
+
-webkit-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
|
10
|
+
-moz-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
|
11
|
+
-ms-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
|
12
|
+
-o-box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.75);
|
13
13
|
}
|
14
14
|
|
15
15
|
.textLayer {
|
@@ -31,6 +31,11 @@
|
|
31
31
|
cursor: text;
|
32
32
|
}
|
33
33
|
|
34
|
-
::selection {
|
35
|
-
|
34
|
+
::selection {
|
35
|
+
background: rgba(0, 0, 255, 0.3);
|
36
|
+
}
|
37
|
+
|
38
|
+
::-moz-selection {
|
39
|
+
background: rgba(0, 0, 255, 0.3);
|
40
|
+
}
|
36
41
|
|
@@ -5,23 +5,17 @@
|
|
5
5
|
@font-face {
|
6
6
|
font-family: 'Novecentowide Book';
|
7
7
|
src: url("/ViewerJS/fonts/Novecentowide-Bold-webfont.eot");
|
8
|
-
src: url("/ViewerJS/fonts/Novecentowide-Bold-webfont.eot?#iefix") format("embedded-opentype"),
|
9
|
-
url("/ViewerJS/fonts/Novecentowide-Bold-webfont.woff") format("woff"),
|
10
|
-
url("/fonts/Novecentowide-Bold-webfont.ttf") format("truetype"),
|
11
|
-
url("/fonts/Novecentowide-Bold-webfont.svg#NovecentowideBookBold") format("svg");
|
8
|
+
src: url("/ViewerJS/fonts/Novecentowide-Bold-webfont.eot?#iefix") format("embedded-opentype"), url("/ViewerJS/fonts/Novecentowide-Bold-webfont.woff") format("woff"), url("/fonts/Novecentowide-Bold-webfont.ttf") format("truetype"), url("/fonts/Novecentowide-Bold-webfont.svg#NovecentowideBookBold") format("svg");
|
12
9
|
font-weight: normal;
|
13
10
|
font-style: normal;
|
14
11
|
}
|
15
12
|
|
16
13
|
@font-face {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
url('/ViewerJS/fonts/Exotica-webfont.svg#exoticamedium') format('svg');
|
23
|
-
font-weight: normal;
|
24
|
-
font-style: normal;
|
14
|
+
font-family: 'exotica';
|
15
|
+
src: url('/ViewerJS/fonts/Exotica-webfont.eot');
|
16
|
+
src: url('/ViewerJS/fonts/Exotica-webfont.eot?#iefix') format('embedded-opentype'), url('/ViewerJS/fonts/Exotica-webfont.woff') format('woff'), url('/ViewerJS/fonts/Exotica-webfont.ttf') format('truetype'), url('/ViewerJS/fonts/Exotica-webfont.svg#exoticamedium') format('svg');
|
17
|
+
font-weight: normal;
|
18
|
+
font-style: normal;
|
25
19
|
|
26
20
|
}
|
27
21
|
|
@@ -126,81 +126,81 @@ select {
|
|
126
126
|
visibility: hidden;
|
127
127
|
}
|
128
128
|
|
129
|
-
|
129
|
+
div[dir='ltr'] #toolbarLeft {
|
130
130
|
margin-left: -1px;
|
131
131
|
}
|
132
132
|
|
133
|
-
|
133
|
+
div[dir='rtl'] #toolbarRight {
|
134
134
|
margin-left: -1px;
|
135
135
|
}
|
136
136
|
|
137
|
-
|
138
|
-
|
137
|
+
div[dir='ltr'] #toolbarLeft,
|
138
|
+
div[dir='rtl'] #toolbarRight {
|
139
139
|
position: absolute;
|
140
140
|
top: 0;
|
141
141
|
left: 0;
|
142
142
|
}
|
143
143
|
|
144
|
-
|
145
|
-
|
144
|
+
div[dir='ltr'] #toolbarRight,
|
145
|
+
div[dir='rtl'] #toolbarLeft {
|
146
146
|
position: absolute;
|
147
147
|
top: 0;
|
148
148
|
right: 0;
|
149
149
|
}
|
150
150
|
|
151
|
-
|
152
|
-
|
153
|
-
|
151
|
+
div[dir='ltr'] #toolbarLeft > *,
|
152
|
+
div[dir='ltr'] #toolbarMiddle > *,
|
153
|
+
div[dir='ltr'] #toolbarRight > * {
|
154
154
|
float: left;
|
155
155
|
}
|
156
156
|
|
157
|
-
|
158
|
-
|
159
|
-
|
157
|
+
div[dir='rtl'] #toolbarLeft > *,
|
158
|
+
div[dir='rtl'] #toolbarMiddle > *,
|
159
|
+
div[dir='rtl'] #toolbarRight > * {
|
160
160
|
float: right;
|
161
161
|
}
|
162
162
|
|
163
163
|
/* outer/inner center provides horizontal center */
|
164
|
-
|
164
|
+
div[dir='ltr'] .outerCenter {
|
165
165
|
float: right;
|
166
166
|
position: relative;
|
167
167
|
right: 50%;
|
168
168
|
}
|
169
169
|
|
170
|
-
|
170
|
+
div[dir='rtl'] .outerCenter {
|
171
171
|
float: left;
|
172
172
|
position: relative;
|
173
173
|
left: 50%;
|
174
174
|
}
|
175
175
|
|
176
|
-
|
176
|
+
div[dir='ltr'] .innerCenter {
|
177
177
|
float: right;
|
178
178
|
position: relative;
|
179
179
|
right: -50%;
|
180
180
|
}
|
181
181
|
|
182
|
-
|
182
|
+
div[dir='rtl'] .innerCenter {
|
183
183
|
float: left;
|
184
184
|
position: relative;
|
185
185
|
left: -50%;
|
186
186
|
}
|
187
187
|
|
188
|
-
|
188
|
+
div[dir='ltr'] .splitToolbarButton {
|
189
189
|
margin: 3px 2px 4px 0;
|
190
190
|
display: inline-block;
|
191
191
|
}
|
192
192
|
|
193
|
-
|
193
|
+
div[dir='rtl'] .splitToolbarButton {
|
194
194
|
margin: 3px 0 4px 2px;
|
195
195
|
display: inline-block;
|
196
196
|
}
|
197
197
|
|
198
|
-
|
198
|
+
div[dir='ltr'] .splitToolbarButton > .toolbarButton {
|
199
199
|
border-radius: 0;
|
200
200
|
float: left;
|
201
201
|
}
|
202
202
|
|
203
|
-
|
203
|
+
div[dir='rtl'] .splitToolbarButton > .toolbarButton {
|
204
204
|
border-radius: 0;
|
205
205
|
float: right;
|
206
206
|
}
|
@@ -218,13 +218,13 @@ html[dir='rtl'] .splitToolbarButton > .toolbarButton {
|
|
218
218
|
background-image: none;
|
219
219
|
}
|
220
220
|
|
221
|
-
|
222
|
-
|
221
|
+
div[dir='ltr'] .toolbarButton,
|
222
|
+
div[dir='ltr'] .dropdownToolbarButton {
|
223
223
|
margin: 3px 2px 4px 0;
|
224
224
|
}
|
225
225
|
|
226
|
-
|
227
|
-
|
226
|
+
div[dir='rtl'] .toolbarButton,
|
227
|
+
div[dir='rtl'] .dropdownToolbarButton {
|
228
228
|
margin: 3px 0 4px 2px;
|
229
229
|
}
|
230
230
|
|
@@ -374,13 +374,13 @@ html[dir='rtl'] .dropdownToolbarButton {
|
|
374
374
|
transition-timing-function: ease;
|
375
375
|
}
|
376
376
|
|
377
|
-
|
378
|
-
|
377
|
+
div[dir='ltr'] .toolbarButton,
|
378
|
+
div[dir='ltr'] .dropdownToolbarButton {
|
379
379
|
margin: 3px 2px 4px 0;
|
380
380
|
}
|
381
381
|
|
382
|
-
|
383
|
-
|
382
|
+
div[dir='rtl'] .toolbarButton,
|
383
|
+
div[dir='rtl'] .dropdownToolbarButton {
|
384
384
|
margin: 3px 0 4px 2px;
|
385
385
|
}
|
386
386
|
|
@@ -413,8 +413,8 @@ html[dir='rtl'] .dropdownToolbarButton {
|
|
413
413
|
box-shadow: 0 1px 1px hsla(0, 0%, 0%, .2) inset, 0 0 1px hsla(0, 0%, 0%, .3) inset, 0 1px 0 hsla(0, 0%, 100%, .05);
|
414
414
|
}
|
415
415
|
|
416
|
-
|
417
|
-
|
416
|
+
div[dir='ltr'] .splitToolbarButton > .toolbarButton:first-child,
|
417
|
+
div[dir='rtl'] .splitToolbarButton > .toolbarButton:last-child {
|
418
418
|
position: relative;
|
419
419
|
margin: 0;
|
420
420
|
margin-left: 4px;
|
@@ -424,8 +424,8 @@ html[dir='rtl'] .splitToolbarButton > .toolbarButton:last-child {
|
|
424
424
|
border-right-color: transparent;
|
425
425
|
}
|
426
426
|
|
427
|
-
|
428
|
-
|
427
|
+
div[dir='ltr'] .splitToolbarButton > .toolbarButton:last-child,
|
428
|
+
div[dir='rtl'] .splitToolbarButton > .toolbarButton:first-child {
|
429
429
|
position: relative;
|
430
430
|
margin: 0;
|
431
431
|
margin-left: -1px;
|
@@ -444,11 +444,11 @@ html[dir='rtl'] .splitToolbarButton > .toolbarButton:first-child {
|
|
444
444
|
margin: 5px 0;
|
445
445
|
}
|
446
446
|
|
447
|
-
|
447
|
+
div[dir='ltr'] .splitToolbarButtonSeparator {
|
448
448
|
float: left;
|
449
449
|
}
|
450
450
|
|
451
|
-
|
451
|
+
div[dir='rtl'] .splitToolbarButtonSeparator {
|
452
452
|
float: right;
|
453
453
|
}
|
454
454
|
|
@@ -480,11 +480,11 @@ html[dir='rtl'] .splitToolbarButtonSeparator {
|
|
480
480
|
border-bottom: 1px rgba(255, 255, 255, .5) solid;
|
481
481
|
}
|
482
482
|
|
483
|
-
|
483
|
+
div[dir='ltr'] .dropdownToolbarButton {
|
484
484
|
background-position: 95%;
|
485
485
|
}
|
486
486
|
|
487
|
-
|
487
|
+
div[dir='rtl'] .dropdownToolbarButton {
|
488
488
|
background-position: 5%;
|
489
489
|
}
|
490
490
|
|
@@ -1,74 +1,83 @@
|
|
1
1
|
module Viewerjs
|
2
2
|
module ViewHelpers
|
3
|
-
|
3
|
+
|
4
|
+
#options = {
|
5
|
+
# viewer_alignment: 'right', #Possible values 'right' or 'left'
|
6
|
+
# title: nil #If nothing or nil is provided then referred document(with extension) is used in viewer's header title else the given title)
|
7
|
+
# }
|
8
|
+
def viewerjs_viewer(options = {viewer_alignment: 'right', title: nil})
|
9
|
+
|
10
|
+
options[:viewer_alignment] = (['right', 'left'].include?(options[:viewer_alignment]) ? options[:viewer_alignment] : 'left')
|
4
11
|
_viewer = <<-EOM
|
5
|
-
<div
|
6
|
-
<div id="
|
7
|
-
<div id="
|
8
|
-
|
9
|
-
<
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
</div>
|
14
|
-
<div id="toolbarContainer">
|
15
|
-
<div id="toolbar">
|
16
|
-
<div id="toolbarLeft">
|
17
|
-
<div id="navButtons" class="splitToolbarButton">
|
18
|
-
<button id="previous" class="toolbarButton pageUp" title="Previous Page"></button>
|
19
|
-
<div class="splitToolbarButtonSeparator"></div>
|
20
|
-
<button id="next" class="toolbarButton pageDown" title="Next Page"></button>
|
21
|
-
</div>
|
22
|
-
<label id="pageNumberLabel" class="toolbarLabel" for="pageNumber">Page:</label>
|
23
|
-
<input type="number" id="pageNumber" class="toolbarField pageNumber"/>
|
24
|
-
<span id="numPages" class="toolbarLabel"></span>
|
12
|
+
<div dir="#{{'right' => 'rtl', 'left' => 'ltr'}[options[:viewer_alignment]]}">
|
13
|
+
<div id="viewer">
|
14
|
+
<div id="titlebar">
|
15
|
+
<div id="documentName"></div>
|
16
|
+
<div id="toolbarRight">
|
17
|
+
<button id="presentation" class="toolbarButton presentation" title="Presentation"></button>
|
18
|
+
<button id="fullscreen" class="toolbarButton fullscreen" title="Fullscreen"></button>
|
19
|
+
<button id="download" class="toolbarButton download" title="Download"></button>
|
25
20
|
</div>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
</div>
|
22
|
+
<div id="toolbarContainer">
|
23
|
+
<div id="toolbar">
|
24
|
+
<div id="toolbarLeft">
|
25
|
+
<div id="navButtons" class="splitToolbarButton">
|
26
|
+
<button id="previous" class="toolbarButton pageUp" title="Previous Page"></button>
|
30
27
|
<div class="splitToolbarButtonSeparator"></div>
|
31
|
-
<button id="
|
28
|
+
<button id="next" class="toolbarButton pageDown" title="Next Page"></button>
|
32
29
|
</div>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
30
|
+
<label id="pageNumberLabel" class="toolbarLabel" for="pageNumber">Page:</label>
|
31
|
+
<input type="number" id="pageNumber" class="toolbarField pageNumber"/>
|
32
|
+
<span id="numPages" class="toolbarLabel"></span>
|
33
|
+
</div>
|
34
|
+
<div id="toolbarMiddleContainer" class="outerCenter">
|
35
|
+
<div id="toolbarMiddle" class="innerCenter">
|
36
|
+
<div id='zoomButtons' class="splitToolbarButton">
|
37
|
+
<button id="zoomOut" class="toolbarButton zoomOut" title="Zoom Out"></button>
|
38
|
+
<div class="splitToolbarButtonSeparator"></div>
|
39
|
+
<button id="zoomIn" class="toolbarButton zoomIn" title="Zoom In"></button>
|
40
|
+
</div>
|
41
|
+
<span id="scaleSelectContainer" class="dropdownToolbarButton">
|
42
|
+
<select id="scaleSelect" title="Zoom" oncontextmenu="return false;">
|
43
|
+
<option id="pageAutoOption" value="auto" selected>Automatic</option>
|
44
|
+
<option id="pageActualOption" value="page-actual">Actual Size</option>
|
45
|
+
<option id="pageWidthOption" value="page-width">Full Width</option>
|
46
|
+
<option id="customScaleOption" value="custom"></option>
|
47
|
+
<option value="0.5">50%</option>
|
48
|
+
<option value="0.75">75%</option>
|
49
|
+
<option value="1">100%</option>
|
50
|
+
<option value="1.25">125%</option>
|
51
|
+
<option value="1.5">150%</option>
|
52
|
+
<option value="2">200%</option>
|
53
|
+
</select>
|
54
|
+
</span>
|
47
55
|
|
48
|
-
|
49
|
-
|
56
|
+
<div id="sliderContainer">
|
57
|
+
<div id="slider"></div>
|
58
|
+
</div>
|
50
59
|
</div>
|
51
60
|
</div>
|
52
61
|
</div>
|
53
62
|
</div>
|
63
|
+
<div id="canvasContainer">
|
64
|
+
<div id="canvas"></div>
|
65
|
+
</div>
|
66
|
+
<div id="overlayNavigator">
|
67
|
+
<div id="previousPage"></div>
|
68
|
+
<div id="nextPage"></div>
|
69
|
+
</div>
|
70
|
+
<div id="overlayCloseButton">
|
71
|
+
✖
|
72
|
+
</div>
|
73
|
+
<div id="dialogOverlay"></div>
|
54
74
|
</div>
|
55
|
-
<div id="canvasContainer">
|
56
|
-
<div id="canvas"></div>
|
57
|
-
</div>
|
58
|
-
<div id="overlayNavigator">
|
59
|
-
<div id="previousPage"></div>
|
60
|
-
<div id="nextPage"></div>
|
61
|
-
</div>
|
62
|
-
<div id="overlayCloseButton">
|
63
|
-
✖
|
64
|
-
</div>
|
65
|
-
<div id="dialogOverlay"></div>
|
66
75
|
</div>
|
67
76
|
<script>
|
77
|
+
var _document_title = "#{options[:title].blank? ? '' : options[:title]}";
|
68
78
|
loadDocument(window.location.hash);
|
69
79
|
</script>
|
70
80
|
EOM
|
71
|
-
|
72
81
|
raw(_viewer)
|
73
82
|
end
|
74
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viewerjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Praveen Kumar Sinha
|
@@ -74,7 +74,7 @@ files:
|
|
74
74
|
- app/assets/javascripts/viewerjs/pdfjsversion.js
|
75
75
|
- app/assets/javascripts/viewerjs/text_layer_builder.js
|
76
76
|
- app/assets/javascripts/viewerjs/ui_utils.js
|
77
|
-
- app/assets/javascripts/viewerjs/viewer.js
|
77
|
+
- app/assets/javascripts/viewerjs/viewer.js.erb
|
78
78
|
- app/assets/javascripts/viewerjs/webodf.js
|
79
79
|
- app/assets/javascripts/viewerjs_rails.js
|
80
80
|
- app/assets/stylesheets/ODFViewerPlugin.css.scss
|