PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 3.6.3
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v3.6.3
4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / assets / pdf / web / ep-scripts.js
embedpress / assets / pdf / web Last commit date
images 4 years ago locale 4 years ago ep-scripts.js 3 years ago viewer.css 3 years ago viewer.html 3 years ago viewer.js 4 years ago
ep-scripts.js
158 lines
1 "use strict";
2
3 //Create theme mode function
4 const setThemeMode = (themeMode) => {
5 const htmlEL = document.getElementsByTagName("html")[0];
6 if (htmlEL) {
7 htmlEL.setAttribute('ep-data-theme', themeMode);
8 }
9 }
10
11 const getParamObj = (hash) => {
12 let paramsObj = {};
13
14 if (location.hash) {
15 let hashParams = new URLSearchParams(hash.substring(1));
16
17 paramsObj = {
18 themeMode: hashParams.get('themeMode'),
19 presentation: hashParams.get('presentation'),
20 copy_text: hashParams.get('copy_text'),
21 position: hashParams.get('position'),
22 download: hashParams.get('download'),
23 toolbar: hashParams.get('toolbar'),
24 doc_details: hashParams.get('doc_details'),
25 doc_rotation: hashParams.get('doc_rotation')
26 }
27 }
28
29 return paramsObj;
30 }
31
32 const isDisplay = (selectorName) => {
33 if (selectorName == 'false' || selectorName == false) {
34 selectorName = 'none';
35 }
36 else {
37 selectorName = 'block';
38 }
39 return selectorName;
40 }
41
42
43 const pdfIframeStyle = (data) => {
44 let settingsPos = '';
45
46 if (data.toolbar === false || data.toolbar == 'false') {
47 data.presentation = false; data.download = true; data.copy_text = true; data.doc_details = false; data.doc_rotation = false;
48 }
49
50 let position = 'top';
51 let toolbar = isDisplay(data.toolbar);
52 let presentation = isDisplay(data.presentation);
53 let download = isDisplay(data.download);
54 let copy_text = isDisplay(data.copy_text);
55
56 if (copy_text === 'block' || copy_text == 'true' || copy_text == true) {
57 copy_text = 'all';
58 }
59
60 let doc_details = isDisplay(data.doc_details);
61 let doc_rotation = isDisplay(data.doc_rotation);
62
63 // console.log(position, toolbar, presentation, download, copy_text, doc_details, doc_rotation);
64
65 const otherhead = document.getElementsByTagName("head")[0];
66
67 // console.log(document.getElementsByTagName("head")[0]);
68
69 const style = document.createElement("style");
70 style.setAttribute('id', 'EBiframeStyleID');
71
72 if (data.position === 'top') {
73 position = 'top:0;bottom:auto;'
74 settingsPos = '';
75 }
76 else {
77 position = 'bottom:0;top:auto;'
78 settingsPos = `
79 .findbar, .secondaryToolbar {
80 top: auto;bottom: 32px;
81 }
82 .doorHangerRight:after{
83 transform: rotate(180deg);
84 bottom: -16px;
85 }
86 .doorHangerRight:before {
87 transform: rotate(180deg);
88 bottom: -18px;
89 }
90
91 .findbar.doorHanger:before {
92 bottom: -18px;
93 transform: rotate(180deg);
94 }
95 .findbar.doorHanger:after {
96 bottom: -16px;
97 transform: rotate(180deg);
98 }
99 `;
100 }
101
102 style.textContent = `
103 .toolbar{
104 display: ${toolbar}!important;
105 position: absolute;
106 ${position}
107 }
108 #secondaryToolbar{
109 display: ${toolbar};
110 }
111 #secondaryPresentationMode, #toolbarViewerRight #presentationMode{
112 display: ${presentation}!important;
113 }
114 #secondaryOpenFile, #toolbarViewerRight #openFile{
115 display: none!important;
116 }
117 #secondaryDownload, #secondaryPrint, #toolbarViewerRight #print, #toolbarViewerRight #download{
118 display: ${download}!important;
119 }
120 #pageRotateCw{
121 display: ${doc_rotation}!important;
122 }
123 #pageRotateCcw{
124 display: ${doc_rotation}!important;
125 }
126 #documentProperties{
127 display: ${doc_details}!important;
128 }
129 .textLayer{
130 user-select: ${copy_text}!important;
131 }
132 ${settingsPos}
133 `;
134
135 if (otherhead) {
136 if (document.getElementById("EBiframeStyleID")) {
137 document.getElementById("EBiframeStyleID").remove();
138 }
139 otherhead.appendChild(style);
140 }
141 }
142
143 const manupulatePDFIframe = (e) => {
144 let hashNewUrl = new URL(e.newURL);
145 let data = getParamObj(hashNewUrl.hash);
146 pdfIframeStyle(data);
147 setThemeMode(data.themeMode);
148 }
149
150 window.addEventListener('hashchange', (e) => {
151 manupulatePDFIframe(e);
152 }, false);
153
154
155 let data = getParamObj(location.hash);
156 pdfIframeStyle(data);
157 setThemeMode(data.themeMode);
158