Completed
Push — master ( 108b89...0a9573 )
by Craig
06:27
created

  A

Complexity

Conditions 4
Paths 3

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
nc 3
nop 1
dl 0
loc 15
rs 9.2
c 1
b 0
f 0
1
// Copyright Zikula Foundation, licensed MIT.
2
3
jQuery.noConflict();
4
/*
5
 Fix provided by http://softec.lu/site/DevelopersCorner/BootstrapPrototypeConflict
6
 */
7
if (typeof Prototype !== 'undefined' && Prototype.BrowserFeatures.ElementExtensions) {
0 ignored issues
show
Bug introduced by
The variable Prototype seems to be never declared. If this is a global, consider adding a /** global: Prototype */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
8
    var disablePrototypeJS = function (method, pluginsToDisable) {
9
            var handler = function (event) {
10
                event.target[method] = undefined;
11
                setTimeout(function () {
12
                    delete event.target[method];
13
                }, 0);
14
            };
15
            pluginsToDisable.each(function (plugin) {
16
                jQuery(window).on(method + '.bs.' + plugin, handler);
17
            });
18
        },
19
        pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip', 'popover', 'tab'];
20
    disablePrototypeJS('show', pluginsToDisable);
21
    disablePrototypeJS('hide', pluginsToDisable);
22
}
23
24
// setup ajax for jQuery
25
(function($) {
26
    var defaultOptions = {
27
        type: 'POST',
28
        timeout: Zikula.Config.ajaxtimeout || 5000
0 ignored issues
show
Bug introduced by
The variable Zikula seems to be never declared. If this is a global, consider adding a /** global: Zikula */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
29
    };
30
    if (Zikula.Config.sessionName) {
31
        var sessionId = new RegExp(Zikula.Config.sessionName + '=(.*?)(;|$)').exec(document.cookie);
32
        if (sessionId && sessionId[1]) {
33
            defaultOptions.headers = {
34
                'X-ZIKULA-AJAX-TOKEN': sessionId[1]
35
            };
36
        }
37
    }
38
    $.ajaxSetup(defaultOptions);
39
})(jQuery);
40