PageSourceSearch

https://valvesale.ru/ds-comf/ds-form/js/dsforms.js

js valvesale.ru collected 2026-10-07 22:26:03 UTC 38,370 bytes, 806 lines download raw bytes

1//           ________________    __________                        
2//            ___  __ \_  ___/    ___  ____/___________________ ___ 
3//            __  / / /____ \     __  /_   _  __ \_  ___/_  __ `__ |
4//            _  /_/ /____/ /     _  __/   / /_/ /  /   _  / / / / /
5//            /_____/ /____/      /_/      \____//_/    /_/ /_/ /_/ 
6//                    
7                                            
8dsformROOT = '/ds-comf/ds-form/';
9
10function compareVersionjQuery(v) {
11    var required = v.split('.', 2),
12        current = gKweri.fn.jquery.split('.', 2);
13    return (parseInt(current[0]) > parseInt(required[0])) ||
14        (parseInt(current[0]) == parseInt(required[0]) &&
15            parseInt(current[1]) >= parseInt(required[1]));
16}
17if (!window.gKweri && window.jQuery) {
18    window.gKweri = window.jQuery
19}
20
21if (!window.gKweri || !compareVersionjQuery('1.5')) {
22    console.error('Version jQuery < 1.5 or jQuery is not found!');
23}
24else {
25
26    (function(window, document, $, undefined) {
27        "use strict";
28        var W = $(window),
29            D = $(document),
30            version = '4.1.0',
31            root = dsformROOT,
32            lib = dsformROOT + 'js/plugins/',
33            F,
34            gData = window.dsformglobaldata = {},
35            Modals = window.dsformglobaldata.buttonindexes = {},
36            usings = 'External included scripts: \n \
37                   Input Mask: https://github.com/RobinHerbots/jquery.inputmask \n \
38                   jQuery Form Styler: http://dimox.name/jquery-form-styler/ \n \
39                   popDate: https://github.com/jokernakartama/popdate',
40            pseudoRandom = function() {
41                var now = new Date,
42                    res = String(Math.abs(now.getMilliseconds() - (Math.floor(Math.random() * (999 - 1)) + 1))) +
43                    String((Math.floor(Math.random() * (999 - 1)) + 1));
44                return res;
45            },
46            F = function(o, options) {
47
48                var self = this; //simple way 
49
50
51
52                /*private vars*/
53                var _id = '', //form id
54                    _modal,
55                    _formLoaded = false,
56                    _visible,
57                    _bi = pseudoRandom() + pseudoRandom(), // kinda unique index for buttons
58                    _o = o && o.hasOwnProperty && o instanceof $ ? o : $(o); // wrap DOM objects in jQuery
59
60
61                /*public vars*/
62                self.options = {},
63                self.container = {},
64                self.form = {},
65                self.report = undefined,
66                self.config = undefined,
67                self.sended = false,
68                self.element = _o;
69
70
71
72                /* defaults */
73                var defaults = {
74                    formID: undefined,
75                    modal: true, // if true, the determined element uses as button
76                    additionalClass: undefined,
77                    config: '',
78                    inputmask: {}, //options for inputmask
79                    dates: {},
80                    showLoader: true,
81                    useFormStyler: false, // uses jQuery Form Styler plugin http://dimox.name/jquery-form-styler/
82                    reload: true,
83                    stackErrors: true,
84                    clearErrors: false,
85
86
87                    // callbacks
88                    onLoad: undefined, // when form loads, mostly runs one time for each defined element
89                    onShow: undefined, // when modal window opens
90                    onSuccess: undefined, // when form data successfully sends
91                    onFail: undefined, // in case of input errors 
92                    onClose: undefined, // when modal window close
93                    onServerError: undefined, // in case of form data cannot be send
94                    onInit: undefined, // when inits form
95
96                    // modals
97                    animationspeed: 300, //how fast animations are
98                    closeonbackgroundclick: true, //if you click background will modal close
99
100                    formstyler: {},
101                };
102
103                /* private methods */
104                var __init__ = function() {
105
106                        _o.get(0).dsformmarker = true;
107
108                        //extendnig defaults with options
109                        self.options = $.extend({}, defaults, options);
110                        _id = self.options.formID; // for comfortable coding
111                        _modal = self.options.modal;
112                        self.config = self.options.config;
113
114                        if (typeof onInit === 'function') {
115                            self.options.onInit.call(self, $);
116                        }
117
118                        if (!compareVersionjQuery('1.7') && self.options.useFormStyler) {
119                            self.options.useFormStyler = false;
120                            console.warn('DSFORM(#' + _id + '): Form Styler uses version jQuery 1.7.1 and higher. ');
121                        }
122
123                        if (self.options.useFormStyler) {
124                            self.run(lib + 'formstyler.js', function() {
125                                $(null).styler(null);
126                            }, 'formstyler');
127                        } //preload if use styler
128
129                        if (_modal) { // if button
130                            // check the container existing
131                            if ($('*[data-dsform-id="' + _id + '"]').get().length > 0) {
132                                self.container = $('*[data-dsform-id="' + _id + '"]');
133                            }
134                            else {
135                                self.container = $('<div class="ds-form dspopup-modal ' + _id + '"><div/>').appendTo('body');
136                                self.container.attr('data-dsform-id', _id);
137                            }
138
139                            // binding modal on click
140                            _o.bind('click', function(e) {
141                                e.preventDefault();
142                                self.config = $(this).attr('data-dsconfig') || self.config;
143                                //refresh form only if another button was clicked
144                                if (_bi != Modals[_id] || (self.sended && self.options.reload)) {
145                                    Modals[_id] = _bi;
146                                    self.getForm();
147                                }
148                                if (_formLoaded) __align__();
149                                __reveal__();
150                                if (self.options.additionalClass) self.container.addClass(self.options.additionalClass);
151                            });
152                        }
153                        else { // if container
154                            self.container = _o;
155                            if (self.options.additionalClass) self.container.addClass(self.options.additionalClass);
156                            self.container.addClass('ds-form');
157                            self.config = _o.attr('data-dsconfig') || self.config;
158                            self.getForm();
159                        }
160                    } // init ends
161
162                var __align__ = function() {
163                        // restart modal window geometry if this function was used before
164                        if (self.container.children().is('.scrollform')) {
165                            self.form.appendTo(self.container);
166                            self.container.find('.scrollform').remove();
167                            self.container.css({
168                                'height': 'auto'
169                            });
170                        }
171                        var scrollbar = 0;
172                        self.container.css({
173                            'height': '',
174                            'width': ''
175                        }); // remove inline styles at first
176                        // determine browser geometry
177                        var windowWidth = window.innerWidth ||
178                            document.documentElement.clientWidth ||
179                            document.body.clientWidth,
180                            windowHeight = window.innerHeight ||
181                            document.documentElement.clientHeight ||
182                            document.body.clientHeight;
183                        if (window.innerWidth && document.documentElement.clientWidth) {
184                            scrollbar = window.innerWidth - document.documentElement.clientWidth;
185                        }
186
187                        // but if width is too large, make the modal window a bit smaller than browser window
188                        if (windowWidth < (self.container.innerWidth() + 20)) {
189                            self.container.width(+windowWidth - scrollbar - 20 - (self.container.innerWidth() - self.container.width()));
190                        }
191
192                        var widthForm = self.container.innerWidth(),
193                            heightForm = self.container.outerHeight(true),
194                            leftForm = Math.round((windowWidth - widthForm - scrollbar) / 2); // calculate left margin with some fixes
195
196                        if (windowHeight <= (heightForm + 20)) {
197                            var topForm = 20,
198                                marginScroll = 15,
199                                paddingForm = heightForm - self.container.height();
200                            self.container.append('<div class="scrollform"></div>');
201                            self.form.appendTo(self.container.find('.scrollform'));
202                            heightForm = windowHeight - topForm * 2;
203                            self.container.find('.scrollform').height(heightForm - paddingForm - marginScroll);
204                            self.container.find('.scrollform').css({
205                                'overflow-y': 'scroll',
206                                'margin': marginScroll + 'px 0'
207                            });
208                        }
209                        else {
210                            // if evrthng is ok, calculate margins
211                            var topForm = Math.round((windowHeight - heightForm) / 2);
212                        }
213                        // use the geometry
214                        self.container.css({
215                            'top': topForm + 'px',
216                            'left': leftForm + 'px',
217                        });
218                    } // align ends
219
220                var __send__ = function() {
221
222                        if (self.options.showLoader) {
223                            var h = self.container.find('input[type="submit"]').outerHeight(true),
224                                w = self.container.find('input[type="submit"]').outerWidth(true),
225                                mt = 0,
226                                ml;
227
228                            if (+h > 32) {
229                                mt = (+h - 32) / 2;
230                                h = 32;
231                            }
232                            ml = (((+w) - (+h)) / 2),
233                                mt = mt + 'px';
234                            ml = ml + 'px';
235
236                            $('img.loadform').siblings('input[type="submit"]').toggle();
237
238                            self.form.find('input[type="submit"]').hide();
239
240                            $('img.loadform').appendTo(self.container.find('input[type="submit"]').parent()).css({
241                                'height': h,
242                                'width': h,
243                                'margin': mt + ' ' + ml,
244                                'display': 'inline',
245                                'verticalAlign': 'middle',
246                            });
247                        }
248
249                        if (!window.FormData) {
250                            var dataform = self.form.serialize();
251                            dataform = dataform + '&formid=' + _id + '&route=DSFormSend';
252                            $.ajax({
253                                type: "POST",
254                                url: root + "index.php",
255                                dataType: "json",
256                                cache: false,
257                                data: dataform,
258                                success: function(data) {
259                                    __result__(data);
260                                }
261                            });
262                            // new browsers use FormData
263                        }
264                        else {
265                            var formData = new FormData(self.form.get(0));
266                            formData.append('formid', _id);
267                            formData.append('route', 'DSFormSend');
268                            $.ajax({
269                                url: root + "index.php",
270                                type: "POST",
271                                contentType: false,
272                                processData: false,
273                                data: formData,
274                                dataType: 'json',
275                                success: function(data) {
276                                    __result__(data);
277                                }
278                            });
279                        }
280                        return false;
281                    } // send ends
282
283                var __help__ = function() {
284
285                    self.form.find('input[data-dsform-date]').each(function() {
286                        var format = $(this).attr('data-dsform-date');
287                        if (!self.options.dates[$(this).attr('name')]) self.options.dates[$(this).attr('name')] = {};
288                        if (!self.options.dates[$(this).attr('name')].format) {
289                            self.options.dates[$(this).attr('name')].format = format;
290                        }
291                    });
292
293                    self.form.find('input[data-dsform-mask]').each(function() {
294                        var format = $(this).attr('data-dsform-mask');
295                        if (!self.options.inputmask[$(this).attr('name')]) self.options.inputmask[$(this).attr('name')] = {};
296                        if (!self.options.inputmask[$(this).attr('name')].mask) {
297                            self.options.inputmask[$(this).attr('name')].mask = format;
298                        }
299                    });
300
301
302                    (function() {
303                        for (var i in self.options.dates) {
304                            if (i) {
305                                var field = self.form.find('input[name="' + i + '"]');
306                                var customs = typeof self.options.dates[i] === 'object' ? self.options.dates[i] : {};
307                                customs.format = customs.format ? customs.format : field.attr('data-dsform-date');
308                                self.run(lib + 'dscalendar.js', function() {
309                                    dscalendar(field.get(0), customs);
310                                }, 'dscalendar');
311                            }
312                        }
313                    })();
314
315
316                    (function() {
317                        for (var i in self.options.inputmask) {
318                            if (i) {
319                                var field = self.form.find('input[name="' + i + '"]');
320                                var customs = typeof self.options.inputmask[i] === 'object' ? self.options.inputmask[i] : {};
321                                customs.mask = customs.mask ? customs.mask : field.attr('data-dsform-mask');
322                                self.run(lib + 'inputmask.js', function() {
323                                    field.inputmask(customs);
324                                }, 'inputmask');
325                            }
326                        }
327                    })();
328
329                    if (self.options.useFormStyler !== false) {
330                        var s = typeof self.options.useFormStyler === 'string' ? self.options.useFormStyler : 'select, input';
331                        self.run(lib + 'formstyler.js', function() {
332                            self.form.find(s).styler(self.options.formstyler);
333                        }, 'formstyler');
334                    }
335                }
336
337                var __validate__ = function() {
338                        self.form.find('input, textarea').bind('keyup', function() {
339                            var field = $(this);
340
341                            if (field.attr('pattern') && !field.val().match(field.attr('pattern'))) {
342                                field.addClass('improper-value');
343                                if (!self.options.stackErrors) {
344                                    field.siblings('.dsform-field-error.named_as_' + field.attr('name')).removeClass('hint-proper');
345                                }
346                            }
347                            else if (field.attr('pattern') && field.hasClass('improper-value')) {
348                                field.removeClass('improper-value');
349                                if (!self.options.stackErrors) {
350                                    field.siblings('.dsform-field-error.named_as_' + field.attr('name')).addClass('hint-proper');
351                                }
352                            }
353
354                            if (!field.attr('pattern') && field.hasClass('improper-value')) {
355                                field.removeClass('improper-value');
356                                if (!self.options.stackErrors) {
357                                    field.siblings('.dsform-field-error.named_as_' + field.attr('name')).addClass('hint-proper');
358                                }
359                            }
360                        });
361                    } //validate ends
362
363                var __construct__ = function(jsoncode) {
364                        var htmlcode = '',
365                            response = JSON.parse(jsoncode);
366
367                        if (response.error == 0) {
368                            htmlcode = response.error_text;
369                        }
370                        else if (response.error == 3) {
371                            console.error(response.error_text);
372                        }
373
374                        // clean container from other forms (actual for buttons)
375                        if (self.container.find('form').get().length > 0) {
376                            self.container.find('form').remove();
377                        };
378
379                        self.container.find('#' + _id + 'formmessagereport').remove();
380                        self.container.append(htmlcode);
381                        
382                        self.form = self.container.find('form');
383
384                        // auto resize modals
385                        if (!_formLoaded && _modal) {
386                            _formLoaded = true;
387                            $('.dspopup-modal-bg .loadform').hide();
388                        }
389
390                        if (self.form && self.form.length > 0) {
391                            __help__();
392                            __validate__();
393                            self.form.bind('submit', __send__);
394                            __refocus__();
395                        }
396
397                        if (!window.FormData) {
398                            self.container.find(' *[type="file"]').css('display', 'none');
399                        }
400                        
401                        
402                        // call onLoad
403                        if (typeof(self.options.onLoad) == "function") {
404                            self.options.onLoad.call(self, $);
405                        }
406                        
407                        // focus autofocused on simple blocks
408                        if (!self.container.hasClass('dspopup-modal') || !_modal) {
409                            self.container.find('*[autofocus]').focus();
410                        }
411                        else {
412                            // calculate geometry of modal 
413                            __align__();
414                        }
415
416                    } //construct ends
417
418                var __result__ = function(data) {
419                        // hide animation
420                        if (self.options.showLoader) {
421                            self.container.find('img.loadform').hide();
422                            self.container.find('input[type="submit"]').show();
423                        }
424
425                        // order recieved data
426                        delete(data['formid']);
427                        // validation error
428                        if (data['error'] == 1) {
429                            delete(data['error']);
430                            if (self.options.stackErrors) {
431                                self.container.find('.error_form').empty();
432                            }
433                            else {
434                                self.container.find('.dsform-field-error').remove();
435                            }
436                            var error_array = [];
437                            // define "alert" class for improper fields 
438                            $.each(data, function(index, val) {
439                                if ($.inArray(val, error_array) == -1 && val != 1) error_array.push(val);
440                                self.container.find('*[name="' + index + '"]').addClass('improper-value');
441                                if (!self.options.stackErrors) {
442                                    $('<span class="dsform-field-error named_as_' + index + '"><span>' + val + '</span></span>').appendTo(self.form.find('[name="' + index + '"]').parent());
443                                }
444                            });
445                            self.container.find('*[required]').each(function() {
446                                var field = $(this);
447                                if (field.hasClass('improper-value') && !data[field.attr('name')]) {
448                                    field.removeClass('improper-value');
449                                }
450                            });
451
452                            if (self.options.stackErrors) {
453                                var error_text = '<ul class="error-form">' + "\n";
454                                $.each(error_array, function(index, val) {
455                                    error_text += '<li>' + val + '</li>' + "\n";
456                                })
457                                error_text += '</ul>' + "\n";
458                                self.container.find('.error_form').append(error_text);
459                            }
460                            if (typeof self.options.onFail === 'function') {
461                                self.options.onFail.call(self, $);
462                            }
463                            // recalc geometry for modals
464                            if (_modal) {
465                                __align__();
466                            }
467                            else {
468                                self.container.css('height', 'auto');
469                            }
470                            // if data was send successfully or not, show response message
471                        }
472                        else if (data['error'] == 0 || data['error'] == 2) {
473                            self.form.remove();
474                            self.container.find('.scrollform').remove();
475                            self.container.find('.scrollform').css('height', 'auto');
476                            self.container.css('height', 'auto');
477                            self.report = document.createElement('div');
478                            self.report.id = _id + 'formmessagereport';
479                            self.report.className = 'report-message';
480                            self.report = $(self.report);
481                            self.report.append(data['error_text']);
482                            self.container.append(self.report);
483                            self.report.find('.repeatform').bind('click', function(e) {
484                                e.preventDefault();
485                                $(this).unbind('click');
486                                self.report.remove();
487                                self.getForm();
488                            });
489
490
491                            // call user functions if need
492                            if (data['error'] == 0) self.sended = true;
493
494                            if (data['error'] == 0 && typeof self.options.onSuccess === 'function') {
495                                self.options.onSuccess.call(self, $);
496                            }
497                            if (data['error'] == 2 && typeof self.options.onServerError === 'function') {
498                                self.options.onServerError.call(self, $);
499                            }
500
501                            if (self.container.hasClass('dspopup-modal') || _modal) {
502                                __align__();
503                            }
504
505                        }
506                    } // result ends
507
508                var __refocus__ = function() {
509                        self.form.find('input, textarea, select').bind('focusin', function() {
510                            self.form.find('input[type="text"], textarea, select').each(function() {
511                                $(this).removeClass('focusout');
512                            });
513                        });
514                        self.form.find('input[type="text"]:not(input[readonly]),textarea:not(textarea[readonly]), select').bind('focusout', function() {
515                            $(this).addClass('focusout');
516                        });
517                    } // refocus ends
518
519                // just copy reveal modal code locked on the container
520                var __reveal__ = function() {
521                        var modal = self.container,
522                            locked = false,
523                            modalBG = $('.dspopup-modal-bg');
524
525                        if (modalBG.length == 0) {
526                            modalBG = $('<div class="dspopup-modal-bg"></div>').insertAfter(modal);
527                        }
528
529                        if (!_formLoaded) {
530                            var windowHeight = window.innerHeight ||
531                                document.documentElement.clientHeight ||
532                                document.body.clientHeight;
533                            $('img.loadform').appendTo('.dspopup-modal-bg').css({
534                                'height': '64px',
535                                'width': '64px',
536                                'margin': ((+windowHeight / 2) - 32) + 'px auto auto',
537                                'display': 'block',
538                            });
539                        }
540
541                        modal.bind('dspopup:open', function() {
542                            modalBG.unbind('click.modalEvent');
543                            $('.close-dspopup-modal').unbind('click.modalEvent');
544                            if (!locked) {
545                                lockModal();
546                                modal.append('<div class="close-dspopup-modal dsclose-button"></div>');
547                                modal.css({
548                                    'opacity': 0,
549                                    'visibility': 'visible',
550                                    'display': 'block'
551                                });
552                                modal.addClass('active-dspopup');
553                                modalBG.fadeIn(self.options.animationspeed / 2);
554                                modal.delay(self.options.animationspeed / 2).animate({
555                                        "opacity": 1
556                                    },
557                                    self.options.animationspeed,
558                                    function() {
559                                        _visible = true;
560                                        self.container.find('*[autofocus]').focus();
561                                        if (typeof self.options.onShow === "function") {
562                                            self.options.onShow.call(self, $);
563                                        }
564                                        unlockModal();
565                                    });
566								modal.css({'opacity': 1});
567                            }
568                            modal.unbind('dspopup:open');
569                        });
570
571                        modal.bind('dspopup:close', function() {
572                            unlockModal();
573							if (!locked) {
574                                //lockModal();
575                                $('.close-dspopup-modal').remove();
576                                modal.removeClass('active-dspopup');
577                                modalBG.delay(self.options.animationspeed).fadeOut(self.options.animationspeed);
578								modal.css({'opacity': 0});
579                                modal.animate({
580                                        "opacity": 0
581                                    },
582                                    self.options.animationspeed,
583                                    function() {
584                                        _visible = false;
585                                        modal.css({
586                                            'opacity': 1,
587                                            'visibility': 'hidden',
588                                            'display': 'none'
589                                        });
590                                        if (self.options.additionalClass) self.container.removeClass(self.options.additionalClass);
591                                        if (typeof self.options.onClose === "function") {
592                                            self.options.onClose.call(self, $);
593                                        }
594                                        unlockModal();
595                                        if (self.options.clearErrors) {
596                                            self.form.find('.error-form, .dsform-field-error').remove();
597                                            self.form.find('input.improper-value, textarea.improper-value').removeClass('improper-value');                                 
598                                        }
599                                    }
600                                );
601                            }
602                            modal.unbind('dspopup:close');
603                        });
604
605                        modal.trigger('dspopup:open');
606                        var closeButton = $('.close-dspopup-modal').bind('click.modalEvent', function() {
607                            modal.trigger('dspopup:close');
608                        });
609                        if (self.options.closeonbackgroundclick) {
610                            modalBG.css({
611                                "cursor": "pointer"
612                            })
613                            modalBG.bind('click.modalEvent', function() {
614                                modal.trigger('dspopup:close');
615                            });
616                        }
617                        $('body').keyup(function(e) {
618                            if (e.which === 27) {
619                                modal.trigger('dspopup:close');
620                            } // 27 is the keycode for the Escape key
621                        });
622
623                        function unlockModal() {
624                            locked = false;
625                        }
626
627                        function lockModal() {
628                            locked = true;
629                        }
630                    } // reveal ends
631                    
632
633                var __path__ = function($o, path) {
634                        // The first time this function is called, path won't be defined.
635                        if (typeof path == 'undefined') path = '';
636
637                        // If this element is <html> we've reached the end of the path.
638                        if ($o.is('html'))
639                            return 'html' + path;
640
641                        // Add the element name.
642
643                        var cur = $o.get(0).nodeName.toLowerCase();
644
645                        // Determine the IDs and path.
646                        var id = $o.attr('id'),
647                            className = $o.attr('class');
648
649
650                        // Add the #id if there is one.
651                        if (typeof id != 'undefined')
652                            cur += '#' + id;
653
654                        // Add any classes.
655                        if (typeof className != 'undefined')
656                            cur += '.' + className.split(/[\s\n]+/).join('.');
657
658                        // Recurse up the DOM.
659                        return __path__($o.parent(), ' > ' + cur + path);
660                    } // path ends
661
662
663                /* public methods */
664                
665                self.open = function() {
666                        if (_modal) self.element.trigger('click');
667                    } //open ends    
668
669                self.close = function() {
670                        if (_modal) self.container.trigger('dspopup:close');
671                    } //close ends
672                    
673                self.getPath = function(e) {
674                    if (!e) e = self.element;
675                    return __path__(e);                
676                }
677
678                self.run = function(path, func, fname) {
679                        try {
680                            func.apply(this, arguments);
681                            if (!gData[fname]) console.info('DSFORM: ' + fname + ' was loaded before');
682                        }
683                        catch (err) {
684                            if (!gData[fname]) { // if script includes first time              
685                                var s = document.createElement('script');
686                                s.src = path;
687                                document.head.appendChild(s);
688                                gData[fname] = true;
689                            }
690                            setTimeout(function() {
691                                self.run(path, func, fname);
692                            }, 1000);
693                        }
694                    } // run ends
695
696
697                self.getForm = function() {
698                        self.sended = false;
699                        // create query string for ajax
700                        var datajax;
701                        datajax = "formid=" + _id + '&route=DSFormView';
702                        if (self.config) {
703                            var configs = self.config.replace(/'/g, '"');
704                            try {
705                                eval(JSON.parse(configs));
706                                datajax += "&dsconfig=" + configs;
707                            }
708                            catch (e) {
709                                console.error('JSON array is improper for #' + _id + '!');
710                            }
711                        }
712                        // send to template constructor
713                        $.ajax({
714                            url: root + "index.php",
715                            type: "POST",
716                            dataType: "text",
717                            data: datajax,
718                            cache: false,
719                            success: function(data) {
720                                __construct__(data);
721                            }
722                        });
723                    } //getform ends
724                    
725                self.isOpen = function(){
726                    return _visible;                
727                }
728
729                self.field = function(name) {
730                    if (name.indexOf('#') === 0) {
731                        return $(name);
732                    }
733                    else {
734                        return $('[name="' + name + '"]');
735                    }
736                }
737
738
739                if (o && options.formID && !_o.get(0).dsformmarker) {
740                    __init__();
741                }
742                else if (_o.get(0).dsformmarker === true) {
743                    console.warn('DSFORM (' + options.formID + '): element already uses \n Path: ' + __path__(self.element) + '\n Element:', self.element.get(0));
744                }
745                else if (!options.formID) {
746                    console.warn('DSFORM: formID is undefined \n Path: ' + __path__(self.element) + ' \n Element:', self.element.get(0));
747                }
748                return self;
749            } // dsform object ends
750
751        // jQuery method
752        $.dsform = function(opts, o) {
753            if (o === undefined) {
754                opts.modal = true;
755                o = document.createElement('figure');
756            }
757            var result = new F(o, opts);
758            return result;
759        }
760
761        $.dsform.ver = function() {
762            return version;
763        }
764        $.dsform.uses = function() {
765            return usings;
766        }
767        $.dsform.close = function(f_id) {
768            $('[data-dsform-id="' + f_id + '"]').trigger('dspopup:close')
769        }
770
771        // jQuery plugin
772        $.fn.dsform = function(options) {
773            this.each(function() {
774                new F($(this), options);
775            });
776            return this;
777        }
778
779        D.ready(function() {
780            $('<img />', {
781                'src': root + 'images/loading.gif',
782                'class': 'loadform'
783            }).css("display", "none").appendTo('body');
784            var styleforms = document.createElement('link');
785            styleforms.rel = "stylesheet";
786            styleforms.href = root + "index.php?m=getcss";
787            document.head.appendChild(styleforms);
788
789            $('.ds-form').each(function() {
790                $.dsform({
791                    formID: $(this).attr('id'),
792                    modal: false
793                }, $(this));
794            });
795
796            $('*[data-dspopup-id]').each(function() {
797                var id = $(this).attr('data-dspopup-id');
798                $.dsform({
799                    formID: id
800                }, $(this));
801            });
802        }); // ready ends
803
804    }(window, document, gKweri));
805
806}

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.