PageSourceSearch

https://www.4recruiting.co.uk/app/public/js/backend/function.js?2026092911

js 4recruiting.co.uk collected 2026-09-29 11:10:55 UTC 27,289 bytes, 872 lines download raw bytes

1'use strict';
2
3let ajaxUrl,
4    files,
5    intervals = [],
6    ajaxVars = {},
7    GLOBAL_URL = ''; // GLOBAL_URL
8
9
10function clearFiles() { files = null; }
11
12$.fn.hasAttr = function (name) {
13    return this.attr(name) !== undefined;
14};
15
16$(function () {
17    // Cancel transitions
18    $('body').on('click', 'a', function (e) {
19        console.log('Cancel transitions');
20        if ($(this).hasAttr('onclick')) {
21            e.preventDefault();
22        }
23        //if (!$(this).hasClass('nob'))
24    });
25});
26
27
28window.addEventListener('popstate', function(event) {
29    // back to prev page
30    // load(window.location.pathname.replace('/dir', ''));
31    // history.pushState(null, null, window.location.pathname);
32});
33
34
35function load(url = null, ...fileds) {
36    let data = new FormData();
37    let type = 'POST';
38
39    // Files
40    let fieldOfFiles = $('#files');
41    if (typeof fieldOfFiles[0] != "undefined")
42        files = fieldOfFiles[0].files;
43
44    // Files 2
45    let fieldOfFiles2 = $('.init-files');
46    for (let i = 0; i < fieldOfFiles2.length; i++) {
47        if (fieldOfFiles2[i].files) {
48            files = fieldOfFiles2[i].files;
49            break;
50        }
51    }
52
53    $.each(files, function (key, value) {
54        data.append(key, value);
55    });
56
57
58    // Parse params:
59    // #text - значення input з id='text'
60    // .text - значення input з class='text'
61    // age=25 - передаємо ключ та значення
62    // name#field - передаємо ключ та значення форми ( ключ=name, значення=field )
63    // !name#el - передаємо ключ та значення елементу(не input, ex: <p id="el">Text</p>)
64    // form:#login - передаємо форму з id='login'
65    // json:{} - передаємо json // TODO ...
66    // *SYS_OPTION* - системна опція для load() ex: *move*
67    for (let i = 0; i < fileds.length; i++) {
68        if (fileds[i].charAt(0) === '#' || fileds[i].charAt(0) === '.') {
69            data.append(fileds[i], $(fileds[i]).val());
70        } else {
71
72            // if (fileds[i].indexOf('=') >= 0) {
73            if (/^\w{1,32}=(.*?)$/i.test(fileds[i])) {
74                let arr = fileds[i].split('=');
75                data.append(arr[0], arr[1]);
76            } else {
77                if (/^!?\w{1,32}#(.*?)$/i.test(fileds[i])) { // name#field
78                    let arr = fileds[i].split('#');
79                    if (arr[0].charAt(0) === '!')
80                        data.append(arr[0].replace('!', ''), $('#'+arr[1]).text());
81                    else
82                        data.append(arr[0], $('#'+arr[1]).val());
83
84                } else if (/^!?\w{1,32}\.(.*?)$/i.test(fileds[i])) { // name.field
85                    let arr = fileds[i].split('.');
86                    if (arr[0].charAt(0) === '!')
87                        data.append(arr[0].replace('!', ''), $('.'+arr[1]).text());
88                    else
89                        data.append(arr[0], $('.'+arr[1]).val());
90
91                } else if (/^\*(.*?)\*$/i.test(fileds[i])) { // *SYS_OPTION*
92                    let arr = fileds[i].split('=');
93                    sysFunctions[arr[0]] = (arr[1]) ? arr[1] : true;
94
95                } else if ('url:url' === (fileds[i])) { // url:url curent page url
96                    data.append('_url', window.location.href);
97
98                } else {
99                    // form serialize
100                    if (/^form:#(.*?)$/i.test(fileds[i])) {
101                        let arr = fileds[i].split('#');
102                        let elements = document.forms[arr[1]].elements;
103                        // console.log($('#' + arr[1]).serialize());
104
105                        for (let i = 0; i < elements.length; i++){
106                            let formField = $(elements[i]);
107
108                            if (formField[0].type === 'radio' || formField[0].type === 'checkbox') {
109                                if (formField[0].checked === true) {
110                                    data.append(formField.attr("name"), formField[0].value);
111                                }
112                            } else {
113                                data.append(formField.attr("name"), formField.val());
114                            }
115                        }
116                    }
117                    // console.log(fileds[i]);
118                }
119            }
120        }
121    }
122
123    let contentType = false;
124    if (/Edge/.test(navigator.userAgent)) {
125        // contentType = "application/x-www-form-urlencoded"; // [-----------------------------7e314734a0746 Content-Disposition:_form-data;_name] => "email" [email protected]
126        // contentType = "multipart/form-data;"; // Missing boundary in multipart/form-data POST data in <b>Unknown</b> on line <b>0</b>
127        // contentType = "application/json; charset=utf-8;"; // empty
128        // contentType = "multipart/form-data; charset=utf-8; boundary=" + Math.random() .toString().substr(2); // empty
129    }
130        // var recaptcha_used;
131        var recaptcha_used;
132        if(recaptcha_used == '1')
133        {
134        grecaptcha.ready(function() {
135            grecaptcha.execute(recaptcha_site_key, {action: 'validate_captcha'}).then(function(token) {
136                if(document.getElementById("recaptchaResponseBookCall"))
137                {
138                    document.getElementById('recaptchaResponseBookCall').value = token;
139                    $('#book_call_form').unbind('submit').submit
140                }
141                if(document.getElementById("recaptchaResponse"))
142                {
143                    document.getElementById('recaptchaResponse').value = token;
144                    $('#contact_us_form').unbind('submit').submit
145                }
146                if(document.getElementById("recaptchaResponseUpload"))
147                {
148                    document.getElementById('recaptchaResponseUpload').value = token;
149                    $('#upload_cv_form').unbind('submit').submit
150                }
151                if(document.getElementById("recaptchaResponseUploadVacancy"))
152                {
153                    document.getElementById('recaptchaResponseUploadVacancy').value = token;
154                    $('#upload_vacancy_form').unbind('submit').submit
155                }
156                if(document.getElementById("recaptchaResponseVacancy"))
157                {
158                    document.getElementById('recaptchaResponseVacancy').value = token;
159                    $('#apply_form').unbind('submit').submit
160                }
161                if(document.getElementById("g-recaptcha-response"))
162                {
163                    document.getElementById('g-recaptcha-response').value = token;
164                    $('#apply_form_download').unbind('submit').submit
165                }
166                if(document.getElementById("salary-guide-form"))
167                {
168                    document.getElementById('salary-guide-form').value = token;
169                    $('#salary_guide_form').unbind('submit').submit
170                }
171                if(document.getElementById("g-recaptcha-response-jobAlert"))
172                {
173                    document.getElementById('g-recaptcha-response-jobAlert').value = token;
174                    $('#apply_form').unbind('submit').submit
175                }
176            });;
177        });
178        }
179
180    $.ajax({
181        // url:         site_url + trim(url, '/'),
182        url:         url.substring(0, 4) === 'http' ? url : ( site_url + trim(url, '/') ),
183        type:        type,
184        data:        data,
185        cache:       false,
186        dataType:    'json',
187        processData: false,
188        contentType: contentType,
189
190
191        success: function (result) {
192            if (result.error == false) {
193                //prev page
194                ajaxUrl = window.location.href;
195
196                // Parse result
197                for (let key in result.res)
198                    processField(result.res[key]);
199
200                callAfterLoad(); // After Load func
201            } else {
202                if (Array.isArray(result.error)) {
203                    result.error.forEach(function (item, i, arr) {
204                        $('.' + item.key).addClass('error');
205                        $('.' + item.key + ' span.error_text').text(item.value);
206                    });
207                } else {
208                    noticeError(result.error);
209                    // alert(result.error);
210                }
211
212                // Parse error res
213                if (Array.isArray(result.error_res)) {
214                    for (let key in result.error_res)
215                        processField(result.error_res[key]);
216                }
217
218                callAfterLoad(); // After Load func
219            }
220
221            // callAfterLoad();
222        },
223        error: function (result) {
224            // alert("Error!");
225            stopAllSpinnersIMG();
226        }
227    });
228
229    callAfterClick();
230}
231
232
233function processField(jsonObj) {
234    try {
235        if (jsonObj.action === 'prepend') {
236            // paste at the begin
237            $(jsonObj.key).prepend(jsonObj.value);
238
239        } else if (jsonObj.action === 'append') {
240            // paste et the end
241            $(jsonObj.key).append(jsonObj.value);
242
243        } else if (jsonObj.action === 'after') {
244            // paste after
245            $(jsonObj.key).after(jsonObj.value);
246
247            console.log(jsonObj.key);
248            console.log(jsonObj.value);
249
250        } else if (jsonObj.action === 'before') {
251            // paste before
252            $(jsonObj.key).before(jsonObj.value);
253
254        } else if (jsonObj.action === 'attr') {
255            // set attr
256            $(jsonObj.key).attr(jsonObj.attrName, jsonObj.value);
257
258        } else if (jsonObj.action === 'removeAttr') {
259            // set attr
260            $(jsonObj.key).removeAttr(jsonObj.value);
261
262        } else if (jsonObj.action === 'addClass') {
263            // set attr
264            $(jsonObj.key).addClass(jsonObj.value);
265
266        } else if (jsonObj.action === 'removeClass') {
267            // set attr
268            $(jsonObj.key).removeClass(jsonObj.value);
269
270        } else if (jsonObj.action === 'remove' || jsonObj.action === 'delete') {
271            // remove element
272            $(jsonObj.key).remove();
273
274        } else if (jsonObj.action === 'val') {
275            // set value
276            $(jsonObj.key).val(jsonObj.value);
277
278        } else if (jsonObj.action === 'func') {
279            // function
280            window[jsonObj.key](jsonObj.value);
281
282        } else if (jsonObj.action === 'jvar') {
283            // переменная в глобальном масиве ajaxVars
284            ajaxVars[jsonObj.key] = jsonObj.value;
285
286        } else if (jsonObj.action === 'load') {
287            // load page
288            if (jsonObj.value)
289                load(jsonObj.key, jsonObj.value);
290            else
291                load(jsonObj.key);
292
293        } else if (jsonObj.action === 'redirect') {
294            // redirect
295            window.location.href = jsonObj.value;
296
297        } else if (jsonObj.action === 'title') {
298            // set title
299            document.title = jsonObj.value;
300
301        } else if (jsonObj.action === 'url') { //url
302            // add history
303            history.pushState('', '', jsonObj.value);
304            GLOBAL_URL = jsonObj.value;
305
306        } else if (jsonObj.url != false && typeof jsonObj.url !== 'undefined') {
307            // add history
308            history.pushState('', '', jsonObj.url);
309            GLOBAL_URL = jsonObj.url;
310
311        } else if (jsonObj.click != false && typeof jsonObj.click !== 'undefined') {
312            // trigger click
313            $(jsonObj.click).trigger("click");
314
315        } else {
316            $(jsonObj.key).html(jsonObj.value);
317        }
318        return;
319    } catch (e) {
320        console.log("Error process", e);
321        return;
322    }
323}
324
325
326let CHECKcallAfterClick = false;
327let CHECKcallAfterLoad = false;
328
329/**
330 * Function calling after click load()
331 */
332function callAfterClick() {
333    if (!CHECKcallAfterClick) {
334        CHECKcallAfterClick = true;
335
336        // // Hide boards panel
337        // $(document).on('click', function(e) {
338        //     // Board
339        //     if (!$(e.target).closest('.boards_window').length && !$(e.target).closest('header a').length) {
340        //         // console.log("click not boards_window");
341        //         $('#boards').removeClass('open').addClass('close');
342        //         // $('#boards').fadeOut(200);
343        //     }
344        //
345        //     // Board link
346        //     if ($(e.target).closest('.boards_window .board_choose a').length) {
347        //         // console.log("click not boards_window > a");
348        //         // $('#boards').removeClass('open').addClass('close'); // <--- work before
349        //         // $('#search').addClass('close').removeClass('open');
350        //     }
351        //
352        //     e.stopPropagation();
353        // });
354    }
355}
356
357function callAfterLoad() {
358    if (!CHECKcallAfterLoad) {
359        CHECKcallAfterLoad = true;
360
361        // // Hide search
362        // $(document).on('click', function(e) {
363        //     // Search -> Home
364        //     if ($(e.target).closest('._home').length) {
365        //         // console.log("click home");
366        //         // closeSearch();
367        //     }
368        //
369        //     // Search -> tool open
370        //     if ($(e.target).closest('a.head').length) {
371        //         // console.log("click search tool");
372        //         // closeSearch();
373        //     }
374        //
375        //     e.stopPropagation();
376        // });
377    }
378
379    if (typeof(AOS) !== 'undefined') {
380        AOS.refreshHard();
381    }
382    // if (typeof window['showBtn'] === "function") {
383    //     showBtn();
384    // }
385    // if (typeof window['redissBtn'] === "function") {
386    //     redissBtn();
387    // }
388}
389
390function isEmpty(obj) {
391    for(var prop in obj) {
392        if(Object.prototype.hasOwnProperty.call(obj, prop)) {
393            return false;
394        }
395    }
396
397    return JSON.stringify(obj) === JSON.stringify({});
398}
399
400/**
401 * Function event_stop
402 * - event.preventDefault() stop go by link
403 * - event.stopPropagation() stop next events
404 */
405function stopEv() {
406    event.preventDefault(); // cancel switch href
407    event.stopPropagation();
408}
409
410
411function trim( str, charlist ) {
412    charlist = !charlist ? ' \\s\xA0' : charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1');
413    let re = new RegExp('^[' + charlist + ']+|[' + charlist + ']+$', 'g');
414    return str.replace(re, '');
415}
416
417function formatString(str) {
418    return str
419        .replace(/\\\'/g, '\'')
420        .replace(/\\\"/g, '\"')
421        .replace(/\\\//g, '\/')
422        .replace(/\\\\/g, '\\');
423}
424
425
426function putText(target, html) {
427    $(target).html(html);
428}
429
430function setVal(target, html) {
431    $(target).val(html);
432}
433
434
435function getTime (mode) {
436    mode = mode || 's';
437
438    if (mode === 'ms')
439        return new Date().getTime(); // result in ms
440    else
441        return Math.floor(new Date().getTime() / 1000); // result in s
442}
443
444
445function addZero(value) {
446    if (value.toString().length === 1)
447        value = '0' + value;
448
449    return value;
450}
451
452function focusMe(key) {
453    $(key).focus();
454}
455
456
457function scrollToEl(el) {
458    let $page = $('html, body'),
459        speed = 0;
460
461    // el = el || '#content';
462    el = el || 'body';
463
464
465    if (/^(.*?)\|\w{1,32}$/i.test(el)) {
466        // Scroll with time
467        let arr = el.split('|');
468        el      = arr[0];
469        speed   = parseInt(arr[1]);
470
471        // $page.animate({
472        //     scrollTop: $(el).offset().top
473        // }, speed);
474    } else {
475        // // Scroll
476        // $(el).animate({
477        //     scrollTop: 0
478        // }, 0);
479    }
480
481    $page.animate({
482        scrollTop: $(el).offset().top
483    }, speed);
484}
485
486
487/**
488 * isObjEmpty
489 * @param obj
490 * @returns {boolean}
491 */
492function isObjEmpty(obj) {
493    for (let key in obj)
494        return false;
495
496    return true;
497}
498
499
500/**
501 * checkInt - перевіряє чи значення є чилом і повертає його, якщо ні - повертається значення за замовчуванням
502 * @param value
503 * @param defaultValue
504 */
505function checkInt(value, defaultValue) {
506    if (!defaultValue && defaultValue !== false)
507        defaultValue = 0;
508
509    if (!isNaN(parseFloat(value)) && isFinite(value))
510        return parseInt(value); // added parseInt 12.11.2018
511    else
512        return defaultValue;
513}
514
515/**
516 * incrementAction
517 * @param el
518 */
519
520function incrementAction(el) {
521    let value = parseInt( $(el).text() );
522    if (isNaN(value))
523        value = 0;
524
525    $(el).text(value + 1);
526}
527
528function hideNotice(id) {
529    setTimeout(function(){ $('#'+id).fadeOut(2000); }, 7000);
530}
531
532
533function randomInteger(min, max) {
534    return Math.round( min + Math.random() * (max - min) );
535}
536
537function docW() { return $(document).width(); }
538function docH() { return $(document).height(); }
539function winW() { return $(window).width(); }
540function winH() { return $(window).height(); }
541
542
543/**
544 * copyToClipboard
545 * @param target
546 */
547function copyToClipboard(target) {
548    /* Get the text field */
549    var copyText = document.getElementById(target);
550
551    /* Select the text field */
552    copyText.select();
553    copyText.setSelectionRange(0, 99999); /*For mobile devices*/
554
555    /* Copy the text inside the text field */
556    document.execCommand("copy");
557
558    /* Alert the copied text */
559    noticeInfo('Copied!');
560}
561
562
563
564
565
566
567/* Crop */
568
569var minHeightForCrop = 300;
570var minWidthForCrop = 300;
571
572function setMinHeightForCrop(height) {
573    minHeightForCrop = height;
574}
575function setMinWidthForCrop(width) {
576    minWidthForCrop = width;
577}
578
579function addCrop(cropEl) {
580    var xy_h = document.getElementById("xy_h");
581    var div = document.getElementById("xy");
582    var flagOnMove = false;
583    var flagOnResize = false;
584
585    var crop = document.getElementById(cropEl);
586    var cropHeight = parseInt(crop.style.height);
587    var cropWidth = parseInt(crop.style.width);
588
589    var imgCoefficient = $("#coef").val();
590    if (imgCoefficient <= 1)
591        imgCoefficient = 1;
592
593    var minCropHeight = parseInt(minHeightForCrop / imgCoefficient);
594    var minCropWidth = parseInt(minWidthForCrop / imgCoefficient);
595
596
597    //console.log(cropWidth + ' * ' + cropHeight);
598    //console.log(imgCoefficient);
599
600    xy_h.style.top = 0 + "px";
601    xy_h.style.left = 0 + "px";
602    $("#posY").val(0);
603    $("#posX").val(0);
604
605    xy_h.style.width = minCropWidth + "px";
606    xy_h.style.height = minCropHeight + "px";
607    div.style.width = minCropWidth + "px";
608    div.style.height = minCropHeight + "px";
609    $("#width").val(minCropWidth);
610    $("#height").val(minCropHeight);
611
612    // ---C1--------------------------
613    var c1 = document.getElementById("c1");
614
615    c1.onmousedown = function (event) {
616        flagOnResize = true;
617
618        var width = div.offsetWidth;
619        var height = div.offsetHeight;
620        var top = xy_h.offsetTop;
621        var left = xy_h.offsetLeft;
622
623        var posX = event.pageX;
624        var posY = event.pageY;
625
626        document.onmousemove = function (event) {
627            if (flagOnResize == true) {
628                var res = width - (event.pageX - posX);
629                var resTop = top + event.pageX - posX;
630                var resLeft = left + event.pageX - posX;
631
632                if (res >= minCropWidth && resTop >= 0 && resLeft >= 0) {
633                    xy_h.style.top = resTop + "px";
634                    xy_h.style.left = resLeft + "px";
635                    $("#posY").val(resTop);
636                    $("#posX").val(resLeft);
637                }
638
639                if (res >= minCropWidth && resTop >= 0 && resLeft >= 0) {
640                    xy_h.style.width = res + "px";
641                    xy_h.style.height = res + "px";
642                    div.style.width = res + "px";
643                    div.style.height = res + "px";
644
645                    $("#width").val(res);
646                    $("#height").val(res);
647                }
648
649                scaling('mini');
650            }
651        };
652    };
653
654    // ---C2--------------------------
655    var c2 = document.getElementById("c2");
656
657    c2.onmousedown = function (event) {
658        flagOnResize = true;
659
660        var width = div.offsetWidth;
661        var height = div.offsetHeight;
662        var top = xy_h.offsetTop;
663        var left = xy_h.offsetLeft;
664
665        var posX = event.pageX;
666        var posY = event.pageY;
667
668        document.onmousemove = function (event) {
669            if (flagOnResize == true) {
670                var res = height + (posY - event.pageY);
671                var resTop = top - (posY - event.pageY);
672
673                if (res >= minCropHeight && resTop >= 0) {
674                    if (left + res <= cropWidth) {
675                        xy_h.style.top = resTop + "px";
676                        $("#posY").val(resTop);
677                    }
678                }
679
680                if (res >= minCropHeight && resTop >= 0) {
681
682                    if (left + res <= cropWidth) {
683                        //res = cropWidth - left;
684                        xy_h.style.width = res + "px";
685                        xy_h.style.height = res + "px";
686                        div.style.width = res + "px";
687                        div.style.height = res + "px";
688
689                        $("#width").val(res);
690                        $("#height").val(res);
691                    }
692                }
693
694                scaling('mini');
695            }
696        };
697    };
698
699    // ---C3--------------------------
700    var c3 = document.getElementById("c3");
701
702    c3.onmousedown = function (event) {
703        flagOnResize = true;
704
705        var width = div.offsetWidth;
706        var height = div.offsetHeight;
707        var top = xy_h.offsetTop;
708        var left = xy_h.offsetLeft;
709
710        var posX = event.pageX;
711        var posY = event.pageY;
712
713        document.onmousemove = function (event) {
714            if (flagOnResize == true) {
715                var res = width + event.pageX - posX;
716
717                if (res <= minCropWidth)
718                    res = minCropWidth;
719                if (left + res >= cropWidth)
720                    res = cropWidth - left;
721                if (top + res >= cropHeight)
722                    res = cropHeight - top;
723
724                xy_h.style.width = res + "px";
725                xy_h.style.height = res + "px";
726                div.style.width = res + "px";
727                div.style.height = res + "px";
728
729                $("#width").val(res);
730                $("#height").val(res);
731
732                scaling('mini');
733            }
734        };
735    };
736
737    // ---C4--------------------------
738    var c4 = document.getElementById("c4");
739
740    c4.onmousedown = function (event) {
741        flagOnResize = true;
742
743        var width = div.offsetWidth;
744        var height = div.offsetHeight;
745        var top = xy_h.offsetTop;
746        var left = xy_h.offsetLeft;
747
748        var posX = event.pageX;
749        var posY = event.pageY;
750
751        document.onmousemove = function (event) {
752            if (flagOnResize == true) {
753                var res = height + (event.pageY - posY);
754                var resLeft = left + (posY - event.pageY);
755
756                if (res >= minCropHeight && resLeft >= 0 && top + res <= cropHeigh
756t) {
757                    xy_h.style.left = resLeft + "px";
758                    $("#posX").val(resLeft);
759                }
760
761                if (res >= minCropHeight && resLeft >= 0 && top + res <= cropHeight) {
762                    xy_h.style.width = res + "px";
763                    xy_h.style.height = res + "px";
764                    div.style.width = res + "px";
765                    div.style.height = res + "px";
766
767                    $("#width").val(res);
768                    $("#height").val(res);
769                }
770
771                scaling('mini');
772            }
773        };
774    };
775
776    // -----------------------------
777
778    div.onmousedown = function (event) {
779        flagOnMove = true;
780
781        var width = div.offsetWidth;
782        var height = div.offsetHeight;
783        var top = xy_h.offsetTop;
784        var left = xy_h.offsetLeft;
785
786        var posX = event.pageX;
787        var posY = event.pageY;
788
789        document.onmousemove = function (event) {
790            if (flagOnMove == true) {
791                var newTop = top + event.pageY - posY;
792                if (newTop <= 0)
793                    newTop = 0;
794                if (newTop + height >= cropHeight)
795                    newTop = cropHeight - height;
796
797                var newLeft = left + event.pageX - posX;
798                if (newLeft <= 0)
799                    newLeft = 0;
800                if (newLeft + width >= cropWidth)
801                    newLeft = cropWidth - width;
802
803                xy_h.style.top = newTop + "px";
804                xy_h.style.left = newLeft + "px";
805
806                $("#width").val(width);
807                $("#height").val(height);
808                $("#posY").val(newTop);
809                $("#posX").val(newLeft);
810
811                scaling('mini');
812            }
813        };
814    };
815
816    document.onmouseup = function () {
817        flagOnMove = false;
818        flagOnResize = false;
819    };
820}
821
822function scaling(id) {
823    var obj = document.getElementById(id);
824    var xy_h = document.getElementById("xy_h");
825    var div = document.getElementById("xy");
826
827    var width = div.offsetWidth;
828    var height = div.offsetHeight;
829    var top = xy_h.offsetTop;
830    var left = xy_h.offsetLeft;
831
832    var imgW = 265;
833    var imgH = 265;
834    var miniature = 50;
835
836    var cofW = miniature/width;
837    var cofH = miniature/height;
838
839    if (obj != null) {
840        obj.style.width = imgW*cofW + "px";
841        obj.style.height = imgH*cofH + "px";
842        obj.style.marginTop = "-"+top*cofW + "px";
843        obj.style.marginLeft = "-"+left*cofH + "px";
844    }
845}
846
847function removeFieldImage(id) {
848    $('#image_block_' + id).remove();
849}
850
851// Return TRUE if the given function has been defined
852function function_exists(function_name) {
853    if (typeof function_name == 'string') {
854        return (typeof window[function_name] == 'function');
855    } else {
856        return (function_name instanceof Function);
857    }
858}
859
860function replaceContent(content) {
861    return content.replace(/&nbsp;/g, " ")
862        .replace(/"/g, '\\"')
863        .replace(new RegExp('\n','g'), '<br />')
864        .replace(/\\'/g, "\\'")
865        .replace(/\\"/g, '\\"')
866        .replace(/\\&/g, "\\&")
867        .replace(/\\r/g, "\\r")
868        .replace(/\\t/g, "\\t")
869        .replace(/\\b/g, "\\b")
870        .replace(/\\f/g, "\\f");
871}
872;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.