Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.93 KB | None | 0 0
  1. (function() {
  2. if (!this.require) {
  3. var e = {}
  4. , t = {}
  5. , n = function(o, s) {
  6. var a, u, d = r(s, o), l = r(d, "./index");
  7. if (a = t[d] || t[l]) {
  8. if (a.__define_in_progress)
  9. throw new Error("Circular dependency: " + o + " already required.");
  10. return a
  11. }
  12. if (u = e[d] || e[d = l])
  13. return a = {
  14. id: d,
  15. exports: {
  16. __define_in_progress: !0
  17. }
  18. },
  19. t[d] = a.exports,
  20. u(a.exports, function(e) {
  21. return n(e, i(d))
  22. }, a),
  23. delete a.exports.__define_in_progress,
  24. t[d] = a.exports;
  25. throw "module " + o + " not found"
  26. }
  27. , r = function(e, t) {
  28. var n, r, i = [];
  29. n = /^\.\.?(\/|$)/.test(t) ? [e, t].join("/").split("/") : t.split("/");
  30. for (var o = 0, s = n.length; o < s; o++)
  31. r = n[o],
  32. ".." == r ? i.pop() : "." != r && "" != r && i.push(r);
  33. return i.join("/")
  34. }
  35. , i = function(e) {
  36. return e.split("/").slice(0, -1).join("/")
  37. };
  38. this.require = function(e) {
  39. return n(e, "")
  40. }
  41. ,
  42. this.require.define = function(t) {
  43. for (var n in t)
  44. e[n] = t[n]
  45. }
  46. ,
  47. this.require.modules = e,
  48. this.require.cache = t
  49. }
  50. return this.require
  51. }
  52. ).call(this),
  53. function() {
  54. null == window.W && (window.W = {})
  55. }
  56. .call(this),
  57. function() {
  58. W.GoogleAnalyticsEvent = {
  59. raise: function(e, t, n, r) {
  60. return null == n && (n = null),
  61. null == r && (r = null),
  62. ga("send", "event", {
  63. eventCategory: e,
  64. eventAction: t,
  65. eventLabel: n,
  66. hitCallback: r
  67. })
  68. },
  69. raiseWithOutboundLink: function(e, t, n, r) {
  70. return null == r && (r = null),
  71. this.raise(t, n, r, function() {
  72. return window.location = e
  73. })
  74. }
  75. },
  76. $(document).ready(function() {
  77. return $("body").on("submit", "[data-ga-event=submit]", function(e) {
  78. var t, n, r, i;
  79. return e.preventDefault(),
  80. r = 2e3,
  81. t = $(this),
  82. n = this,
  83. i = window.setTimeout(function() {
  84. return n.submit()
  85. }, r),
  86. W.GoogleAnalyticsEvent.raise(t.data("ga-category"), t.data("ga-action"), t.data("ga-label"), function() {
  87. return clearTimeout(i),
  88. n.submit()
  89. })
  90. }),
  91. $("body").on("click", "[data-ga-action]", function(e) {
  92. var t, n, r;
  93. if (t = $(this),
  94. "click" === (n = $.trim(t.data("ga-event"))) || "" === n)
  95. return "_blank" === t.attr("target") ? W.GoogleAnalyticsEvent.raise(t.data("ga-category"), t.data("ga-action"), t.data("ga-label")) : (e.preventDefault(),
  96. r = t.attr("href"),
  97. r || (r = window.location.hash || "#"),
  98. W.GoogleAnalyticsEvent.raiseWithOutboundLink(r, t.data("ga-category"), t.data("ga-action"), t.data("ga-label")))
  99. })
  100. })
  101. }
  102. .call(this),
  103. function() {
  104. $(function() {
  105. if (null != $("body").data("remove-external-links"))
  106. return $("a[href^=http]").attr("href", "/")
  107. })
  108. }
  109. .call(this),
  110. function() {
  111. $.fn.serializeHash = function() {
  112. var e, t, n, r, i;
  113. for (e = {},
  114. i = this.serializeArray(),
  115. t = 0,
  116. n = i.length; t < n; t++)
  117. r = i[t],
  118. e[r.name] = r.value;
  119. return e
  120. }
  121. ,
  122. $.fn.validatePresenceOf = function(e) {
  123. var t;
  124. return t = this.find("[name=" + e + "]"),
  125. /^ *$/.test(t.val()) ? (t.addErrorMessage("Please enter a value"),
  126. !1) : (t.removeErrorMessage(),
  127. !0)
  128. }
  129. ,
  130. $.fn.validateEquals = function(e, t, n) {
  131. var r;
  132. return null == n && (n = ""),
  133. r = this.find("[name=" + e + "]"),
  134. r.val() !== t ? (r.addErrorMessage(n),
  135. !1) : (r.removeErrorMessage(),
  136. !0)
  137. }
  138. ,
  139. $.fn.validateEmailAddress = function(e) {
  140. var t;
  141. return t = this.find("[name=" + e + "]"),
  142. /\S+@\S+\.\S+/.test(t.val())
  143. }
  144. ,
  145. $.fn.addErrorMessage = function(e) {
  146. var t;
  147. if (this.closest(".form-group").addClass("has-error"),
  148. t = this.siblings(".help-block"),
  149. 0 === t.length)
  150. return $("<span>").addClass("help-block").text(e).insertAfter(this)
  151. }
  152. ,
  153. $.fn.removeErrorMessage = function() {
  154. return this.closest(".form-group").removeClass("has-error"),
  155. this.siblings(".help-block").remove()
  156. }
  157. ,
  158. $.fn.removeAllErrors = function() {
  159. return this.find(".help-block").remove(),
  160. this.find(".form-group.has-error").removeClass("has-error")
  161. }
  162. }
  163. .call(this),
  164. function() {
  165. W.Recaptcha = function() {
  166. function e(e) {
  167. this.el = e,
  168. this.el instanceof $ && (this.el = this.el[0]),
  169. this.captchaId = null
  170. }
  171. return e.SITEKEY = "6LdQBgcTAAAAAHNSmTJ5n43d5fIaWw7BmkAwcxXn",
  172. e.URL = "https://www.google.com/recaptcha/api.js?render=explicit&onload=onRecaptchaLoad&hl=" + I18n.locale,
  173. e.loaded = $.Deferred(),
  174. e.ready = function() {
  175. return "resolved" === this.loaded.state()
  176. }
  177. ,
  178. e.load = function() {
  179. return this.ready() || $.getScript(this.URL),
  180. this.loaded.promise()
  181. }
  182. ,
  183. e.onload = function() {
  184. return this.loaded.resolve()
  185. }
  186. ,
  187. e.prototype.show = function() {
  188. return this.constructor.load().done(function(e) {
  189. return function() {
  190. return e.captchaId = grecaptcha.render(e.el, {
  191. sitekey: e.constructor.SITEKEY
  192. })
  193. }
  194. }(this))
  195. }
  196. ,
  197. e.prototype.reset = function() {
  198. if (null != this.captchaId)
  199. return grecaptcha.reset(this.captchaId)
  200. }
  201. ,
  202. e.prototype.getResponse = function() {
  203. return null != this.captchaId ? grecaptcha.getResponse(this.captchaId) : ""
  204. }
  205. ,
  206. e
  207. }(),
  208. window.onRecaptchaLoad = function() {
  209. return W.Recaptcha.onload()
  210. }
  211. }
  212. .call(this),
  213. function() {
  214. var e, t;
  215. t = 500,
  216. e = 300,
  217. W.ShareButton = function() {
  218. function n(e) {
  219. this.el = e,
  220. this.el.click(function(e) {
  221. return function(t) {
  222. return "function" == typeof t.preventDefault && t.preventDefault(),
  223. e._openShareWindow()
  224. }
  225. }(this))
  226. }
  227. return n.prototype._openShareWindow = function() {
  228. var e;
  229. return e = this.el.attr("href"),
  230. window.open(e, "", this._getWindowOptions())
  231. }
  232. ,
  233. n.prototype._getWindowOptions = function() {
  234. var n, r;
  235. return r = this.el.data("width") || t,
  236. n = this.el.data("height") || e,
  237. "width=" + r + ",height=" + n + ",toolbar=no,menubar=no,location=no"
  238. }
  239. ,
  240. n
  241. }(),
  242. $.fn.shareButton = function() {
  243. return this.each(function() {
  244. var e;
  245. if (e = $(this),
  246. null == e.data("shareButton") && "_blank" === e.attr("target"))
  247. return e.data("shareButton", new W.ShareButton(e))
  248. })
  249. }
  250. ,
  251. $(function() {
  252. return $("a[role=share-button]").shareButton()
  253. })
  254. }
  255. .call(this),
  256. function() {
  257. "undefined" != typeof $ && null !== $ && ($.fn.oneTransitionEnd = function(e) {
  258. var t;
  259. return t = "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",
  260. $(this).one(t, e)
  261. }
  262. ,
  263. $.fn.oneAnimationEnd = function(e) {
  264. var t;
  265. return t = "webkitAnimationEnd oanimationend oAnimationEnd msAnimationEnd animationend",
  266. $(this).one(t, e)
  267. }
  268. )
  269. }
  270. .call(this),
  271. function() {
  272. W.YouTubePlayer = function() {
  273. function e(e, t) {
  274. this.id = e,
  275. this.options = null != t ? t : {},
  276. this._initOptions(),
  277. this._createPlayer()
  278. }
  279. return e.prototype._initOptions = function() {
  280. return this.options.playerVars = _.defaults(this.options.playerVars || {}, {
  281. wmode: "transparent",
  282. modestbranding: 1,
  283. rel: 0,
  284. showinfo: 0,
  285. showsearch: 0,
  286. autohide: 1,
  287. controls: 1
  288. }),
  289. _.defaults(this.options, {
  290. height: "481",
  291. width: "800",
  292. events: {
  293. onReady: $.proxy(this._onPlayerReady, this),
  294. onStateChange: $.proxy(this._onPlayerStateChanged, this)
  295. }
  296. })
  297. }
  298. ,
  299. e.prototype._createPlayer = function() {
  300. return $.when(W.YouTubePlayer.initialize()).then(function(e) {
  301. return function() {
  302. return e._player = new YT.Player(e.id,e.options)
  303. }
  304. }(this))
  305. }
  306. ,
  307. e.prototype._onPlayerReady = function() {}
  308. ,
  309. e.prototype._onPlayerStateChanged = function() {}
  310. ,
  311. e
  312. }(),
  313. W.YouTubePlayer._deferred = null,
  314. W.YouTubePlayer.initialize = function() {
  315. return this._promise || (this._promise = this._loadAPI())
  316. }
  317. ,
  318. W.YouTubePlayer._loadAPI = function() {
  319. var e;
  320. return e = $.Deferred(),
  321. $.getScript("https://www.youtube.com/player_api"),
  322. window.onYouTubePlayerAPIReady = function() {
  323. return function() {
  324. return delete window.onYouTubePlayerAPIReady,
  325. e.resolve()
  326. }
  327. }(),
  328. e.promise()
  329. }
  330. }
  331. .call(this),
  332. function() {
  333. W.DeleteAccountView = function() {
  334. function e(e) {
  335. this.el = $(e),
  336. this.ui = this._findUiElements(),
  337. this.params = W_.QueryParams.all(),
  338. this._checkAuthenticationType(),
  339. this.ui.form.submit(function(e) {
  340. return function(t) {
  341. return t.preventDefault(),
  342. e.onSubmit()
  343. }
  344. }(this)),
  345. this.useRTSession ? this._removeLoading() : W.userService.ensureLoggedIn().done(function(e) {
  346. return function() {
  347. return e._removeLoading()
  348. }
  349. }(this)),
  350. this.ui.proceedButton.on("click", function(e) {
  351. return function() {
  352. return e._moveToStep(e.STEPS.VALIDATION)
  353. }
  354. }(this))
  355. }
  356. return e.prototype.STEPS = {
  357. EXPLANATION: 1,
  358. VALIDATION: 2,
  359. CONFIRMATION: 3
  360. },
  361. e.prototype.ERROS_CODES = {
  362. 422: "invalid-credentials",
  363. 423: "invalid-captcha",
  364. 500: "general-error"
  365. },
  366. e.prototype.DEFAULT_ERROR_CODE = 500,
  367. e.prototype.params = null,
  368. e.prototype.useRTSession = !1,
  369. e.prototype.requireUsername = !0,
  370. e.prototype.requirePassword = !0,
  371. e.prototype.userActivated = !0,
  372. e.prototype.idToEnv = {
  373. 1: null,
  374. 2: "usa",
  375. 3: "row",
  376. 4: "il",
  377. il: "il",
  378. usa: "usa",
  379. row: "row"
  380. },
  381. e.prototype.confirmationMessageDelay = 5e3,
  382. e.prototype._removeLoading = function() {
  383. return this.ui.loading.remove(),
  384. this.ui.username.toggle(this.requireUsername),
  385. this.ui.password.toggle(this.requirePassword),
  386. this.ui.mainView.removeClass("hidden"),
  387. this._moveToStep(this.STEPS.EXPLANATION),
  388. this._createCaptcha()
  389. }
  390. ,
  391. e.prototype._createCaptcha = function() {
  392. return Recaptcha.create("6LdJPuESAAAAAHLXqxOvZIYxyUzSMJv2U31HXqsA", "recaptcha", {
  393. theme: "clean",
  394. callback: Recaptcha.focus_response_field
  395. })
  396. }
  397. ,
  398. e.prototype._findUiElements = function() {
  399. return {
  400. form: this.el.find("form"),
  401. loading: this.el.find(".main-loading"),
  402. mainView: this.el.find(".delete-account-view"),
  403. submitButton: this.el.find(".step2 button"),
  404. proceedButton: this.el.find(".proceed"),
  405. username: this.el.find("input[name=username]"),
  406. password: this.el.find("input[name=password]"),
  407. errorMessages: this.el.find(".error-message"),
  408. spinner: this.el.find(".loading")
  409. }
  410. }
  411. ,
  412. e.prototype._moveToStep = function(e) {
  413. return $(".step").addClass("hidden"),
  414. this.el.find(".step" + e).removeClass("hidden")
  415. }
  416. ,
  417. e.prototype.validate = function() {
  418. var e;
  419. return e = 1,
  420. this.requireUsername && (e &= this.ui.form.validatePresenceOf("username")),
  421. this.requirePassword && (e &= this.ui.form.validatePresenceOf("password")),
  422. 1 === e
  423. }
  424. ,
  425. e.prototype._getErrorCode = function(e) {
  426. try {
  427. return JSON.parse(e.responseText).code
  428. } catch (e) {
  429. return this.DEFAULT_ERROR_CODE
  430. }
  431. }
  432. ,
  433. e.prototype._checkAuthenticationType = function() {
  434. return this.useRTSession = this.params.sessionid && this.params.cookie,
  435. this.userActivated = "T" === this.params.activated,
  436. this.requireUsername = !this.useRTSession,
  437. this.requirePassword = !this.useRTSession || this.userActivated
  438. }
  439. ,
  440. e.prototype._getUsersProfileURL = function() {
  441. var e, t;
  442. return this.useRTSession ? (t = "",
  443. e = this.idToEnv[this.params.env],
  444. "usa" !== e && null != e && (t = e + "-"),
  445. "/" + t + "UsersProfile/account/delete_mobile") : "/UsersProfile/account/delete"
  446. }
  447. ,
  448. e.prototype._getRTSessionParams = function() {
  449. return _(this.params).pick("sessionid", "cookie", "rtserver-id")
  450. }
  451. ,
  452. e.prototype.onSubmit = function() {
  453. var e;
  454. if (!this.ui.submitButton.hasClass("disabled") && this.validate() && confirm(this.ui.submitButton.data("alert-message")))
  455. return this.ui.spinner.removeClass("hidden"),
  456. this.ui.submitButton.addClass("disabled"),
  457. this.ui.errorMessages.addClass("hidden"),
  458. e = {
  459. username: this.ui.username.val(),
  460. password: this.ui.password.val(),
  461. recaptcha_challenge_field: $("#recaptcha_challenge_field").val(),
  462. recaptcha_response_field: $("#recaptcha_response_field").val()
  463. },
  464. this.useRTSession && (e = _.extend(e, this._getRTSessionParams())),
  465. $.post(this._getUsersProfileURL(), e).done(function(e) {
  466. return function() {
  467. if (e.useRTSession || (W.userService.clearSession(),
  468. W.loginView.hideLoggedInUser()),
  469. e._moveToStep(e.STEPS.CONFIRMATION),
  470. e.useRTSession)
  471. return window.setTimeout(function() {
  472. return e._notifyClient()
  473. }, e.confirmationMessageDelay)
  474. }
  475. }(this)).fail(function(e) {
  476. return function(t) {
  477. var n, r;
  478. return n = e._getErrorCode(t),
  479. r = e.ERROS_CODES[n] || e.ERROS_CODES[e.DEFAULT_ERROR_CODE],
  480. e.el.find(".error-message." + r).removeClass("hidden"),
  481. Recaptcha.reload()
  482. }
  483. }(this)).always(function(e) {
  484. return function() {
  485. return e.ui.spinner.addClass("hidden"),
  486. e.ui.submitButton.removeClass("disabled")
  487. }
  488. }(this))
  489. }
  490. ,
  491. e.prototype._notifyClient = function() {
  492. return this.params.rider ? null != ("undefined" != typeof androidInterface && null !== androidInterface ? androidInterface.clientCallback : void 0) ? androidInterface.clientCallback(this.params.token) : "undefined" != typeof iosInterface_deleteAccountToken && null !== iosInterface_deleteAccountToken ? iosInterface_deleteAccountToken(this.params.token) : void 0 : W.Util.redirect("waze://?delete_account=" + this.params.token + "&nl=T")
  493. }
  494. ,
  495. e
  496. }(),
  497. document.querySelector("body#user-delete_account") && document.addEventListener("DOMContentLoaded", function() {
  498. return W.view = new W.DeleteAccountView(".container")
  499. })
  500. }
  501. .call(this),
  502. function() {
  503. W.DownloadRedirectorView = function() {
  504. function e(e) {
  505. var t;
  506. null == e && (e = {}),
  507. _.defaults(e, this.defaults()),
  508. t = W_.QueryParams.all(),
  509. (e.redirect || "true" === t.auto_redirect) && this._redirect(t, e)
  510. }
  511. return e.prototype.defaults = function() {
  512. return {
  513. redirect: !1,
  514. desktop_destination: "/" + W.LocaleService.getPageLocale(),
  515. mobile_destinations: gon.data.links.download_urls
  516. }
  517. }
  518. ,
  519. e.prototype._redirect = function(e, t) {
  520. var n;
  521. return delete e.auto_redirect,
  522. n = this._getDeviceUrl(t),
  523. null != n ? (this._sanitizeParams(e),
  524. n = this._addParams(n, e),
  525. setTimeout(function() {
  526. return W.Util.redirect(t.desktop_destination)
  527. }, 1e3),
  528. W.Util.redirect(n)) : W_.isBlank(t.desktop_destination) ? void 0 : W.Util.redirect(t.desktop_destination)
  529. }
  530. ,
  531. e.prototype._getDeviceUrl = function(e) {
  532. var t;
  533. return t = W_.Browser.getDeviceType(),
  534. "other" !== t ? e.mobile_destinations[t] : null
  535. }
  536. ,
  537. e.prototype._addParams = function(e, t) {
  538. return t = $.param(t),
  539. 0 === t.length ? e : -1 !== e.indexOf("?") ? e + "&" + t : e + "?" + t
  540. }
  541. ,
  542. e.prototype._sanitizeParams = function(e) {
  543. var t, n, r, i, o;
  544. for (i = ["appid", "mt", "id", "fake_device", "noop"],
  545. o = [],
  546. t = 0,
  547. r = i.length; t < r; t++)
  548. n = i[t],
  549. o.push(delete e[n]);
  550. return o
  551. }
  552. ,
  553. e
  554. }(),
  555. document.querySelector("body#home-download") && (W.view = new W.DownloadRedirectorView)
  556. }
  557. .call(this),
  558. function() {
  559. var e, t = function(e, t) {
  560. return function() {
  561. return e.apply(t, arguments)
  562. }
  563. }, n = function(e, t) {
  564. function n() {
  565. this.constructor = e
  566. }
  567. for (var i in t)
  568. r.call(t, i) && (e[i] = t[i]);
  569. return n.prototype = t.prototype,
  570. e.prototype = new n,
  571. e.__super__ = t.prototype,
  572. e
  573. }, r = {}.hasOwnProperty;
  574. W.ForgotPasswordView = function(e) {
  575. function r() {
  576. return this.resendSmsOnSuccess = t(this.resendSmsOnSuccess, this),
  577. this.sendSmsOnSuccess = t(this.sendSmsOnSuccess, this),
  578. this.sendEmailOnSuccess = t(this.sendEmailOnSuccess, this),
  579. r.__super__.constructor.apply(this, arguments)
  580. }
  581. return n(r, e),
  582. r.prototype.sendSmsUrl = "/UsersProfile/password/change_on_mobile",
  583. r.prototype.sendEmailUrl = "/UsersProfile/password/reset",
  584. r.prototype.countryCodesUrl = "/UsersProfile/info/countryCodes",
  585. r.prototype.environment = "web",
  586. r.prototype.template = function() {}
  587. ,
  588. r.prototype.initialize = function() {
  589. return this.ajaxInProgress = !1,
  590. this.phoneData = null,
  591. this.countryCodes = []
  592. }
  593. ,
  594. r.prototype.ui = {
  595. loading: ".main-loading",
  596. sendSmsForm: ".send-sms-form",
  597. resendSmsForm: ".resend-sms-form",
  598. sendEmailForm: ".send-email-form",
  599. forgotPassStep1: ".forgot-password-step1",
  600. forgotPassStep2: ".forgot-password-step2",
  601. resendSms: ".resend-sms",
  602. openApp: ".open-app",
  603. countryCodesSelect: "#country-codes",
  604. phone: "#phone",
  605. email: "[name=email]",
  606. register: ".register"
  607. },
  608. r.prototype.onRender = function() {
  609. return this.isStartedFromWazeApp() ? this.renderForWazeApp() : this.buildCountriesList(),
  610. this.ui.sendSmsForm.submit(function(e) {
  611. return function(t) {
  612. return t.preventDefault(),
  613. e.sendSms()
  614. }
  615. }(this)),
  616. this.ui.resendSmsForm.submit(function(e) {
  617. return function(t) {
  618. return t.preventDefault(),
  619. e.resendSms()
  620. }
  621. }(this)),
  622. this.ui.sendEmailForm.submit(function(e) {
  623. return function(t) {
  624. return t.preventDefault(),
  625. e.sendEmail()
  626. }
  627. }(this))
  628. }
  629. ,
  630. r.prototype.isStartedFromWazeApp = function() {
  631. return W_.QueryParams.has("from_app")
  632. }
  633. ,
  634. r.prototype.renderForWazeApp = function() {
  635. return this.$el.addClass("from-app"),
  636. this._removeLoading()
  637. }
  638. ,
  639. r.prototype.buildCountriesList = function() {
  640. return gon.countryCodes ? (this.countryCodes = gon.countryCodes,
  641. this.parseCoutriesList(),
  642. this._removeLoading()) : this.loadCountriesList()
  643. }
  644. ,
  645. r.prototype.loadCountriesList = function() {
  646. return $.get(this.countryCodesUrl).done(function(e) {
  647. return function(t) {
  648. return e.countryCodes = t,
  649. e.parseCoutriesList()
  650. }
  651. }(this)).always(function(e) {
  652. return function() {
  653. return e._removeLoading()
  654. }
  655. }(this))
  656. }
  657. ,
  658. r.prototype.parseCoutriesList = function() {
  659. var e, t, n, r, i, o, s, a;
  660. for (t = W.location.attributes.name,
  661. o = [],
  662. s = this.countryCodes,
  663. n = 0,
  664. r = s.length; n < r; n++)
  665. e = s[n],
  666. a = e[0] + " (+" + e[1] + ")",
  667. i = $("<option>").text(a).val(e[2]),
  668. t === e[0] && i.attr("selected", !0),
  669. o.push(i);
  670. return this.ui.countryCodesSelect.append(o)
  671. }
  672. ,
  673. r.prototype.isValidEmail = function() {
  674. return this.ui.sendEmailForm.validateEmailAddress("email")
  675. }
  676. ,
  677. r.prototype._removeLoading = function() {
  678. return this.ui.loading.addClass("hidden"),
  679. this.ui.forgotPassStep1.removeClass("hidden"),
  680. this.ui.register.removeClass("hidden")
  681. }
  682. ,
  683. r.prototype.disableForm = function(e) {
  684. return e.find(".loading").removeClass("hidden"),
  685. e.find("button").addClass("disabled"),
  686. e.find(".error-message").addClass("hidden"),
  687. e.find(".success-message").addClass("hidden")
  688. }
  689. ,
  690. r.prototype.enableForm = function(e) {
  691. return e.find(".loading").addClass("hidden"),
  692. e.find("button").removeClass("disabled")
  693. }
  694. ,
  695. r.prototype.showSuccessMessage = function(e) {
  696. return e.find(".success-message").removeClass("hidden"),
  697. e.find(".error-message").addClass("hidden")
  698. }
  699. ,
  700. r.prototype.showErrorMessage = function(e) {
  701. return e.find(".success-message").addClass("hidden"),
  702. e.find(".error-message").removeClass("hidden")
  703. }
  704. ,
  705. r.prototype.sendEmail = function() {
  706. var e;
  707. return this.isValidEmail() ? (e = {
  708. email: this.ui.email.val(),
  709. env: this.environment
  710. },
  711. this.submitForm(this.ui.sendEmailForm, e, this.sendEmailOnSuccess, this.sendEmailUrl)) : void this.showErrorMessage(this.ui.sendEmailForm)
  712. }
  713. ,
  714. r.prototype.sendEmailOnSuccess = function() {
  715. return this.showSuccessMessage(this.ui.sendEmailForm)
  716. }
  717. ,
  718. r.prototype.sendSms = function() {
  719. return this.phoneData = {
  720. region: this.ui.countryCodesSelect.val(),
  721. phone: this.ui.phone.val()
  722. },
  723. this.submitForm(this.ui.sendSmsForm, this.phoneData, this.sendSmsOnSuccess, this.sendSmsUrl)
  724. }
  725. ,
  726. r.prototype.sendSmsOnSuccess = function() {
  727. return this.ui.forgotPassStep1.addClass("hidden"),
  728. this.ui.forgotPassStep2.removeClass("hidden")
  729. }
  730. ,
  731. r.prototype.resendSms = function() {
  732. return this.submitForm(this.ui.resendSmsForm, this.phoneData, this.resendSmsOnSuccess, this.sendSmsUrl)
  733. }
  734. ,
  735. r.prototype.resendSmsOnSuccess = function() {
  736. return this.ui.resendSms.addClass("hidden"),
  737. this.ui.openApp.removeClass("hidden")
  738. }
  739. ,
  740. r.prototype.submitForm = function(e, t, n, r) {
  741. if (!this.ajaxInProgress)
  742. return this.disableForm(e),
  743. this.ajaxInProgress = !0,
  744. t.locale = I18n.locale,
  745. $.post(r, t).done(function() {
  746. return function() {
  747. return n()
  748. }
  749. }()).fail(function(t) {
  750. return function() {
  751. return t.showErrorMessage(e)
  752. }
  753. }(this)).always(function(t) {
  754. return function() {
  755. return t.ajaxInProgress = !1,
  756. t.enableForm(e)
  757. }
  758. }(this))
  759. }
  760. ,
  761. r
  762. }(Marionette.ItemView),
  763. document.querySelector("body#user-forgot_password") && (e = $(".forgot-password-page"),
  764. e.length && (W.forgotPasswordView = new W.ForgotPasswordView({
  765. el: e
  766. }),
  767. W.forgotPasswordView.render()))
  768. }
  769. .call(this),
  770. function() {
  771. var e = function(e, n) {
  772. function r() {
  773. this.constructor = e
  774. }
  775. for (var i in n)
  776. t.call(n, i) && (e[i] = n[i]);
  777. return r.prototype = n.prototype,
  778. e.prototype = new r,
  779. e.__super__ = n.prototype,
  780. e
  781. }
  782. , t = {}.hasOwnProperty;
  783. W.HeaderView = function(t) {
  784. function n() {
  785. return n.__super__.constructor.apply(this, arguments)
  786. }
  787. return e(n, t),
  788. n.prototype.el = ".waze-header",
  789. n.prototype.ui = {
  790. togglable: ".waze-caret, .waze-header-menu"
  791. },
  792. n.prototype.events = {
  793. "click .waze-header-brand": "onHeaderClicked"
  794. },
  795. n.prototype.initialize = function() {
  796. return this.bindUIElements()
  797. }
  798. ,
  799. n.prototype.onHeaderClicked = function() {
  800. return this._toggleMenu()
  801. }
  802. ,
  803. n.prototype._toggleMenu = function() {
  804. return this.ui.togglable.toggleClass("opened closed")
  805. }
  806. ,
  807. n
  808. }(Backbone.Marionette.ItemView),
  809. W.HeaderView_v2 = function(t) {
  810. function n() {
  811. return n.__super__.constructor.apply(this, arguments)
  812. }
  813. return e(n, t),
  814. n.prototype.el = ".wz-header",
  815. n.prototype.events = {
  816. "click .wz-header__hamburger": "onHeaderClicked"
  817. },
  818. n.prototype.onHeaderClicked = function() {
  819. return this._toggleMenu()
  820. }
  821. ,
  822. n.prototype._toggleMenu = function() {
  823. return this.$el.toggleClass("wz-header--opened")
  824. }
  825. ,
  826. n
  827. }(Backbone.Marionette.ItemView),
  828. $(function() {
  829. return new W.HeaderView,
  830. new W.HeaderView_v2
  831. })
  832. }
  833. .call(this),
  834. function() {
  835. W.LoginView = function() {
  836. function e(e) {
  837. this.captcha = null,
  838. this.el = $(e),
  839. this.ui = this._findUiElements(),
  840. this.ui.form.submit(function(e) {
  841. return function(t) {
  842. return t.preventDefault(),
  843. e.onSubmit()
  844. }
  845. }(this)),
  846. this.ui.loginButton.click(function(e) {
  847. return function() {
  848. return setTimeout($.proxy(e.focusUsername, e), 0)
  849. }
  850. }(this))
  851. }
  852. return e.CAPTCHA_ERROR_CODE = 429,
  853. e.prototype.focusUsername = function() {
  854. if (this.ui.username.is(":visible"))
  855. return this.ui.username.focus()
  856. }
  857. ,
  858. e.prototype._findUiElements = function() {
  859. return {
  860. form: this.el.find("form"),
  861. loading: this.el.find(".loading"),
  862. submitButton: this.el.find("button"),
  863. username: this.el.find("input[name=username]"),
  864. password: this.el.find("input[name=password]"),
  865. loginButton: this.el.find(".login-button"),
  866. loggedInUser: this.el.find(".logged-in-user"),
  867. errorMessage: this.el.find(".error-message"),
  868. logoutButton: this.el.find(".logout-button"),
  869. dashboardButton: this.el.find(".dashboard-button"),
  870. loggedInItems: this.el.find(".logged-in-items"),
  871. captchaContainer: this.el.find(".captcha-container")
  872. }
  873. }
  874. ,
  875. e.prototype.validate = function() {
  876. return 1 === (this.ui.form.validatePresenceOf("username") & this.ui.form.validatePresenceOf("password"))
  877. }
  878. ,
  879. e.prototype.onSubmit = function() {
  880. var e;
  881. if (!this.ui.submitButton.hasClass("disabled"))
  882. return this.validate() ? (this.ui.loading.removeClass("wz-hidden"),
  883. this.ui.submitButton.addClass("disabled"),
  884. this.ui.errorMessage.text("").addClass("wz-hidden"),
  885. W.userService.login(this.ui.username.val(), this.ui.password.val(), null != (e = this.captcha) ? e.getResponse() : void 0).always(function(e) {
  886. return function() {
  887. return e.ui.loading.addClass("wz-hidden"),
  888. e.ui.submitButton.removeClass("disabled")
  889. }
  890. }(this)).done(function(e) {
  891. return function(t) {
  892. return e.shouldUseRedirect() ? e.redirect() : e.showLoggedInUser(t)
  893. }
  894. }(this)).fail(function(e) {
  895. return function(t) {
  896. return t.code === e.constructor.CAPTCHA_ERROR_CODE ? e.createCaptcha() : (e.showLoginError(t.message),
  897. null != e.captcha ? e.captcha.reset() : void 0)
  898. }
  899. }(this))) : void 0
  900. }
  901. ,
  902. e.prototype.shouldUseRedirect = function() {
  903. return this.el.hasClass("login-page") || this.el.hasClass("login-after-reset")
  904. }
  905. ,
  906. e.prototype.showLoggedInUser = function(e) {
  907. return this.ui.loginButton.addClass("wz-hidden"),
  908. this.ui.loggedInUser.text(this._getWelcomeText(e)),
  909. this.ui.loggedInItems.removeClass("wz-hidden"),
  910. this.ui.username.val(""),
  911. this.ui.password.val(""),
  912. this.ui.submitButton.removeClass("disabled"),
  913. this.ui.loading.addClass("wz-hidden")
  914. }
  915. ,
  916. e.prototype._getWelcomeText = function(e) {
  917. return I18n.t("application.header_login.hi", {
  918. user: e.getFullName()
  919. })
  920. }
  921. ,
  922. e.prototype.redirect = function() {
  923. var e;
  924. return e = W_.QueryParams.get("redirect") || "/",
  925. "/" !== e.charAt(0) && (e = "/" + e),
  926. this._redirectToUrl(e)
  927. }
  928. ,
  929. e.prototype._redirectToUrl = function(e) {
  930. return window.location.href = e
  931. }
  932. ,
  933. e.prototype.showLoginError = function(e) {
  934. return e = this.localizeErrorMessage(e),
  935. this.ui.errorMessage.text(e).removeClass("wz-hidden"),
  936. this.ui.loading.addClass("wz-hidden"),
  937. this.ui.submitButton.removeClass("disabled")
  938. }
  939. ,
  940. e.prototype.createCaptcha = function() {
  941. if (!this.captcha)
  942. return this.captcha = new W.Recaptcha(this.ui.captchaContainer),
  943. this.captcha.show()
  944. }
  945. ,
  946. e.prototype.checkIfAlreadyLoggedIn = function() {
  947. var e;
  948. return e = W.userService.getCurrent(),
  949. $.when(e).done(function(e) {
  950. return function(t) {
  951. return null != t ? e.showLoggedInUser(t) : e.ui.loginButton.removeClass("wz-hidden")
  952. }
  953. }(this))
  954. }
  955. ,
  956. e.prototype.getErrorKey = function(e) {
  957. return null != e && e.length > 0 ? e.toLowerCase().replace(/\ +/g, "_").replace(/[^a-zA-Z_]/g, "").replace(/^_*/, "").replace(/_*$/, "") : "unknown_error"
  958. }
  959. ,
  960. e.prototype.localizeErrorMessage = function(e) {
  961. var t;
  962. return t = this.getErrorKey(e),
  963. I18n.t("application.header_login.errors." + t, {
  964. defaultValue: e
  965. })
  966. }
  967. ,
  968. e
  969. }(),
  970. $(function() {
  971. var e;
  972. if (e = $(".login-page"),
  973. e.length > 0 && (W.loginPage = new W.LoginView(e),
  974. W.loginPage.checkIfAlreadyLoggedIn()),
  975. e = $(".login-after-reset"),
  976. e.length > 0)
  977. return W.loginPage = new W.LoginView(e),
  978. W.loginPage.checkIfAlreadyLoggedIn()
  979. })
  980. }
  981. .call(this),
  982. function() {
  983. var e;
  984. W.ResetPasswordView = function() {
  985. function e(e) {
  986. this.el = $(e),
  987. this.ui = this._findUiElements(),
  988. this.ui.form.submit(function(e) {
  989. return function(t) {
  990. return t.preventDefault(),
  991. e.onSubmit()
  992. }
  993. }(this)),
  994. this.passwordReset = !1,
  995. this.verifyToken()
  996. }
  997. return e.prototype._findUiElements = function() {
  998. return {
  999. form: this.el.find("form"),
  1000. loading: this.el.find(".loading"),
  1001. submitButton: this.el.find("button"),
  1002. tokenExpiredErrorMessage: this.el.find(".token-expired-error-message"),
  1003. errorMessage: this.el.find(".error-message"),
  1004. successMessage: this.el.find(".success-message"),
  1005. pageLoad: this.el.find(".main-loading"),
  1006. view: this.el.find(".reset-password-view")
  1007. }
  1008. }
  1009. ,
  1010. e.prototype.verifyToken = function() {
  1011. return this.token = W_.QueryParams.get("uuid"),
  1012. $.get("/UsersProfile/password/testuuid", {
  1013. uuid: this.token
  1014. }).done(function(e) {
  1015. return function() {
  1016. return e.ui.view.removeClass("hidden")
  1017. }
  1018. }(this)).error(function(e) {
  1019. return function() {
  1020. return e.ui.tokenExpiredErrorMessage.removeClass("hidden")
  1021. }
  1022. }(this)).always(function(e) {
  1023. return function() {
  1024. return e.ui.pageLoad.addClass("hidden")
  1025. }
  1026. }(this))
  1027. }
  1028. ,
  1029. e.prototype.validate = function() {
  1030. return 1 == (this.ui.form.validatePresenceOf("password") & this.ui.form.validatePresenceOf("password_confirmation") & this.ui.form.validateEquals("password_confirmation", this.getPassword(), I18n.t("home.reset_password.errors.match")))
  1031. }
  1032. ,
  1033. e.prototype.getPassword = function() {
  1034. return this.ui.form.find("input[name=password]").val()
  1035. }
  1036. ,
  1037. e.prototype.getForceLogin = function() {
  1038. return this.ui.form.find("#force_logins").is(":checked")
  1039. }
  1040. ,
  1041. e.prototype.onSubmit = function() {
  1042. var e, t;
  1043. if (this.validate() && !this.passwordReset)
  1044. return this.ui.loading.removeClass("hidden"),
  1045. this.ui.submitButton.addClass("disabled"),
  1046. this.ui.errorMessage.addClass("hidden"),
  1047. t = this.getPassword(),
  1048. e = this.getForceLogin(),
  1049. $.post("/UsersProfile/password/update", {
  1050. password: t,
  1051. uuid: this.token,
  1052. force_logins: e
  1053. }).done(function(e) {
  1054. return function() {
  1055. return e.passwordReset = !0,
  1056. e.ui.successMessage.removeClass("hidden"),
  1057. e.ui.view.remove()
  1058. }
  1059. }(this)).fail(function(e) {
  1060. return function(t) {
  1061. var n;
  1062. return n = 406 === t.status ? I18n.t("home.change_password.responses.incorrect_new") : I18n.t("home.reset_password.errors.general"),
  1063. e.ui.errorMessage.removeClass("hidden").text(n)
  1064. }
  1065. }(this)).always(function(e) {
  1066. return function() {
  1067. return e.ui.loading.addClass("hidden"),
  1068. e.ui.submitButton.removeClass("disabled")
  1069. }
  1070. }(this))
  1071. }
  1072. ,
  1073. e
  1074. }(),
  1075. document.querySelector("body#user-reset_password") && (e = $(".reset-password-page"),
  1076. W.resetPasswordView = new W.ResetPasswordView(e))
  1077. }
  1078. .call(this),
  1079. function() {
  1080. var e = function(e, n) {
  1081. function r() {
  1082. this.constructor = e
  1083. }
  1084. for (var i in n)
  1085. t.call(n, i) && (e[i] = n[i]);
  1086. return r.prototype = n.prototype,
  1087. e.prototype = new r,
  1088. e.__super__ = n.prototype,
  1089. e
  1090. }
  1091. , t = {}.hasOwnProperty
  1092. , n = function(e, t) {
  1093. return function() {
  1094. return e.apply(t, arguments)
  1095. }
  1096. };
  1097. W.SelectView = function(t) {
  1098. function n() {
  1099. return n.__super__.constructor.apply(this, arguments)
  1100. }
  1101. return e(n, t),
  1102. n.prototype.tagName = "select",
  1103. n.prototype.itemView = W.SelectView,
  1104. n.prototype.events = {
  1105. change: "_onChange"
  1106. },
  1107. n.prototype.onShow = function() {
  1108. return this.trigger("select:show")
  1109. }
  1110. ,
  1111. n.prototype._onChange = function() {
  1112. var e, t;
  1113. return e = this.$el.val(),
  1114. t = this.children.filter(function(t) {
  1115. return t.getValue() === e
  1116. }),
  1117. this._selectedView = t[0]
  1118. }
  1119. ,
  1120. n.prototype.getSelectedView = function() {
  1121. return null == this._selectedView && this._setSelectedView(),
  1122. this._selectedView
  1123. }
  1124. ,
  1125. n
  1126. }(Marionette.CollectionView),
  1127. W.SelectOptionView = function(t) {
  1128. function r() {
  1129. return this.template = n(this.template, this),
  1130. r.__super__.constructor.apply(this, arguments)
  1131. }
  1132. return e(r, t),
  1133. r.prototype.tagName = "option",
  1134. r.prototype.template = function() {
  1135. return this.getText()
  1136. }
  1137. ,
  1138. r.prototype.getText = function() {
  1139. return this.model.get("text")
  1140. }
  1141. ,
  1142. r.prototype.getValue = function() {
  1143. return this.model.get("value")
  1144. }
  1145. ,
  1146. r.prototype.onRender = function() {
  1147. return this.$el.attr({
  1148. value: this.getValue()
  1149. })
  1150. }
  1151. ,
  1152. r
  1153. }(Marionette.ItemView)
  1154. }
  1155. .call(this),
  1156. function() {
  1157. W.VideosView = function() {
  1158. function e(e) {
  1159. this.$el = $(e),
  1160. this.ui = {
  1161. iframe: this.$el.find("iframe"),
  1162. guidedTourButton: this.$el.find(".guided-tour-button")
  1163. },
  1164. null != this.$el.data("video-id") && this.showVideo(this.$el.data("video-id"), {
  1165. autoplay: 0
  1166. }),
  1167. this.$el.on("click", ".guided-tour-button, .screenshot", function(e) {
  1168. return function(t) {
  1169. return t.preventDefault(),
  1170. t.stopPropagation(),
  1171. e.showVideo(e.ui.guidedTourButton.data("video-id"))
  1172. }
  1173. }(this))
  1174. }
  1175. return e.prototype.showVideo = function(e, t) {
  1176. return null == t && (t = {}),
  1177. this.$el.addClass("playing"),
  1178. this.ui.iframe.removeClass("hidden"),
  1179. this.ui.iframe.prop("src", this.getVideoUrl(e, t))
  1180. }
  1181. ,
  1182. e.prototype.getVideoUrl = function(e, t) {
  1183. var n;
  1184. return null == t && (t = {}),
  1185. n = _.defaults(t, {
  1186. feature: "player_embedded",
  1187. autoplay: 1,
  1188. modestbranding: 1,
  1189. showinfo: 0,
  1190. showsearch: 0,
  1191. wmode: "transparent",
  1192. autohide: 1,
  1193. controls: 1
  1194. }),
  1195. "https://www.youtube.com/embed/" + e + "?" + $.param(n)
  1196. }
  1197. ,
  1198. e
  1199. }(),
  1200. $(function() {
  1201. var e;
  1202. if (e = $(".videos-view"),
  1203. e.length)
  1204. return W.videosView = new W.VideosView(e)
  1205. })
  1206. }
  1207. .call(this),
  1208. function() {
  1209. W_.Browser.addDeviceTypeClassToBody()
  1210. }
  1211. .call(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement