Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.80 KB | None | 0 0
  1. window.FMS_VERSION = "1.14.0",
  2. function() {
  3. function a() {
  4. return document.getElementById(g)
  5. }
  6.  
  7. function b() {
  8. var b = !!a();
  9. return b || console.error("Could not find FMS container with ID '" + g + "'."), b
  10. }
  11.  
  12. function c(b) {
  13. var c = a().getAttribute("data-" + b);
  14. return null != c && "" !== c || !h[b] || (c = h[b]), c
  15. }
  16.  
  17. function d(b, c) {
  18. return a().setAttribute("data-" + b, c)
  19. }
  20.  
  21. function e() {
  22. j.load(function() {
  23. window.FMS_APP_MANAGER.startApp(), console.log("FMS Angular app started.")
  24. })
  25. }
  26.  
  27. function f(a) {
  28. var b = document.getElementById(a);
  29. if (b) {
  30. var c = b.getBoundingClientRect().top,
  31. d = b.getBoundingClientRect().left;
  32. b.style.height = "calc(100% - " + c + "px", b.style.width = "calc(100% - " + d + "px"
  33. }
  34. }
  35. var g = "mb-formbuilder-container",
  36. h = {
  37. "base-url": window.location.protocol + "//" + window.location.host
  38. };
  39. window.FMS_APP_MANAGER = function() {
  40. function e() {
  41. return n
  42. }
  43.  
  44. function f() {
  45. return !("undefined" == typeof angular || !n) && void 0 !== angular.element(a()).scope()
  46. }
  47.  
  48. function g() {
  49. for (; o.length;) o.shift()()
  50. }
  51.  
  52. function h(a) {
  53. o.push(a), f() && g()
  54. }
  55.  
  56. function i() {
  57. if (!n && b()) {
  58. var e = a(),
  59. f = c("mode");
  60. if ("full" === f) d("ui-view", "");
  61. else if ("client" === f) {
  62. var h = c("form-id");
  63. e.innerHTML = "<formbuilder-client form-id='" + h + "'></formbuilder-client>"
  64. } else if ("client-preview" === f) {
  65. var h = c("form-id");
  66. e.innerHTML = "<formbuilder-client is-preview='true' form-id='" + h + "'></formbuilder-client>"
  67. }
  68. n = angular.bootstrap(e, [m]), g()
  69. }
  70. }
  71.  
  72. function j(b) {
  73. var c = n.get("$rootScope");
  74. c.$on("$destroy", function() {
  75. n = null;
  76. var c = a();
  77. c && $(c).empty(), b && b()
  78. }), c.$destroy()
  79. }
  80.  
  81. function k(a, b) {
  82. var c = n.get("$rootScope");
  83. return c.$on(a, b)
  84. }
  85.  
  86. function l(a) {
  87. if (!n) return void i();
  88. var b = this;
  89. j(function() {
  90. b.startApp(), a && a()
  91. })
  92. }
  93. var m = "mb.formbuilder",
  94. n = null,
  95. o = [];
  96. return {
  97. getApp: e,
  98. isReady: f,
  99. whenReady: h,
  100. restartApp: l,
  101. startApp: i,
  102. stopApp: j,
  103. subscribe: k
  104. }
  105. }();
  106. var i = function() {
  107. function a(a, b, c) {
  108. var d = new XMLHttpRequest;
  109. d.onload = function(a) {
  110. try {
  111. if (200 !== a.target.status) throw "request failed (status = " + a.target.status + ")";
  112. var e = JSON.parse(a.currentTarget.response || d.responseText);
  113. b(e)
  114. } catch (f) {
  115. console.error("getJson failed. Error = " + f), c && c(a)
  116. }
  117. }, d.open("get", a, !0), d.send()
  118. }
  119.  
  120. function b(a) {
  121. try {
  122. window.angular.module(a)
  123. } catch (b) {
  124. return !1
  125. }
  126. return !0
  127. }
  128.  
  129. function c(a, b, c) {
  130. var d = document.createElement("script");
  131. d.type = "text/javascript", d.readyState ? d.onreadystatechange = function() {
  132. "loaded" !== d.readyState && "complete" !== d.readyState || (d.onreadystatechange = null, b && console.log(b), c && c())
  133. } : d.onload = function() {
  134. b && console.log(b), c && c()
  135. }, d.src = a, document.body.appendChild(d)
  136. }
  137. return {
  138. getJson: a,
  139. isAngularModulePresent: b,
  140. loadScript: c
  141. }
  142. }(),
  143. j = function() {
  144. function a(b, c) {
  145. c || (c = "");
  146. 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))
  147. }
  148.  
  149. function b() {
  150. var a = document.createElement("meta");
  151. a.name = "viewport", a.content = "width=device-width, initial-scale=1", document.getElementsByTagName("head")[0].appendChild(a)
  152. }
  153.  
  154. function d() {
  155. function a() {
  156. window.rangy ? h || i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular-sanitize.min.js", "textAngular-sanitize loaded", function() {
  157. i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular.min.js", "textAngular loaded")
  158. }) : i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular-rangy.min.js", "textAngular-rangy loaded", function() {
  159. h || i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular-sanitize.min.js", "textAngular-sanitize loaded", function() {
  160. i.loadScript("https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.4.1/dist/textAngular.min.js", "textAngular loaded")
  161. })
  162. })
  163. }
  164. var b = c("base-url"),
  165. d = i.isAngularModulePresent("angular-sortable-view"),
  166. e = i.isAngularModulePresent("angular-animate"),
  167. f = i.isAngularModulePresent("ui.router"),
  168. g = i.isAngularModulePresent("ui.bootstrap"),
  169. h = i.isAngularModulePresent("textAngular"),
  170. j = i.isAngularModulePresent("jcs-autoValidate"),
  171. k = i.isAngularModulePresent("ngCsv.config"),
  172. l = i.isAngularModulePresent("ui.grid"),
  173. m = i.isAngularModulePresent("credit-cards"),
  174. n = i.isAngularModulePresent("jdFontselect"),
  175. o = i.isAngularModulePresent("rzModule"),
  176. p = i.isAngularModulePresent("angularSpectrumColorpicker"),
  177. q = i.isAngularModulePresent("angularRipple"),
  178. r = i.isAngularModulePresent("ngFileUpload"),
  179. s = i.isAngularModulePresent("ngIntlTelInput"),
  180. t = i.isAngularModulePresent("kendoUi");
  181. 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() {
  182. i.loadScript(b + "/scripts/b_angular-spectrum-colorpicker.min.js", "angular spectrum color picker loaded ")
  183. }), 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")
  184. }
  185.  
  186. function e(a) {
  187. function e() {
  188. g = "undefined" != typeof jQuery, h = "undefined" != typeof angular, g && h ? (console.log("loading of main modules complete"), b(), d(), a && a()) : setTimeout(function() {
  189. console.log("waiting on main modules..."), e()
  190. }, 500)
  191. }
  192. var f = c("base-url"),
  193. g = "undefined" != typeof jQuery,
  194. h = "undefined" != typeof angular;
  195. ! function() {
  196. 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() {
  197. 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")
  198. }), 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() {
  199. var a = "function" == typeof $().emulateTransitionEnd;
  200. 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");
  201. var b = "undefined" != typeof jQuery.ui;
  202. b || i.loadScript("https://code.jquery.com/ui/1.11.3/jquery-ui.js", "JQuery UI loaded - Depends on JQuery", function() {
  203. 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")
  204. })
  205. })
  206. }(), i.loadScript(f + "/scripts/scripts_lib.min.js", "scripts_lib loaded"), e();
  207. var j = "false" !== c("use-form-styles"),
  208. k = [];
  209. 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"]);
  210. for (var l = "true" === c("prepend-css"), m = document.getElementsByTagName("head")[0], n = m.querySelector('link[rel="stylesheet"]'), o = 0; o < k.length; o++) {
  211. var p = document.createElement("link");
  212. p.setAttribute("rel", "stylesheet"), p.setAttribute("type", "text/css"), p.setAttribute("href", k[o]), l && n ? m.insertBefore(p, n) : m.appendChild(p)
  213. }
  214. }
  215.  
  216. function f() {
  217. angular.module("mb.formbuilder.tpls", []), angular.module("mb.formbuilder.tpls").run(["$templateCache", function(a) {
  218. for (var b in l) l.hasOwnProperty(b) && a.put(b, l[b])
  219. }])
  220. }
  221.  
  222. function g() {
  223. var a = c("base-url");
  224. i.loadScript(a + "/scripts/mb.formbuilder.js", "mb.formbuilder loaded", function() {
  225. i.getJson(a + "/scripts/angular_app_scripts.json", function(b) {
  226. for (var c in b)
  227. if (b.hasOwnProperty(c) && b[c] && "mb.formbuilder.embed.js" !== b[c] && "mb.formbuilder.js" !== b[c]) {
  228. var d = b[c];
  229. if ("string" == typeof d || d instanceof String) m--, i.loadScript(a + "/scripts/" + d, d + " loaded", function() {
  230. n++
  231. });
  232. else
  233. for (var e in d) d.hasOwnProperty(e) && (m--, i.loadScript(a + "/scripts/" + e, e + " loaded", function() {
  234. n++
  235. }))
  236. }
  237. m = Math.abs(m), 0 === m && (m = 1, n = 1)
  238. })
  239. })
  240. }
  241.  
  242. function h(b, d) {
  243. var e = c("base-url"),
  244. g = e + "/scripts/mb.formbuilder.tpls.json",
  245. h = c("custom-templates-url");
  246. i.getJson(g, function(b) {
  247. return a(b), h ? (h = h + "?fms_version=" + window.FMS_VERSION, void i.getJson(h, function(b) {
  248. a(b), f()
  249. }, d)) : void f()
  250. }, d)
  251. }
  252.  
  253. function j(a) {
  254. var b = i.isAngularModulePresent("angular-sortable-view"),
  255. c = i.isAngularModulePresent("ui.router"),
  256. d = i.isAngularModulePresent("ui.bootstrap"),
  257. e = i.isAngularModulePresent("textAngular"),
  258. f = i.isAngularModulePresent("jcs-autoValidate"),
  259. g = i.isAngularModulePresent("mb.formbuilder.tpls"),
  260. h = i.isAngularModulePresent("mb.formbuilder"),
  261. k = i.isAngularModulePresent("ngCsv.config"),
  262. l = i.isAngularModulePresent("ui.grid"),
  263. o = i.isAngularModulePresent("credit-cards"),
  264. p = i.isAngularModulePresent("jdFontselect"),
  265. q = i.isAngularModulePresent("rzModule"),
  266. r = i.isAngularModulePresent("angularSpectrumColorpicker"),
  267. s = i.isAngularModulePresent("angularRipple");
  268. 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() {
  269. console.log("waiting on angular plugins..."), j(a)
  270. }, 500)
  271. }
  272.  
  273. function k(a) {
  274. e(function() {
  275. h(), g(), j(a)
  276. })
  277. }
  278. var l = {},
  279. m = 0,
  280. n = 0;
  281. return {
  282. load: k
  283. }
  284. }(),
  285. k = function() {
  286. function a() {
  287. document.removeEventListener("DOMContentLoaded", a), d = !0;
  288. for (var c; c = b.shift();) c()
  289. }
  290. var b = [],
  291. c = document.documentElement.doScroll,
  292. d = (c ? /^loaded|^c/ : /^loaded|^i|^c/).test(document.readyState);
  293. return d || document.addEventListener("DOMContentLoaded", a),
  294. function(a) {
  295. d ? setTimeout(a, 0) : b.push(a)
  296. }
  297. }();
  298. k(function() {
  299. if (b()) {
  300. var d = a();
  301. 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.");
  302. e(), document.body.classList.contains("gbf-giving-fms") && f("mb-formbuilder-container")
  303. }
  304. })
  305. }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement