Subversion Repositories cheapmusic

Rev

Rev 146 | Rev 151 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
127 - 1
<?php
143 - 2
// title
3
function headTitle($page) {
4
    switch ($page) {
5
        case "terms":
6
            $titleText = "Find Cheap Music | Terms of Service";
7
            break;
8
 
9
        case "privacy":
10
            $titleText = "Find Cheap Music | Privacy Policy";
11
            break;
12
 
13
        case "help":
14
            $titleText = "Find Cheap Music | Help Page";
15
            break;
16
 
17
        case "wishlist":
18
            $titleText = "Find Cheap Music | Wishlist";
19
            break;
20
 
21
        case "coupons":
22
            $titleText = "Find Cheap Music | Coupons";
23
            break;
24
 
25
        case "priceMonitor":
26
            $titleText = "Find Cheap Music | Price Monitor";
27
            break;
28
 
29
        case "random":
30
            $titleText = "Find Cheap Music | Random Albums";
31
            break;
32
 
33
        default:
34
            $titleText = "Find Cheap Music | CDs, Records, Digital, Books and Sheets";
35
            break;
36
    }
37
 
38
    return ('<title>' . $titleText . '</title>');
39
}
40
 
41
// meta description
42
function metaDescription($page) {
43
    switch ($page) {
44
        case "terms":
45
            $metaText = "By visiting our site and/or purchasing something from us, you engage in our Service and agree to be bound by these terms and conditions.";
46
            break;
47
 
48
        case "privacy":
49
            $metaText = "In our User Privacy Notice, we have compiled all essential information about our handling of your personal data and your corresponding rights for you.";
50
            break;
51
 
52
        case "help":
53
            $metaText = "The help page explains the basic functionality of the search page with its various sections of supporting information.";
54
            break;
55
 
56
        case "wishlist":
57
            $metaText = "Maintain a wishlist at FindCheapMusic to keep track of your favorite music albums or to receive price drop alerts right to your email. Free login required.";
58
            break;
59
 
60
        case "coupons":
61
            $metaText = "Weekly updated coupons and special offers from various music online stores. When they are gone, they are gone. Free login required.";
62
            break;
63
 
64
        case "priceMonitor":
65
            $metaText = "Explore your personal price monitor results. Results will be updated at user-defined intervals and published via email. Free login required.";
66
            break;
67
 
68
        case "random":
69
            $metaText = "See several completely random music album suggestions.";
70
            break;
71
 
72
        default:
73
            $metaText = "Search dozens of online stores at once for low-priced or hard to find Compact Discs, Vinyl Records, MP3s, Music Sheets and Music related books.";
74
            break;
75
    }
76
 
77
    return ('<meta name="description" content="' . $metaText . '">');
78
}
79
 
127 - 80
function htmlHeader() {
81
    $xh = new Html;
82
    $xh->init($_SESSION["htmlIndent"]);
107 - 83
 
127 - 84
    $xh->add_attribute("name", "viewport");
85
    $xh->add_attribute("content", "width=device-width, initial-scale=1");
86
    $xh->single_tag('meta');
87
    $xh->add_attribute("http-equiv", "Content-Type");
88
    $xh->add_attribute("content", "text/html; charset=utf-8");
89
    $xh->single_tag('meta');
119 - 90
 
127 - 91
    $xh->add_attribute("href", "https://maxcdn.bootstrapcdn.com");
92
    $xh->add_attribute("rel", "preconnect");
93
    $xh->add_attribute("crossorigin", "");
94
    $xh->single_tag('link');
95
    $xh->add_attribute("href", "https://fonts.googleapis.com");
96
    $xh->add_attribute("rel", "preconnect");
97
    $xh->add_attribute("crossorigin", "");
98
    $xh->single_tag('link');
99
    $xh->add_attribute("href", "https://ajax.googleapis.com");
100
    $xh->add_attribute("rel", "preconnect");
101
    $xh->add_attribute("crossorigin", "");
102
    $xh->single_tag('link');
103
    $xh->add_attribute("href", "https://cdnjs.cloudflare.com");
104
    $xh->add_attribute("rel", "preconnect");
105
    $xh->add_attribute("crossorigin", "");
106
    $xh->single_tag('link');
143 - 107
    $xh->add_attribute("href", "https://cdn.datatables.net");
108
    $xh->add_attribute("rel", "preconnect");
109
    $xh->add_attribute("crossorigin", "");
110
    $xh->single_tag('link');
107 - 111
 
127 - 112
    $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
113
    $xh->tag('script', "window.dataLayer = window.dataLayer || [];");
107 - 114
 
134 - 115
    if (!empty($_SESSION["gtmId"])) {
127 - 116
        $xh->add_attribute("href", "https://www.googletagmanager.com");
117
        $xh->add_attribute("rel", "preconnect");
118
        $xh->add_attribute("crossorigin", "");
119
        $xh->single_tag('link');
120
        $xh->add_attribute("href", "https://www.google-analytics.com");
121
        $xh->add_attribute("rel", "preconnect");
122
        $xh->add_attribute("crossorigin", "");
123
        $xh->single_tag('link');
124
        $xh->add_attribute("href", "https://connect.facebook.net");
125
        $xh->add_attribute("rel", "preconnect");
126
        $xh->add_attribute("crossorigin", "");
127
        $xh->single_tag('link');
128
        $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
129
        $xh->tag('script');
134 - 130
        $xh->write("(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;var n=d.querySelector('[nonce]');n&&j.setAttribute('nonce',n.nonce||n.getAttribute('nonce'));f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','" . $_SESSION["gtmId"] . "');");
127 - 131
        $xh->close();
132
    }
104 - 133
 
127 - 134
    $xh->add_attribute("rel", "stylesheet");
135
    $xh->add_attribute("href", "https://fonts.googleapis.com/css?family=Material+Icons&display=swap");
136
    $xh->add_attribute("nonce",  base64_encode($_SESSION["nonce"]));
137
    $xh->single_tag('link');
138
    $xh->add_attribute("rel", "stylesheet");
139
    $xh->add_attribute("href", "https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css");
140
    $xh->add_attribute("integrity", "sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh");
141
    $xh->add_attribute("crossorigin", "anonymous");
142
    $xh->single_tag('link');
143
    $xh->add_attribute("rel", "stylesheet");
141 - 144
    $xh->add_attribute("href",  timeStampUrl("css/theme-" . (!empty($_SESSION["colorTheme"]) ? $_SESSION["colorTheme"] : "default") . ".min.css"));
145
    $xh->add_attribute("integrity", "sha384-" . base64_encode(hash_file("sha384", "css/theme-" . (!empty($_SESSION["colorTheme"]) ? $_SESSION["colorTheme"] : "default") . ".min.css", true)));
127 - 146
    $xh->add_attribute("crossorigin", "anonymous");
147
    $xh->single_tag('link');
148
    $xh->add_attribute("rel", "stylesheet");
149
    $xh->add_attribute("href",  timeStampUrl("css/style.min.css"));
150
    $xh->add_attribute("integrity", "sha384-" . base64_encode(hash_file("sha384", "css/style.min.css", true)));
151
    $xh->add_attribute("crossorigin", "anonymous");
152
    $xh->single_tag('link');
114 - 153
 
127 - 154
    $xh->add_attribute("async", "");
155
    $xh->add_attribute("defer", "");
156
    $xh->add_attribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js");
157
    $xh->add_attribute("integrity", "sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh");
158
    $xh->add_attribute("crossorigin", "anonymous");
159
    $xh->tag('script', '');
160
 
134 - 161
    if (in_array(getPGV('submitBtn'), array("terms", "privacy"))) {
127 - 162
        $xh->add_attribute("src",  timeStampUrl("js/email.min.js"));
163
        $xh->add_attribute("integrity", "sha384-" . base64_encode(hash_file("sha384", "js/email.min.js", true)));
164
        $xh->add_attribute("crossorigin", "anonymous");
165
        $xh->tag('script', '');
166
    }
167
 
168
    $xh->add_attribute("rel", "shortcut icon");
169
    $xh->add_attribute("href", "/favicon.ico");
170
    $xh->add_attribute("type", "image/x-icon");
171
    $xh->single_tag('link');
172
    $xh->add_attribute("rel", "icon");
173
    $xh->add_attribute("href", "/favicon.ico");
174
    $xh->add_attribute("type", "image/x-icon");
175
    $xh->single_tag('link');
176
    $xh->add_attribute("rel", "apple-touch-icon");
177
    $xh->add_attribute("sizes", "57x57");
178
    $xh->add_attribute("href", "/images/favicon/apple-icon-57x57.png");
179
    $xh->single_tag('link');
180
    $xh->add_attribute("rel", "apple-touch-icon");
181
    $xh->add_attribute("sizes", "60x60");
182
    $xh->add_attribute("href", "/images/favicon/apple-icon-60x60.png");
183
    $xh->single_tag('link');
184
    $xh->add_attribute("rel", "apple-touch-icon");
185
    $xh->add_attribute("sizes", "72x72");
186
    $xh->add_attribute("href", "/images/favicon/apple-icon-72x72.png");
187
    $xh->single_tag('link');
188
    $xh->add_attribute("rel", "apple-touch-icon");
189
    $xh->add_attribute("sizes", "76x76");
190
    $xh->add_attribute("href", "/images/favicon/apple-icon-76x76.png");
191
    $xh->single_tag('link');
192
    $xh->add_attribute("rel", "apple-touch-icon");
193
    $xh->add_attribute("sizes", "114x114");
194
    $xh->add_attribute("href", "/images/favicon/apple-icon-114x114.png");
195
    $xh->single_tag('link');
196
    $xh->add_attribute("rel", "apple-touch-icon");
197
    $xh->add_attribute("sizes", "120x120");
198
    $xh->add_attribute("href", "/images/favicon/apple-icon-120x120.png");
199
    $xh->single_tag('link');
200
    $xh->add_attribute("rel", "apple-touch-icon");
201
    $xh->add_attribute("sizes", "144x144");
202
    $xh->add_attribute("href", "/images/favicon/apple-icon-144x144.png");
203
    $xh->single_tag('link');
204
    $xh->add_attribute("rel", "apple-touch-icon");
205
    $xh->add_attribute("sizes", "152x152");
206
    $xh->add_attribute("href", "/images/favicon/apple-icon-152x152.png");
207
    $xh->single_tag('link');
208
    $xh->add_attribute("rel", "apple-touch-icon");
209
    $xh->add_attribute("sizes", "180x180");
210
    $xh->add_attribute("href", "/images/favicon/apple-icon-180x180.png");
211
    $xh->single_tag('link');
212
    $xh->add_attribute("rel", "icon");
213
    $xh->add_attribute("type", "image/png");
214
    $xh->add_attribute("sizes", "192x192");
215
    $xh->add_attribute("href", "/images/favicon/android-icon-192x192.png");
216
    $xh->single_tag('link');
217
    $xh->add_attribute("rel", "icon");
218
    $xh->add_attribute("type", "image/png");
219
    $xh->add_attribute("sizes", "32x32");
220
    $xh->add_attribute("href", "/images/favicon/favicon-32x32.png");
221
    $xh->single_tag('link');
222
    $xh->add_attribute("rel", "icon");
223
    $xh->add_attribute("type", "image/png");
224
    $xh->add_attribute("sizes", "96x96");
225
    $xh->add_attribute("href", "/images/favicon/favicon-96x96.png");
226
    $xh->single_tag('link');
227
    $xh->add_attribute("rel", "icon");
228
    $xh->add_attribute("type", "image/png");
229
    $xh->add_attribute("sizes", "16x16");
230
    $xh->add_attribute("href", "/images/favicon/favicon-16x16.png");
231
    $xh->single_tag('link');
232
    $xh->add_attribute("rel", "manifest");
233
    $xh->add_attribute("href", "/manifest.json");
234
    $xh->single_tag('link');
235
    $xh->add_attribute("name", "msapplication-TileColor");
236
    $xh->add_attribute("content", "#ffffff");
237
    $xh->single_tag('meta');
238
    $xh->add_attribute("name", "msapplication-TileImage");
239
    $xh->add_attribute("content", "/images/favicon/ms-icon-144x144.png");
240
    $xh->single_tag('meta');
241
    $xh->add_attribute("name", "theme-color");
242
    $xh->add_attribute("content", "#ffffff");
243
    $xh->single_tag('meta');
244
 
245
    $html = $xh->flush();
246
    //error_log(print_r($html, 1));
247
    return $html;
248
}
143 - 249
 
