PageSourceSearch

https://area254.fun/WebResource.axd?d=yhXLdp2jLGr1ReRZEEZSQ-KMEc9n…dOk38Rrdqc7hlzjm21G_U1&t=638295073150967850

js area254.fun collected 2026-10-05 22:11:06 UTC 76,426 bytes, 1,402 lines download raw bytes

1var LForm_Time;
2var IsSqlsingle = true;
3var IsSqlmultiple = false;
4var loadingTime;
5var field = new Array();
6$(document).ready(function () {
7
8    $('.Form_Navigation').find('li:first-child').addClass('active');
9    $('.Form_title').find('li:first-child').addClass('active');
10
11
12    $('.LiveForm').each(function (item, obj) {
13        var LF = $(obj).attr('uniqueid');
14        if ($(window).width() <= 768) {
15            $('#' + LF + ' ul.Form_Navigation li').hide().slice(0, 2).show();
16            $('#' + LF + ' ul.Form_title li').hide().slice(0, 2).show();
17        }
18        else {
19            $('#' + LF + ' ul.Form_Navigation li').hide().slice(0, 5).show();
20            $('#' + LF + ' ul.Form_title li').hide().slice(0, 5).show();
21
22        }
23    });
24    //we also want to check condition on page load to match with the default values
25    ConditionCheck(null);
26
27    $('[condition] select,[condition] input[type="radio"]').each(function (i, obj) {
28        $(obj).bind("keyup change FilesAdded", function () {
29            ConditionCheck(obj);
30        });
31    });
32    $('[condition] input[type="checkbox"], [condition] input[type="tel"]').each(function (i, obj) {
33        $(obj).bind("keyup change FilesAdded", debounce(function (event) {
34            ConditionCheck(obj);
35        }, 1500));
36    });
37    $('[condition] input[type="text"],[condition] textarea').each(function (i, obj) {
38        $(obj).bind("blur", function () {
39            ConditionCheck(obj);
40        });
41    });
42    $('[condition]').find('.StarRatingRequired').find('div img').each(function (i, obj) {
43        $(obj).bind("click", function () {
44            ConditionCheck(obj);
45        });
46    });
47    $(window).load(function (ob) {//window.load used because of late binding
48
49        $('.LiveForm .Fileupload div[controlid]').each(function (i, obj) {
50            eval(jQuery(obj).attr("controlid")).bind("FilesAdded", function (i, files) {
51                ConditionCheck(obj);
52            });
53            eval(jQuery(obj).attr("controlid")).bind("FilesRemoved", function (i, files) {
54                ConditionCheck(obj);
55            });
56
57        });
58    });
59    IsSqlmultiple = true;
60
61    $('.DvLfBrowsefile').click();
62});
63function debounce(func, wait, immediate) {
64    var timeout;
65    return function () {
66        var context = this, args = arguments;
67        var later = function () {
68            timeout = null;
69            if (!immediate) func.apply(context, args);
70        };
71        var callNow = immediate && !timeout;
72        clearTimeout(timeout);
73        timeout = setTimeout(later, wait);
74        if (callNow) func.apply(context, args);
75    };
76}
77function ConditionCheck(obj, ele) {
78
79    loadingTime = new Date();
80
81    if ($('.ClientSideActionJson') != 'undefined' && $('.ClientSideActionJson').val() != "") {
82        var clientActions = $(".ClientSideActionJson[value!='[]']");  // get client action from hidden field
83        field = new Array();
84        $.each(clientActions, function (key, value) {
85            var conditionalActions = jQuery.parseJSON($(value).val());
86            var ModuleId = $(value).attr("mid");
87            var PortalId = $(value).attr("pid");
88            //$.each(conditionalActions, function (key, value) {
89            for (var caindex = 0; caindex < conditionalActions.length; caindex++) {
90                var IscheckCon = true;
91                var condition_action = conditionalActions[caindex];
92                if (obj) {
93                    IscheckCon = false;
94                    var conditions = condition_action.ConditionSet.Conditions;
95                    for (var con_index = 0; con_index < conditions.length; con_index++) {
96                        if (conditions[con_index].FieldId === $(obj).parents("li.Field").attr('guid')) {
97                            IscheckCon = true;
98                        }
99                    }
100                    var actions = condition_action.Actions;
101                    for (var act_index = 0; act_index < actions.length; act_index++) {
102                        if (actions[act_index].FriendlyName === "Evaluating JavaScript") {
103                            if (actions[act_index].Script.indexOf($(obj).parents("li.Field").attr('guid')) !== -1) {
104                                IscheckCon = true;
105                            }
106                        }
107                        else if (actions[act_index].FriendlyName === "SQLQuery") {
108                            if (actions[act_index].Query.indexOf($(obj).parents("li.Field").attr('guid')) !== -1) {
109                                IscheckCon = true;
110                            }
111                        }
112                    }
113                }
114                if (IscheckCon) {
115                    ConditionalActionCheck(obj, ele, condition_action, ModuleId, PortalId);
116                    //if (!isLoop) {
117                    //	setTimeout(function () {
118                    //		ConditionalActionCheck(obj, ele, condition_action, ModuleId, PortalId);
119                    //	}, 10);
120                    //}
121                    //else
122                    //	ConditionalActionCheck(obj, ele, condition_action);
123                }
124            }
125        });
126
127        setTimeout(function () {
128            $(".lfoverlay, .lfmodal").hide();
129            IsSqlsingle = false;
130        }, 10);
131    }
132}
133function ConditionalActionCheck(obj, ele, conditionalActions, ModuleId, PortalId) {
134
135    if (new Date() - loadingTime > 1000)
136        $(".lfoverlay, .lfmodal").show();
137
138    var cavalue = conditionalActions;
139    var action; var script = [];
140    if (typeof cavalue.Actions != 'undefined') {
141        action = cavalue.Actions[0];
142        action.ModuleId = ModuleId;
143        action.PortalId = PortalId;
144        action.GUID = cavalue.GUID;
145    }
146
147    if (typeof cavalue.ConditionSet != 'undefined') {
148        for (var index = 0; index < cavalue.ConditionSet.Conditions.length; index++) {
149            var condition = cavalue.ConditionSet.Conditions[index];
150
151            if (obj == null || obj == 'undefined') {
152                obj = jQuery("[guid='" + condition.FieldId + "']").children().first();
153            }
154
155            var element = '';
156            if ($(obj).parents('li').hasClass('Textbox'))
157                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
158            if ($(obj).parents('li').hasClass('Currency')) {
159                if ($.browser.device)
160                    element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='tel']");
161                else
162                    element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
163            }
164            else if ($(obj).parents('li').hasClass('Datetime'))
165                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
166            else if ($(obj).parents('li').hasClass('Number'))
167                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
168            else if ($(obj).parents('li').hasClass('Fullname'))
169                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
170            else if ($(obj).parents('li').hasClass('Address'))
171                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
172            else if ($(obj).parents('li').hasClass('CreditCard'))
173                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
174            else if ($(obj).parents('li').hasClass('Phone'))
175                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
176            else if ($(obj).parents('li').hasClass('Email'))
177                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
178            else if ($(obj).parents('li').hasClass('Textarea'))
179                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] textarea");
180            else if ($(obj).parents('li').hasClass('Dropdown'))
181                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] select");
182            else if ($(obj).parents('li').hasClass('Radiobutton'))
183                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='radio']:checked");
184            else if ($(obj).parents('li').hasClass('ScaleRating'))
185                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='radio']:checked");
186            else if ($(obj).parents('li').hasClass('Checkbox'))
187                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='checkbox']:checked");
188            else if ($(obj).parents('li').hasClass('Fileupload'))
189                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] div[controlid]");
190            else if ($(obj).parents('li').hasClass('StarRating'))
191                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "']").find('.StarRatingRequired').find('div');
192            else if ($(obj).parents('li').hasClass('Matrix'))
193                element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
194
195            if (element != '' && element.length == 0) {
196                var conditionObject = jQuery(".LiveForm li[guid='" + condition.FieldId + "']");
197                element = getElement(conditionObject, condition);//get condition field if no element above found
198            }
199            if (element != 'undefined' && element.length > 0 && $(element).parents('li').attr('guid') == condition.FieldId) {
200                //element 
201                var cScript = '';
202                var ElementLength = element.length;
203                for (var i = 0; i < ElementLength; i++) {// in case of multiple elements found
204                    var currentelement = element[i];
205                    if (cScript != '') {
206                        if (ElementLength > 1 && condition.DisplayName != "Is Selected") {//handling control groups required
207                            cScript += " && ";
208                        }
209                        else {
210                            cScript += " || ";
211                        }
212                    }
213                    if (typeof $(currentelement).attr("id") != 'undefined' && $(currentelement).attr('class') != "plupload_content" && $(currentelement).parent('div').attr('class') != "StarRatingRequired" && $(obj).parents('li').hasClass('Currency') == false)
214                        cScript += "jQuery('#" + $(currentelement).attr("id") + "').val().replace(\"'\",'\"') ";
215                    else if ($(obj).parents('li').hasClass('Currency') == true)
216                        cScript += "element.maskMoney('unmasked')[0]";
217
218                    if (condition.CompareTo) {
219                        condition.CompareTo = condition.CompareTo.replace("'", '"');
220                    }
221
222                    if (cScript != '' || cScript.length > 0) {
223                        if (condition.DisplayName == "Is Equal To" || condition.DisplayName == "Is Selected")
224                            cScript += "==" + " '" + condition.CompareTo + "'";
225                        else if (condition.DisplayName == "Less Than")
226                            cScript += "<" + "" + condition.CompareTo + "&&" + cScript + "!=''";
227                        else if (condition.DisplayName == "Greater Than")
228                            cScript += ">" + "" + condition.CompareTo + "&&" + cScript + "!=''";
229                        else if (condition.DisplayName == "Is Not Equal To" || condition.DisplayName == "N
229ot Selected")
230                            cScript += "!=" + " '" + condition.CompareTo + "'";
231                        else if (condition.DisplayName == "Is Filled")
232                            cScript += "!= ''";
233                        else if (condition.DisplayName == "Is Empty")
234                            cScript += "== ''";
235                        else if (condition.DisplayName == "Contains")
236                            cScript += ".indexOf('" + condition.CompareTo + "')!=-1";
237                        else if (condition.DisplayName == "Does Not Contains")
238                            cScript += ".indexOf('" + condition.CompareTo + "')==-1";
239                        else if (condition.DisplayName == "Starts With")
240                            cScript += ".indexOf('" + condition.CompareTo + "')==0";
241                        else if (condition.DisplayName == "Doesn't Start With")
242                            cScript += ".indexOf('" + condition.CompareTo + "')!=0";
243                        else if (condition.DisplayName == "Ends With")
244                            cScript += ".substr(-" + condition.CompareTo.length + ")=='" + condition.CompareTo + "'";
245                        else if (condition.DisplayName == "Doesn't End With")
246                            cScript += ".substr(-" + condition.CompareTo.length + ")!='" + condition.CompareTo + "'";
247                    }
248                    if ($(currentelement).attr('class') == "plupload_content") {
249                        if (condition.DisplayName == "Is Filled") {
250                            cScript += " " + jQuery(currentelement).attr("controlid") + ".files.length > 0 ";//pending task find foreach fileupload for checking each file
251                        }
252                        else if (condition.DisplayName == "Is Empty") {
253                            cScript += " " + jQuery(currentelement).attr("controlid") + ".files.length == 0 ";
254                        }
255                    }
256                    if ($(currentelement).parent('div').attr('class') == "StarRatingRequired") {
257                        if (condition.DisplayName == "Is Equal To")
258                            cScript += "jQuery('#" + currentelement.id + "').raty('score')=='" + condition.CompareTo + "'";
259                        else if (condition.DisplayName == "Is Not Equal To")
260                            cScript += "jQuery('#" + currentelement.id + "').raty('score')!='" + condition.CompareTo + "'";
261                        else if (condition.DisplayName == "Less Than")
262                            cScript += "jQuery('#" + currentelement.id + "').raty('score')<'" + condition.CompareTo + "'";
263                        else if (condition.DisplayName == "Greater Than")
264                            cScript += "jQuery('#" + currentelement.id + "').raty('score')>'" + condition.CompareTo + "'";
265                        else if (condition.DisplayName == "Is Filled")
266                            cScript += "jQuery('#" + currentelement.id + "').raty('score') > 0";
267                        else if (condition.DisplayName == "Is Empty")
268                            cScript += "jQuery('#" + currentelement.id + "').raty('score') == 'undefined' || jQuery('#" + currentelement.id + "').raty('score') == 0";
269                    };
270                }
271                if (cScript != '') {
272                    script.push(cScript);
273                    cScript = '';
274                }
275            }
276            else if (($(jQuery(".LiveForm li[guid='" + condition.FieldId + "']")).hasClass('Radiobutton') || $(jQuery(".LiveForm li[guid='" + condition.FieldId + "']")).hasClass('Checkbox')) && condition.DisplayName == "Not Selected") {
277                script.push(true);
278            }
279            else if (($(jQuery(".LiveForm li[guid='" + condition.FieldId + "']")).hasClass('Radiobutton') || $(jQuery(".LiveForm li[guid='" + condition.FieldId + "']")).hasClass('Checkbox')) && condition.DisplayName == "Is Empty") {
280                script.push(true);
281            }
282            else
283                script.push(false);
284        }
285        var evalScript = '';
286        $.each(script, function (key, test) {
287            if (evalScript != '') {
288                if (cavalue.ConditionSet.MatchCondition == 1)//and condition
289                    evalScript += " && ";
290                else
291                    evalScript += " || ";
292            }
293            evalScript += test;
294        });
295        if (evalScript == "jQuery('#undefined').val() != ''") {
296            evalScript = '';
297        }
298
299        if (action.FriendlyName == "SQLQuery") {
300            var guid = $($(obj).closest('.Field')).attr("guid");
301            if (IsSqlsingle) {
302                PerformAction(evalScript, action, obj, element, ele);
303            }
304            if (action.FieldValue != guid && action.Query != "" && IsSqlmultiple == true) {
305                var isavl = false;
306                $.each(field, function (index, value) {
307                    if (action.Query.indexOf(value) > -1) {
308                        isavl = true;
309                        return false;
310                    }
311                    else
312                        isavl = false;
313                });
314                if (isavl || action.Query.indexOf(guid) > -1) {
315                    PerformAction(evalScript, action, obj, element, ele);
316                    field.push(action.FieldValue);
317                }
318            }
319        }
320        else if (action.FriendlyName == "Evaluating JavaScript") {
321            PerformAction(evalScript, action, obj, element, ele);
322        }
323        else if (action.FriendlyName == "Create Ticket") {
324            PerformAction(evalScript, action, obj, element, ele);
325        }
326        else if (evalScript != '') {
327            PerformAction(evalScript, action, obj, element, ele);
328        }
329        else if (evalScript == '' && $(element).attr('class') == "plupload_content") {
330            PerformAction(evalScript, action, obj, element, ele);
331        }
332    }
333    //IsSqlsingle = false;	
334}
335function getElement(conditionObject, condition) {
336    if ($(conditionObject).hasClass('Textbox'))
337        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
338    if ($(conditionObject).hasClass('Currency')) {
339        if ($.browser.device)
340            element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='tel']");
341        else
342            element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
343    }
344    else if ($(conditionObject).hasClass('Datetime'))
345        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
346    else if ($(conditionObject).hasClass('Number'))
347        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
348    else if ($(conditionObject).hasClass('Fullname'))
349        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
350    else if ($(conditionObject).hasClass('Address'))
351        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
352    else if ($(conditionObject).hasClass('CreditCard'))
353        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
354    else if ($(conditionObject).hasClass('Phone'))
355        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
356    else if ($(conditionObject).hasClass('Email'))
357        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
358    else if ($(conditionObject).hasClass('Textarea'))
359        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] textarea");
360    else if ($(conditionObject).hasClass('Dropdown'))
361        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] select");
362    else if ($(conditionObject).hasClass('Radiobutton'))
363        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='radio']:checked");
364    else if ($(conditionObject).hasClass('ScaleRating'))
365        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='radio']:checked");
366    else if ($(conditionObject).hasClass('Checkbox'))
367        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='checkbox']:checked");
368    else if ($(conditionObject).hasClass('Fileupload'))
369        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] div[controlid]");
370    else if ($(conditionObject).hasClass('StarRating'))
371        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "']").find('.StarRatingRequired').find('div');
372    else if ($(conditionObject).hasClass('Matrix'))
373        element = jQuery(".LiveForm li[guid='" + condition.FieldId + "'] input[type='text']");
374
375    return element;
376}
377function PerformAction(evalScript, action, obj, element, ele) {
378    var result = eval(evalScript);
379
380    if (action.FriendlyName == "Show Hide Field") {
381        var ControlsToHideShow = action.ControlToHideShow.split(',');
382        $.each(ControlsToHideShow, function (i, value) {
383            if (action.HideShowType == "Show" || action.HideShowType == "Show Multiple") {
384                if (result) {
385                    $(".LiveForm li[guid='" + value + "']").find('input[furequired],input[scalerequired],input[scorerequired]').removeClass("novalidate");
386                    var controls = $(".LiveForm li[guid='" + value + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
387                    $.each(controls, function (i, control) {
388                        $(control).removeClass('novalidate');
389                    });
390                    if ($(".LiveForm li[guid='" + value + "']").hasClass("form-col-12"))
391                        $(".LiveForm li[guid='" + value + "']").css("display", "block");
392                    else
393                        $(".LiveForm li[guid='" + value + "']").css("visibility", "visible");
394                }
395                else {
396                    $(".LiveForm li[guid='" + value + "']").find('input[furequired],input[scalerequired],input[scorerequired]').addClass("novalidate");
397                    var controls = $(".LiveForm li[guid='" + value + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
398                    $.each(controls, function (i, control) {
399                        $(control).addClass('novalidate');
400                    });
401                    if ($(".LiveForm li[guid='" + value + "']").hasClass("form-col-12"))
402                        $(".LiveForm li[guid='" + value + "']").css("display", "none");
403                    else
404                        $(".LiveForm li[guid='" + value + "']").css("visibility", "hidden");
405                }
406            }
407            if (action.HideShowType == "Hide" || action.HideShowType == "Hide Multiple") {
408                if (result) {
409                    $(".LiveForm li[guid='" + value + "']").find('input[furequired],input[scalerequired],input[scorerequired]').addClass("novalidate");
410                    var controls = $(".LiveForm li[guid='" + value + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
411                    $.each(controls, function (i, control) {
412                        $(control).addClass('novalidate');
413                    });
414                    if ($(".LiveForm li[guid='" + value + "']").hasClass("form-col-12"))
415                        $(".LiveForm li[guid='" + value + "']").css("display", "none");
416                    else
417                        $(".LiveForm li[guid='" + value + "']").css("visibility", "hidden");
418                }
419                else {
420                    $(".LiveForm li[guid='" + value + "']").find('input[furequired],input[scalerequired],input[scorerequired]').removeClass("novalidate");
421                    var controls = $(".LiveForm li[guid='" + value + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
422                    $.each(controls, function (i, control) {
423                        $(control).removeClass('novalidate');
424                    });
425                    if ($(".LiveForm li[guid='" + value + "']").hasClass("form-col-12"))
426                        $(".LiveForm li[guid='" + value + "']").css("display", "block");
427                    else
428                        $(".LiveForm li[guid='" + value + "']").css("visibility", "visible");
429                }
430            }
431        });
432    }
433    else if (action.FriendlyName == "Require Field") {
434        var controlToRequire = action.controlToRequire.split(',');
435        $.each(controlToRequire, function (i, value) {
436            if (action.requireType == "Require" || action.requireType == "Require Multiple") {
437                if (result) {
438                    $(".LiveForm li[guid='" + value + "']").addClass("Required");
439                    $(".LiveForm li[guid='" + value + "']").find('input.starratinghidden').attr("scorerequired", "scorerequired");
440                    $(".LiveForm li[guid='" + value + "']").find('input').attr("furequired", "furequired");
441                    var controls = $(".LiveForm li[guid='" + value + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
442                    $.each(controls, function (i, control) {
443                        $(control).attr("required", "required");
444                    });
445                }
446                else {
447                    $(".LiveForm li[guid='" + value + "']").removeClass("Required");
448                    var controls = $(".LiveForm li[guid='" + value + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
449                    $.each(controls, function (i, control) {
450                        $(control).removeAttr("required");
451                        $(control).removeClass("error");
452                        $(control).next(".error").css("display", "none");
453                    });
454                }
455            }
456            if (action.requireType == "Unrequire" || action.requireType == "Unrequire Multiple") {
457                if (result) {
458                    $(".LiveForm li[guid='" + value + "']").removeClass("Required");
459                    $(".LiveForm li[guid='" + value + "']").find('input[furequired]').removeAttr("furequired");
460                    $(".LiveForm li[guid='" + value + "']").find('input[scalerequired]').removeAttr("scalerequired");
461                    $(".LiveForm li[guid='" + value + "']").find('input[scorerequired]').removeAttr("scorerequired");
462                    var controls = $(".LiveForm li[guid='" + value + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
463                    $.each(controls, function (i, control) {
464                        $(control).removeAttr("required");
465                        $(control).removeAttr("cbrequired");
466                        $(control).removeClass("error");
467                        $(control).next(".error").css("display", "none");
468                        $(control).parents('div').next(".error").css("display", "none");
469                    });
470                }
471                else {
472                    $(".LiveForm li[guid='" + value + "']").addClass("Required");
473                    $(".LiveForm li[guid='" + value + "']").find('input.starratinghidden').attr("scorerequired", "scorerequired");
474                    $(".LiveForm li[guid='" + value + "']").find('input').attr("furequired", "furequired");
475                    var controls = $(".LiveForm li[guid='" + value + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
476                    $.each(controls, function (i, control) {
477                        $(control).attr("required", "required");
478                    });
479                }
480            }
481        });
482    }
483    else if (action.FriendlyName == "SQLQuery") {
484        if (result || result == undefined) {
485            var fields = [];
486            $(".Field.Textbox,.Field.Textarea,.Field.Dropdown,.Field.Radiobutton,.Field.Email,.Field.Number,.Field.Currency").each(function (index, field) {
487                var Value = "";
488                if ($(field).hasClass("Textbox"))
489                    Value = $(field).find("input[type=text]").val();
490
491                else if ($(field).hasClass("Textarea"))
492                    Value = $(field).find("textarea").val();
493
494                else if ($(field).hasClass("Email"))
495                    Value = $(field).find("input[type=text]").val();
496
497                else if ($(field).hasClass("Number"))
498                    Value = $(field).find("input[type=text]").val();
499
500                else if ($(field).hasClass("Currency")) {
501                    if ($.browser.device)
502                        Value = $($(field).find("input[type=tel]")).maskMoney('unmasked')[0].toString();
503                    else
504                        Value = $($(field).find("input[type=text]")).maskMoney('unmasked')[0].toString();
505                }
506
507                else if ($(field).hasClass("Dropdown")) {
508                    var val = $(field).find("select").val().split("|");
509
510                    Value = val[0];
511                    if (val.length > 1)
512                        Value = val[1];
513                    if (Value == '') {
514                        Value = $(field).find("select").attr('selectedoption');
515                    }
516                }
517                else if ($(field).hasClass("Radiobutton")) {
518                    if ($(field).find("input[type=radio]:checked").val() != undefined) {
519                        var val = $(field).find("input[type=radio]:checked").val().split("|");
520                        Value = val[0];
521                        if (val.length > 1)
522                            Value = val[1];
523                    }
524                    else
525                        Value = "";
526                }
527                if (Value == undefined)
528                    Value = "";
529                if (Value.indexOf("+") > -1)
530                    Value = encodeURIComponent(Value);
531
532                var f = {
533                    "GUID": "" + field.getAttribute('guid') + "",
534                    "Value": "" + Value + ""
535                };
536                fields.push(f);
537            });
538            var controls = $(".LiveForm li[guid='" + action.FieldValue + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
539            var api = eval("LiveFormTabID" + action.ModuleId);
540            var sf = $.ServicesFramework(api.TabID);
541            var formdata = JSON.stringify(fields);
542            $(".lfoverlay, .lfmodal").show();
543            $.ajax({
544                type: "POST",
545                url: window.location.origin + sf.getServiceRoot("LiveForms") + "views/ExecuteSQL?SqlId=" + action.SqlId,
546                headers: {
547                    'ModuleId': parseInt(action.ModuleId),
548                    'TabId': parseInt(api.TabID),
549                    'RequestVerificationToken': $.ServicesFramework(parseInt(action.ModuleId)).getAntiForgeryValue()
550                },
551                data: JSON.stringify(formdata),
552                dataType: "json",
553                async: false,
554                contentType: "application/json",
555                success: function (data) {
556                    $(".lfoverlay, .lfmodal").hide();
557                    if ($(controls).closest('.Field').hasClass("Textbox")) {
558                        if (data != "")
559                            controls[0].value = data["Value"];
560                        else
561                            controls[0].value = "";
562                    }
563                    else if ($(controls).closest('.Field').hasClass("Currency")) {
564                        if (data != "")
565                            controls[0].value = data["Value"];
566                        else
567                            controls[0].value = "";
568                    }
569                    else if ($(controls).closest('.Field').hasClass("Textarea")) {
570                        if (data != "")
571                            controls[0].value = data["Value"];
572                        else
573                            controls[0].value = "";
574                    }
575                    else if ($(controls).closest('.Field').hasClass("Email")) {
576                        if (data != "")
577                            controls[0].value = data["Value"];
578                        else
579                            controls[0].value = "";
580                    }
581                    else if ($(controls).closest('.Field').hasClass("Number")) {
582                        if (data != "")
583                            controls[0].value = data["Value"];
584                        else
585                            controls[0].value = "";
586                    }
587                    else if ($(controls).closest('.Field').hasClass("Dropdown")) {
588                        var selected = $(controls).val();
589                        if (selected == "")
590                            selected = $(controls).attr('selectedoption');
591                        $(controls).empty();
592                        if (data != "") {
593                            $.each(data, function (key, val) {
594                                var opt = $("<option></option>");
595                                opt.attr("value", val);
596
597                                if (selected == val)
598                                    opt.attr("selected", "selected");
599                                var text = key.substr(1);
600                                opt.append(text);
601                                $(controls).append(opt);
602                            });
603                        }
604                        else {
605                            var opt = $("<option></option>");
606                            opt.attr("value", "");
607                            opt.append("");
608                            $(controls).append(opt);
609                        }
610                    }
611                    else if ($(controls).closest('.Field').hasClass("Checkbox")) {
612                        //selected = $(controls).closest('.Field').find("input[type=checkbox]:checked");
613                        var required = $(controls).closest('.Field').hasClass("Required");
614                        var id = $(controls[0]).attr("id");
615                        id = id.substring(0, id.length - 2);
616                        var name = $(controls[0]).attr("name");
617                        name = name.substring(0, name.length - 1);
618                        var index = 0;
619                        var element = document.getElementById(id);
620                        id = id + "_";
621                        var tbody = document.createElement("tbody");
622                        if (data != "") {
623                            $.each(data, function (key, val) {
624                                var opt = "<tr><td><input id=\"" + id + index + "\" type=\"checkbox\" name=\"" + name + index + "\" value=\"" + val + "\"";
625                                if (required)
626                                    opt += "cbrequired=\"cbrequired\"";
627
628                                //if (typeof selected != 'undefined') {
629                                //    $.each(selected, function (key, value) {
630                                //        if ($(value).val() == val) {
631                                //            opt += " checked=\"true\"";
632                                //        }
633                                //    });
634                                //}
635                                var text = key.substr(1);
636                                opt += "><label for=\"" + id + index + "\">" + text + "</label></td></tr>";
637                                $(tbody).append(opt);
638                                index++;
639                            });
640                        }
641                        else {
642                            var opt = "<tr><td><input id=\"" + id + "0\" type=\"checkbox\" name=\"" + name + "0\" value=\" \"";
643                            //if (selected == " ")
644                            //    opt += " checked=\"true\"";
645                            opt += "><label for=\"\"></label></td></tr>";
646                            $(tbody).append(opt);
647                        }
648                        $(element).empty();
649                        $(element).append(tbody);
650                        if (data != "") {
651                            $(element).find("input").bind("change", function () {
652                                ConditionCheck(this);
653                            });
654                        }
655                    }
656                    else if ($(controls).closest('.Field').hasClass("Radiobutton")) {
657                        //selected = $(controls).closest('.Field').find("input[type=radio]:checked").val();
658                        var required = $(controls).closest('.Field').hasClass("Required");
659                        var id = $(controls[0]).attr("id");
660                        var name = $(controls[0]).attr("name");
661                        id = id.substring(0, id.length - 2);
662                        var index = 0;
663                        var element = document.getElementById(id);
664                        id = id + "_";
665                        var tbody = document.createElement("tbody");
666                        if (data != "") {
667                            $.each(data, function (key, val) {
668                                var temp = id + "_" + index;
669                                var opt = "<tr><td><input id=\"" + id + index + "\" type=\"radio\" name=\"" + name + "\" value=\"" + val + "\"";
670                                if (required)
671                                    opt += "required=\"required\" ";
672                                //if (val == selected)
673                                //    opt += " checked=\"true\"";
674                                var text = key.substr(1);
675                                opt += "><label for=\"" + id + index + "\">" + text + "</label></td></tr>";
676                                $(tbody).append(opt);
677                                index++;
678                            });
679                        }
680                        else {
681                            var opt = "<tr><td><input id=\"" + id + "0\" type=\"radio\" name=\"" + name + "\" value=\" \"";
682                            //if (" " == selected)
683                            //    opt += " checked=\"true\"";
684                            opt += "><label for=\"\"></label></td></tr>";
685                            $(tbody).append(opt);
686                        }
687                        $(element).empty();
688                        $(element).append(tbody);
689                        if (data != "") {
690                            $(element).find("input").bind("change", function () {
691                                ConditionCheck(this);
692                            });
693                        }
694                    }
695                }
696            });
697        }
698
699    }
700    else if (action.FriendlyName == "Evaluating JavaScript") {
701
702        if (result || result == undefined) {
703
704            $(".Field.Textbox,.Field.Number,.Field.Currency,.Field.Dropdown,.Field.Radiobutton,.Field.Checkbox,.Field.Textarea,.Field.Email,.Field.Phone").each(function (index, field) {
705                var Value = "";
706                var Text = "";
707                if ($(field).hasClass("Textbox"))
708                    Value = $(field).find("input[type=text]").val();
709                else if ($(field).hasClass("Textarea"))
710                    Value = $(field).find("textarea").val();
711                else if ($(field).hasClass("Email"))
712                    Value = $(field).find("input[type=text]").val();
713                else if ($(field).hasClass("Phone")) {
714                    Value = $(field).find("input[type=text].AreaCode").val() + " " + $(field).find("input[type=text].PhoneNumber").val();
715                    if ($(field).find("input[type=text].AreaCode").val() == undefined) {
716                        Value = $(field).find("input[type=text].phone").val();
717                    }
718                }
719                else if ($(field).hasClass("Number"))
720                    Value = $(field).find("input[type=text]").val();
721                else if ($(field).hasClass("Currency")) {
722                    if ($.browser.device)
723                        Value = $($(field).find("input[type=tel]")).maskMoney('unmasked')[0];
724                    else
725                        Value = $($(field).find("input[type=text]")).maskMoney('unmasked')[0];
726                }
727                else if ($(field).hasClass("Dropdown")) {
728                    var val = $(field).find("select").val().split("|");
729                    Value = val[0];
730                    if (val.length > 1)
731                        Value = val[1];
732                    Text = $(field).find('option:selected').text();
733                }
734                else if ($(field).hasClass("Radiobutton")) {
735                    if ($(field).find("input[type=radio]:checked").val() != undefined) {
736                        var val = $(field).find("input[type=radio]:checked").val().split("|");
737                        Value = val[0];
738                        if (val.length > 1)
739                            Value = val[1];
740                        Text = $(field).find('input:checked').next().text()
741                    }
742                }
743                else if ($(field).hasClass("Checkbox")) {
744                    var chk = 0;
745                    $.each($(field).find("input[type=checkbox]:checked"), function (i, control) {
746                        if ($(control).val() != undefined) {
747                            var val = $(control).val().split("|");
748                            var V = val[0];
749                            if (val.length > 1)
750                                V = val[1];
751                            chk = chk + "+" + V;
752                            Text += $(this).next().text() + ",";
753                        }
754                    });
755                    Value = "(" + chk + ")";
756                    Text = Text.replace(/,$/, "");
757                }
758                if (Value == "") {
759                    Value = 0;
760                }
761                if (action.Script.indexOf("[" + field.getAttribute('guid') + "]") >= 0) {
762                    action.Script = action.Script.replace(new RegExp("\\[" + field.getAttribute('guid') + "]", 'g'), Value);
763                }
764                if (action.Script.indexOf("[" + field.getAttribute('guid') + ":text]") >= 0) {
765                    action.Script = action.Script.replace(new RegExp("\\[" + field.getAttribute('guid') + ":text]", 'g'), "'" + Text + "'");
766                }
767            });
768            "";
769            try {
770                var Value = "";
771                eval("Value =" + action.Script);
772            } catch (e) {
773                Value = action.Script;
774            }
775
776            var controls = $(".LiveForm li[guid='" + action.FieldName + "']").find('input[type=text],textarea,input[type=tel]');
777            $.each(controls, function (i, control) {
778                if ($(control).closest('li').hasClass('Currency')) {
779                    var pre = $(control).attr('precision');
780                    $(control).val(parseFloat(Value).toFixed(pre));
781                    $(control).maskMoney('mask')
782                }
783                else
784                    $(control).val(Value);
785            });
786            $(':contains("{' + action.FieldValue + '}")').filter(function () {
787                if ($(this).children().length < 1) {
788                    $(this).html(function (index, html) {
789                        return html.replace("{" + action.FieldValue + "}", "<span class=" + action.GUID + "></span>");
790                    });
791                }
792            });
793
794            controls = $("." + action.GUID);
795            $.each(controls, function (i, control) {
796                $(control).html(Value);
797            });
798        }
799    }
800    else if (action.FriendlyName == "Create Ticket") {
801        $(':contains("{' + action.Token + '}")').filter(function () {
802            if ($(this).children().length < 1) {
803                $(this).html(function (index, html) {
804                    return html.replace("{" + action.Token + "}", "<div id='" + action.GUID + "' class='Helpdesk_integration'></div>");
805                });
806            }
807        });
808        $("#" + action.GUID + "").hide();
809        if (action.ModuleID != null) {
810            var controls = $(".LiveForm li[guid='" + action.Subject.replace(/[\[\]']+/g, '') + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]').val();
811            var Category = $(".LiveForm li[guid='" + action.CategoryName.replace(/[\[\]']+/g, '') + "']").find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]').val();
812            if (controls != "") {
813                var IsTokenExistInUI = false;
814                if (action.Token != null && action.Token != '')
815                    if (document.documentElement.innerHTML.indexOf('{' + action.Token + '}') > -1)
816                        IsTokenExistInUI = true
817                    else {
818                        IsTokenExistInUI = false;
819                    }
820                if (IsTokenExistInUI)
821                    $.ajax({
822                        url: action.IntegrationURL + "?app=Knowledgebase",
823                        headers: {
824                            'ModuleId': parseInt(action.ModuleID),
825                            'TabId': parseInt(action.TabID),
826                            'RequestVerificationToken': $.ServicesFramework(parseInt(action.ModuleID)).getAntiForgeryValue()
827                        },
828                        dataType: "json",
829                        method: 'GET',
830                        async: false,
831                        success: function (data) {
832
833                            if (data != null && data != undefined && data.KnowledgebaseIntegrationAvailable == "true" && data.IntegrateKnowledgebase != "false") {
834                                $.ajax({
835                                    url: data.URL + "?moduleId=" + parseInt(data.ModuleID) + "&query=" + controls + "&category=" + Category,
836                                    headers: {
837                                        'ModuleId': parseInt(data.ModuleID),
838                                        'TabId': parseInt(data.TabID),
839                                        'RequestVerificationToken': $.ServicesFramework(parseInt(data.ModuleID)).getAntiForgeryValue()
840                                    },
841                                    dataType: "json",
842                                    method: 'GET',
843                                    async: false,
844                                    success: function (data) {
845                                        if (data != null && data.length > 0) {
846                                            $("#" + action.GUID + "").show();
847                                            $("#Panel_" + action.GUID + "").remove();
848                                            $("#" + action.GUID + "").append("<div id='Panel_" + action.GUID + "' class='ms-panel ms-panel-default'><div class='ms-panel-heading'><strong>" + LFValidations.RelatedArticle + "</strong></div><div class='ms-panel-body'><ul class='ms-list-group " + action.GUID + "'></ul></div></div>");
849                                            $.each(data, function (key, value) {
850                                                $("ul." + action.GUID + "").append("<li class=\"ms-list-group-item\"><a href=" + value.PermLink + "><p class=\"helpdesk-title\">" + value.Title + "</p><span class=\"ms-badge pull-right\">" + value.Folder.Parent.Name + " / " + value.Folder.Name + "</span></a></li>");
851                                            });
852                                        }
853                                        else {
854                                            $("#Panel_" + action.GUID + "").remove();
855                                            $("#" + action.GUID + "").hide();
856                                        }
857                                    }
858                                });
859                            }
860                        }
861                    });
862            }
863        }
864    }
865
866    if (action.FriendlyName == "Skip To Page") {
867        var pageToSkip = action.skipToPage.replace("Page ", "");
868
869        //Check if we're already on same page, in which case we don't need to switch
870        var SkipPage = !$(obj).closest('.LiveForm').find('ul.page-break-section:nth-of-type(' + pageToSkip + ')').is(':visible');
871        if (result) {
872            var prevUL = $(obj).closest('ul.page-break-section').prevAll("ul.page-break-section").length;
873            for (var i = prevUL + 2; i < pageToSkip; i++) {
874
875                $(obj).closest('.LiveForm').find('ul.page-break-section:nth-of-type(' + i + ')').addClass('skipped').hide();
876            }
877        } else {
878            var prevUL = $(obj).closest('ul.page-break-section').prevAll("ul.page-break-section").length;
879            for (var i = prevUL + 2; i < pageToSkip; i++) {
880
881                $(obj).closest('.LiveForm').find('ul.page-break-section:nth-of-type(' + i + ')').removeClass('skipped');
882            }
883        }
884        if (SkipPage && result && ValidatePageNextSubmit(obj, element)) {
885
886            if ((ele == undefined) && $(obj).is(':visible')) {
887                $(obj).closest('ul.page-break-section').hide();
888                $(obj).closest('.LiveForm').find('ul.page-break-section:nth-of-type(' + pageToSkip + ')').fadeIn(function () {
889                    $(".Signatures").each(function (index, element) {
890                        if ($(element).is(":visible") && $(element).find('canvas').length <= 0) {
891                            if (parseInt(element.getAttribute("width")) > 0) {
892                                $(element).jSignature({ 'decor-color': 'transparent', 'he
892ight': parseInt(element.getAttribute("height")), 'width': parseInt(element.getAttribute("width")) }).addClass('mobile-resp');
893                            }
894                            else {
895                                $(element).jSignature({ 'decor-color': 'transparent', 'height': parseInt(element.getAttribute("height")) }).addClass('mobile-resp');
896                            }
897                        }
898                    })
899                });
900                ProgressSection($(obj).closest('.LiveForm').find('ul.page-break-section:nth-of-type(' + pageToSkip + ')'));
901                $('html,body').animate({ scrollTop: $(obj).closest('.LiveForm').find('ul.page-break-section:nth-of-type(' + pageToSkip + ')').find('li').first().offset().top - 100 }, 500);
902
903                var pages = $(obj).closest('.LiveForm').find('ul.page-break-section.skipped');
904                $.each(pages, function (i, page) {
905                    var fields = $(page).find('li.Field');
906                    $.each(fields, function (i, field) {
907                        $(field).find('input[furequired],input[scalerequired],input[scorerequired]').addClass("novalidate");
908                        var controls = $(field).find('input[type=text],textarea,select,input[type=radio],input[type=checkbox]');
909                        $.each(controls, function (i, control) {
910                            $(control).addClass('novalidate');
911                        });
912                    });
913                });
914
915            }
916        }
917    }
918}
919$("[pageNext]").unbind('click');
920$(document).on("click", "[pageNext]", ValidatePageNextSubmit);
921
922$("[pageBack]").unbind('click');
923$(document).on("click", "[pageBack]", ValidatePageNextSubmit);
924
925//$("[pageBack]").click(ValidatePageNextSubmit);
926//$("[pageNext]").click(ValidatePageNextSubmit);
927
928function ValidatePageNextSubmit(evt, element) {
929    var $this = this;
930    $('.Field.Currency input').each(function () {
931        $(this).select();
932    });
933    return ProcessingActions(evt, element, $this);
934
935}
936
937
938var ProcessingActions = function (evt, element, currentobj) {
939
940    loadingTime = new Date();
941
942    var selector = evt.currentTarget;
943    if (typeof selector == 'undefined')
944        selector = evt;
945    if (typeof element == 'undefined')
946        element = evt;
947    var $group = $(selector).parents('.page-break-section');
948
949    var isValid = true;
950    var focus = new Array();
951    if ($(element.currentTarget).is(':visible')) {
952        if ($(selector).attr('pageback') != "pageBack") {
953            $group.find(':input').each(function (i, item) {
954                if ($(item).is(':visible') && !$(item).valid()) {
955                    focus.push(item);
956                    isValid = false;
957                }
958                else if ($(item).attr('furequired') == "furequired" && !$(item).valid()) {
959                    focus.push(item);
960                    isValid = false;
961                }
962                else if ($(item).attr('fbrequired') == "fbrequired" && !$(item).valid()) {
963                    focus.push(item);
964                    isValid = false;
965                }
966                else if ($(item).attr('ckeditor') == "required") {
967                    if ($(item).parent('div').attr('editorrequired') != undefined && $(item).parent('div').attr('editorrequired') == "true") {
968                        $.each(CKEDITOR.instances, function (key, editor) {
969                            if ($(editor.element.$).parent('div').parent('li') != undefined && $(editor.element.$).parent('div').parent('li').is(':visible') == true) {
970                                if ($(item).attr('ckeditor') == $(editor.element.$).attr('ckeditor')) {
971                                    if (editor.getData() == "") {
972                                        $("#label" + $(item).attr('ckeditor') + "").remove();
973                                        $("<label id=label" + $(item).attr('ckeditor') + " class=\"error\">" + LFValidations.required + "</label>").insertAfter($(item).parent('div').children('div'));
974                                        isValid = false;
975                                    }
976                                    else {
977                                        $("#label" + $(item).attr('ckeditor') + "").remove();
978                                    }
979                                }
980                            }
981                        })
982                    }
983                }
984
985                if ($(item).hasClass('g-recaptcha-response') && !$(item).hasClass('novalidate')) {
986                    var captchadiv = $(item).closest('div[googlerecaptchaid]');
987                    var captcharesponse = grecaptcha.getResponse($(captchadiv).attr('googlerecaptchaid'));
988                    $("#" + $(captchadiv).attr("id") + " .error").remove();
989                    if (captcharesponse.length == 0) {
990                        isValid = false;
991                        $("#" + $(captchadiv).attr("id")).append('<label class="error">' + LFValidations.recaptcha + '</label>');
992                    }
993
994                }
995            });
996            //password validate
997            $group.find('.Field.Password').each(function (i, item) {
998                var password = "", confirmpassword = "";
999                $(item).find(':input').each(function (i, inputitem) {
1000                    if ($(inputitem).is(':visible')) {
1001                        $(inputitem).next('.conmessage').remove();
1002                        if ($(inputitem).hasClass('password')) {
1003                            password = inputitem.value;
1004                        }
1005                        else if ($(inputitem).hasClass('confirmpassword')) {
1006                            $(inputitem).next('.conmessage').remove();
1007                            confirmpassword = inputitem.value;
1008                            if (password != confirmpassword) {
1009                                $('<label class="error conmessage">' + LFValidations.matchpassmessage + '</label>').insertAfter(inputitem)
1010                                isValid = false;
1011                            }
1012                        }
1013                    }
1014                });
1015
1016            });
1017            if ($(focus).length > 0) {
1018                $('html,body').animate({ scrollTop: $(focus).first().closest('li').first().offset().top - 100 }, 500, function () { $(focus).first().focus(); });
1019            }
1020        }
1021    }
1022    if (!isValid) {
1023        if ($(evt).is('input[type=button]'))
1024            evt.preventDefault();
1025    }
1026    else if (!$.isWindow(currentobj)) {
1027
1028        $(".lfoverlay, .lfmodal").show();
1029
1030        //Condition Check
1031        $('[condition] input[type="text"],[condition] textarea,[condition] select,[condition] input[type="radio"],[condition] input[type="checkbox"]').each(function (i, obj) {
1032            if ($(obj).is(":visible"))
1033                //we  want to check condition on prior to changing page
1034                setTimeout(function () {
1035                    ConditionCheck(obj, element);
1036                }, 10);
1037        });
1038
1039        setTimeout(function () {
1040
1041
1042
1043            var srcElement = element.srcElement || element.target;
1044            if ($(srcElement).is(":visible")) {
1045                if ($(srcElement).attr("pageNext") == "pageNext") {
1046                    //var thisElement = this;
1047                    //$(thisElement).closest('ul').fadeOut("fast", function () {
1048                    //    $(thisElement).closest('ul').next().fadeIn("fast", function () {
1049                    //        $('html,body').animate({ scrollTop: $(thisElement).closest('ul').next().find('li').first().offset().top - 100 }, 500);
1050                    //    });
1051                    //});
1052                    var item = $(srcElement).parents('ul.page-break-section').nextAll('ul.page-break-section:not(.skipped)').first();
1053
1054                    $(currentobj).closest('ul.page-break-section').hide();
1055                    $(srcElement).parents('ul.page-break-section').nextAll('ul.page-break-section:hidden:not(.skipped)').first().removeClass('bounceInRight bounceInLeft').fadeIn(function () {
1056                        $(".Signatures").each(function (index, element) {
1057                            if ($(element).is(":visible") && $(element).find('canvas').length <= 0) {
1058                                if (parseInt(element.getAttribute("width")) > 0) {
1059                                    $(element).jSignature({ 'decor-color': 'transparent', 'height': parseInt(element.getAttribute("height")), 'width': parseInt(element.getAttribute("width")) }).addClass('mobile-resp');
1060                                }
1061                                else {
1062                                    $(element).jSignature({ 'decor-color': 'transparent', 'height': parseInt(element.getAttribute("height")) }).addClass('mobile-resp');
1063                                }
1064                            }
1065                        })
1066                    }).addClass("appear-animation appear-animation-visible bounceInRight");
1067                    $('body').addClass('overflow-hide');
1068
1069                    ProgressSection(item);
1070
1071                    if (typeof item != 'undefined') {
1072                        $('html,body').animate({ scrollTop: $(item).find('li').first().offset().top - 100 }, 500);
1073                    }
1074
1075                    setTimeout(function () {
1076                        $('body').removeClass('overflow-hide');
1077                    }, 1000);
1078
1079                }
1080                else if ($(srcElement).attr("pageBack") == "pageBack") {
1081
1082                    var item = $(srcElement).parents('ul.page-break-section').prevAll('ul.page-break-section:not(.skipped)').first();
1083
1084                    $(currentobj).closest('ul.page-break-section').hide();
1085                    $(srcElement).parents('ul.page-break-section').prevAll('ul.page-break-section:hidden:not(.skipped)').first().removeClass('bounceInRight bounceInLeft').fadeIn().addClass("appear-animation appear-animation-visible bounceInLeft");
1086                    $('body').addClass('overflow-hide');
1087
1088                    ProgressSection(item)
1089
1090                    if (typeof item != 'undefined') {
1091                        $('html,body').animate({ scrollTop: $(item).find('li').first().offset().top - 100 }, 500);
1092                    }
1093
1094                    setTimeout(function () {
1095                        $('body').removeClass('overflow-hide');
1096                    }, 1000);
1097                }
1098
1099                var LF = $(currentobj).parents('.LiveForm').attr('uniqueid');
1100
1101                if (typeof LF != undefined)
1102                    LiveForms.AppendViewPortClass(LF, eval(LF + 'MU'));
1103
1104                $(".lfoverlay, .lfmodal").hide();
1105            }
1106        }, 10);
1107    }
1108    else if ($.isWindow(currentobj)) {
1109        return true;
1110    }
1111
1112};
1113
1114var ProgressSection = function (item) {
1115
1116    var LF = $(item).parents('.LiveForm').attr('uniqueid');
1117    var navigation = $('#' + LF + ' .Form_Navigation');
1118    var i = item.index();
1119
1120    if (navigation.length > 0) {
1121        var breaksection = $('#' + LF + ' ul.page-break-section').length;
1122        var progpercent = 100 / breaksection;
1123        var progresswidth = progpercent * (i);
1124        var navigation = $('#' + LF + ' .Form_Navigation');
1125        var progressbar = $('#' + LF + ' .progressbar');
1126
1127        $(navigation).find('li').removeClass('active');
1128        $('#' + LF + ' .Form_title').find('li').removeClass('active');
1129        $(navigation).find('li:eq(' + (i - 1) + ')').addClass('active');
1130        $('#' + LF + ' .Form_title').find('li:eq(' + (i - 1) + ')').addClass('active');
1131        $(progressbar).find('.progressfield').css("width", progresswidth + '%');
1132
1133        if (Math.round(progresswidth) == 100)
1134            $(progressbar).find('.progressfield').css("border-radius", "20px");
1135        else
1136            $(progressbar).find('.progressfield').css("border-radius", "20px 0 0 20px");
1137
1138        $('#' + LF + ' .numbering').text(i + ' of ' + breaksection);
1139        $('#' + LF + ' .percentage').text(Math.round(progresswidth) + '%');
1140
1141
1142        if ($(window).width() <= 768 && breaksection > 2) {
1143            for (var pn = 1; pn <= i; pn++) {
1144                $('#' + LF + ' ul.Form_Navigation li').hide().slice(pn - 1, pn + 1).show();
1145                $('#' + LF + ' ul.Form_title li').hide().slice(pn - 1, pn + 1).show();
1146
1147                if (pn == breaksection) {
1148                    $('#' + LF + ' ul.Form_Navigation li').hide().slice(pn - 2, pn).show();
1149                    $('#' + LF + ' ul.Form_title li').hide().slice(pn - 2, pn).show();
1150                }
1151            }
1152        }
1153        else if ($(window).width() > 768 && breaksection > 5) {
1154            for (var pn = 3; pn < i; pn++) {
1155                $('#' + LF + ' ul.Form_Navigation li').hide().slice(pn - 3, pn + 2).show();
1156                $('#' + LF + ' ul.Form_title li').hide().slice(pn - 3, pn + 2).show();
1157
1158                if (pn == breaksection - 1) {
1159                    $('#' + LF + ' ul.Form_Navigation li').hide().slice(pn - 4, pn + 1).show();
1160                    $('#' + LF + ' ul.Form_title li').hide().slice(pn - 4, pn + 1).show();
1161                }
1162            }
1163        }
1164    }
1165
1166}
1167
1168var Click_FileBrowseUpload = function (event, GUID, ModuleId, Extension, Size) {
1169    var errormsg = "";
1170    var sf = $.ServicesFramework(ModuleId);
1171    if (sf != undefined) {
1172        var form_data = new FormData();
1173        for (var x = 0; x < $(event).prop('files').length; x++) {
1174            var parts = $(event).prop('files')[x].name.split('.');
1175            var ext = parts[parts.length - 1];
1176            var size = $(event).prop('files')[x].size / 1024;
1177            if (Extension.indexOf(ext) < 0)
1178                errormsg += "Allowed extensions are " + Extension;
1179            else if (size > Size)
1180                errormsg += "Max allowed file size is " + (Size / 1024) + " MB";
1181            else
1182                form_data.append("files[]", $(event).prop('files')[x]);
1183        }
1184        if (errormsg == "") {
1185            var api = eval("LiveFormWebapi" + ModuleId);
1186            var foid = -1;
1187            var allow = false;
1188            if ($($('.browse.' + GUID.replace(/-/g, "_") + '>.folder').find('li.active')).attr('foid') != undefined) {
1189                foid = $($('.browse.' + GUID.replace(/-/g, "_") + '>.folder').find('li.active')).attr('foid');
1190                allow = $($('.browse.' + GUID.replace(/-/g, "_") + '>.folder').find('li.active')).attr('allow');
1191            }
1192            $.ajax({
1193                url: sf.getServiceRoot(api.ModuleFolder) + 'BrowseFile/UploadFile?GUID=' + GUID + '&FolderID=' + foid,
1194                headers: {
1195                    'ModuleId': parseInt(sf.getModuleId()),
1196                    'TabId': parseInt(sf.getTabId()),
1197                    'RequestVerificationToken': sf.getAntiForgeryValue()
1198                },
1199                cache: false,
1200                contentType: false,
1201                processData: false,
1202                data: form_data,
1203                type: 'POST',
1204                success: function (response) {
1205                    if (response == "File/s not uploaded successfully!")
1206                        swal(response);
1207                    else
1208                        setTimeout(function () { LFClick_GetFiles('' + GUID + '', ModuleId, foid, 0, allow, response.split('fileid')[1]); }, 100);
1209                },
1210                error: function (error) {
1211                    swal(error);
1212                }
1213            });
1214        }
1215        else
1216            swal(errormsg);
1217    }
1218};
1219
1220var Click_FileBrowse = function (GUID, ModuleId) {
1221    $(".browsefile." + GUID.replace(/-/g, "_")).hide();
1222    $(".browse." + GUID.replace(/-/g, "_")).show();
1223    var api = eval("LiveFormWebapi" + ModuleId);
1224    var foid = -1;
1225    var allow = false;
1226    if ($.trim($('.' + GUID.replace(/-/g, "_") + ' .folder').text()).length == 0) {
1227        api.webApi.get('BrowseFile/GetFolders', 'GUID=' + GUID).success(function (data) {
1228            var string = "<span style='font-size: medium;'><strong>Select Folder</strong></span><ul>";
1229            $(data).each(function (index, value) {
1230                if (foid == -1) {
1231                    foid = value.Value;
1232                    allow = value.uploadAllowed;
1233                }
1234                string += "<li class='active' foid=" + value.Value + " allow=" + value.uploadAllowed + ">";
1235                if (value.childrenCount > 0)
1236                    string += "<span onclick=\"LFClick_GetSubFolder('" + GUID + "'," + ModuleId + "," + value.Value + "); $(this).toggleClass('glyphicon-triangle-bottom glyphicon-triangle-right'); if ($(this).siblings('ul.rootfolder').find('li').length) $(this).siblings('ul.rootfolder').toggle(); \" class=\"glyphicon glyphicon-triangle-bottom\"></span>";
1237                else
1238                    string += "<span class=\"glyphicon glyphicon-triangle-right content-hidden\"></span>";
1239                string += "<span onclick=\"LFClick_GetFiles('" + GUID + "'," + ModuleId + "," + value.Value + ",0," + value.uploadAllowed + ",''); $('.browse').find('.active').removeClass('active'); $(this).parent('li').addClass('active'); \" class=\"glyphicon glyphicon-folder-close\"></span>";
1240                string += "<span onclick=\"LFClick_GetFiles('" + GUID + "'," + ModuleId + "," + value.Value + ",0," + value.uploadAllowed + ",''); $('.browse').find('.active').removeClass('active'); $(this).parent('li').addClass('active'); \" class=\"folders\">" + value.Text + "</span>";
1241                string += "<ul class=\"rootfolder " + ModuleId + "_" + value.Value + "\">";
1242                if (value.children)
1243                    string += FolderMarkup(value.children, GUID, ModuleId);
1244                string += "</ul>";
1245                string += "</li>";
1246            });
1247            string += "</ul>";
1248            $('.' + GUID.replace(/-/g, "_") + ' .folder').html(string);
1249            setTimeout(function () { LFClick_GetFiles('' + GUID + '', ModuleId, foid, 0, allow, ''); }, 100);
1250        });
1251    }
1252};
1253
1254var FolderMarkup = function (data, GUID, ModuleId) {
1255    var string = "";
1256    $(data).each(function (index, value) {
1257        string += "<li foid=" + value.Value + " allow=" + value.uploadAllowed + ">";
1258        if (value.childrenCount > 0)
1259            string += "<span onclick=\"LFClick_GetSubFolder('" + GUID + "'," + ModuleId + "," + value.Value + "); $(this).toggleClass('glyphicon-triangle-bottom glyphicon-triangle-right'); if ($(this).siblings('ul.rootfolder').find('li').length) $(this).siblings('ul.rootfolder').toggle();\" class=\"glyphicon glyphicon-triangle-right\"></span>";
1260        else
1261            string += "<span class=\"glyphicon glyphicon-triangle-right content-hidden\"></span>";
1262        string += "<span onclick=\"LFClick_GetFiles('" + GUID + "'," + ModuleId + "," + value.Value + ",0," + value.uploadAllowed + ",''); $('.browse').find('.active').removeClass('active'); $(this).parent('li').addClass('active'); \" class=\"glyphicon glyphicon-folder-close\"></span>";
1263        string += "<span onclick=\"LFClick_GetFiles('" + GUID + "'," + ModuleId + "," + value.Value + ",0," + value.uploadAllowed + ",''); $('.browse').find('.active').removeClass('active'); $(this).parent('li').addClass('active'); \" class=\"folders\">" + value.Text + "</span>";
1264        string += "<ul class=\"rootfolder " + ModuleId + "_" + value.Value + "\">";
1265        if (value.children)
1266            string += FolderMarkup(value.children, GUID, ModuleId);
1267        string += "</ul>";
1268        string += "</li>";
1269    });
1270    return string;
1271};
1272
1273var LFClick_GetSubFolder = function (GUID, ModuleId, value) {
1274    var api = eval("LiveFormWebapi" + ModuleId);
1275    if ($.trim($('.' + GUID.replace(/-/g, "_") + ' .rootfolder.' + ModuleId + "_" + value).text()).length == 0) {
1276        api.webApi.get('BrowseFile/GetSubFolders', 'folderid=' + value).success(function (data) {
1277            $('.' + GUID.replace(/-/g, "_") + ' .rootfolder.' + ModuleId + "_" + value).html(FolderMarkup(data, GUID, ModuleId));
1278        });
1279    }
1280};
1281
1282var LFKeyword_Search = function (GUID, ModuleId, Value, allow) {
1283    if (LForm_Time) {
1284        clearTimeout(LForm_Time);
1285    }
1286    LForm_Time = setTimeout(function () { LFClick_GetFiles(GUID, ModuleId, Value, 0, allow, ''); }, 500);
1287};
1288
1289var LFKeypress = function (event) {
1290
1291    if (event.which === 13) {
1292        event.preventDefault();
1293    }
1294};
1295
1296
1297var LFClick_GetFiles = function (GUID, ModuleId, Value, Skip, allowUpload, uploadedfileid) {
1298    if (allowUpload)
1299        $(".BrowseInputSpan." + GUID.replace(/-/g, "_")).attr("style", "display: inline-block;");
1300    else
1301        $(".BrowseInputSpan." + GUID.replace(/-/g, "_")).attr("style", "display: none;");
1302    var api = eval("LiveFormWebapi" + ModuleId);
1303    var keyword = $('#keyword' + GUID).val();
1304    if (keyword == undefined)
1305        keyword = "";
1306    var string = "<span style='font-size: medium;'><strong>Select File</strong></span><input id='keyword" + GUID + "' type='text' onkeypress=\"LFKeypress(event)\" onkeyup=\"LFKeyword_Search('" + GUID + "'," + ModuleId + "," + Value + "," + allowUpload + ");\" style='width:100%;margin-top: 5px;' placeholder='Search' />";
1307    api.webApi.get('BrowseFile/GetFiles', 'GUID=' + GUID + '&folderid=' + Value + '&skip=' + Skip + '&pagesize=100&keyword=' + keyword).success(function (data) {
1308        $('.' + GUID.replace(/-/g, "_") + ' .file').html(string + FileMarkup(GUID, data) + data.Pager);
1309        $('#keyword' + GUID).val(keyword);
1310        if (uploadedfileid != undefined && uploadedfileid != '')
1311            $('.' + GUID.replace(/-/g, "_") + ' .file').find('li[fid="' + uploadedfileid + '"]').click();
1312    });
1313};
1314
1315
1316var FileMarkup = function (GUID, data) {
1317    var string = "";
1318    if (data) {
1319        string += "</ul>";
1320        $(data.Files).each(function (index, value) {
1321            string += "<li style='cursor:pointer;' fid='" + value.Value + "' onclick=\"LFClick_SelectFile(this,'" + GUID + "'," + value.Value + ");\">";
1322            string += "<span class='glyphicon glyphicon-file'></span>";
1323            string += "<span>" + value.Text + "</span>";
1324            string += "</li>";
1325        });
1326        string += "</ul>";
1327    }
1328    return string;
1329};
1330
1331var LFClick_SelectFile = function (event, GUID, data) {
1332    var myArray = $('.' + GUID + '_browseFileUploadButton').val().split(",");
1333    var isavl = false;
1334    for (let i = 0; i < myArray.length; i++) {
1335        if (myArray[i] == data)
1336            isavl = true;
1337    }
1338    if (!isavl) {
1339        LFSelectedMarkUp(event, GUID, data);
1340    }
1341};
1342
1343
1344
1345var LFSelectedMarkUp = function (event, GUID, data) {
1346    if ($('.fileheader.' + GUID.replace(/-/g, "_")).attr('style') == "display: none;")
1347        $('.fileheader.' + GUID.replace(/-/g, "_")).attr("style", "display: block;");
1348
1349    var selectedmarkup = "<div guid=" + GUID + " file='" + data + "' class='rowfile row_" + data + "'><span>" + event.innerText + "</span><span class='glyphicon glyphicon-trash' style='cursor:pointer;' onclick=\"LFClick_DeleteFile('" + GUID + "','" + data + "')\"></span><span class='glyphicon glyphicon-move assetsmove' style='cursor:move;'></span></div>";
1350    var maxallowed = 1;
1351    $.each($($(event).closest('.Field-Container-Wide').find('.browse')[0]).attr('class').split(' '), function (k, v) {
1352        if (v.indexOf('maxallowed') > -1) {
1353            maxallowed = parseInt(v.split('maxallowed')[1]);
1354        }
1355    });
1356    var totalfilesselected = $('.selectedfile' + GUID.replace(/-/g, "_")).find('.rowfile').length;
1357    if (maxallowed != 0 && totalfilesselected == maxallowed) {
1358        LFClick_DeleteFile(GUID, $($('.selectedfile' + GUID.replace(/-/g, "_")).find('.rowfile')[0]).attr('file'));
1359    }
1360    $('.selectedfile' + GUID.replace(/-/g, "_")).append(selectedmarkup);
1361    $('.' + GUID + '_browseFileUploadButton').val($('.' + GUID + '_browseFileUploadButton').val() + "," + data);
1362};
1363var LFClick_DeleteFile = function (GUID, data) {
1364    var myArray = $('.' + GUID + '_browseFileUploadButton').val().split(",");
1365    $('.' + GUID + '_browseFileUploadButton').val('');
1366    for (let i = 0; i < myArray.length; i++) {
1367        if (myArray[i] != data && myArray[i])
1368            $('.' + GUID + '_browseFileUploadButton').val($('.' + GUID + '_browseFileUploadButton').val() + "," + myArray[i]);
1369    }
1370    if (!$('.' + GUID + '_browseFileUploadButton').val())
1371        $('.fileheader.' + GUID.replace(/-/g, "_")).attr("style", "display: none;");
1372    $('.selectedfile' + GUID.replace(/-/g, "_") + ' .row_' + data).remove();
1373};
1374
1375$('.asset_grid > div').sortable({
1376    items: 'div',
1377    handle: '.assetsmove',
1378    stop: function (event, ui) {
1379        var guid = ui.item.attr('guid');
1380        if (guid) {
1381            $('.' + guid + '_browseFileUploadButton').val('');
1382            $('.selectedfile' + guid.replace(/-/g, "_") + ' .rowfile').each(function (i, obj) {
1383                var file = $(obj).attr('file');
1384                if (file)
1385                    $('.' + guid + '_browseFileUploadButton').val($('.' + guid + '_browseFileUploadButton').val() + "," + file);
1386            });
1387        }
1388    }
1389});
1390
1391
1392var LFClick_DeletePlUploadFile = function (GUID, data, index) {
1393    var myArray = $('.' + GUID + '_FileUploadButton').val().split("%&%");
1394    $('.' + GUID + '_FileUploadButton').val('');
1395    for (let i = 0; i < myArray.length; i++) {
1396        if (myArray[i] != data && myArray[i])
1397            $('.' + GUID + '_FileUploadButton').val($('.' + GUID + '_FileUploadButton').val() + "%&%" + myArray[i]);
1398    }
1399    if (!$('.' + GUID + '_FileUploadButton').val())
1400        $('.fileheader.' + GUID.replace(/-/g, "_")).attr("style", "display: none;");
1401    $('.selectedfile' + GUID.replace(/-/g, "_") + ' .pluploadrow_' + index).remove();
1402};

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.