-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincludepb.min.js
120 lines (108 loc) · 4.32 KB
/
includepb.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
(function () {
var mainStyleCssPath = "//cdn.viewst.com/style.css";
var jquerypepPath = "//cdn.viewst.com/libs/jquery.pep.min.js";
var fancyboxPath = "//cdn.viewst.com/libs/jquery.fancybox.min.js";
var fancyboxCssPath = "//cdn.viewst.com/libs/jquery.fancybox.min.css";
var probtnPath = "//cdn.viewst.com/probtn.js"; //"//probtnexample1.azurewebsites.net/probtn2.js";
var jqueryPath = '//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js';
var isServerCommunicationEnabled = true;
var useLocalFileSettings = false;
var localSettingsPath = "settings.json";
var isHPMD = false;
try {
window.probtn_hpmd = hpmd;
} catch(ex) {
window.probtn_hpmd = null;
}
var vernums = [0,0,0];
try {
vernums = jQuery.fn.jquery.split('.');
} catch(ex) { }
var loadProbtn = function() {
jQuery.getScript(probtnPath, function () {
jQuery(document).StartButton({
isHPMD: isHPMD,
hpmd: window.probtn_hpmd,
mainStyleCss: mainStyleCssPath,
fancyboxCssPath: fancyboxCssPath,
fancyboxJsPath: fancyboxPath,
jqueryPepPath: jquerypepPath
})
})
}
var loadFancybox = function () {
var fancyboxFunction = null;
try {
fancyboxFunction = jQuery.fancybox;
if ((fancyboxFunction!==null) && (fancyboxFunction!==undefined)) {
fancyboxFunction = jQuery.fancybox.open;
}
} catch (ex) {
}
var mo_domain = document.domain.replace("www.", "");
var mo_not_load_fb = ( mo_domain && mo_domain.indexOf('maximonline.ru') >= 0 );
if (typeof fancyboxFunction == 'function' || mo_not_load_fb) {
console.log('includepb, loading probtn');
loadProbtn();
} else {
console.log('includepb, loading fancybox');
jQuery.getScript(fancyboxPath, function () {
loadProbtn();
})
}
}
var loadJqueryPep = function () {
var pepFunction = null;
try {
pepFunction = jQuery.pep.toggleAll;
} catch (ex) { }
if (typeof pepFunction == 'function') {
loadFancybox();
} else {
jQuery.getScript(jquerypepPath, function() {
loadFancybox();
})
}
}
var isjQuery = window.jQuery;
if ((vernums[0]>0) && (vernums[1]>4)) {
} else { isjQuery = false; };
if (isjQuery) {
if ($ == jQuery) {
//jQuery(document).ready(function () {
loadJqueryPep();
//})
} else {
var oHead = document.getElementsByTagName('HEAD').item(0);
var oScript = document.createElement("script");
oScript.type = "text/javascript";
oScript["data-cfasync"] = "false";
oScript.text = "jQuery.noConflict(); jQuery.getScript('" + jquerypepPath + "', function() { jQuery.getScript('" + fancyboxPath + "', function () { jQuery.getScript('" + probtnPath + "', function () { jQuery(document).StartButton({'hpmd': window.probtn_hpmd, 'fancyboxCssPath': '" +fancyboxCssPath +"', 'isHPMD': " + isHPMD + ", 'mainStyleCss':'" + mainStyleCssPath + "'});});});}); ";
oHead.appendChild(oScript);
}
} else {
var oHead = document.getElementsByTagName('HEAD').item(0);
function loadJS(src, callback) {
var s = document.createElement('script');
s.src = src;
s["data-cfasync"] = "false";
s.async = true;
s.onreadystatechange = s.onload = function () {
var state = s.readyState;
if (!callback.done && (!state || /loaded|complete/.test(state))) {
callback.done = true;
callback();
}
};
document.getElementsByTagName('head')[0].appendChild(s);
}
loadJS(jqueryPath, function () {
var oScript = document.createElement("script");
oScript.type = "text/javascript";
oScript["data-cfasync"] = "false";
oScript.text = "(function ($) {jQuery.noConflict(); jQuery.getScript('" + jquerypepPath + "', function() {jQuery.getScript('" + fancyboxPath + "', function () {jQuery.getScript('" + probtnPath + "', function () { jQuery(document).StartButton({'hpmd': window.probtn_hpmd, 'fancyboxCssPath': '" + fancyboxCssPath + "', 'isHPMD': " + isHPMD + ", 'mainStyleCss': '" + mainStyleCssPath + "'}); })});}); })(window.jQuery);";
//setTimeout(function() {oHead.appendChild( oScript) }, 100);
oHead.appendChild(oScript);
});
}
})();