250
function mainSearchForm() {
251
    $xh = new Html;
252
    $xh->init($_SESSION["htmlIndent"]);
253
 
254
    $class = "container bg-secondary pt-3";
255
    if ($_SESSION["mode"] !== SIMPLE_SEARCH ||
256
        in_array(getPGV('submitBtn') , array("terms", "privacy", "coupons", "wishlist", "priceMonitor", "help", "barcode", "unsubscribe"))) {
257
        $class .= " d-none";
258
    }
259
    $xh->add_attribute("class", $class);
260
    $xh->add_attribute("id", "simpleSearchDiv");
261
    $xh->tag('div');
262
        $xh->add_attribute("class", "form-inline");
263
        $xh->add_attribute("id", "searchForm");
264
        $xh->add_attribute("method", "post");
265
        $xh->add_attribute("action", "/index.php");
266
        $xh->tag('form');
267
            $xh->insert_code(inputSessionId(true));
268
            $xh->insert_code(inputSessionTab());
269
            $xh->insert_code(inputNonce());
270
            $xh->add_attribute("class", "hidden-default-btn");
271
            $xh->tag('div');
272
                $xh->add_attribute("type", "submit");
273
                $xh->add_attribute("name", "submitBtn");
274
                $xh->add_attribute("value", "Search");
275
                $xh->tag('button', "Hidden Submit Button");
276
            $xh->close(); // div
277
            $xh->add_attribute("class", "form-group");
278
            $xh->tag('div');
279
                $xh->add_attribute("class", "btn-group");
280
                $xh->tag('div');
281
                    $xh->add_attribute("class", "btn btn-info input-group-text mx-1 rounded");
282
                    $xh->add_attribute("id", "searchTipsBtn");
283
                    $xh->add_attribute("type", "button");
284
                    $xh->add_attribute("data-toggle", "modal");
285
                    $xh->add_attribute("data-target", "#searchInfoModal");
286
                    $xh->add_attribute("data-toggle2", "tooltip");
287
                    $xh->add_attribute("title", "Search Tips");
288
                    $xh->add_attribute("aria-label", "Search Tips");
289
                    $xh->tag('button');
290
                        $xh->add_attribute("class", "material-icons");
291
                        $xh->tag('i', "info_outline");
292
                    $xh->close(); // button
293
 
294
                    $xh->add_attribute("class", "btn btn-info input-group-text mx-1 rounded py-0");
295
                    $xh->add_attribute("id", "barcodeBtn");
296
                    $xh->add_attribute("type", "submit");
297
                    $xh->add_attribute("name", "submitBtn");
298
                    $xh->add_attribute("value", "barcode");
299
                    $xh->add_attribute("data-toggle", "tooltip");
300
                    $xh->add_attribute("title", "Barcode Checker");
301
                    $xh->add_attribute("aria-label", "Barcode Checker");
302
                    $xh->tag('button');
303
                        $xh->add_attribute("class", "svg-24");
304
                        $xh->add_attribute("viewbox", "0 0 24 24");
305
                        $xh->tag('svg');
306
                            $xh->add_attribute("fill", "currentColor");
307
                            $xh->add_attribute("d", "M2,6H4V18H2V6M5,6H6V18H5V6M7,6H10V18H7V6M11,6H12V18H11V6M14,6H16V18H14V6M17,6H20V18H17V6M21,6H22V18H21V6Z");
308
                            $xh->single_tag('path');
309
                        $xh->close(); // button
310
                    $xh->close(); // button
311
                $xh->close(); // div
312
        	$xh->close(); // div
313
            $xh->add_attribute("class", "form-group mx-1");
314
            $xh->tag('div');
315
                $xh->add_attribute("class", "form-control flexdatalist searchTerm-width clearable");
316
                $xh->add_attribute("id", "searchTerm");
317
                $xh->add_attribute("list", "searchHistory");
318
                $xh->add_attribute("name", "searchTerm");
319
                $xh->add_attribute("type", "text");
320
                $xh->add_attribute("placeholder", "Search by Barcode, Artist, Title, ...");
321
                $xh->add_attribute("aria-label", "Search Term Input");
322
                $xh->add_attribute("value", getSV("searchTerm"));
323
        	    $xh->single_tag('input');
324
                $xh->add_attribute("id", "searchHistory");
325
                $xh->tag('datalist');
326
            	    $xh->insert_code(getSearchHistory());
327
                $xh->close(); // datalist
328
            $xh->close(); // div
329
            $xh->add_attribute("class", "form-group");
330
            $xh->tag('div');
331
                $xh->add_attribute("class", "btn btn-success mx-1 rounded");
332
                $xh->add_attribute("id", "searchBtn");
333
                $xh->add_attribute("type", "submit");
334
                $xh->add_attribute("name", "submitBtn");
335
                $xh->add_attribute("value", "Search");
336
                $xh->tag('button');
337
                    $xh->add_attribute("class", "material-icons material-text");
338
                    $xh->tag('i', "search");
339
                    $xh->add_attribute("class", "d-none d-md-inline");
340
                    $xh->tag('span', "Search");
341
                $xh->close(); // button
342
            $xh->close(); // div
343
        $xh->close(); // form
344
        $xh->add_attribute("class", "text-left small");
345
        $xh->tag('div');
346
            $xh->add_attribute("class", "btn btn-link text-reset");
347
            $xh->add_attribute("id", "advFormBtn");
348
            $xh->add_attribute("href", "");
349
            $xh->add_attribute("role", "button");
350
            $xh->tag('a');
351
                $xh->add_attribute("class", "material-icons md-12");
352
                $xh->tag('i', "settings");
353
                $xh->add_attribute("class", "small");
354
                $xh->tag('span', " Switch to advanced search");
355
            $xh->close(); // a
356
        $xh->close(); // div
357
        $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
358
        $xh->tag('script');
359
            $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
360
            $str .= my_trim('    document.getElementById("advFormBtn").addEventListener("click", function () {');
361
            $str .= my_trim('        event.preventDefault();');
362
            $str .= my_trim('        document.getElementById("simpleSearchDiv").classList.add("d-none");');
363
            $str .= my_trim('        var div = document.getElementById("advSearchDiv");');
364
            $str .= my_trim('        div.classList.remove("d-none");');
365
            $str .= my_trim('        $("input.clearable").trigger("change");');
366
            $str .= my_trim('        window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Search Form", "eventAction" : "Switch", "eventLabel" : "Advanced"});');
367
            $str .= my_trim('    });');
368
            $str .= my_trim('    document.getElementById("searchForm").addEventListener("submit", function (event) {');
369
            $str .= my_trim('        var t = document.getElementById("searchTerm-flexdatalist").value.toString().toProperCase().replace(/  +/g, " ");');
370
            $str .= my_trim('        if (t.length > 0) {');
371
            $str .= my_trim('            progressBar("Searching for:<br><br><strong>" + t + "</strong>");');
372
            $str .= my_trim('            document.getElementById("searchBtn").innerHTML = "<span class=\"spinner-border spinner-border-sm\"></span> Searching, please wait...";');
373
            $str .= my_trim('            if (window.google_tag_manager && window.ga && ga.create) {');
374
            $str .= my_trim('                event.preventDefault();');
375
            $str .= my_trim('                form = event.target.closest("form");');
376
            $str .= my_trim('                var input = document.createElement("input");');
377
            $str .= my_trim('                input.setAttribute("type", "hidden");');
378
            $str .= my_trim('                input.setAttribute("name", "submitBtn");');
379
            $str .= my_trim('                input.setAttribute("value", "Search");');
380
            $str .= my_trim('                form.appendChild(input);');
381
            $str .= my_trim('                window.dataLayer.push({ "event": "search", "search_term": t, "eventTimeout" : 2000, "eventCallback": function(){form.submit();} });');
382
            $str .= my_trim('            }');
383
            $str .= my_trim('        }');
384
            $str .= my_trim('    });');
385
            $str .= my_trim('');
386
            $str .= my_trim('    document.getElementById("searchTipsBtn").addEventListener("click", function (event) {');
387
            $str .= my_trim('        window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Search Tips", "eventAction" : "Click", "eventLabel" : ""});');
388
            $str .= my_trim('    });');
389
            $str .= my_trim('    document.getElementById("barcodeBtn").addEventListener("click", function (event) {');
390
            $str .= my_trim('        document.getElementById("searchTerm").value = "";');
391
            $str .= my_trim('        document.getElementById("searchTerm-flexdatalist").value = "";');
392
            $str .= my_trim('    });');
393
            $str .= my_trim('});');
394
            $xh->insert_code($str);
395
        $xh->close(); // script
396
    $xh->close(); // div
397
 
398
    $html = $xh->flush();
399
    //error_log(print_r($html, 1));
400
 
401
    return $html;
402
}
403
 
404
function mainAdvSearchForm() {
405
    $xh = new Html;
406
    $xh->init($_SESSION["htmlIndent"]);
407
 
408
    $class = "container bg-secondary pt-3";
409
    if ($_SESSION["mode"] !== ADVANCED_SEARCH ||
410
        in_array(getPGV('submitBtn') , array("terms", "privacy", "coupons", "wishlist", "priceMonitor", "help", "barcode", "unsubscribe"))) {
411
        $class .= " d-none";
412
    }
413
    $xh->add_attribute("class", $class);
414
    $xh->add_attribute("id", "advSearchDiv");
415
    $xh->tag('div');
416
        $xh->add_attribute("class", "alert alert-danger d-none");
417
        $xh->add_attribute("id", "advSearchFormError");
418
        $xh->tag('p', "");
419
        $xh->add_attribute("id", "advSearchForm");
420
        $xh->add_attribute("method", "post");
421
        $xh->add_attribute("action", "/index.php");
422
        $xh->tag('form');
423
            $xh->insert_code(inputSessionId());
424
            $xh->insert_code(inputSessionTab());
425
            $xh->insert_code(inputNonce());
426
            $xh->add_attribute("id", "advSearchTerm");
427
            $xh->add_attribute("name", "searchTerm");
428
            $xh->add_attribute("type", "hidden");
429
    	    $xh->single_tag('input');
430
            $xh->add_attribute("class", "form-group form-row mb-md-3 mb-0");
431
            $xh->tag('div');
432
                $xh->add_attribute("for", "advArtist");
433
                $xh->add_attribute("class", "col-form-label col-md-1 col-sm-2");
434
                $xh->tag('label', "Artist:");
435
                $xh->add_attribute("type", "text");
436
                $xh->add_attribute("class", "form-control col-md-5 col-sm-10 clearable");
437
                $xh->add_attribute("id", "advArtist");
438
                $xh->add_attribute("name", "advArtist");
439
                $xh->add_attribute("value", !empty($_SESSION["advSearch"]["Artist"]) ? $_SESSION["advSearch"]["Artist"] : "");
440
                $xh->single_tag('input');
441
                $xh->add_attribute("for", "advTitle");
442
                $xh->add_attribute("class", "col-form-label col-md-1 col-sm-2");
443
                $xh->tag('label', "Title:");
444
                $xh->add_attribute("type", "text");
445
                $xh->add_attribute("class", "form-control col-md-5 col-sm-10 clearable");
446
                $xh->add_attribute("id", "advTitle");
447
                $xh->add_attribute("name", "advTitle");
448
                $xh->add_attribute("value", !empty($_SESSION["advSearch"]["Title"]) ? $_SESSION["advSearch"]["Title"] : "");
449
                $xh->single_tag('input');
450
    		$xh->close(); // div
451
            $xh->add_attribute("class", "form-group form-row mb-md-3 mb-0");
452
            $xh->tag('div');
453
                $xh->add_attribute("for", "advTrack");
454
                $xh->add_attribute("class", "col-form-label col-md-1 col-sm-2");
455
                $xh->tag('label', "Track:");
456
                $xh->add_attribute("type", "text");
457
                $xh->add_attribute("class", "form-control col-md-5 col-sm-10 clearable");
458
                $xh->add_attribute("id", "advTrack");
459
                $xh->add_attribute("name", "advTrack");
460
                $xh->add_attribute("value", !empty($_SESSION["advSearch"]["Track"]) ? $_SESSION["advSearch"]["Track"] : "");
461
                $xh->single_tag('input');
462
                $xh->add_attribute("for", "advBarcode");
463
                $xh->add_attribute("class", "col-form-label col-md-1 col-sm-2");
464
                $xh->tag('label', "Barcode:");
465
                $xh->add_attribute("type", "text");
466
                $xh->add_attribute("class", "form-control col-md-5 col-sm-10 clearable");
467
                $xh->add_attribute("id", "advBarcode");
468
                $xh->add_attribute("name", "advBarcode");
469
                $xh->add_attribute("value", !empty($_SESSION["advSearch"]["Barcode"]) ? $_SESSION["advSearch"]["Barcode"] : "");
470
                $xh->single_tag('input');
471
    		$xh->close(); // div
472
            $xh->add_attribute("class", "form-group form-row mb-md-3 mb-0");
473
            $xh->tag('div');
474
                $xh->add_attribute("for", "advCatno");
475
                $xh->add_attribute("class", "col-form-label col-md-1 col-sm-2");
476
                $xh->tag('label', "Cat #:");
477
                $xh->add_attribute("type", "text");
478
                $xh->add_attribute("class", "form-control col-md-2 col-sm-4 clearable");
479
                $xh->add_attribute("id", "advCatno");
480
                $xh->add_attribute("name", "advCatno");
481
                $xh->add_attribute("value", !empty($_SESSION["advSearch"]["Catno"]) ? $_SESSION["advSearch"]["Catno"] : "");
482
                $xh->single_tag('input');
483
                $xh->add_attribute("for", "advLabel");
484
                $xh->add_attribute("class", "col-form-label col-md-1 col-sm-2");
485
                $xh->tag('label', "Label:");
486
                $xh->add_attribute("type", "text");
487
                $xh->add_attribute("class", "form-control col-md-2 col-sm-4 clearable");
488
                $xh->add_attribute("id", "advLabel");
489
                $xh->add_attribute("name", "advLabel");
490
                $xh->add_attribute("value", !empty($_SESSION["advSearch"]["Label"]) ? $_SESSION["advSearch"]["Label"] : "");
491
                $xh->single_tag('input');
492
                $xh->add_attribute("for", "advCountry");
493
                $xh->add_attribute("class", "col-form-label col-md-1 col-sm-2");
494
                $xh->tag('label', "Country:");
495
                $xh->add_attribute("type", "text");
496
                $xh->add_attribute("class", "form-control col-md-2 col-sm-4 clearable");
497
                $xh->add_attribute("id", "advCountry");
498
                $xh->add_attribute("name", "advCountry");
499
                $xh->add_attribute("value", !empty($_SESSION["advSearch"]["Country"]) ? $_SESSION["advSearch"]["Country"] : "");
500
                $xh->single_tag('input');
501
                $xh->add_attribute("for", "advYear");
502
                $xh->add_attribute("class", "col-form-label col-md-1 col-sm-2");
503
                $xh->tag('label', "Year:");
504
                $xh->add_attribute("type", "text");
505
                $xh->add_attribute("class", "form-control col-md-2 col-sm-4 clearable");
506
                $xh->add_attribute("id", "advYear");
507
                $xh->add_attribute("name", "advYear");
508
                $xh->add_attribute("value", !empty($_SESSION["advSearch"]["Year"]) ? $_SESSION["advSearch"]["Year"] : "");
509
                $xh->single_tag('input');
510
    		$xh->close(); // div
511
            $xh->add_attribute("class", "form-group d-flex mt-2 mb-0");
512
            $xh->tag('div');
513
                $xh->add_attribute("class", "btn btn-sm btn-danger mr-auto");
514
                $xh->add_attribute("id", "advSearchResetBtn");
515
                $xh->add_attribute("type", "button");
516
                $xh->tag('button', "Reset");
517
                $xh->add_attribute("class", "btn btn-success ml-auto");
518
                $xh->add_attribute("id", "advSearchBtn");
519
                $xh->add_attribute("type", "submit");
520
                $xh->add_attribute("name", "submitBtn");
521
                $xh->add_attribute("value", "advSearch");
522
                $xh->tag('button');
523
                    $xh->add_attribute("class", "material-icons material-text");
524
                    $xh->tag('i', "search");
525
                    $xh->tag('span', " Search");
526
                $xh->close(); // button
527
            $xh->close(); // div
528
            $xh->add_attribute("class", "form-group d-flex my-0");
529
            $xh->tag('div');
530
                $xh->add_attribute("class", "btn btn-link text-reset ml-auto");
531
                $xh->add_attribute("id", "simpleFormBtn");
532
                $xh->add_attribute("role", "button");
533
                $xh->add_attribute("href", "");
534
                $xh->tag('a');
535
                    $xh->add_attribute("class", "material-icons md-12");
536
                    $xh->tag('i', "settings");
537
                    $xh->add_attribute("class", "small");
538
                    $xh->tag('span', "  Switch to simple search");
539
                $xh->close(); // a
540
            $xh->close(); // div
541
        $xh->close(); // form
542
        $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
543
        $xh->tag('script');
544
            $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
545
            $str .= my_trim('    document.getElementById("simpleFormBtn").addEventListener("click", function (event) {');
546
            $str .= my_trim('        event.preventDefault();');
547
            $str .= my_trim('        document.getElementById("advSearchFormError").classList.remove("d-block");');
548
            $str .= my_trim('        var form = event.target.closest("form");');
549
            $str .= my_trim('        for (var i = 0; i < form.length; i++) { form[i].classList.remove("is-valid", "is-invalid"); }');
550
            $str .= my_trim('        document.getElementById("advSearchDiv").classList.add("d-none");');
551
            $str .= my_trim('        document.getElementById("simpleSearchDiv").classList.remove("d-none");');
552
            $str .= my_trim('        $("input.clearable").trigger("change");');
553
            $str .= my_trim('        window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Search Form", "eventAction" : "Switch", "eventLabel" : "Simple"});');
554
            $str .= my_trim('    });');
555
            $str .= my_trim('    document.getElementById("advSearchResetBtn").addEventListener("click", function () {');
556
            $str .= my_trim('        document.getElementById("advSearchFormError").classList.remove("d-block");');
557
            $str .= my_trim('        var form = event.target.closest("form");');
558
            $str .= my_trim('        for (var i = 0; i < form.length; i++) { form[i].classList.remove("is-valid", "is-invalid"); }');
559
            $str .= my_trim('        document.getElementById("advTitle").value = "";');
560
            $str .= my_trim('        document.getElementById("advArtist").value = "";');
561
            $str .= my_trim('        document.getElementById("advTrack").value = "";');
562
            $str .= my_trim('        document.getElementById("advBarcode").value = "";');
563
            $str .= my_trim('        document.getElementById("advCatno").value = "";');
564
            $str .= my_trim('        document.getElementById("advLabel").value = "";');
565
            $str .= my_trim('        document.getElementById("advCountry").value = "";');
566
            $str .= my_trim('        document.getElementById("advYear").value = "";');
567
            $str .= my_trim('        $("input.clearable").trigger("change");');
568
            $str .= my_trim('    });');
569
            $str .= my_trim('    document.getElementById("advSearchForm").addEventListener("submit", function (event) {');
570
            $str .= my_trim('        var errFlag = false;');
571
            $str .= my_trim('        for (var i = 0; i < event.target.length; i++) { event.target[i].classList.remove("is-valid", "is-invalid"); }');
572
            $str .= my_trim('        var title = document.getElementById("advTitle").value.toString().toProperCase().trim();');
573
            $str .= my_trim('        var artist = document.getElementById("advArtist").value.toString().toProperCase().trim();');
574
            $str .= my_trim('        var trackTitle = document.getElementById("advTrack").value.toString().toProperCase().trim();');
575
            $str .= my_trim('        var barcode = document.getElementById("advBarcode").value.toString().replace(/\D/g,"").trim();');
576
            $str .= my_trim('        var catno = document.getElementById("advCatno").value.toString().toUpperCase().trim();');
577
            $str .= my_trim('        var label = document.getElementById("advLabel").value.toString().toProperCase().trim();');
578
            $str .= my_trim('        var country = document.getElementById("advCountry").value.toString().toUpperCase().trim();');
579
            $str .= my_trim('        var year = document.getElementById("advYear").value.toString().replace(/\D/g,"").trim();');
580
            $str .= my_trim('        if (barcode.length == 0 && document.getElementById("advBarcode").value.length > 0) { errFlag = true; document.getElementById("advBarcode").classList.add("is-invalid"); }');
581
            $str .= my_trim('        if (year.length == 0 && document.getElementById("advYear").value.length > 0) { errFlag = true; document.getElementById("advYear").classList.add("is-invalid"); }');
582
            $str .= my_trim('        if (year.length > 0 && (Number(year) < 1900 || Number(year) > new Date().getFullYear())) { errFlag = true; document.getElementById("advYear").classList.add("is-invalid"); }');
583
            $str .= my_trim('        if (title.length > 0) {document.getElementById("advTitle").classList.add("is-valid"); }');
584
            $str .= my_trim('        if (artist.length > 0) {document.getElementById("advArtist").classList.add("is-valid"); }');
585
            $str .= my_trim('        if (trackTitle.length > 0) {document.getElementById("advTrack").classList.add("is-valid"); }');
586
            $str .= my_trim('        if (barcode.length > 0) {document.getElementById("advBarcode").classList.add("is-valid"); }');
587
            $str .= my_trim('        if (catno.length > 0) {document.getElementById("advCatno").classList.add("is-valid"); }');
588
            $str .= my_trim('        if (label.length > 0) {document.getElementById("advLabel").classList.add("is-valid"); }');
589
            $str .= my_trim('        if (country.length > 0) {document.getElementById("advCountry").classList.add("is-valid"); }');
590
            $str .= my_trim('        if (year.length > 0) {document.getElementById("advYear").classList.add("is-valid"); }');
591
            $str .= my_trim('        var len = title.length + artist.length + trackTitle.length + barcode.length + catno.length + label.length + country.length + year.length;');
592
            $str .= my_trim('        var searchTerm = (title + " " + artist + " " + trackTitle + " " + barcode + " " + catno + " " + label + " " + country + " " + year).trim().replace(/  +/g, " ");');
593
            $str .= my_trim('        if (len > 0 && !errFlag) {');
594
            $str .= my_trim('            document.getElementById("advTitle").value = title;');
595
            $str .= my_trim('            document.getElementById("advArtist").value = artist;');
596
            $str .= my_trim('            document.getElementById("advTrack").value = trackTitle;');
597
            $str .= my_trim('            document.getElementById("advBarcode").value = barcode;');
598
            $str .= my_trim('            document.getElementById("advCatno").value = catno;');
599
            $str .= my_trim('            document.getElementById("advLabel").value = label;');
600
            $str .= my_trim('            document.getElementById("advCountry").value = country;');
601
            $str .= my_trim('            document.getElementById("advYear").value = year;');
602
            $str .= my_trim('            document.getElementById("advSearchFormError").classList.remove("d-block");');
603
            $str .= my_trim('            document.getElementById("advSearchTerm").value = searchTerm;');
604
            $str .= my_trim('            pbTxt = "Advanced Searching:<br><strong>";');
605
            $str .= my_trim('            if (artist.length > 0) pbTxt += "<br>Artist: " + artist;');
606
            $str .= my_trim('            if (title.length > 0) pbTxt += "<br>Title: " + title;');
607
            $str .= my_trim('            if (trackTitle.length > 0) pbTxt += "<br>Track: " + trackTitle;');
608
            $str .= my_trim('            if (barcode.length > 0) pbTxt += "<br>Barcode: " + barcode;');
609
            $str .= my_trim('            if (catno.length > 0) pbTxt += "<br>Catalog #: " + catno;');
610
            $str .= my_trim('            if (label.length > 0) pbTxt += "<br>Label: " + label;');
611
            $str .= my_trim('            if (country.length > 0) pbTxt += "<br>Country: " + country;');
612
            $str .= my_trim('            if (year.length > 0) pbTxt += "<br>Year: " + year;');
613
            $str .= my_trim('            pbTxt += "</strong>";');
614
            $str .= my_trim('            progressBar(pbTxt);');
615
            $str .= my_trim('            document.getElementById("advSearchBtn").innerHTML = "<span class=\"spinner-border spinner-border-sm\"></span> Searching, please wait...";');
616
            $str .= my_trim('            if (window.google_tag_manager && window.ga && ga.create) {');
617
            $str .= my_trim('                event.preventDefault();');
618
            $str .= my_trim('                form = event.target.closest("form");');
619
            $str .= my_trim('                var input = document.createElement("input");');
620
            $str .= my_trim('                input.setAttribute("type", "hidden");');
621
            $str .= my_trim('                input.setAttribute("name", "submitBtn");');
622
            $str .= my_trim('                input.setAttribute("value", "advSearch");');
623
            $str .= my_trim('                form.appendChild(input);');
624
            $str .= my_trim('                window.dataLayer.push({ "event": "search", "search_term": searchTerm, "eventTimeout" : 2000, "eventCallback": function(){form.submit();} });');
625
            $str .= my_trim('            }');
626
            $str .= my_trim('        } else {');
627
            $str .= my_trim('            x = document.getElementById("advSearchFormError");');
628
            $str .= my_trim('            x.innerHTML = (errFlag ? "Please correct the criteria." : "Please enter at least one criteria.");');
629
            $str .= my_trim('            x.classList.add("d-block");');
630
            $str .= my_trim('            event.preventDefault();');
631
            $str .= my_trim('        }');
632
            $str .= my_trim('    });');
633
            $str .= my_trim('');
634
            $str .= my_trim('});');
635
            $xh->insert_code($str);
636
        $xh->close(); // script
637
    $xh->close(); // div
638
 
639
    $html = $xh->flush();
640
    //error_log(print_r($html, 1));
641
 
642
    return $html;
643
}
644
 
645
function downloadAtOnload() {
646
    $xh = new Html;
647
    $xh->init($_SESSION["htmlIndent"]);
648
 
649
    $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
650
    $xh->tag('script');
651
        $str  = my_trim('function downloadAtOnload() {');
652
        $str .= my_trim('var i, element;');
653
        $str .= my_trim('var linkArr = [');
654
        $str .= my_trim('                  { fn:"' . timeStampUrl("css/jquery.flexdatalist.min.css") . '", hash:"sha384-' . base64_encode(hash_file("sha384", "css/jquery.flexdatalist.min.css", true)) . '" },');
655
        $str .= my_trim('                  { fn:"https://cdn.datatables.net/v/bs4/dt-1.10.20/b-1.6.1/b-colvis-1.6.1/b-print-1.6.1/r-2.2.3/datatables.min.css", hash:"sha384-A6mMt/FRtf7afy5tvbeUM9oILonoc/SgFN+PJGQ5vzjemTa7QjI9fS0wigS7URyy" }');
656
        $str .= my_trim('                ];');
657
        $str .= my_trim('var scriptArr = [');
658
        $str .= my_trim('                  { fn:"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js", hash:"sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" },');
659
        $str .= my_trim('                  { fn:"https://cdn.datatables.net/v/bs4/dt-1.10.20/b-1.6.1/b-colvis-1.6.1/b-print-1.6.1/r-2.2.3/datatables.min.js", hash:"sha384-iaJmlk/Rs9bPXyjHenhI8wFmIBMnXvjSieMasaZVSDkrv7sCZedSuJce8woADAHJ" },');
660
        $str .= my_trim('                  { fn:"' . timeStampUrl("js/jquery.flexdatalist.min.js") . '", hash:"sha384-' . base64_encode(hash_file("sha384", "js/jquery.flexdatalist.min.js", true)) . '" },');
661
        $str .= my_trim('                  { fn:"' . timeStampUrl("js/paginate.min.js") . '", hash:"sha384-' . base64_encode(hash_file("sha384", "js/paginate.min.js", true)) . '" },');
662
        $str .= my_trim('                  { fn:"' . timeStampUrl("js/lazysizes.min.js") . '", hash:"sha384-' . base64_encode(hash_file("sha384", "js/lazysizes.min.js", true)) . '" },');
149 - 663
        $str .= my_trim('                  { fn:"' . timeStampUrl("js/dr.min.js") . '", hash:"sha384-' . base64_encode(hash_file("sha384", "js/dr.min.js", true)) . '" }');
143 - 664
        $str .= my_trim('                ];');
665
        $str .= my_trim('');
666
        if (isLoggedIn()) {
667
            $str .= my_trim('window.dataLayer.push({ "event" : "addinginCustomDimData", "IsLoggedIn" :  "Yes"});');
668
        }
669
        $str .= my_trim('    if (window.performance) {');
670
        $str .= my_trim('        var timeSincePageLoad = Math.round(performance.now());');
671
        $str .= my_trim('        window.dataLayer.push({"event": "timing", ');
672
        $str .= my_trim('            "timingVar": "page load",');
673
        $str .= my_trim('            "timingValue": timeSincePageLoad,');
674
        $str .= my_trim('            "timingCategory": "client",');
675
        $str .= my_trim('            "timingLabel": "load"');
676
        $str .= my_trim('          });');
677
        $str .= my_trim('    }');
678
        $str .= my_trim('');
679
        $str .= my_trim('for (i=0; i < linkArr.length; i++) {');
680
        $str .= my_trim('    element = document.createElement("link");');
681
        $str .= my_trim('    element.rel = "stylesheet";');
682
        $str .= my_trim('    element.type = "text/css";');
683
        $str .= my_trim('    element.href = linkArr[i].fn;');
684
        $str .= my_trim('    element.setAttribute("crossorigin", "anonymous");');
685
        $str .= my_trim('    element.setAttribute("integrity", linkArr[i].hash);');
686
        $str .= my_trim('    document.head.appendChild(element);');
687
        $str .= my_trim('}');
688
        $str .= my_trim('');
689
        $str .= my_trim('for (i=0; i < scriptArr.length; i++) {');
690
        $str .= my_trim('    element = document.createElement("script");');
691
        $str .= my_trim('    element.src = scriptArr[i].fn;');
692
        $str .= my_trim('    element.async = true;');
693
        $str .= my_trim('    element.setAttribute("crossorigin", "anonymous");');
694
        $str .= my_trim('    element.setAttribute("integrity", scriptArr[i].hash);');
695
        $str .= my_trim('    document.body.appendChild(element);');
696
        $str .= my_trim('}');
697
        $str .= my_trim('');
698
        $str .= my_trim('    function loadDepend() {');
699
        $str .= my_trim('        if (typeof Popper == "undefined") {');
700
        $str .= my_trim('            window.setTimeout(function() { loadDepend(); }, 100);');
701
        $str .= my_trim('        } else {');
702
        $str .= my_trim('            element = document.createElement("script");');
703
        $str .= my_trim('            element.src = "https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js";');
704
        $str .= my_trim('            element.async = true;');
705
        $str .= my_trim('            element.setAttribute("crossorigin", "anonymous");');
706
        $str .= my_trim('            element.setAttribute("integrity", "sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6");');
707
        $str .= my_trim('            document.body.appendChild(element);');
708
        $str .= my_trim('        }');
709
        $str .= my_trim('    }');
710
        $str .= my_trim('');
711
        $str .= my_trim('    loadDepend();');
712
        $str .= my_trim('}');
713
        $str .= my_trim('');
714
        $str .= my_trim('window.addEventListener("load", function() { downloadAtOnload(); }, {passive: true});');
715
        $xh->insert_code($str);
716
    $xh->close(); // script
717
 
718
    $html = $xh->flush();
719
    //error_log(print_r($html, 1));
720
 
721
    return $html;
722
}
723
 
724
function headerQuoteSlides() {
725
    $xh = new Html;
726
    $xh->init($_SESSION["htmlIndent"]);
727
 
728
    $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
729
    $xh->tag('script');
730
 
731
    $str = 'var quotes = [';
732
    if ($file = fopen("snippets/headerQuotes.txt", "r")) {
733
        while (($line = fgets($file)) !== false) {
734
            $str .= '"' . trim($line) . '",';
735
        }
736
        fclose($file);
737
    }
738
    $str .= ']; setInterval(function() { $("#textslide").html(quotes[Math.floor(Math.random() * (quotes.length + 1))]); }, 5 * 1000);';
739
 
740
    $xh->insert_code($str);
741
    $xh->close(); // script
742
 
743
    $html = $xh->flush();
744
    //error_log(print_r($html, 1));
745
 
746
    return $html;
747
}
748
 
