Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.FMS_VERSION = "1.14.0",
- function() {
- function a() {
- return document.getElementById(g)
- }
- function b() {
- var b = !!a();
- return b || console.error("Could not find FMS container with ID '" + g + "'."), b
- }
- function c(b) {
- var c = a().getAttribute("data-" + b);
- return null != c && "" !== c || !h[b] || (c = h[b]), c
- }
- function d(b, c) {
- return a().setAttribute("data-" + b, c)
- }
- function e() {
- j.load(function() {
- window.FMS_APP_MANAGER.startApp(), console.log("FMS Angular app started.")
- })
- }
- function f(a) {
- var b = document.getElementById(a);
- if (b) {
- var c = b.getBoundingClientRect().top,
- d = b.getBoundingClientRect().left;
- b.style.height = "calc(100% - " + c + "px", b.style.width = "calc(100% - " + d + "px"
- }
- }
- var g = "mb-formbuilder-container",
- h = {
- "base-url": window.location.protocol + "//" + window.location.host
- };
- window.FMS_APP_MANAGER = function() {
- function e() {
- return n
- }
- function f() {
- return !("undefined" == typeof angular || !n) && void 0 !== angular.element(a()).scope()
- }
- function g() {
- for (; o.length;) o.shift()()
- }
- function h(a) {
- o.push(a), f() && g()
- }
- function i() {
- if (!n && b()) {
- var e = a(),
- f = c("mode");
- if ("full" === f) d("ui-view", "");
- else if ("client" === f) {
- var h = c("form-id");
- e.innerHTML = "<formbuilder-client form-id='" + h + "'></formbuilder-client>"
- } else if ("client-preview" === f) {
- var h = c("form-id");
- e.innerHTML = "<formbuilder-client is-preview='true' form-id='" + h + "'></formbuilder-client>"
- }
- n = angular.bootstrap(e, [m]), g()
- }
- }
- function j(b) {
- var c = n.get("$rootScope");
- c.$on("$destroy", function() {
- n = null;
- var c = a();
- c && $(c).empty(), b && b()
- }), c.$destroy()
- }
- function k(a, b) {
- var c = n.get("$rootScope");
- return c.$on(a, b)
- }
- function l(a) {
- if (!n) return void i();
- var b = this;
- j(function() {
- b.startApp(), a && a()
- })
- }
- var m = "mb.formbuilder",
- n = null,
- o = [];
- return {
- getApp: e,
- isReady: f,
- whenReady: h,
- restartApp: l,
- startApp: i,
- stopApp: j,
- subscribe: k
- }
- }();
- var i = function() {
- function a(a, b, c) {
- var d = new XMLHttpRequest;
- d.onload = function(a) {
- try {
- if (200 !== a.target.status) throw "request failed (status = " + a.target.status + ")";
- var e = JSON.parse(a.currentTarget.response || d.responseText);
- b(e)
- } catch (f) {
- console.error("getJson failed. Error = " + f), c && c(a)
- }
- }, d.open("get", a, !0), d.send()
- }
- function b(a) {
- try {
- window.angular.module(a)
- } catch (b) {
- return !1
- }
- return !0
- }
- function c(a, b, c) {
- var d = document.createElement("script");
- d.type = "text/javascript", d.readyState ? d.onreadystatechange = function() {
- "loaded" !== d.readyState && "complete" !== d.readyState || (d.onreadystatechange = null, b && console.log(b), c && c())
- } : d.onload = function() {
- b && console.log(b), c && c()
- }, d.src = a, document.body.appendChild(d)
- }
- return {
- getJson: a,
- isAngularModulePresent: b,
- loadScript: c
- }
- }(),
- j = function() {
- function a(b, c) {
- c || (c = "");
- for (var d in b) b.hasOwnProperty(d) && ("string" == typeof b[d] || b[d] instanceof String ? l["includedTemplates" + c + "/" + d] = b[d] : a(b[d], c + "/" + d))
- }
- function b() {
- var a = document.createElement("meta");
- a.name = "viewport", a.content = "width=device-width, initial-scale=1", document.getElementsByTagName("head")[0].appendChild(a)
- }
- function d() {
- function a() {
- window.rangy ? h || i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular-sanitize.min.js", "textAngular-sanitize loaded", function() {
- i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular.min.js", "textAngular loaded")
- }) : i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular-rangy.min.js", "textAngular-rangy loaded", function() {
- h || i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular-sanitize.min.js", "textAngular-sanitize loaded", function() {
- i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular.min.js", "textAngular loaded")
- })
- })
- }
- var b = c("base-url"),
- d = i.isAngularModulePresent("angular-sortable-view"),
- e = i.isAngularModulePresent("angular-animate"),
- f = i.isAngularModulePresent("ui.router"),
- g = i.isAngularModulePresent("ui.bootstrap"),
- h = i.isAngularModulePresent("textAngular"),
- j = i.isAngularModulePresent("jcs-autoValidate"),
- k = i.isAngularModulePresent("ngCsv.config"),
- l = i.isAngularModulePresent("ui.grid"),
- m = i.isAngularModulePresent("credit-cards"),
- n = i.isAngularModulePresent("jdFontselect"),
- o = i.isAngularModulePresent("rzModule"),
- p = i.isAngularModulePresent("angularSpectrumColorpicker"),
- q = i.isAngularModulePresent("angularRipple"),
- r = i.isAngularModulePresent("ngFileUpload"),
- s = i.isAngularModulePresent("ngIntlTelInput"),
- t = i.isAngularModulePresent("kendoUi");
- e || i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular-animate.js", "Angular animate loaded"), f || i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.js", "ui.router loaded"), g || i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.3/ui-bootstrap-tpls.min.js", "ui.bootstrap loaded"), a(), k || i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/ng-csv/0.3.6/ng-csv.min.js", "NgCsv loaded"), d || j || l || m || n || o || p || q || r || t || s ? (p || i.loadScript(b + "/scripts/a_spectrum.min.js", "angular spectrum loaded ", function() {
- i.loadScript(b + "/scripts/b_angular-spectrum-colorpicker.min.js", "angular spectrum color picker loaded ")
- }), q || i.loadScript(b + "/scripts/angular-ripple.min.js", "angular-ripple loaded"), d || i.loadScript(b + "/scripts/angular-sortable-view.min.js", "angular-sortable-view loaded"), j || i.loadScript(b + "/scripts/angular-auto-validate.min.js", "ngMessages auto-validate loaded "), l || i.loadScript(b + "/scripts/ui-grid.min.js", "Angular UI Grid loaded"), t || i.loadScript(b + "/scripts/kendo.custom.min.js", "Kendo loaded"), m || i.loadScript(b + "/scripts/angular-credit-cards.min.js", "credit-cards loaded "), n || (i.loadScript(b + "/scripts/web-font-loader.min.js", "font-select web font loader loaded "), i.loadScript(b + "/scripts/angular-font-select.min.js", "font-select loaded ")), o || i.loadScript(b + "/scripts/range-slider.min.js", "range slider loaded "), r || i.loadScript(b + "/scripts/ng-file-upload-all.min.js", "ngFileUpload loaded "), s || i.loadScript(b + "/scripts/ng-intl-tel-input.js", "Intl Phone Number")) : i.loadScript(b + "/scripts/angular_lib.min.js", "angular-lib loaded")
- }
- function e(a) {
- function e() {
- g = "undefined" != typeof jQuery, h = "undefined" != typeof angular, g && h ? (console.log("loading of main modules complete"), b(), d(), a && a()) : setTimeout(function() {
- console.log("waiting on main modules..."), e()
- }, 500)
- }
- var f = c("base-url"),
- g = "undefined" != typeof jQuery,
- h = "undefined" != typeof angular;
- ! function() {
- g && "undefined" != typeof jQuery.ui && "undefined" == typeof $ && ($ = jQuery), g ? h ? g && "undefined" == typeof jQuery.ui ? (i.loadScript("https://code.jquery.com/ui/1.11.3/jquery-ui.js", "JQuery UI loaded - Depends on JQuery", function() {
- i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js", "JQuery Touch Punch loaded - Allows Touch for JQuery UI - Depends on JQuery UI")
- }), i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/7.0.2/js/intlTelInput.min.js", "Intl-Tel-Input - Depends on JQuery")) : "undefined" != typeof jQuery.ui ? (i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js", "JQuery Touch Punch loaded - Allows Touch for JQuery UI - Depends on JQuery UI"), i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/7.0.2/js/intlTelInput.min.js", "Intl-Tel-Input - Depends on JQuery")) : "function" != typeof $().emulateTransitionEnd && i.loadScript("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js", "Bootstrap JS loaded") : (console.log("Angular not present, loading angular..."), i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.js", "Angular loaded. Loading modules...")) : i.loadScript("https://code.jquery.com/jquery-2.1.4.min.js", "JQuery loaded", function() {
- var a = "function" == typeof $().emulateTransitionEnd;
- a || i.loadScript("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js", "Bootstrap JS loaded"), h || (console.log("Angular not present, loading angular..."), i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.js", "Angular loaded. Loading modules...")), i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/7.0.2/js/intlTelInput.min.js", "Intl-Tel-Input - Depends on JQuery");
- var b = "undefined" != typeof jQuery.ui;
- b || i.loadScript("https://code.jquery.com/ui/1.11.3/jquery-ui.js", "JQuery UI loaded - Depends on JQuery", function() {
- i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js", "JQuery Touch Punch loaded - Allows Touch for JQuery UI - Depends on JQuery UI")
- })
- })
- }(), i.loadScript(f + "/scripts/scripts_lib.min.js", "scripts_lib loaded"), e();
- var j = "false" !== c("use-form-styles"),
- k = [];
- j && Array.prototype.push.apply(k, [f + "/styles/bootstrap.min.css", f + "/styles/default.min.css", f + "/styles/mbcustomtheme.min.css"]), Array.prototype.push.apply(k, [f + "/styles/ui-grid.min.css", f + "/styles/font-select.min.css", f + "/styles/range-slider.min.css", f + "/styles/spectrum.min.css", f + "/styles/kendo-common-material.min.css", f + "/styles/kendo-material.min.css", f + "/styles/kendo-material-mobile.min.css", "https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css", "https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular.css", "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/7.0.2/css/intlTelInput.css"]), j && Array.prototype.push.apply(k, ["https://fonts.googleapis.com/css?family=Lora:400,400i,700,700i", "https://fonts.googleapis.com/css?family=Montserrat:300,300i,400,400i,500,500i,600,600i,700,700i", "https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600,600i,700,700i"]);
- for (var l = "true" === c("prepend-css"), m = document.getElementsByTagName("head")[0], n = m.querySelector('link[rel="stylesheet"]'), o = 0; o < k.length; o++) {
- var p = document.createElement("link");
- p.setAttribute("rel", "stylesheet"), p.setAttribute("type", "text/css"), p.setAttribute("href", k[o]), l && n ? m.insertBefore(p, n) : m.appendChild(p)
- }
- }
- function f() {
- angular.module("mb.formbuilder.tpls", []), angular.module("mb.formbuilder.tpls").run(["$templateCache", function(a) {
- for (var b in l) l.hasOwnProperty(b) && a.put(b, l[b])
- }])
- }
- function g() {
- var a = c("base-url");
- i.loadScript(a + "/scripts/mb.formbuilder.js", "mb.formbuilder loaded", function() {
- i.getJson(a + "/scripts/angular_app_scripts.json", function(b) {
- for (var c in b)
- if (b.hasOwnProperty(c) && b[c] && "mb.formbuilder.embed.js" !== b[c] && "mb.formbuilder.js" !== b[c]) {
- var d = b[c];
- if ("string" == typeof d || d instanceof String) m--, i.loadScript(a + "/scripts/" + d, d + " loaded", function() {
- n++
- });
- else
- for (var e in d) d.hasOwnProperty(e) && (m--, i.loadScript(a + "/scripts/" + e, e + " loaded", function() {
- n++
- }))
- }
- m = Math.abs(m), 0 === m && (m = 1, n = 1)
- })
- })
- }
- function h(b, d) {
- var e = c("base-url"),
- g = e + "/scripts/mb.formbuilder.tpls.json",
- h = c("custom-templates-url");
- i.getJson(g, function(b) {
- return a(b), h ? (h = h + "?fms_version=" + window.FMS_VERSION, void i.getJson(h, function(b) {
- a(b), f()
- }, d)) : void f()
- }, d)
- }
- function j(a) {
- var b = i.isAngularModulePresent("angular-sortable-view"),
- c = i.isAngularModulePresent("ui.router"),
- d = i.isAngularModulePresent("ui.bootstrap"),
- e = i.isAngularModulePresent("textAngular"),
- f = i.isAngularModulePresent("jcs-autoValidate"),
- g = i.isAngularModulePresent("mb.formbuilder.tpls"),
- h = i.isAngularModulePresent("mb.formbuilder"),
- k = i.isAngularModulePresent("ngCsv.config"),
- l = i.isAngularModulePresent("ui.grid"),
- o = i.isAngularModulePresent("credit-cards"),
- p = i.isAngularModulePresent("jdFontselect"),
- q = i.isAngularModulePresent("rzModule"),
- r = i.isAngularModulePresent("angularSpectrumColorpicker"),
- s = i.isAngularModulePresent("angularRipple");
- b && c && d && e && g && h && f && k && l && o && p && m > 0 && m === n && q && r && s ? (console.log("loading of angular plugins complete"), a && a()) : setTimeout(function() {
- console.log("waiting on angular plugins..."), j(a)
- }, 500)
- }
- function k(a) {
- e(function() {
- h(), g(), j(a)
- })
- }
- var l = {},
- m = 0,
- n = 0;
- return {
- load: k
- }
- }(),
- k = function() {
- function a() {
- document.removeEventListener("DOMContentLoaded", a), d = !0;
- for (var c; c = b.shift();) c()
- }
- var b = [],
- c = document.documentElement.doScroll,
- d = (c ? /^loaded|^c/ : /^loaded|^i|^c/).test(document.readyState);
- return d || document.addEventListener("DOMContentLoaded", a),
- function(a) {
- d ? setTimeout(a, 0) : b.push(a)
- }
- }();
- k(function() {
- if (b()) {
- var d = a();
- if ("client" === c("mode") && window.self === window.top && console.warn("Form must be embedded in iframe."), navigator.appName.indexOf("Internet Explorer") !== -1 && navigator.appVersion.indexOf("MSIE 1") === -1) return void(d.innerHTML = "Please update your browser to use this feature.");
- e(), document.body.classList.contains("gbf-giving-fms") && f("mb-formbuilder-container")
- }
- })
- }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement