-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
323 lines (282 loc) · 13.4 KB
/
index.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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sales Navigation</title>
<link rel="stylesheet" href="index.css">
<link rel="icon" type="image/x-icon" href="SaleNav.ico">
<script src="opencv.js" async></script>
<script src="https://cdn.jsdelivr.net/npm/tesseract.js@2.1.1/dist/tesseract.min.js"></script>
</head>
<body>
<div id="PopUpBox"></div>
<div class="InfoBtn" id="inactiveBtn" onclick="DisplayInfo()">i</div>
<span id="offWindowBtn" style="display: none;" onclick="DisplayInfo()"></span>
<section id="InfoDisplay" style="display: none;">
<!--INFO DISPLAY-->
<div id="InfoDisHead">
<h2>Sales Navigation Manual</h2>
</div>
<div id="InfoDisText">
<div class="InfoContent" id="info_content_second" onmouseover="DisplayVisual(1)">
<h3>The basics</h3>
<p>
Select the contacts you want to convert. Make sure the Fullname and the in function time is contained in the selection.
Copy it and paste it this website. Click the convert button and you're ready to go.
</p>
</div>
<div class="InfoContent" id="info_content_fourth" onmouseover="DisplayVisual(2)">
<h3>Auto-convert</h3>
<p>
By double-clicking on the convert button you change to auto-convert modus.
<br><br>
When enableing this modus, you'll only have to paste your data into this website and it'll automatically convert it and copy it for you.
Eliminating the convert button press to convert your copied data.
</p>
</div>
<div class="InfoContent" id="info_content_fourth" onmouseover="DisplayVisual(3)">
<h3>Set page theme</h3>
<p>
You can change your color mode by double-clicking on the title of the page
</p>
</div>
</div>
<div id="InfoDisVis">
<div id="InfoBasics">
<div id="BasicsSingle"></div>
<div id="BasicsAll"></div>
</div>
</div>
</section>
<!--INFO DISPLAY-->
<h1 id="LightModus" onclick="changeLightModus('dark')">Sales Navigation</h1> <!-- ScrnSafe -->
<a id="feedback" href="https://forms.office.com/e/F7rc13nynL" target="_blank">Click me to give feedback. For when the website does not work or for other feedback.</a>
<section id="TextModus">
<textarea id="TextInputArea" onclick="eraseText()" ondblclick="eraseText(true)"> Ctrl + v</textarea>
</section>
<section id="Controls">
<button id="CnvrtBtn" onclick="conversionText()" ondblclick="conversionAutomate('automate')">Convert</button>
<span>Job filtering: <input type="checkbox" id="JobFiltering"/></span>
</section>
</body>
</html>
<script>
let ScrnShotCounter = 0;
let counter = false;
let TextAreaClickCount = 0;
let AutomateStatus = false;
let OldTextDuplicate;
const JobTitles = ['manager','managing','directeur','director','ceo','cfo','chief','head','hoofd','founder','cto'];
//CHECK IF BROWSER COLOR SCHEME IS SET TO DARK: IF SO SET WEBPAGE COLOR SCHEME ALSO TO BLACK
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
changeLightModus('dark');
}
let v_count = 0;
let p_count = 0;
window.addEventListener("paste", function (e) {
if (!e.clipboardData) {
console.error('Clipboard data is not available.');
return;
}
const items = e.clipboardData.items;
if (items.length >= 1 && items[0].type === 'text/plain') {
v_count++;
items[0].getAsString(function (str) {
p_count++;
document.getElementById('TextInputArea').value = str;
checkDublicateText(str);
if (AutomateStatus) {
conversionText();
checkDublicateText(str);
}
});
} else {
PopUpWindow('Pasted content is not plain text or is empty.');
eraseText(true);
}
});
function checkDublicateText(InputText){
if ((OldTextDuplicate != "") && InputText == OldTextDuplicate){
document.getElementById('TextInputArea').style.setProperty("color", 'red');
}else{
document.getElementById('TextInputArea').style.setProperty("color", 'var(--col-txt)');
}
OldTextDuplicate = InputText;
}
function eraseText(OverRide = false) {
if (TextAreaClickCount == 0 || OverRide) {
document.getElementById('TextInputArea').value = '';
}
TextAreaClickCount++;
}
function conversionAutomate(modus){
const CnvrtBtn = document.getElementById('CnvrtBtn');
switch(modus){
case 'manual':
CnvrtBtn.setAttribute("ondblclick", "conversionAutomate('automate')");
CnvrtBtn.setAttribute("onclick", "conversionText()");
document.getElementById('CnvrtBtn').innerText = 'Convert';
AutomateStatus = false;
break;
case 'automate':
CnvrtBtn.setAttribute("ondblclick", "conversionAutomate('manual')");
CnvrtBtn.setAttribute("onclick", "");
document.getElementById('CnvrtBtn').innerText = 'Auto-Convert';
AutomateStatus = true;
break;
default:
//placeholder
}
}
//LIGHT MODUS CHANGE FUNCTION: WITH 'MODUS' = 'dark' OR 'light' AS INPUT;
function changeLightModus(modus) {
switch (modus) {
case 'dark':
//CHANGE INPUT STATUS TO LIGHT MODUS ON BUTTON
document.getElementById('LightModus').setAttribute("onclick", "changeLightModus('light')");
//CHANGE CSS GLOBAL VARIABLES TO DARK THEME
document.documentElement.style.setProperty("--col-background", '#262626');
document.documentElement.style.setProperty("--col-background-sub", '#000000');
document.documentElement.style.setProperty("--col-popup", '#F0F0F0');
document.documentElement.style.setProperty("--col-popup-txt", '#262626');
document.documentElement.style.setProperty("--col-txt", '#F0F0F0');
document.documentElement.style.setProperty("--col-border", '#F0F0F0');
document.documentElement.style.setProperty("--col-InfoDisplay", 'rgba(255,255,255,0.95)');
document.documentElement.style.setProperty("--col-InfoDisplay-sub", 'rgba(0,0,0,0.05)');
break;
case 'light':
//CHANGE INPUT STATUS TO LIGHT MODUS ON BUTTON
document.getElementById('LightModus').setAttribute("onclick", "changeLightModus('dark')");
//CHANGE CSS GLOBAL VARIABLES TO LIGHT THEME
document.documentElement.style.setProperty("--col-background", '#F0F0F0');
document.documentElement.style.setProperty("--col-background-sub", '#FFFFFF');
document.documentElement.style.setProperty("--col-popup", '#262626');
document.documentElement.style.setProperty("--col-popup-txt", '#F0F0F0');
document.documentElement.style.setProperty("--col-txt", '#262626');
document.documentElement.style.setProperty("--col-border", '#262626');
document.documentElement.style.setProperty("--col-InfoDisplay", 'rgba(0,0,0,0.95)');
document.documentElement.style.setProperty("--col-InfoDisplay-sub", 'rgba(255,255,255,0.05)');
document.getElementById('VisualConvertBtn').style.backgroundImage = 'url(SalesNavWhite.gif)';
break;
default:
//IF AN ERROR OCCURS IT SHOULD DEFAULT ITSELF TO LIGHT MODUS
changeLightModus('light');
}
}
//POP UP WINDOW FUNCTION
function PopUpWindow(DisplayText) {
PopUpBox = document.getElementById('PopUpBox');
PopUpBox.innerText = DisplayText;
if (counter) {
PopUpBox.style.animation = 'PopUp1 4s';
counter = false;
}
else {
PopUpBox.style.animation = 'PopUp2 4s';
counter = true;
}
}
function findCloseValues(arr, rangeValue, WantDupes = false) {
arr.sort((a, b) => a - b);
let closeValues = [];
let currentGroup = [arr[0]];
for (let i = 1; i < arr.length; i++) {
if (arr[i] - arr[i - 1] <= rangeValue) {
currentGroup.push(arr[i]);
if (currentGroup.length === 2) {
if (currentGroup[0] !== currentGroup[1] || WantDupes) {
closeValues.push([...currentGroup]);
}
currentGroup = [arr[i]];
}
} else {
currentGroup = [arr[i]];
}
}
return closeValues;
}
function findIndexesOfRepeatedValue(arr, value) {
let indexes = [];
// Iterate through the array to find indexes of the repeated value
for (let i = 0; i < arr.length; i++) {
if (arr[i] === value) {
indexes.push(i);
}
}
return indexes;
}
function DisplayInfo() {
let InfoStatus = document.getElementsByClassName('InfoBtn')[0].id;
if (InfoStatus == 'inactiveBtn') {
document.getElementsByClassName('InfoBtn')[0].id = 'activeBtn';
document.getElementById('InfoDisplay').style.display = 'unset';
document.getElementById('offWindowBtn').style.display = 'unset';
} else {
document.getElementsByClassName('InfoBtn')[0].id = 'inactiveBtn';
document.getElementById('InfoDisplay').style.display = 'none';
document.getElementById('offWindowBtn').style.display = 'none';
}
}
function CheckLines() {
}
function conversionText() {
const inputText = document.getElementById('TextInputArea').value;
const lines = inputText.split('\n');
let outputText = '';
for (let i = 0; i < lines.length; i++) {
let infoline = '';
if ((/in rol/.test(lines[i]) && /bedrijf/.test(lines[i])) || (/in role/.test(lines[i]) && /company/.test(lines[i]))) {
let NameDist = 1;
while (NameDist < 15) {
let NameGuess = lines[i - NameDist];
if (/\d/.test(NameGuess) && /[·]/.test(NameGuess)) {
NameDist += 2;
break;
}
if ((/in rol/.test(NameGuess) && /bedrijf/.test(NameGuess)) || (/in role/.test(NameGuess) && /company/.test(NameGuess))) {
NameDist = 3;
break;
}
NameDist++;
}
if (document.getElementById('JobFiltering').checked) {
let JobBoolean = false;
for (let j = 0; j < JobTitles.length; j++) {
let regex = new RegExp(JobTitles[j], 'i');
if (regex.test(lines[i - 2])) {
JobBoolean = true;
break
}
}
if (JobBoolean) {
infoline += lines[i - NameDist].split(' ')[0] + '\t' + lines[i - NameDist].split(' ').slice(1, lines[i - NameDist].split(' ').length).join(' ');
infoline += '\t' + lines[i - 2].split(' ')[0] + '\t';
infoline += '\t' + lines[i - 2].split(' ')[1];
infoline += '\t' + lines[i - 2].split(' ')[1] + '\t\t';
infoline += '\t' + lines[i - 1].split(',')[0];
outputText += infoline + '\n';
}
} else {
infoline += lines[i - NameDist].split(' ')[0] + '\t' + lines[i - NameDist].split(' ').slice(1, lines[i - NameDist].split(' ').length).join(' ');
infoline += '\t' + lines[i - 2].split(' ')[0] + '\t';
infoline += '\t' + lines[i - 2].split(' ')[1];
infoline += '\t' + lines[i - 2].split(' ')[1] + '\t\t';
infoline += '\t' + lines[i - 1].split(',')[0];
outputText += infoline + '\n';
}
}
}
navigator.clipboard.writeText(outputText);
PopUpWindow('All contact info from the text are copied to your clipboard');
}
function DisplayVisual(Visual) {
switch (Visual) {
case 1:
document.getElementById('VisualConvertBtn').style.display = 'unset';
break
case 2:
document.getElementById('VisualConvertBtn').style.display = 'none';
break
default:
break
}
}
</script>