749
function barcodePage() {
750
    $xh = new Html;
751
    $xh->init($_SESSION["htmlIndent"]);
752
 
753
    $xh->add_attribute("class", "container py-4 bg-light border d-flex justify-content-center align-items-center");
754
    $xh->tag('div');
755
        $xh->add_attribute("class", "my-3");
756
        $xh->tag('div');
757
            $xh->tag('p');
758
                $xh->tag('span', "This tool verifies Music CD barcodes or calculates the check digit.");
759
                $xh->brnl();
760
                $xh->tag('span', "See our ");
761
                $blHref = "https://blog.findcheapmusic.com/2020/03/music-cd-barcodes-and-identifiers.html";
762
                $xh->add_attribute("id", "blBarcodeLink");
763
                $xh->add_attribute("href", $blHref);
764
                $xh->add_attribute("target", "blank");
765
                $xh->add_attribute("rel", "noopener noreferrer");
766
                $xh->tag('a', "blog post");
767
                $xh->tag('span', " for more information about music barcodes.");
768
            $xh->close(); // p
769
            $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
770
            $xh->tag('script');
771
                $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
772
                $str .= my_trim('    document.getElementById("blBarcodeLink").addEventListener("click", function() {');
773
                $str .= my_trim('        window.dataLayer.push({ "event": "social", "socialNetwork": "Blogger", "socialAction": "Link", "socialTarget": "' . $blHref . '"});');
774
                $str .= my_trim('    });');
775
                $str .= my_trim('});');
776
                $xh->insert_code($str);
777
            $xh->close(); // script
778
            $xh->add_attribute("id", "barcodeForm");
779
            $xh->tag('form');
780
                $xh->insert_code(inputSessionTab());
127 - 781
                $xh->insert_code(inputSearchTerm());
782
                $xh->insert_code(inputNonce());
143 - 783
                $xh->add_attribute("class", "input-group mb-3");
784
                $xh->tag('div');
146 - 785
                    $xh->add_attribute("class", "clearable");
143 - 786
                    $xh->add_attribute("id", "barcode");
787
                    $xh->add_attribute("name", "barcode");
788
                    $xh->add_attribute("type", "text");
789
                    $xh->add_attribute("placeholder", "Enter Barcode...");
790
                    $xh->add_attribute("aria-label", "Barcode Input");
791
                    $xh->single_tag('input');
792
                    $xh->add_attribute("class", "input-group-append");
793
                    $xh->tag('div');
794
                        $xh->add_attribute("class", "btn btn-success barcodeButton");
795
                        $xh->add_attribute("id", "barcodeFormVerify");
796
                        $xh->add_attribute("type", "submit");
797
                        $xh->add_attribute("name", "submitBtn");
798
                        $xh->add_attribute("value", "check");
799
                        $xh->tag('button', "Verify");
800
                        $xh->add_attribute("class", "btn btn-info barcodeButton");
801
                        $xh->add_attribute("id", "barcodeFormCalc");
802
                        $xh->add_attribute("type", "submit");
803
                        $xh->add_attribute("name", "submitBtn");
804
                        $xh->add_attribute("value", "calc");
805
                        $xh->tag('button', "Calculate");
806
                    $xh->close(); // div
807
                $xh->close(); // div
808
            $xh->close(); // form
809
            $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
810
            $xh->tag('script');
811
                $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
812
                $str .= my_trim('    document.getElementById("barcodeFormVerify").addEventListener("click", function() {');
813
                $str .= my_trim('        window.dataLayer.push({ "event": "trackEvent", "eventCategory": "Barcode", "eventAction": "Verify" });');
814
                $str .= my_trim('    });');
815
                $str .= my_trim('    document.getElementById("barcodeFormCalc").addEventListener("click", function() {');
816
                $str .= my_trim('        window.dataLayer.push({ "event": "trackEvent", "eventCategory": "Barcode", "eventAction": "Check Digit" });');
817
                $str .= my_trim('    });');
818
                $str .= my_trim('});');
819
                $xh->insert_code($str);
820
            $xh->close(); // script
821
            $xh->add_attribute("id", "barcodeResult");
822
            $xh->tag('div', "");
823
        $xh->close(); // div
824
    $xh->close(); // div
825
 
826
    $html = $xh->flush();
827
    //error_log(print_r($html, 1));
828
 
829
    return $html;
830
}
831
 
832
function htmlFooter() {
833
    $xh = new Html;
834
    $xh->init($_SESSION["htmlIndent"]);
835
 
836
    $xh->add_attribute("class", "container-fluid text-center bg-primary py-5");
837
    $xh->tag('footer');
838
        if (!empty($_SESSION["searchTerm"]) || getPGV('submitBtn') == "priceMonitor") {
839
            $xh->tag('p', "Disclaimer: As an Associate we earn from qualifying purchases");
840
        }
841
        $xh->add_attribute("class", "btn-group mb-3");
842
        $xh->tag('div');
843
            $fbHref = "https://www.facebook.com/FindCheapMusic";
844
            $xh->add_attribute("id", "fbLink");
845
            $xh->add_attribute("href", $fbHref);
846
            $xh->add_attribute("target", "_blank");
847
            $xh->add_attribute("rel", "noopener noreferrer");
848
            $xh->tag('a');
849
                $xh->add_attribute("class", "socialBtn pr-4 lazyload");
850
                $xh->add_attribute("src", PIXEL);
851
                $xh->add_attribute("data-src", "images/f_logo_RGB-Blue_58.png");
852
                $xh->add_attribute("alt", "Facebook Logo");
853
                $xh->single_tag('img');
854
            $xh->close(); // a
855
 
856
            $twHref = "https://twitter.com/findcheapmusic";
857
            $xh->add_attribute("id", "twLink");
858
            $xh->add_attribute("href", $twHref);
859
            $xh->add_attribute("target", "_blank");
860
            $xh->add_attribute("rel", "noopener noreferrer");
861
            $xh->tag('a');
862
                $xh->add_attribute("class", "socialBtn pr-4 lazyload");
863
                $xh->add_attribute("src", PIXEL);
864
                $xh->add_attribute("data-src", "images/Twitter_Social_Icon_Circle_Color.png");
865
                $xh->add_attribute("alt", "Twitter Logo");
866
                $xh->single_tag('img');
867
            $xh->close(); // a
868
 
869
            $blHref = "https://blog.findcheapmusic.com";
870
            $xh->add_attribute("id", "blLink");
871
            $xh->add_attribute("href", $blHref);
872
            $xh->add_attribute("target", "_blank");
873
            $xh->add_attribute("rel", "noopener noreferrer");
874
            $xh->tag('a');
875
                $xh->add_attribute("class", "socialBtn pr-4 lazyload");
876
                $xh->add_attribute("src", PIXEL);
877
                $xh->add_attribute("data-src", "images/blogger_logo.jpg");
878
                $xh->add_attribute("alt", "Blogger Logo");
879
                $xh->single_tag('img');
880
            $xh->close(); // a
881
 
882
        $xh->close(); // div
883
        $xh->tag('p', "Copyright &#169; " . @date("Y") . " FindCheapMusic.com. All rights reserved.");
884
 
885
        $xh->add_attribute("class", "d-lg-none");
886
        $xh->add_attribute("method", "post");
887
        $xh->add_attribute("action", "/index.php");
888
        $xh->tag('form');
889
            $xh->insert_code(inputSessionTab());
127 - 890
            $xh->insert_code(inputSearchTerm());
143 - 891
            $xh->add_attribute("class", "list-inline text-center");
892
            $xh->tag('ul');
893
                $xh->add_attribute("class", "list-inline-item");
894
                $xh->tag('li');
895
                    $xh->add_attribute("class", "btn btn-sm btn-light");
896
                    $xh->add_attribute("type", "submit");
897
                    $xh->add_attribute("name", "submitBtn");
898
                    $xh->add_attribute("value", "terms");
899
                    $xh->tag('button', "Terms of Service");
900
                $xh->close(); // li
901
                $xh->add_attribute("class", "list-inline-item");
902
                $xh->tag('li');
903
                    $xh->add_attribute("class", "btn btn-sm btn-light");
904
                    $xh->add_attribute("type", "submit");
905
                    $xh->add_attribute("name", "submitBtn");
906
                    $xh->add_attribute("value", "privacy");
907
                    $xh->tag('button', "Privacy Policy");
908
                $xh->close(); // li
909
            $xh->close(); // ul
910
        $xh->close(); // form
911
    $xh->close(); // footer
912
 
913
    $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
914
    $xh->tag('script');
915
        $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
916
        $str .= my_trim('	document.getElementById("fbLink").addEventListener("click", function() {');
917
        $str .= my_trim('    dataLayer.push({ "event": "social", "socialNetwork": "Facebook", "socialAction": "Link", "socialTarget": "' . $fbHref . '"});');
918
        $str .= my_trim('  });');
919
        $str .= my_trim('	document.getElementById("twLink").addEventListener("click", function() {');
920
        $str .= my_trim('    dataLayer.push({ "event": "social", "socialNetwork": "Twitter", "socialAction": "Link", "socialTarget": "' . $twHref . '"});');
921
        $str .= my_trim('  });');
922
        $str .= my_trim('	document.getElementById("blLink").addEventListener("click", function() {');
923
        $str .= my_trim('    dataLayer.push({ "event": "social", "socialNetwork": "Blogger", "socialAction": "Link", "socialTarget": "' . $blHref . '"});');
924
        $str .= my_trim('  });');
925
        $str .= my_trim('});');
926
        $xh->insert_code($str);
927
    $xh->close(); // script
928
 
929
    $html = $xh->flush();
930
    //error_log(print_r($html, 1));
931
 
932
    return $html;
933
}
934
 
935
function navigationPane() {
936
    $xh = new Html;
937
    $xh->init($_SESSION["htmlIndent"]);
938
 
939
    $xh->add_attribute("method", "post");
940
    $xh->add_attribute("action", "/index.php");
941
    $xh->tag('form');
942
        $xh->insert_code(inputSessionTab(true));
127 - 943
        $xh->insert_code(inputSearchTerm());
944
        $xh->insert_code(inputNonce());
143 - 945
        $xh->add_attribute("class", "navbar navbar-expand-sm bg-black navbar-dark fixed-top");
946
        $xh->tag('nav');
947
            $xh->add_attribute("class", "navbar-header");
948
            $xh->tag('div');
949
                $xh->add_attribute("class", "btn text-white");
950
                $xh->add_attribute("type", "submit");
951
                $xh->add_attribute("name", "submitBtn");
952
                $xh->add_attribute("value", "Home");
953
                $xh->add_attribute("aria-label", "Go to home page");
954
                $xh->tag('button', "Find Cheap Music");
955
            $xh->close(); // div
956
            $xh->add_attribute("class", "navbar-toggler");
957
            $xh->add_attribute("type", "button");
958
            $xh->add_attribute("data-toggle", "collapse");
959
            $xh->add_attribute("data-target", "#collapsibleNavbar");
960
            $xh->add_attribute("aria-label", "Open Menu");
961
            $xh->tag('button');
962
                $xh->add_attribute("class", "navbar-toggler-icon");
963
                $xh->tag('span', "");
964
            $xh->close(); // button
127 - 965
 
143 - 966
            $xh->add_attribute("class", "collapse navbar-collapse");
967
            $xh->add_attribute("id", "collapsibleNavbar");
968
            $xh->tag('div');
969
                $xh->add_attribute("class", "navbar-nav mr-auto");
970
                $xh->tag('ul');
971
                    $xh->add_attribute("class", "nav-item");
972
                    $xh->tag('li');
973
                        $xh->add_attribute("class", "nav-item");
974
                        $xh->add_attribute("class", "nav-link btn");
975
                        $xh->add_attribute("type", "submit");
976
                        $xh->add_attribute("name", "submitBtn");
977
                        $xh->add_attribute("value", "Home");
978
                        $xh->add_attribute("aria-label", "Go to home page");
979
                        $xh->tag('button');
980
                            $xh->add_attribute("class", "material-icons");
981
                            $xh->tag('i', "home");
982
                        $xh->close(); // button
983
                    $xh->close(); // li
984
                    if (isLoggedIn()) {
985
                        $xh->add_attribute("class", "nav-item");
986
                        $xh->tag('li');
987
                            $xh->add_attribute("class", "nav-link btn");
988
                            $xh->add_attribute("type", "submit");
989
                            $xh->add_attribute("name", "submitBtn");
990
                            $xh->add_attribute("value", "coupons");
991
                            $xh->tag('button', "Coupons");
992
                        $xh->close(); // li
993
                        $xh->add_attribute("class", "nav-item");
994
                        $xh->tag('li');
995
                            $xh->add_attribute("class", "nav-link btn");
996
                            $xh->add_attribute("type", "submit");
997
                            $xh->add_attribute("name", "submitBtn");
998
                            $xh->add_attribute("value", "wishlist");
999
                            $xh->tag('button');
1000
                                $xh->tag('span', "Wishlist");
1001
                                if (!empty($_SESSION['priceMonitor']['newFlag']) && $_SESSION['priceMonitor']['newFlag'] === true) {
1002
                                    $xh->add_attribute("class", "badge badge-pill badge-light");
1003
                                    $xh->tag('span', "New");
1004
                                }
1005
                            $xh->close(); // button
1006
                        $xh->close(); // li
1007
                    }
1008
                    $xh->add_attribute("class", "nav-item  d-none d-lg-block");
1009
                    $xh->tag('li');
1010
                        $xh->add_attribute("class", "nav-link btn");
1011
                        $xh->add_attribute("type", "submit");
1012
                        $xh->add_attribute("name", "submitBtn");
1013
                        $xh->add_attribute("value", "terms");
1014
                        $xh->tag('button', "Terms of Service");
1015
                    $xh->close(); // li
1016
                    $xh->add_attribute("class", "nav-item  d-none d-lg-block");
1017
                    $xh->tag('li');
1018
                        $xh->add_attribute("class", "nav-link btn");
1019
                        $xh->add_attribute("type", "submit");
1020
                        $xh->add_attribute("name", "submitBtn");
1021
                        $xh->add_attribute("value", "privacy");
1022
                        $xh->tag('button', "Privacy Policy");
1023
                    $xh->close(); // li
1024
                    $xh->add_attribute("class", "nav-item");
1025
                    $xh->tag('li');
1026
                        $blHref = "https://blog.findcheapmusic.com";
1027
                        $xh->add_attribute("class", "nav-link");
1028
                        $xh->add_attribute("id", "blNavLink");
1029
                        $xh->add_attribute("role", "button");
1030
                        $xh->add_attribute("href", $blHref);
1031
                        $xh->add_attribute("target", "_blank");
1032
                        $xh->add_attribute("rel", "noreferrer noopener");
1033
                        $xh->tag('a', "Blog");
1034
                    $xh->close(); // li
1035
                    $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
1036
                    $xh->tag('script');
1037
                        $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
1038
                        $str .= my_trim('    document.getElementById("blNavLink").addEventListener("click", function() {');
1039
                        $str .= my_trim('        dataLayer.push({ "event": "social", "socialNetwork": "Blogger", "socialAction": "Link", "socialTarget": "' . $blHref . '"});');
1040
                        $str .= my_trim('    });');
1041
                        $str .= my_trim('});');
1042
                        $xh->insert_code($str);
1043
                    $xh->close(); // script
1044
                    $xh->add_attribute("class", "nav-item");
1045
                    $xh->tag('li');
1046
                        $xh->add_attribute("class", "nav-link btn");
1047
                        $xh->add_attribute("type", "submit");
1048
                        $xh->add_attribute("name", "submitBtn");
1049
                        $xh->add_attribute("value", "help");
1050
                        $xh->add_attribute("aria-label", "Go to Help Page");
1051
                        $xh->tag('button');
1052
                            $xh->add_attribute("class", "material-icons");
1053
                            $xh->tag('i', "help_outline");
1054
                        $xh->close(); // button
1055
                    $xh->close(); // li
1056
                    $xh->close(); // ul
1057
                    $xh->add_attribute("class", "navbar-nav");
1058
                    $xh->tag('ul');
1059
                    if (!isLoggedIn()) {
1060
                        $xh->add_attribute("class", "nav-item");
1061
                        $xh->tag('li');
1062
                            $xh->add_attribute("class", "nav-link");
1063
                            $xh->add_attribute("href", "/login/index.php");
1064
                            $xh->tag('a');
1065
                                $xh->add_attribute("class", "svg-24");
1066
                                $xh->add_attribute("viewBox", "0 0 24 24");
1067
                                $xh->tag('svg');
1068
                                    $xh->add_attribute("fill", "currentColor");
1069
                                    $xh->add_attribute("d", "M10,17V14H3V10H10V7L15,12L10,17M10,2H19A2,2 0 0,1 21,4V20A2,2 0 0,1 19,22H10A2,2 0 0,1 8,20V18H10V20H19V4H10V6H8V4A2,2 0 0,1 10,2Z");
1070
                                    $xh->single_tag('path');
1071
                                $xh->close(); // svg
1072
                                $xh->tag('span', "Login");
1073
                            $xh->close(); // a
1074
                        $xh->close(); // li
1075
                    } else {
1076
                        $xh->add_attribute("class", "nav-item");
1077
                        $xh->tag('li');
1078
                            $xh->add_attribute("class", "img-fluid hide-extra-small hide-small user-img");
1079
                            $xh->add_attribute("src", timeStampUrl($_SESSION["userPicture"]));
1080
                            $xh->add_attribute("alt", "User Image");
1081
                            $xh->single_tag('img');
1082
                        $xh->close(); // li
1083
                        $xh->add_attribute("class", "nav-item dropdown");
1084
                        $xh->tag('li');
1085
                            $xh->add_attribute("class", "nav-link dropdown-toggle");
1086
                            $xh->add_attribute("href", "#");
1087
                            $xh->add_attribute("id", "navbardrop");
1088
                            $xh->add_attribute("data-toggle", "dropdown");
1089
                            $xh->tag('a');
1090
                                $xh->add_attribute("class", "material-icons material-text");
1091
                                $xh->tag('i', "account_box");
1092
                                $xh->tag('span', "Account");
1093
                            $xh->close(); // a
1094
                            $xh->add_attribute("class", "dropdown-menu dropdown-menu-right");
1095
                            $xh->tag('div');
1096
                                $xh->add_attribute("class", "dropdown-item btn");
1097
                                $xh->add_attribute("formaction", "/login/account.php");
1098
                                $xh->add_attribute("type", "submit");
1099
                                $xh->add_attribute("name", "submitBtn");
1100
                                $xh->add_attribute("value", "account");
1101
                                $xh->tag('button');
1102
                                    $xh->add_attribute("class", "svg-24");
1103
                                    $xh->add_attribute("viewBox", "0 0 24 24");
1104
                                    $xh->tag('svg');
1105
                                        $xh->add_attribute("fill", "currentColor");
1106
                                        $xh->add_attribute("d", "M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z");
1107
                                        $xh->single_tag('path');
1108
                                    $xh->close(); // svg
1109
                                    $xh->tag('span', "Information");
1110
                                $xh->close(); // button
1111
 
1112
                                $xh->add_attribute("class", "dropdown-item btn");
1113
                                $xh->add_attribute("formaction", "/login/editAccount.php");
1114
                                $xh->add_attribute("type", "submit");
1115
                                $xh->add_attribute("name", "submitBtn");
1116
                                $xh->add_attribute("value", "editAccount");
1117
                                $xh->tag('button');
1118
                                    $xh->add_attribute("class", "svg-24");
1119
                                    $xh->add_attribute("viewBox", "0 0 24 24");
1120
                                    $xh->tag('svg');
1121
                                        $xh->add_attribute("fill", "currentColor");
1122
                                        $xh->add_attribute("d", "M21.7,13.35L20.7,14.35L18.65,12.3L19.65,11.3C19.86,11.09 20.21,11.09 20.42,11.3L21.7,12.58C21.91,12.79 21.91,13.14 21.7,13.35M12,18.94L18.06,12.88L20.11,14.93L14.06,21H12V18.94M12,14C7.58,14 4,15.79 4,18V20H10V18.11L14,14.11C13.34,14.03 12.67,14 12,14M12,4A4,4 0 0,0 8,8A4,4 0 0,0 12,12A4,4 0 0,0 16,8A4,4 0 0,0 12,4Z");
1123
                                        $xh->single_tag('path');
1124
                                    $xh->close(); // svg
1125
                                    $xh->tag('span', "Edit Account");
1126
                                $xh->close(); // button
1127
 
1128
                                if (empty($_SESSION['sessData']['loginType']) || $_SESSION['sessData']['loginType'] != 'social') {
1129
                                    $xh->add_attribute("class", "dropdown-item btn");
1130
                                    $xh->add_attribute("formaction", "/login/changePassword.php");
1131
                                    $xh->add_attribute("type", "submit");
1132
                                    $xh->add_attribute("name", "submitBtn");
1133
                                    $xh->add_attribute("value", "changePassword");
1134
                                    $xh->tag('button');
1135
                                        $xh->add_attribute("class", "svg-24");
1136
                                        $xh->add_attribute("viewBox", "0 0 24 24");
1137
                                        $xh->tag('svg');
1138
                                            $xh->add_attribute("fill", "currentColor");
1139
                                            $xh->add_attribute("d", "M12.63,2C18.16,2 22.64,6.5 22.64,12C22.64,17.5 18.16,22 12.63,22C9.12,22 6.05,20.18 4.26,17.43L5.84,16.18C7.25,18.47 9.76,20 12.64,20A8,8 0 0,0 20.64,12A8,8 0 0,0 12.64,4C8.56,4 5.2,7.06 4.71,11H7.47L3.73,14.73L0,11H2.69C3.19,5.95 7.45,2 12.63,2M15.59,10.24C16.09,10.25 16.5,10.65 16.5,11.16V15.77C16.5,16.27 16.09,16.69 15.58,16.69H10.05C9.54,16.69 9.13,16.27 9.13,15.77V11.16C9.13,10.65 9.54,10.25 10.04,10.24V9.23C10.04,7.7 11.29,6.46 12.81,6.46C14.34,6.46 15.59,7.7 15.59,9.23V10.24M12.81,7.86C12.06,7.86 11.44,8.47 11.44,9.23V10.24H14.19V9.23C14.19,8.47 13.57,7.86 12.81,7.86Z");
1140
                                            $xh->single_tag('path');
1141
                                        $xh->close(); // svg
1142
                                        $xh->tag('span', "Change Password");
1143
                                    $xh->close(); // button
1144
                                }
1145
 
1146
                                $xh->add_attribute("class", "dropdown-item btn");
1147
                                $xh->add_attribute("formaction", "/login/userAccount.php?logoutSubmit=1");
1148
                                $xh->add_attribute("type", "submit");
1149
                                $xh->add_attribute("name", "submitBtn");
1150
                                $xh->add_attribute("value", "logout");
1151
                                $xh->tag('button');
1152
                                    $xh->add_attribute("class", "svg-24");
1153
                                    $xh->add_attribute("viewBox", "0 0 24 24");
1154
                                    $xh->tag('svg');
1155
                                        $xh->add_attribute("fill", "currentColor");
1156
                                        $xh->add_attribute("d", "M16,17V14H9V10H16V7L21,12L16,17M14,2A2,2 0 0,1 16,4V6H14V4H5V20H14V18H16V20A2,2 0 0,1 14,22H5A2,2 0 0,1 3,20V4A2,2 0 0,1 5,2H14Z");
1157
                                        $xh->single_tag('path');
1158
                                    $xh->close(); // svg
1159
                                    $xh->tag('span', "Logout");
1160
                                $xh->close(); // button
1161
                            $xh->close(); // div
1162
                        $xh->close(); // li
1163
                    }
1164
                $xh->close(); // ul
1165
            $xh->close(); // div
1166
        $xh->close(); // nav
1167
    $xh->close(); // form
1168
 
1169
    $html = $xh->flush();
1170
    //error_log(print_r($html, 1));
1171
 
1172
    return $html;
1173
}
1174
 
1175
function productTableEventListeners() {
1176
    $xh = new Html;
1177
    $xh->init($_SESSION["htmlIndent"]);
1178
 
1179
    $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
1180
    $xh->tag('script');
1181
        $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
1182
        $str .= my_trim('    document.getElementById("productTable").addEventListener("click", function(event) {');
1183
        $str .= my_trim('        e = event.target.closest("button") || event.target.closest("a");');
1184
        $str .= my_trim('        if (e && e.id == "resultViewToggle") {');
1185
        $str .= my_trim('            $("[data-toggle=\"tooltip\"]").tooltip("hide");');
1186
        $str .= my_trim('            window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Result View", "eventAction" : "Toggle", "eventLabel" : "' . ($_SESSION["currentLayout"] == "CardView" ? "Table View" : "Card View") . '"});');
1187
        $str .= my_trim('        }');
1188
        $str .= my_trim('        if (e && e.id == "detailTab") {');
1189
        $str .= my_trim('            window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Filter", "eventAction" : (document.getElementById("detailFilter").style.display == "block" ? "Open" : "Close" ), "eventLabel" : ""});');
1190
        $str .= my_trim('        }');
1191
        $str .= my_trim('        if (e && e.id == "detailTabSubmit") {');
1192
        $str .= my_trim('            window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Filter", "eventAction" : "Apply", "eventLabel" : ""});');
1193
        $str .= my_trim('        }');
1194
        $str .= my_trim('        if (e && e.id == "detailTabReset") {');
1195
        $str .= my_trim('            window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Filter", "eventAction" : "Reset", "eventLabel" : ""});');
1196
        $str .= my_trim('        }');
1197
        $str .= my_trim('        if (event.target.classList.contains("affiliate-link-table")) {');
1198
        $str .= my_trim('            var tr = event.target.closest("tr");');
1199
        $str .= my_trim('            window.dataLayer.push({ "event" :  "trackEvent",  "eventCategory" :  "Affiliate",  "eventAction" :  "Click",  "eventLabel" :  tr.getAttribute("data-merchant")});');
1200
        $str .= my_trim('            saveTransfer(tr.getAttribute("data-url"));');
1201
        $str .= my_trim('        }');
1202
        $str .= my_trim('        if (event.target.classList.contains("affiliate-link-card")) {');
1203
        $str .= my_trim('            var card = event.target.closest(".card");');
1204
        $str .= my_trim('            window.dataLayer.push({ "event" :  "trackEvent",  "eventCategory" :  "Affiliate",  "eventAction" :  "Click",  "eventLabel" :  card.getAttribute("data-merchant")});');
1205
        $str .= my_trim('            saveTransfer(card.getAttribute("data-url"));');
1206
        $str .= my_trim('        }');
1207
        $str .= my_trim('    });');
1208
        $str .= my_trim('});');
1209
    $xh->insert_code($str);
1210
    $xh->close(); // script
1211
 
1212
    $html = $xh->flush();
1213
    //error_log(print_r($html, 1));
1214
 
1215
    return $html;
1216
}
1217
 
1218
function printHelp() {
1219
 
1220
    $outer = "shadow p-4 mb-4 bg-light";
1221
    $head = "bg-info px-2 py-2";
1222
    $image = "img-fluid border border-dark lazyload";
1223
    $list = "btn btn-link align-baseline";
149 - 1224
    $icon = "material-icons material-text material-nlm material-nrm md-18";
143 - 1225
 
1226
    $xh = new Html;
1227
    $xh->init($_SESSION["htmlIndent"]);
1228
 
1229
 
1230
$xh->add_attribute("class", "container bg-3");
1231
$xh->tag('div');
1232
    $xh->add_attribute("class", "mt-3");
1233
    $xh->tag('p');
1234
        $xh->tag('span', "In a nutshell, ");
1235
        $xh->tag('b', "Find Cheap Music");
1236
        $xh->tag('span', " is for the serious collector or bargain hunter. It searches dozens of online stores for cheap Compact Discs, Vinyl Records, Digital Downloads, Music Sheets and Music related books without displaying any additional ads.");
1237
    $xh->close(); // p
1238
 
1239
    $xh->add_attribute("class", $outer);
1240
    $xh->tag('div');
1241
 
1242
        $xh->add_attribute("id", "contents");
1243
        $xh->add_attribute("class", "bg-primary px-2 py-2");
1244
        $xh->tag('h2',"Table of Contents");
1245
        $xh->tag('ol');
1246
            $xh->tag('li');
1247
                $xh->add_attribute("class", $list);
1248
                $xh->add_attribute("href", "#mainnav");
1249
                $xh->tag('a', "Main Navigation Menu");
1250
            $xh->close(); // li
1251
            $xh->tag('li');
1252
                $xh->add_attribute("class", $list);
1253
                $xh->add_attribute("href", "#homescreen");
1254
                $xh->tag('a', "Main / Home Screen");
1255
            $xh->close(); // li
1256
            $xh->tag('li');
1257
                $xh->add_attribute("class", $list);
1258
                $xh->add_attribute("href", "#search");
1259
                $xh->tag('a', "Search Results");
1260
            $xh->close(); // li
1261
            $xh->tag('li');
1262
                $xh->add_attribute("class", $list);
1263
                $xh->add_attribute("href", "#random");
1264
                $xh->tag('a', "Random Results");
1265
            $xh->close(); // li
1266
            $xh->tag('li');
1267
                $xh->add_attribute("class", $list);
1268
                $xh->add_attribute("href", "#coupons");
1269
                $xh->tag('a', "Coupons and Special Offers");
1270
            $xh->close(); // li
1271
            $xh->tag('li');
1272
                $xh->add_attribute("class", $list);
1273
                $xh->add_attribute("href", "#wishlist");
1274
                $xh->tag('a', "Wishlist");
1275
            $xh->close(); // li
1276
            $xh->tag('li');
1277
                $xh->add_attribute("class", $list);
1278
                $xh->add_attribute("href", "#login");
1279
                $xh->tag('a', "Login / Registration");
1280
            $xh->close(); // li
1281
        $xh->close(); // ol
1282
    $xh->close(); // div
1283
 
1284
    $xh->add_attribute("class", $outer);
1285
    $xh->tag('div');
1286
        $xh->add_attribute("class", $head);
1287
        $xh->add_attribute("id", "mainnav");
1288
        $xh->tag('h2', "1. Main Navigation Menu");
1289
        $xh->add_attribute("class", $outer);
1290
        $xh->tag('div');
1291
            $xh->add_attribute("class", $image);
1292
            $xh->add_attribute("src", PIXEL);
1293
            $xh->add_attribute("data-src", timeStampUrl("images/help/main_menu.png"));
1294
            $xh->add_attribute("alt", "Main Menu");
1295
            $xh->single_tag('img');
1296
            $xh->add_attribute("class", "mt-3");
1297
            $xh->tag('p');
1298
                $xh->tag('span', "The main menu contains the home button (");
1299
                $xh->add_attribute("class", $icon);
1300
                $xh->tag('i', "home");
1301
                $xh->tag('span', "), links to the terms of service, the privacy policy, our blog as well as a link to this help page (");
1302
                $xh->add_attribute("class", $icon);
1303
                $xh->tag('i', "help_outline");
1304
                $xh->tag('span', "). Located on the right-hand side is the login button. The main menu expands with links to the coupons / special offers and wishlist after logging in:");
1305
            $xh->close(); // p
1306
            $xh->add_attribute("class", $image);
1307
            $xh->add_attribute("src", PIXEL);
1308
            $xh->add_attribute("data-src", timeStampUrl("images/help/main_menu_full.png"));
1309
            $xh->add_attribute("alt", "Main Menu after login");
1310
            $xh->single_tag('img');
149 - 1311
            $xh->add_attribute("class", "mt-3");
143 - 1312
            $xh->tag('p', "After registration or a quick social login - using your Google, Facebook or Twitter account - you get access to a list of store coupons and special offers, are able to maintain an album wishlist, receive price alert emails, set your search preferences or change the color theme.");
1313
        $xh->close(); // div
1314
 
1315
        $xh->insert_code(backToTOC());
1316
   $xh->close(); // div
1317
 
1318
    $xh->add_attribute("class", $outer);
1319
    $xh->tag('div');
1320
        $xh->add_attribute("class", $head);
1321
        $xh->add_attribute("id", "homescreen");
1322
        $xh->tag('h2', "2. Main / Home Screen");
1323
 
1324
        $xh->tag('h3', "Simple Search");
1325
        $xh->add_attribute("class", $image);
1326
        $xh->add_attribute("src", PIXEL);
1327
        $xh->add_attribute("data-src", timeStampUrl("images/help/search_bar.png"));
1328
        $xh->add_attribute("alt", "Search Bar");
1329
        $xh->single_tag('img');
1330
        $xh->add_attribute("class", "mt-3");
149 - 1331
        $xh->tag('p', "The search bar consists of a popup button with search tips, a link to the barcode checker and the search term input box.");
143 - 1332
 
1333
        $xh->add_attribute("class", "bg-light text-dark");
1334
        $xh->tag('div');
1335
            $xh->add_attribute("class", $outer);
1336
            $xh->tag('div');
1337
                $xh->tag('h4');
1338
                    $xh->add_attribute("class", $icon);
1339
                    $xh->tag('i', "search");
1340
                    $xh->tag('span', "Search Terms");
1341
                $xh->close(); // h4
1342
                $xh->add_attribute("class", $image);
1343
                $xh->add_attribute("src", PIXEL);
1344
                $xh->add_attribute("data-src", timeStampUrl("images/help/search_term.png"));
1345
                $xh->add_attribute("alt", "Search Term");
1346
                $xh->single_tag('img');
1347
                $xh->add_attribute("class", "mt-3");
1348
                $xh->tag('p', 'The search algorithm is optimized to find the cheapest store offers for a specific album. Searches with generic keywords like “country music” or “rock”, or established artists like “Elvis Presley” or “Beatles”, will bring up too many results.');
1349
 
1350
                $xh->add_attribute("class", "font-weight-bold");
1351
                $xh->tag('P', "Simple Search or Advanced Search");
1352
                $xh->tag('p', "The simple search with the name of the artist and the title of the album will in most cases suffice to find the desired album. You should switch to the advanced search in case you do not have the name of the artist and the title of the album or you want to explore albums. Here you can search by any combination of artist, title, track (song), barcode, record label, record label catalog number, country and year. Once you found your album in the matching albums section, trigger a store offer search from it to see the cheapest store offers.");
1353
 
1354
                $xh->add_attribute("class", "font-weight-bold");
1355
                $xh->tag('p', "Barcode");
1356
                $xh->tag('p');
149 - 1357
                $xh->tag('span', "The 12- or 13-digit barcode, normally located on the back, offers the best chance to find a specific album. You should use our barcode checker (");
1358
                $xh->add_attribute("class", "svg-24 align-text-top mx-n1");
143 - 1359
                $xh->add_attribute("viewbox", "0 0 24 24");
1360
                $xh->tag('svg');
1361
                    $xh->add_attribute("fill", "currentColor");
1362
                    $xh->add_attribute("d", "M2,6H4V18H2V6M5,6H6V18H5V6M7,6H10V18H7V6M11,6H12V18H11V6M14,6H16V18H14V6M17,6H20V18H17V6M21,6H22V18H21V6Z");
1363
                    $xh->single_tag('path');
1364
                $xh->close(); // svg
1365
                $xh->tag('span', ") to verify the barcode and then search for store offers. See our ");
1366
                $xh->add_attribute("href", "https://blog.findcheapmusic.com/2020/03/music-cd-barcodes-and-identifiers.html");
1367
                $xh->add_attribute("target", "_blank");
1368
                $xh->add_attribute("rel", "noopener noreferrer");
1369
                $xh->tag('a', "blog post");
1370
                $xh->tag('span', " for more information about music barcodes.");
1371
                $xh->close(); // p
1372
            $xh->close(); // div
1373
            $xh->add_attribute("class", $outer);
1374
            $xh->tag('div');
1375
                $xh->tag('p', "During the search, a popup with a percentage bar shows the progress. The percentage bar does not always move equally since some online stores provide the search results faster than others.");
1376
                $xh->add_attribute("class", $image);
1377
                $xh->add_attribute("src", PIXEL);
1378
                $xh->add_attribute("data-src", timeStampUrl("images/help/progress_bar.png"));
1379
                $xh->add_attribute("alt", "Search Progress Bar");
1380
                $xh->single_tag('img');
1381
            $xh->close(); // div
1382
            $xh->add_attribute("class", $outer);
1383
            $xh->tag('div');
1384
                $xh->tag('p');
1385
                    $xh->tag('span', "The last 50 search terms are saved for convenience. The list is filtered as soon as you start typing; to see the full list, empty the search field by hitting the ");
1386
                    $xh->add_attribute("class", $icon);
1387
                    $xh->tag('i', "cancel_presentation");
1388
                    $xh->tag('span', " at the end or press the down-arrow key. When you select a saved search term it will remember and restore an advanced search. The search results are cached for about 1 hour to accelerate switching back and forth between your searches.");
1389
                $xh->close(); // p
1390
                $xh->add_attribute("class", $image);
1391
                $xh->add_attribute("src", PIXEL);
1392
                $xh->add_attribute("data-src", timeStampUrl("images/help/search_history.png"));
1393
                $xh->add_attribute("alt", "Search History Dropdown List");
1394
                $xh->single_tag('img');
1395
            $xh->close(); // div
1396
 
1397
            $xh->tag('h3', "Advanced Search");
1398
            $xh->add_attribute("class", $image);
1399
            $xh->add_attribute("src", PIXEL);
1400
            $xh->add_attribute("data-src", timeStampUrl("images/help/advanced_search_bar.png"));
1401
            $xh->add_attribute("alt", "Advanced Search Bar");
1402
            $xh->single_tag('img');
1403
            $xh->add_attribute("class", "mt-3");
1404
            $xh->tag('p', "The advanced search screen offers individual fields for the criteria which leads to better results.");
1405
 
1406
            $xh->add_attribute("class", "bg-light text-dark");
1407
            $xh->tag('div');
1408
                $xh->add_attribute("class", $outer);
1409
                $xh->tag('div');
1410
                    $xh->tag('h4');
1411
                        $xh->add_attribute("class", $icon);
1412
                        $xh->tag('i', "search");
1413
                        $xh->tag('span', "Advanced Search Terms");
1414
                    $xh->close(); // h4
1415
                    $xh->add_attribute("class", $image);
1416
                    $xh->add_attribute("src", PIXEL);
1417
                    $xh->add_attribute("data-src", timeStampUrl("images/help/advanced_search_term.png"));
1418
                    $xh->add_attribute("alt", "Search Term");
1419
                    $xh->single_tag('img');
1420
                    $xh->add_attribute("class", "mt-3");
149 - 1421
                    $xh->tag('p', 'Use as much or as little criteria as you like; one criterion is necessary for a search. Capitalization is not important, only correct spelling.');
143 - 1422
                    $xh->tag('p');
1423
                        $xh->add_attribute("class", "font-weight-bold");
1424
                        $xh->tag('span', "Artist: ");
1425
                        $xh->tag('span', "The name of the artist or band. Do not use 'Various'.");
1426
                    $xh->close(); // p
1427
                    $xh->tag('p');
1428
                        $xh->add_attribute("class", "font-weight-bold");
1429
                        $xh->tag('span', "Title: ");
1430
                        $xh->tag('span', "The title of the album.");
1431
                    $xh->close(); // p
1432
                    $xh->tag('p');
1433
                        $xh->add_attribute("class", "font-weight-bold");
1434
                        $xh->tag('span', "Track: ");
1435
                        $xh->tag('span', "The name of a track / song on the album.");
1436
                    $xh->close(); // p
1437
                    $xh->tag('p');
1438
                        $xh->add_attribute("class", "font-weight-bold");
1439
                        $xh->tag('span', "Barcode: ");
1440
                        $xh->tag('span', "The 12- or 13-digit barcode.");
1441
                    $xh->close(); // p
1442
                    $xh->tag('p');
1443
                        $xh->add_attribute("class", "font-weight-bold");
1444
                        $xh->tag('span', "Cat #: ");
1445
                        $xh->tag('span', "The record label catalog number. Usually on the spine or sometimes the back of the album.");
1446
                    $xh->close(); // p
1447
                    $xh->tag('p');
1448
                        $xh->add_attribute("class", "font-weight-bold");
1449
                        $xh->tag('span', "Label: ");
1450
                        $xh->tag('span', "The record label name.");
1451
                    $xh->close(); // p
1452
                    $xh->tag('p');
1453
                        $xh->add_attribute("class", "font-weight-bold");
1454
                        $xh->tag('span', "Country: ");
1455
                        $xh->tag('span', "The country of manufacture. Use 'US' for 'United States'.");
1456
                    $xh->close(); // p
1457
                    $xh->tag('p');
1458
                        $xh->add_attribute("class", "font-weight-bold");
1459
                        $xh->tag('span', "Year: ");
1460
                        $xh->tag('span', "The release year.");
1461
                    $xh->close(); // p
1462
                $xh->close(); // div
1463
            $xh->close(); // div
1464
 
1465
 
1466
            $xh->add_attribute("class", $outer);
1467
            $xh->tag('div');
1468
                $xh->tag('h3', "Barcode Checker");
1469
                $xh->tag('p');
1470
                    $xh->tag('span', "The barcode checker verifies Music CD barcodes or calculates a missing check digit. Online stores will not be able to find any results for invalid barcodes. The verified barcode can then be used for an online store search right away.");
1471
                    $xh->brnl();
1472
                    $xh->tag('span', "See our ");
1473
                    $blHref = "https://blog.findcheapmusic.com/2020/03/music-cd-barcodes-and-identifiers.html";
1474
                    $xh->add_attribute("id", "blLinkHelp");
1475
                    $xh->add_attribute("href", $blHref);
1476
                    $xh->add_attribute("target", "_blank");
1477
                    $xh->add_attribute("rel", "noopener noreferrer");
1478
                    $xh->tag('a', "blog post");
1479
                    $xh->tag('span', " for more information about music barcodes.");
1480
                $xh->close(); // p
1481
                $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
1482
                $xh->tag('script');
1483
                    $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
1484
                    $str .= my_trim('    document.getElementById("blLinkHelp").addEventListener("click", function() {');
1485
                    $str .= my_trim('        dataLayer.push({ "event": "social", "socialNetwork": "Blogger", "socialAction": "Link", "socialTarget": "' . $blHref . '"});');
1486
                    $str .= my_trim('    });');
1487
                    $str .= my_trim('});');
1488
                    $xh->insert_code($str);
1489
                $xh->close(); // script
1490
                $xh->tag('p', "Verifying a barcode:");
1491
                $xh->add_attribute("class", $image . " mb-3 lazyload");
1492
                $xh->add_attribute("src", PIXEL);
1493
                $xh->add_attribute("data-src", timeStampUrl("images/help/barcode_verify.png"));
1494
                $xh->add_attribute("alt", "Barcode Verification");
1495
                $xh->single_tag('img');
1496
                $xh->add_attribute("class", "mt-3");
1497
                $xh->tag('p', "Calculating the check digit for a barcode:");
1498
                $xh->add_attribute("class", $image . " mb-3 lazyload");
1499
                $xh->add_attribute("src", PIXEL);
1500
                $xh->add_attribute("data-src", timeStampUrl("images/help/barcode_calc.png"));
1501
                $xh->add_attribute("alt", "Barcode Check Digit Calculation");
1502
                $xh->single_tag('img');
1503
           $xh->close(); // div
1504
        $xh->close(); // div
1505
        $xh->insert_code(backToTOC());
1506
   $xh->close(); // div
1507
 
1508
    $xh->add_attribute("class", $outer);
1509
    $xh->tag('div');
1510
        $xh->add_attribute("class", $head);
1511
        $xh->add_attribute("id", "search");
1512
        $xh->tag('h2', "3. Search Results");
1513
        $xh->tag('p', "The search delivers two different results. At the top is a card deck with up to 6 albums matching the search criteria. Below it is a table with online listings sorted by total price ascending.");
1514
        $xh->add_attribute("class", $outer);
1515
        $xh->tag('div');
1516
            $xh->tag('h3', "Matching Albums Card Deck (Results Part 1)");
1517
            $xh->tag('p', "Each card shows the name and artist of the album on top along with a thumbnail. Clicking on the thumbnail opens a modal with detailed information and track list. The following buttons are at the footer of the card:");
1518
            $xh->add_attribute("class", "list-unstyled");
1519
            $xh->tag('ul');
1520
                $xh->tag('li');
1521
                    $xh->add_attribute("class", $icon);
1522
                    $xh->tag('i', "library_add");
1523
                    $xh->tag('span', " - Add album to wishlist");
1524
                $xh->close(); // li
1525
                $xh->tag('li');
1526
                    $xh->add_attribute("class", $icon);
1527
                    $xh->tag('i', "library_add_check");
1528
                    $xh->tag('span', " - Album already on wishlist");
1529
                $xh->close(); // li
1530
                $xh->tag('li');
1531
                    $xh->add_attribute("class", $icon);
1532
                    $xh->tag('i', "videocam");
1533
                    $xh->tag('span', " - Open Modal with list of videos for this album");
1534
                $xh->close(); // li
1535
                $xh->tag('li');
1536
                    $xh->add_attribute("class", $icon);
1537
                    $xh->tag('i', "search");
1538
                    $xh->tag('span', "Offer - Search for cheap online store listings");
1539
                $xh->close(); // li
1540
            $xh->close(); // ul
1541
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1542
            $xh->add_attribute("src", PIXEL);
1543
            $xh->add_attribute("data-src", timeStampUrl("images/help/matching_albums.png"));
1544
            $xh->add_attribute("alt", "Matching Albums");
1545
            $xh->single_tag('img');
1546
        $xh->close(); // div
1547
        $xh->add_attribute("class", $outer);
1548
        $xh->tag('div');
1549
            $xh->tag('h3', "Detailed Album Information");
1550
            $xh->tag('p', "This pop up shows the detailed album information including the track listing.");
1551
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1552
            $xh->add_attribute("src", PIXEL);
1553
            $xh->add_attribute("data-src", timeStampUrl("images/help/album_info.png"));
1554
            $xh->add_attribute("alt", "Album Information");
1555
            $xh->single_tag('img');
1556
        $xh->close(); // div
1557
        $xh->add_attribute("class", $outer);
1558
        $xh->tag('div');
1559
            $xh->tag('h3', "Album Videos");
1560
            $xh->tag('p', "This pop up shows the available videos.");
1561
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1562
            $xh->add_attribute("src", PIXEL);
1563
            $xh->add_attribute("data-src", timeStampUrl("images/help/album_videos.png"));
1564
            $xh->add_attribute("alt", "Album Video Information");
1565
            $xh->single_tag('img');
1566
        $xh->close(); // div
1567
        $xh->add_attribute("class", $outer);
1568
        $xh->tag('div');
1569
            $xh->tag('h3', "Matching Listings (Results Part 2)");
1570
            $xh->tag('p');
1571
                $xh->tag('span', "This section displays the cheapest available listings from dozens of online stores. The results list can be toggled between a table view (");
1572
                $xh->add_attribute("class", $icon);
1573
                $xh->tag('i', "view_list");
1574
                $xh->tag('span', ") or a card view (");
1575
                $xh->add_attribute("class", $icon);
1576
                $xh->tag('i', "view_module");
1577
                $xh->tag('span', ").");
1578
            $xh->close(); // p
1579
 
1580
            $xh->add_attribute("class", "font-weight-bold");
1581
            $xh->tag('p', "Table View:");
1582
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1583
            $xh->add_attribute("src", PIXEL);
1584
            $xh->add_attribute("data-src", timeStampUrl("images/help/search_results_table.png"));
1585
            $xh->add_attribute("alt", "Search Results Table View");
1586
            $xh->single_tag('img');
1587
            $xh->add_attribute("class", "font-weight-bold");
1588
            $xh->tag('p', "Table View (small):");
1589
            $xh->tag('p', "On smaller screens some of the information is hidden on a card that opens when pressing the + sign in front of the row.");
1590
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1591
            $xh->add_attribute("src", PIXEL);
1592
            $xh->add_attribute("data-src", timeStampUrl("images/help/small_search_results_table.png"));
1593
            $xh->add_attribute("alt", "Small Search Results Table View");
1594
            $xh->single_tag('img');
1595
            $xh->add_attribute("class", "mt-3 font-weight-bold");
1596
            $xh->tag('p', "Card View:");
1597
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1598
            $xh->add_attribute("src", PIXEL);
1599
            $xh->add_attribute("data-src", timeStampUrl("images/help/search_results_cards.png"));
1600
            $xh->add_attribute("alt", "Search Results Card View");
1601
            $xh->single_tag('img');
1602
            $xh->add_attribute("class", "pt-3");
1603
            $xh->tag('p');
1604
                $xh->add_attribute("class", "font-italic");
1605
                $xh->tag('span');
1606
                    $xh->tag('b', "Note:");
149 - 1607
                $xh->tag('span', " Every online merchant uses a slightly different search algorithm. Most return only results which contain all search words. There are some though who check for any of the search words and thereby deliver many unrelated results.");
143 - 1608
                $xh->close(); // span
1609
            $xh->close(); // p
1610
        $xh->close(); // div
1611
        $xh->add_attribute("class", $outer);
1612
        $xh->tag('div');
1613
            $xh->tag('h3', "Result Filtering");
149 - 1614
            $xh->tag('p', "The detailed filter allows selection by any combination of Condition, Media Type, Merchant or Shipping Origination. The number next to the individual criteria indicates the number of matching results in the list. After the filter is applied, the number of selected listings is shown in the title line.");
143 - 1615
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1616
            $xh->add_attribute("src", PIXEL);
1617
            $xh->add_attribute("data-src", timeStampUrl("images/help/detailed_filter.png"));
1618
            $xh->add_attribute("alt", "Detailed Filter Options");
1619
            $xh->single_tag('img');
1620
        $xh->close(); // div
1621
        $xh->insert_code(backToTOC());
1622
    $xh->close(); // div
1623
 
1624
    $xh->add_attribute("class", $outer);
1625
    $xh->tag('div');
1626
        $xh->add_attribute("class", $head);
1627
        $xh->add_attribute("id", "random");
1628
        $xh->tag('h2', "4. Random Results");
1629
        $xh->add_attribute("class", $outer);
1630
        $xh->tag('div');
1631
            $xh->tag('p', "The random album suggestion button is only shown on the front page when you visit the site for the first time (or haven't visited the site in a while). It gives new users a quick start into the website's features.");
1632
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1633
            $xh->add_attribute("src", PIXEL);
1634
            $xh->add_attribute("data-src", timeStampUrl("images/help/random_album_button.png"));
1635
            $xh->add_attribute("alt", "Random Album Button");
1636
            $xh->single_tag('img');
1637
        $xh->close(); // div
1638
        $xh->add_attribute("class", $outer);
1639
        $xh->tag('div');
1640
            $xh->tag('p', "The random album list looks exactly like the matching album list.");
1641
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1642
            $xh->add_attribute("src", PIXEL);
1643
            $xh->add_attribute("data-src", timeStampUrl("images/help/random_albums.png"));
1644
            $xh->add_attribute("alt", "Random Album result cards");
1645
            $xh->single_tag('img');
1646
        $xh->close(); // div
1647
        $xh->insert_code(backToTOC());
1648
       $xh->close(); // div
1649
 
1650
    $xh->add_attribute("class", $outer);
1651
    $xh->tag('div');
1652
        $xh->add_attribute("class", $head);
1653
        $xh->add_attribute("id", "coupons");
1654
        $xh->tag('h2', "5. Coupons and Special Offers");
1655
        $xh->add_attribute("class", $outer);
1656
        $xh->tag('div');
1657
            $xh->add_attribute("class", "mt-3");
1658
            $xh->tag('p', "This page shows the currently active coupons and special offers. The entries are updated on a weekly basis.");
1659
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1660
            $xh->add_attribute("src", PIXEL);
1661
            $xh->add_attribute("data-src", timeStampUrl("images/help/coupons.png"));
1662
            $xh->add_attribute("alt", "Coupons and Special Offers List");
1663
            $xh->single_tag('img');
1664
        $xh->close(); // div
1665
        $xh->insert_code(backToTOC());
1666
    $xh->close(); // div
1667
 
1668
    $xh->add_attribute("class", $outer);
1669
    $xh->tag('div');
1670
        $xh->add_attribute("class", $head);
1671
        $xh->add_attribute("id", "wishlist");
1672
        $xh->tag('h2', "6. Wishlist");
1673
        $xh->add_attribute("class", $outer);
1674
        $xh->tag('div');
1675
            $xh->tag('p');
149 - 1676
                $xh->tag('span', "This page allows managing the wishlist. Clicking on the heading (&#x2191;&#x2193;) for artist, title, barcode, format or ceiling price toggles the sort order between ascending and descending. The search filter (");
143 - 1677
                $xh->add_attribute("class", $icon);
1678
                $xh->tag('i', "search");
149 - 1679
                $xh->tag('span', ") on top of the table hides all rows which do not contain the search phrase.");
143 - 1680
            $xh->close(); // p
1681
            $xh->tag('p', "The following buttons are available for each entry:");
1682
            $xh->add_attribute("class", "list-unstyled");
1683
            $xh->tag('ul');
1684
                $xh->tag('li');
1685
                    $xh->add_attribute("class", $icon);
1686
                    $xh->tag('i', "edit");
1687
                    $xh->tag('span', " - Edit artist, title, barcode, condition, format and ceiling price");
1688
                $xh->close(); // li
1689
                $xh->tag('li');
1690
                    $xh->add_attribute("class", $icon);
1691
                    $xh->tag('i', "cancel_presentation");
1692
                    $xh->tag('span', "  - Delete wishlist entry (after confirmation)");
1693
                $xh->close(); // li
1694
                $xh->tag('li');
1695
                    $xh->add_attribute("class", $icon);
1696
                    $xh->tag('i', "info_outline");
1697
                    $xh->tag('span', "  - Get detailed album information");
1698
                $xh->close(); // li
1699
                $xh->tag('li');
1700
                    $xh->add_attribute("class", $icon);
1701
                    $xh->tag('i', "search");
1702
                    $xh->tag('span', "  - Search for cheap online store listings");
1703
                $xh->close(); // li
1704
            $xh->close(); // ul
1705
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1706
            $xh->add_attribute("src", PIXEL);
1707
            $xh->add_attribute("data-src", timeStampUrl("images/help/wishlist.png"));
1708
            $xh->add_attribute("alt", "Wishlist Table");
1709
            $xh->single_tag('img');
1710
            $xh->tag('p', "On smaller screens some of the information is hidden on a card that opens when pressing the + sign in front of the row.");
1711
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1712
            $xh->add_attribute("src", PIXEL);
1713
            $xh->add_attribute("data-src", timeStampUrl("images/help/small_wishlist.png"));
1714
            $xh->add_attribute("alt", "Wishlist Table");
1715
            $xh->single_tag('img');
1716
        $xh->close(); // div
1717
        $xh->add_attribute("class", $outer);
1718
        $xh->tag('div');
1719
            $xh->tag('h3', "Edit wishlist entry");
1720
            $xh->tag('p', "Any wishlist entry with a non-zero ceiling price is picked up by our nightly price monitor search. This search checks for new cheap listings below your maximum price and emails a notification. To cut down on unnecessary emails, we only send emails with actual results. The standard search frequency is initially set to weekly but can be changed at the user account to daily, weekly, bi-weekly or monthly.");
1721
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1722
            $xh->add_attribute("src", PIXEL);
1723
            $xh->add_attribute("data-src", timeStampUrl("images/help/wishlist_edit.png"));
1724
            $xh->add_attribute("alt", "Edit Wishlist Entry");
1725
            $xh->single_tag('img');
1726
        $xh->close(); // div
1727
        $xh->add_attribute("class", $outer);
1728
        $xh->tag('div');
1729
            $xh->tag('p', "New price monitor results are indicated at the wishlist menu entry at top");
1730
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1731
            $xh->add_attribute("src", PIXEL);
1732
            $xh->add_attribute("data-src", timeStampUrl("images/help/wishlist_menu_flag.png"));
1733
            $xh->add_attribute("alt", "Menu with new price monitor flag");
1734
            $xh->single_tag('img');
1735
            $xh->add_attribute("class", "mt-2");
1736
            $xh->tag('p', "and the header at the wishlist page.");
1737
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1738
            $xh->add_attribute("src", PIXEL);
1739
            $xh->add_attribute("data-src", timeStampUrl("images/help/wishlist_flag.png"));
1740
            $xh->add_attribute("alt", "Wishlist with new price monitor flag");
1741
            $xh->single_tag('img');
1742
            $xh->add_attribute("class", "mt-2");
1743
            $xh->tag('p', "Once you checked your price monitor list, the new flag will disappear.");
1744
        $xh->close(); // div
1745
        $xh->add_attribute("class", $outer);
1746
        $xh->tag('div');
1747
            $xh->tag('p', 'The price monitor results page is static. The system regenerates it at the interval set at your account if the account setting "Email Price Checks" is set to Yes.');
1748
            $xh->tag('p', "The table of contents shows the albums from your wishlist, where the system found music listings below your ceiling price. The number of cheap offers is next to each entry. You can jump back and forth between the table of contents and the result list via the links.");
1749
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1750
            $xh->add_attribute("src", PIXEL);
1751
            $xh->add_attribute("data-src", timeStampUrl("images/help/pricemonitor.png"));
1752
            $xh->add_attribute("alt", "Price monitor result list");
1753
            $xh->single_tag('img');
1754
        $xh->close(); // div
1755
        $xh->insert_code(backToTOC());
1756
    $xh->close(); // div
1757
 
1758
    $xh->add_attribute("class", $outer);
1759
    $xh->tag('div');
1760
        $xh->add_attribute("class", $head);
1761
        $xh->add_attribute("id", "login");
1762
        $xh->tag('h2', "7. Login / Registration");
1763
        $xh->add_attribute("class", $outer);
1764
        $xh->tag('div');
1765
            $xh->tag('p');
1766
                $xh->tag('span', "You can log in with your social account (Google, Facebook or Twitter) or register to create a new login for this site. Either way, you have to agree to the ");
1767
                $xh->add_attribute("href", "terms.php");
1768
                $xh->add_attribute("target", "_blank");
1769
                $xh->tag('a', "terms of service");
1770
                $xh->tag('span', "and the ");
1771
                $xh->add_attribute("href", "privacy.php");
1772
                $xh->add_attribute("target", "_blank");
1773
                $xh->tag('a', "privacy policy");
1774
                $xh->tag('span', ". The webpage is fully functional without a login but the registration gives you access to the coupons / special offers, wishlist, price alerts, search preferences, and layout setup.");
1775
            $xh->close(); // p
1776
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1777
            $xh->add_attribute("src", PIXEL);
1778
            $xh->add_attribute("data-src", timeStampUrl("images/help/login_screen.png"));
1779
            $xh->add_attribute("alt", "Logon / Sign Up Screen");
1780
            $xh->single_tag('img');
1781
        $xh->close(); // div
1782
        $xh->add_attribute("class", $outer);
1783
        $xh->tag('div');
1784
            $xh->tag('p', "Once you are logged in, the site preferences can be changed. The user image is optional and shows up in the top navigation bar. First name and email address are the only mandatory fields. It is recommended though to enter the zip code to get the accurate shipping cost for items listed using a shipping rate table.");
1785
            $xh->tag('p', "The Layout section allows changing the color theme for the website and the initial result layout (table or card).");
1786
            $xh->tag('p', "The Search Filter Preferences section allows limiting the search results by condition or media type. The default behavior is to search for all conditions and media types. Every time you log back into the website, these settings will overwrite the default search filters.");
1787
            $xh->tag('p', "The Wishlist section governs the periodic price monitor emails for all items on your wishlist with a non-zero price cap. By default, weekly emails are turned on. The frequency can be set to daily, weekly, bi-weekly and monthly.");
1788
            $xh->add_attribute("class", $image . " mb-3 lazyload");
1789
            $xh->add_attribute("src", PIXEL);
1790
            $xh->add_attribute("data-src", timeStampUrl("images/help/account_info.png"));
1791
            $xh->add_attribute("alt", "Account information Screen");
1792
            $xh->single_tag('img');
1793
        $xh->close(); // div
1794
        $xh->insert_code(backToTOC());
1795
    $xh->close(); // div
127 - 1796
 
143 - 1797
1798
 
1799
    //error_log(print_r($html, 1));
1800
1801
 
1802
}
129 - 1803
143 - 1804
 
1805
    $xh = new Html;
1806
    $xh->init($_SESSION["htmlIndent"]);
1807
1808
 
1809
    $xh->tag('div');
1810
1811
 
1812
        $xh->add_attribute("href", "#contents");
1813
        $xh->add_attribute("title", "Back to Table of Contents");
1814
        $xh->add_attribute("data-toggle2", "tooltip");
1815
        $xh->add_attribute("aria-label", "Go to table of contents");
1816
        $xh->tag('a');
1817
            $xh->add_attribute("class", "material-icons");
1818
            $xh->tag('i', "arrow_upward");
1819
        $xh->close(); // a
1820
    $xh->close(); // div
1821
1822
 
1823
    //error_log(print_r($html, 1));
1824
1825
 
1826
}
1827
1828
 
1829
function printProgessbarModal() {
1830
    $xh = new Html;
1831
    $xh->init($_SESSION["htmlIndent"]);
1832
1833
 
1834
    $xh->add_attribute("id", "progressBarDiv");
1835
    $xh->tag('div');
1836
        $xh->add_attribute("class", "modal-dialog modal-dialog-centered");
1837
        $xh->tag('div');
1838
            $xh->add_attribute("class", "modal-content");
1839
            $xh->tag('div');
1840
                $xh->add_attribute("class", "modal-header");
1841
                $xh->tag('div');
1842
                    $xh->add_attribute("class", "display-6");
1843
                    $xh->add_attribute("id", "progressBarHeader");
1844
                    $xh->tag('p', "Searching");
1845
                $xh->close(); // div
1846
                $xh->add_attribute("class", "modal-body");
1847
                $xh->tag('div');
1848
                    $xh->add_attribute("class", "progress");
1849
                    $xh->tag('div');
1850
                        $xh->add_attribute("class", "progress-bar bg-success");
1851
                        $xh->add_attribute("id", "progressBar");
1852
                        $xh->tag('div', "0");
1853
                    $xh->close(); // div
1854
                $xh->close(); // div
1855
                $xh->add_attribute("class", "modal-footer");
1856
                $xh->tag('div');
1857
                    $xh->add_attribute("id", "progressBarMessage");
1858
                    $xh->tag('span', "");
1859
                $xh->close(); // div
1860
            $xh->close(); // div
1861
        $xh->close(); // div
1862
    $xh->close(); // div
1863
1864
 
1865
    //error_log(print_r($html, 1));
1866
1867
 
1868
}
1869
1870
 
1871
function printSocialIconBar() {
1872
    $xh = new Html;
1873
    $xh->init($_SESSION["htmlIndent"]);
1874
1875
 
1876
 
1877
    $xh->add_attribute("class", "social-icon-bar btn-group");
1878
    $xh->tag('div');
1879
1880
 
1881
        $xh->add_attribute("class", "btn cfacebook");
1882
        $xh->add_attribute("id", "fbShare");
1883
        $xh->add_attribute("role", "button");
1884
        $xh->add_attribute("title", "Share on Facebook");
1885
        $xh->add_attribute("href", $fbHref);
1886
        $xh->add_attribute("target", "_blank");
1887
        $xh->add_attribute("rel", "noopener noreferrer");
1888
        $xh->tag('a');
1889
            $xh->add_attribute("class", "social-icon-svg");
1890
            $xh->add_attribute("viewBox", "0 0 24 24");
1891
            $xh->tag('svg');
1892
                $xh->add_attribute("fill", "#fff");
1893
                $xh->add_attribute("d", "M12 2.04C6.5 2.04 2 6.53 2 12.06C2 17.06 5.66 21.21 10.44 21.96V14.96H7.9V12.06H10.44V9.85C10.44 7.34 11.93 5.96 14.22 5.96C15.31 5.96 16.45 6.15 16.45 6.15V8.62H15.19C13.95 8.62 13.56 9.39 13.56 10.18V12.06H16.34L15.89 14.96H13.56V21.96A10 10 0 0 0 22 12.06C22 6.53 17.5 2.04 12 2.04Z");
1894
                $xh->single_tag('path');
1895
            $xh->close(); // svg
1896
        $xh->close(); // a
1897
1898
 
1899
        $xh->add_attribute("class", "btn ctwitter");
1900
        $xh->add_attribute("id", "twShare");
1901
        $xh->add_attribute("role", "button");
1902
        $xh->add_attribute("title", "Share on Twitter");
1903
        $xh->add_attribute("href", $twHref . "&text=" . rawurlencode("Find cheap and rare music. Check it out."));
1904
        $xh->add_attribute("target", "_blank");
1905
        $xh->add_attribute("rel", "noopener noreferrer");
1906
        $xh->tag('a');
1907
            $xh->add_attribute("class", "social-icon-svg");
1908
            $xh->add_attribute("viewBox", "0 0 24 24");
1909
            $xh->tag('svg');
1910
                $xh->add_attribute("fill", "#fff");
1911
                $xh->add_attribute("d", "M22.46,6C21.69,6.35 20.86,6.58 20,6.69C20.88,6.16 21.56,5.32 21.88,4.31C21.05,4.81 20.13,5.16 19.16,5.36C18.37,4.5 17.26,4 16,4C13.65,4 11.73,5.92 11.73,8.29C11.73,8.63 11.77,8.96 11.84,9.27C8.28,9.09 5.11,7.38 3,4.79C2.63,5.42 2.42,6.16 2.42,6.94C2.42,8.43 3.17,9.75 4.33,10.5C3.62,10.5 2.96,10.3 2.38,10C2.38,10 2.38,10 2.38,10.03C2.38,12.11 3.86,13.85 5.82,14.24C5.46,14.34 5.08,14.39 4.69,14.39C4.42,14.39 4.15,14.36 3.89,14.31C4.43,16 6,17.26 7.89,17.29C6.43,18.45 4.58,19.13 2.56,19.13C2.22,19.13 1.88,19.11 1.54,19.07C3.44,20.29 5.7,21 8.12,21C16,21 20.33,14.46 20.33,8.79C20.33,8.6 20.33,8.42 20.32,8.23C21.16,7.63 21.88,6.87 22.46,6Z");
1912
                $xh->single_tag('path');
1913
            $xh->close(); // svg
1914
        $xh->close(); // a
1915
1916
 
1917
        $xh->add_attribute("class", "btn jump-top");
1918
        $xh->add_attribute("role", "button");
1919
        $xh->add_attribute("href", "#");
1920
        $xh->add_attribute("title", "Go to top");
1921
        $xh->tag('a');
1922
            $xh->add_attribute("class", "material-icons md-24");
1923
            $xh->tag('i', "arrow_upward");
1924
        $xh->close(); // a
1925
    $xh->close(); // div
1926
1927
 
1928
    $xh->tag('script');
1929
        $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
1930
        $str .= my_trim('	document.getElementById("topBtn").addEventListener("click", function() {');
1931
        $str .= my_trim('    topFunction();');
1932
        $str .= my_trim('  });');
1933
        $str .= my_trim('	document.getElementById("fbShare").addEventListener("click", function() {');
1934
        $str .= my_trim('    dataLayer.push({ "event": "social", "socialNetwork": "Facebook", "socialAction": "Share", "socialTarget": "' . $fbHref . '"});');
1935
        $str .= my_trim('  });');
1936
        $str .= my_trim('	document.getElementById("twShare").addEventListener("click", function() {');
1937
        $str .= my_trim('    dataLayer.push({ "event": "social", "socialNetwork": "Twitter", "socialAction": "Share", "socialTarget": "' . $twHref . '"});');
1938
        $str .= my_trim('  });');
1939
        $str .= my_trim('});');
1940
        $xh->insert_code($str);
1941
    $xh->close(); // script
1942
1943
 
1944
    //error_log(print_r($html, 1));
1945
1946
 
1947
}
1948
1949
 
1950
    $xh = new Html;
1951
    $xh->init($_SESSION["htmlIndent"]);
1952
1953
 
1954
    $xh->tag('h2', "Store Offers");
1955
1956
 
1957
    //error_log(print_r($html, 1));
1958
1959
 
1960
}
1961
1962
 
1963
function printNoResultsWarning() {
1964
    $xh = new Html;
1965
    $xh->init($_SESSION["htmlIndent"]);
1966
    $xh->add_attribute("class", "text-center p-3 rounded bg-warning");
1967
    $xh->tag('div');
1968
    $xh->add_attribute("class", "display-5 font-weight-bold");
1969
    $xh->tag('p', "Your search returned no store offers");
1970
    $xh->tag('p', "You may want to try the following:");
1971
    $xh->tag('ul');
1972
    $xh->tag('li', "Check the spelling");
1973
    $xh->tag('li', "Try using fewer words");
1974
    $xh->tag('li', "Try using artist and title if you used a barcode");
1975
    $xh->close(); // ul
1976
    $xh->close(); // div
1977
1978
 
1979
    //error_log(print_r($html, 1));
1980
    return $html;
1981
}
1982
1983
 
1984
function printSearchInfoModal() {
1985
    $xh = new Html;
1986
    $xh->init($_SESSION["htmlIndent"]);
1987
1988
 
1989
    $xh->add_attribute("id", "searchInfoModal");
1990
    $xh->tag('div');
1991
    $xh->add_attribute("class", "modal-dialog");
1992
    $xh->tag('div');
1993
    $xh->add_attribute("class", "modal-content");
1994
    $xh->tag('div');
1995
    $xh->add_attribute("class", "modal-header");
1996
    $xh->tag('div');
1997
    $xh->add_attribute("class", "modal-title display-5");
1998
    $xh->tag('p', "Search Tips");
1999
    $xh->add_attribute("type", "button");
2000
    $xh->add_attribute("class", "close");
2001
    $xh->add_attribute("data-dismiss", "modal");
2002
    $xh->tag('button');
2003
    $xh->add_attribute("class", "material-icons btn-dismiss");
2004
    $xh->tag('i', "cancel_presentation");
2005
    $xh->close(); // button
2006
    $xh->close(); // div
2007
    $xh->add_attribute("class", "modal-body");
2008
    $xh->tag('div');
2009
    $xh->add_attribute("class", "shadow p-4");
2010
    $xh->tag('div');
2011
    $xh->add_attribute("class", "display-6");
2012
2013
 
2014
    $xh->add_attribute("class", "material-icons material-text md-36");
2015
    $xh->tag('i', "search");
2016
    $xh->tag('span', " Search Keywords");
2017
    $xh->close(); // p
2018
2019
 
2020
2021
 
2022
    $xh->tag('P', "Simple Search or Advanced Search");
2023
    $xh->tag('p', "The simple search with the name of the artist and the title of the album will in most cases suffice to find the desired album. You should switch to the advanced search in case you do not have the name of the artist and the title of the album or you want to explore albums. Here you can search by any combination of artist, title, track (song), barcode, record label, record label catalog number, country and year. Once you found your album in the matching albums section, trigger a store offer search from it to see the cheapest store offers.");
2024
2025
 
2026
    $xh->tag('p', "Barcode");
2027
    $xh->tag('p');
2028
    $xh->tag('span', "The 12 or 13 digit barcode, normally located on the back, offers the best chance to find a specific album. You should use our barcode checker (");
2029
    $xh->add_attribute("class", "svg-24 align-text-top mx-n1");
149 - 2030
    $xh->add_attribute("viewbox", "0 0 24 24");
143 - 2031
    $xh->tag('svg');
2032
        $xh->add_attribute("fill", "currentColor");
2033
        $xh->add_attribute("d", "M2,6H4V18H2V6M5,6H6V18H5V6M7,6H10V18H7V6M11,6H12V18H11V6M14,6H16V18H14V6M17,6H20V18H17V6M21,6H22V18H21V6Z");
2034
        $xh->single_tag('path');
2035
    $xh->close(); // svg
2036
    $xh->tag('span', ") to verify the barcode and then search for store offers. See our ");
2037
    $xh->add_attribute("href", "https://blog.findcheapmusic.com/2020/03/music-cd-barcodes-and-identifiers.html");
2038
    $xh->add_attribute("target", "_blank");
2039
    $xh->add_attribute("rel", "noopener noreferrer");
2040
    $xh->tag('a', "blog post");
2041
    $xh->tag('span', " for more information about music barcodes.");
2042
    $xh->close(); // p
2043
2044
 
2045
    $xh->close(); // div
2046
    $xh->add_attribute("class", "modal-footer");
2047
    $xh->tag('div');
2048
    $xh->add_attribute("type", "button");
2049
    $xh->add_attribute("class", "btn btn-danger");
2050
    $xh->add_attribute("data-dismiss", "modal");
2051
    $xh->tag('button', "Close");
2052
    $xh->close(); // div
2053
    $xh->close(); // div
2054
    $xh->close(); // div
2055
    $xh->close(); // div
2056
2057
 
2058
    //error_log(print_r($html, 1));
2059
2060
 
2061
}
2062
2063
 
2064
    $xh = new Html;
2065
    $xh->init($_SESSION["htmlIndent"]);
2066
2067
 
2068
    $xh->add_attribute("type", "hidden");
2069
    $xh->add_attribute("name", "sessionTab");
2070
    $xh->add_attribute("value", MySessionHandler::getSessionTab());
2071
    $xh->single_tag('input');
2072
2073
 
2074
    //error_log(print_r($html, 1));
2075
2076
 
2077
}
2078
2079
 
2080
    $xh = new Html;
2081
    $xh->init($_SESSION["htmlIndent"]);
2082
2083
 
2084
    $xh->add_attribute("name", "nonce");
2085
    $xh->add_attribute("value", $_SESSION['nonce']);
2086
    $xh->single_tag('input');
2087
2088
 
2089
    //error_log(print_r($html, 1));
2090
2091
 
2092
}
2093
2094
 
2095
    $xh = new Html;
2096
    $xh->init($_SESSION["htmlIndent"]);
2097
2098
 
2099
    $xh->add_attribute("name", "searchTerm");
2100
    $xh->add_attribute("value", getSV("searchTerm"));
2101
    $xh->single_tag('input');
2102
2103
 
2104
    //error_log(print_r($html, 1));
2105
2106
 
2107
}
2108
2109
 
2110
    $xh = new Html;
2111
    $xh->init($_SESSION["htmlIndent"]);
2112
2113
 
2114
    $xh->add_attribute("type", "hidden");
2115
    $xh->add_attribute("name", "sessionId");
2116
    $xh->add_attribute("value", session_id());
2117
    $xh->single_tag('input');
2118
2119
 
2120
    //error_log(print_r($html, 1));
2121
2122
 
2123
}
2124
2125
 
2126
    $xh = new Html;
2127
    $xh->init($_SESSION["htmlIndent"]);
2128
2129
 
2130
    $xh->tag('div');
2131
        $xh->add_attribute("method", "post");
2132
        $xh->add_attribute("action", "/index.php");
2133
        $xh->tag('form');
2134
            $xh->insert_code(inputSessionTab());
2135
            $xh->insert_code(inputSearchTerm());
2136
            $xh->insert_code(inputNonce());
2137
            $xh->add_attribute("class", "btn btn-success mt-5 rounded");
2138
            $xh->add_attribute("id", "randomBtn");
2139
            $xh->add_attribute("type", "submit");
2140
            $xh->add_attribute("name", "submitBtn");
2141
            $xh->add_attribute("value", "random");
2142
            $xh->tag('button', "Random Album Suggestions");
2143
        $xh->close(); // form
2144
    $xh->close(); // div
2145
    $xh->add_attribute("nonce", base64_encode($_SESSION["nonce"]));
2146
    $xh->tag('script');
2147
        $str  = my_trim('document.addEventListener("DOMContentLoaded", function() {');
2148
        $str .= my_trim('    document.getElementById("randomBtn").addEventListener("click", function(event) {');
2149
        $str .= my_trim('        window.dataLayer.push({ "event" : "trackEvent", "eventCategory" : "Random Album", "eventAction" : "Click", "eventLabel" : ""});');
2150
        $str .= my_trim('    });');
2151
        $str .= my_trim('});');
2152
    $xh->insert_code($str);
2153
    $xh->close(); // script
2154
2155
 
2156
    $xh->tag('div');
2157
        $xh->add_attribute("class", "text-center py-2");
2158
        $xh->tag('h2', "Getting Started");
2159
        $xh->tag('p');
2160
            $xh->tag('span', "Welcome to Find Cheap Music. Here you can search dozens of trusted online stores at once. The below information details the major website features and is also available via the link to the help page (");
2161
            $xh->add_attribute("class", "material-icons material-text md-18");
2162
            $xh->tag('i', "help_outline");
2163
            $xh->tag('span', ") up top.");
2164
        $xh->close(); // p
2165
        $xh->single_tag('hr');
2166
        $xh->insert_code(printHelp());
2167
    $xh->close(); // div
2168
2169
 
2170
    //error_log(print_r($html, 1));
2171
2172
 
2173
}
2174
2175
 
2176
    $xh = new Html;
2177
    $xh->init($_SESSION["htmlIndent"]);
2178
2179
 
2180
    $xh->tag('script');
2181
        $str  = trim('window.addEventListener("load", function() {');
2182
        $str .= trim('    window.location.assign("#' . $section . '")');
2183
        $str .= trim('});');
2184
        $xh->insert_code($str);
2185
    $xh->close(); // script
2186
2187
 
2188
    //error_log(print_r($html, 1));
2189
2190
 
2191
}
2192