Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.58 KB | None | 0 0
  1. (function (t) {
  2. function e(e) {
  3. for (var r, a, o = e[0], u = e[1], c = e[2], l = 0, d = []; l < o.length; l++) a = o[l],
  4. s[a] && d.push(s[a][0]),
  5. s[a] = 0;
  6. for (r in u) Object.prototype.hasOwnProperty.call(u, r) && (t[r] = u[r]);
  7. p && p(e);
  8. while (d.length) d.shift()();
  9. return i.push.apply(i, c || []),
  10. n()
  11. }
  12. function n() {
  13. for (var t, e = 0; e < i.length; e++) {
  14. for (var n = i[e], r = !0, a = 1; a < n.length; a++) {
  15. var o = n[a];
  16. 0 !== s[o] && (r = !1)
  17. }
  18. r && (i.splice(e--, 1), t = u(u.s = n[0]))
  19. }
  20. return t
  21. }
  22. var r = {},
  23. a = {
  24. app: 0
  25. },
  26. s = {
  27. app: 0
  28. },
  29. i = [];
  30.  
  31. function o(t) {
  32. return u.p + "js/" + ({}[t] || t) + "." + {
  33. "chunk-663e2646": "4e8d6fc2"
  34. }[t] + ".js"
  35. }
  36. function u(e) {
  37. if (r[e]) return r[e].exports;
  38. var n = r[e] = {
  39. i: e,
  40. l: !1,
  41. exports: {}
  42. };
  43. return t[e].call(n.exports, n, n.exports, u),
  44. n.l = !0,
  45. n.exports
  46. }
  47. u.e = function (t) {
  48. var e = [],
  49. n = {
  50. "chunk-663e2646": 1
  51. };
  52. a[t] ? e.push(a[t]) : 0 !== a[t] && n[t] && e.push(a[t] = new Promise(function (e, n) {
  53. for (var r = "css/" + ({}[t] || t) + "." + {
  54. "chunk-663e2646": "f5bf4c0a"
  55. }[t] + ".css", s = u.p + r, i = document.getElementsByTagName("link"), o = 0; o < i.length; o++) {
  56. var c = i[o],
  57. l = c.getAttribute("data-href") || c.getAttribute("href");
  58. if ("stylesheet" === c.rel && (l === r || l === s)) return e()
  59. }
  60. var d = document.getElementsByTagName("style");
  61. for (o = 0; o < d.length; o++) {
  62. c = d[o],
  63. l = c.getAttribute("data-href");
  64. if (l === r || l === s) return e()
  65. }
  66. var p = document.createElement("link");
  67. p.rel = "stylesheet",
  68. p.type = "text/css",
  69. p.onload = e,
  70. p.onerror = function (e) {
  71. var r = e && e.target && e.target.src || s,
  72. i = new Error("Loading CSS chunk " + t + " failed.\n(" + r + ")");
  73. i.request = r,
  74. delete a[t],
  75. p.parentNode.removeChild(p),
  76. n(i)
  77. },
  78. p.href = s;
  79. var m = document.getElementsByTagName("head")[0];
  80. m.appendChild(p)
  81. }).then(function () {
  82. a[t] = 0
  83. }));
  84. var r = s[t];
  85. if (0 !== r) if (r) e.push(r[2]);
  86. else {
  87. var i = new Promise(function (e, n) {
  88. r = s[t] = [e, n]
  89. });
  90. e.push(r[2] = i);
  91. var c, l = document.createElement("script");
  92. l.charset = "utf-8",
  93. l.timeout = 120,
  94. u.nc && l.setAttribute("nonce", u.nc),
  95. l.src = o(t),
  96. c = function (e) {
  97. l.onerror = l.onload = null,
  98. clearTimeout(d);
  99. var n = s[t];
  100. if (0 !== n) {
  101. if (n) {
  102. var r = e && ("load" === e.type ? "missing" : e.type),
  103. a = e && e.target && e.target.src,
  104. i = new Error("Loading chunk " + t + " failed.\n(" + r + ": " + a + ")");
  105. i.type = r,
  106. i.request = a,
  107. n[1](i)
  108. }
  109. s[t] = void 0
  110. }
  111. };
  112. var d = setTimeout(function () {
  113. c({
  114. type: "timeout",
  115. target: l
  116. })
  117. }, 12e4);
  118. l.onerror = l.onload = c,
  119. document.head.appendChild(l)
  120. }
  121. return Promise.all(e)
  122. },
  123. u.m = t,
  124. u.c = r,
  125. u.d = function (t, e, n) {
  126. u.o(t, e) || Object.defineProperty(t, e, {
  127. enumerable: !0,
  128. get: n
  129. })
  130. },
  131. u.r = function (t) {
  132. "undefined" !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
  133. value: "Module"
  134. }),
  135. Object.defineProperty(t, "__esModule", {
  136. value: !0
  137. })
  138. },
  139. u.t = function (t, e) {
  140. if (1 & e && (t = u(t)), 8 & e) return t;
  141. if (4 & e && "object" === typeof t && t && t.__esModule) return t;
  142. var n = Object.create(null);
  143. if (u.r(n), Object.defineProperty(n, "default", {
  144. enumerable: !0,
  145. value: t
  146. }), 2 & e && "string" != typeof t) for (var r in t) u.d(n, r, function (e) {
  147. return t[e]
  148. }.bind(null, r));
  149. return n
  150. },
  151. u.n = function (t) {
  152. var e = t && t.__esModule ?
  153. function () {
  154. return t["default"]
  155. } : function () {
  156. return t
  157. };
  158. return u.d(e, "a", e),
  159. e
  160. },
  161. u.o = function (t, e) {
  162. return Object.prototype.hasOwnProperty.call(t, e)
  163. },
  164. u.p = "/",
  165. u.oe = function (t) {
  166. throw console.error(t),
  167. t
  168. };
  169. var c = window["webpackJsonp"] = window["webpackJsonp"] || [],
  170. l = c.push.bind(c);
  171. c.push = e,
  172. c = c.slice();
  173. for (var d = 0; d < c.length; d++) e(c[d]);
  174. var p = l;
  175. i.push([0, "chunk-vendors"]),
  176. n()
  177. })({
  178. 0: function (t, e, n) {
  179. t.exports = n("56d7")
  180. },
  181. "21bb": function (t, e, n) {
  182. "use strict";
  183. var r = n("bcc9"),
  184. a = n.n(r);
  185. a.a
  186. },
  187. "56d7": function (t, e, n) {
  188. "use strict";
  189. n.r(e);
  190. n("a481"),
  191. n("cadf"),
  192. n("551c"),
  193. n("f751"),
  194. n("097d");
  195. var r = n("2b0e"),
  196. a = function () {
  197. var t = this,
  198. e = t.$createElement,
  199. n = t._self._c || e;
  200. return "auth" === t.$route.name || t.$root.user ? n("router-view") : t._e()
  201. },
  202. s = [],
  203. i = (n("5c0b"), n("2877")),
  204. o = {},
  205. u = Object(i["a"])(o, a, s, !1, null, null, null),
  206. c = u.exports,
  207. l = n("8c4f"),
  208. d = function () {
  209. var t = this,
  210. e = t.$createElement,
  211. n = t._self._c || e;
  212. return n("div", [t._m(0), n("div", {
  213. staticClass: "ui vertical stripe segment",
  214. attrs: {
  215. id: "shop"
  216. }
  217. }, [n("div", {
  218. staticClass: "ui container",
  219. staticStyle: {
  220. "min-height": "100vh"
  221. }
  222. }, [n("h1", {
  223. staticClass: "ui red header"
  224. }, [t._v("\n Our Flags:\n ")]), n("sui-menu", {
  225. attrs: {
  226. text: ""
  227. }
  228. }, [n("sui-menu-item", {
  229. attrs: {
  230. header: ""
  231. }
  232. }, [t._v("Sort By")]), t._l(t.sorting_items, function (e) {
  233. return n("sui-menu-item", {
  234. key: e.value,
  235. tag: "a",
  236. attrs: {
  237. content: e.name,
  238. active: e.value === t.constraints.order
  239. },
  240. on: {
  241. click: function (n) {
  242. t.constraints.order = e.value
  243. }
  244. }
  245. })
  246. })], 2), t.goods.length && !t.loading ? n("sui-card-group", {
  247. attrs: {
  248. "items-per-row": 5
  249. }
  250. }, t._l(t.goods, function (e) {
  251. return n("sui-card", [n("sui-image", {
  252. attrs: {
  253. src: "/img/" + e.id + ".jpg"
  254. }
  255. }), e.props.fake ? t._e() : n("sui-label", {
  256. attrs: {
  257. color: "orange",
  258. ribbon: ""
  259. },
  260. domProps: {
  261. textContent: t._s("Real")
  262. }
  263. }), n("sui-card-content", [n("sui-card-header", [t._v(t._s(e.name))]), n("sui-card-meta", [t._v("\n Purchased " + t._s(e.purchase_count) + " times\n ")]), n("sui-card-description", {
  264. domProps: {
  265. textContent: t._s(e.description)
  266. }
  267. })], 1), n("sui-card-content", {
  268. attrs: {
  269. extra: ""
  270. }
  271. }, [n("sui-icon", {
  272. attrs: {
  273. name: "money"
  274. }
  275. }), t._v(" " + t._s(e.price) + " $\n ")], 1), n("sui-button", {
  276. attrs: {
  277. attached: "bottom"
  278. },
  279. on: {
  280. click: function (n) {
  281. t.currentGood = e
  282. }
  283. }
  284. }, [n("sui-icon", {
  285. attrs: {
  286. name: "cart"
  287. }
  288. }), t._v(" Purchase\n ")], 1)], 1)
  289. }), 1) : n("sui-dimmer", {
  290. attrs: {
  291. active: ""
  292. }
  293. }, [n("sui-loader", [t._v("Loading")])], 1)], 1)]), n("sui-modal", {
  294. attrs: {
  295. open: !! t.currentGood
  296. },
  297. on: {
  298. changed: function (e) {
  299. t.currentGood = !1
  300. }
  301. }
  302. }, [n("sui-modal-header", [t._v("Flag purchase")]), n("sui-modal-content", {
  303. attrs: {
  304. image: ""
  305. }
  306. }, [n("sui-image", {
  307. attrs: {
  308. wrapped: "",
  309. size: "medium",
  310. src: "/img/" + t.currentGood.id + ".jpg"
  311. }
  312. }), n("sui-modal-description", [n("sui-header", [t._v(" " + t._s(t.currentGood.name))]), n("p", [t._v(t._s(t.currentGood.description))]), t._l(t.currentGood.props, function (e, r) {
  313. return n("sui-label", {
  314. tag: "a",
  315. attrs: {
  316. color: "orange"
  317. }
  318. }, [t._v("\n " + t._s(r) + "\n "), n("sui-label-detail", [t._v(t._s(e))])], 1)
  319. }), n("div", {
  320. staticClass: "amount-selector"
  321. }, [n("span", {
  322. staticClass: "amount"
  323. }, [t._v(t._s(t.amount) + " pcs.")]), n("sui-button-group", [n("sui-button", {
  324. attrs: {
  325. icon: "minus",
  326. disabled: 1 === t.amount
  327. },
  328. on: {
  329. click: function (e) {
  330. t.amount--
  331. }
  332. }
  333. }), n("sui-button", {
  334. attrs: {
  335. icon: "plus"
  336. },
  337. on: {
  338. click: function (e) {
  339. t.amount++
  340. }
  341. }
  342. })], 1), n("span", {
  343. staticClass: "summ"
  344. }, [t._v(t._s(t.amount * t.currentGood.price) + " $")])], 1), t.canBuy ? t._e() : n("sui-message", {
  345. attrs: {
  346. color: "red"
  347. },
  348. domProps: {
  349. textContent: t._s("Too expensive 4 U")
  350. }
  351. })], 2)], 1), n("sui-modal-actions", [n("sui-button", {
  352. attrs: {
  353. disabled: !t.canBuy,
  354. positive: ""
  355. },
  356. nativeOn: {
  357. click: function (e) {
  358. return t.purchase()
  359. }
  360. }
  361. }, [t._v("\n Purchase flag for " + t._s(t.amount * t.currentGood.price) + " $\n ")])], 1)], 1), n("sui-modal", {
  362. attrs: {
  363. open: !! t.recievedFlag
  364. },
  365. on: {
  366. changed: function (e) {
  367. t.recievedFlag = !1
  368. }
  369. }
  370. }, [n("sui-modal-content", [t._v("\n " + t._s(t.recievedFlag) + "\n ")])], 1)], 1)
  371. },
  372. p = [function () {
  373. var t = this,
  374. e = t.$createElement,
  375. n = t._self._c || e;
  376. return n("div", {
  377. staticClass: "ui vertical masthead center aligned segment"
  378. }, [n("div", {
  379. staticClass: "ui text container"
  380. }, [n("h1", {
  381. staticClass: "ui red header"
  382. }, [t._v("\n Вперед за флагами!\n ")]), n("h2", {
  383. staticClass: "ui orange header"
  384. }, [t._v("Нам 10 лет! Не упустите скидки!")]), n("a", {
  385. staticClass: "ui huge primary button",
  386. attrs: {
  387. href: "#shop"
  388. }
  389. }, [t._v("\n РђРђРђРђ "), n("i", {
  390. staticClass: "right arrow icon"
  391. })])])])
  392. }],
  393. m = (n("96cf"), n("3b8d")),
  394. h = {
  395. name: "home",
  396. data: function () {
  397. return {
  398. constraints: {
  399. order: "created_at",
  400. fields: ["id", "name", "description", "price", "purchase_count", "props"]
  401. },
  402. goods: [],
  403. currentGood: !1,
  404. amount: 1,
  405. loading: !0,
  406. recievedFlag: !1,
  407. sorting_items: [{
  408. name: "Latest",
  409. value: "created_at"
  410. },
  411. {
  412. name: "Oldest",
  413. value: "-created_at"
  414. },
  415. {
  416. name: "Cheapest",
  417. value: "price"
  418. },
  419. {
  420. name: "Most Expensive",
  421. value: "-price"
  422. },
  423. {
  424. name: "Most Popular",
  425. value: "-purchase_count"
  426. }]
  427. }
  428. },
  429. computed: {
  430. canBuy: function (t) {
  431. return (t.currentGood.price || 0) * t.amount < (t.$root.user.balance || 150)
  432. }
  433. },
  434. methods: {
  435. refresh: function () {
  436. var t = Object(m["a"])(regeneratorRuntime.mark(function t() {
  437. return regeneratorRuntime.wrap(function (t) {
  438. while (1) switch (t.prev = t.next) {
  439. case 0:
  440. return this.loading = !0,
  441. t.next = 3,
  442. this.$http.get("goods", {
  443. params: this.constraints
  444. });
  445. case 3:
  446. this.goods = t.sent.data,
  447. this.loading = !1;
  448. case 5:
  449. case "end":
  450. return t.stop()
  451. }
  452. }, t, this)
  453. }));
  454.  
  455. function e() {
  456. return t.apply(this, arguments)
  457. }
  458. return e
  459. }(),
  460. purchase: function () {
  461. var t = Object(m["a"])(regeneratorRuntime.mark(function t() {
  462. var e;
  463. return regeneratorRuntime.wrap(function (t) {
  464. while (1) switch (t.prev = t.next) {
  465. case 0:
  466. return t.next = 2,
  467. this.$http.post("goods/".concat(this.currentGood.id, "/purchase"), {
  468. amount: this.amount
  469. });
  470. case 2:
  471. e = t.sent.data.content,
  472. this.$root.user.balance -= this.currentGood.price * this.amount,
  473. this.currentGood = !1,
  474. this.recievedFlag = e;
  475. case 6:
  476. case "end":
  477. return t.stop()
  478. }
  479. }, t, this)
  480. }));
  481.  
  482. function e() {
  483. return t.apply(this, arguments)
  484. }
  485. return e
  486. }()
  487. },
  488. watch: {
  489. constraints: {
  490. handler: function () {
  491. this.refresh()
  492. },
  493. deep: !0
  494. }
  495. },
  496. created: function () {
  497. var t = Object(m["a"])(regeneratorRuntime.mark(function t() {
  498. return regeneratorRuntime.wrap(function (t) {
  499. while (1) switch (t.prev = t.next) {
  500. case 0:
  501. return this.$root.user || this.$router.replace({
  502. name: "auth"
  503. }),
  504. t.next = 3,
  505. this.refresh();
  506. case 3:
  507. case "end":
  508. return t.stop()
  509. }
  510. }, t, this)
  511. }));
  512.  
  513. function e() {
  514. return t.apply(this, arguments)
  515. }
  516. return e
  517. }()
  518. },
  519. f = h,
  520. v = (n("21bb"), Object(i["a"])(f, d, p, !1, null, null, null)),
  521. g = v.exports,
  522. _ = function () {
  523. var t = this,
  524. e = t.$createElement,
  525. n = t._self._c || e;
  526. return n("div", [n("header", [n("div", {
  527. staticClass: "ui large top fixed menu"
  528. }, [n("div", {
  529. staticClass: "ui container"
  530. }, [t._m(0), n("div", {
  531. staticClass: "right menu "
  532. }, [t.$root.user ? [n("div", {
  533. staticClass: "item"
  534. }, [n("img", {
  535. staticClass: "ui mini circular image",
  536. attrs: {
  537. src: "https://semantic-ui.com/images/avatar2/large/patrick.png"
  538. }
  539. }), n("div", {
  540. staticClass: "content",
  541. staticStyle: {
  542. "margin-left": "1rem"
  543. }
  544. }, [n("div", {
  545. staticClass: "ui sub header"
  546. }, [t._v(t._s(t.$root.user.name))]), t._v("\n " + t._s(t.$root.user.email) + "\n ")])]), n("div", {
  547. staticClass: "item"
  548. }, [n("span", {
  549. staticClass: "ui green header"
  550. }, [t._v(t._s(t.$root.user.balance || "150") + " $")])]), n("div", {
  551. staticClass: "item"
  552. }, [n("a", {
  553. staticClass: "ui button",
  554. on: {
  555. click: function (e) {
  556. return t.logout()
  557. }
  558. }
  559. }, [t._v("Log out")])])] : [n("div", {
  560. staticClass: "item"
  561. }, [n("router-link", {
  562. staticClass: "ui button",
  563. attrs: {
  564. to: {
  565. name: "auth"
  566. }
  567. }
  568. }, [t._v("Log in")])], 1), n("div", {
  569. staticClass: "item"
  570. }, [n("router-link", {
  571. staticClass: "ui primary button",
  572. attrs: {
  573. to: {
  574. name: "auth"
  575. }
  576. }
  577. }, [t._v("Sign Up")])], 1)]], 2)])])]), n("main", [n("div", {
  578. staticClass: "pusher"
  579. }, [n("router-view")], 1)]), t._m(1)])
  580. },
  581. b = [function () {
  582. var t = this,
  583. e = t.$createElement,
  584. n = t._self._c || e;
  585. return n("span", {
  586. staticClass: "logo"
  587. }, [n("span", {
  588. staticClass: "alt"
  589. }, [t._v("Flag")]), t._v("Express")])
  590. },
  591.  
  592.  
  593. function () {
  594. var t = this,
  595. e = t.$createElement,
  596. n = t._self._c || e;
  597. return n("footer", {
  598. staticClass: "ui inverted vertical footer segment",
  599. staticStyle: {
  600. "text-align": "center"
  601. }
  602. }, [n("span", [t._v("FlagExpress | 2019")])])
  603. }],
  604. y = {
  605. name: "Layout",
  606. methods: {
  607. logout: function () {
  608. this.$router.replace({
  609. name: "auth"
  610. }),
  611. this.$root.user = void 0
  612. }
  613. }
  614. },
  615. C = y,
  616. w = (n("ebfd"), Object(i["a"])(C, _, b, !1, null, "160df892", null)),
  617. x = w.exports;
  618. r["a"].use(l["a"]);
  619. var $ = new l["a"]({
  620. mode: "history",
  621. base: "/",
  622. routes: [{
  623. path: "/auth",
  624. name: "auth",
  625. component: function () {
  626. return n.e("chunk-663e2646").then(n.bind(null, "a55b"))
  627. }
  628. },
  629. {
  630. path: "",
  631. component: x,
  632. children: [{
  633. path: "/",
  634. name: "home",
  635. component: g
  636. }]
  637. }]
  638. }),
  639. k = n("92d5"),
  640. j = n.n(k),
  641. O = n("bc3a"),
  642. E = n.n(O),
  643. P = n("a7fe"),
  644. G = n.n(P);
  645. E.a.defaults.baseURL = "/api/",
  646. r["a"].use(j.a),
  647. r["a"].use(G.a, E.a),
  648. r["a"].config.productionTip = !1,
  649. new r["a"]({
  650. router: $,
  651. render: function (t) {
  652. return t(c)
  653. },
  654. data: {
  655. user: void 0
  656. },
  657. created: function () {
  658. var t = this;
  659. this.$http.get("me").then(function (e) {
  660. var n = e.data;
  661. t.$root.user = n
  662. }).
  663. catch (function (e) {
  664. t.$router.replace({
  665. name: "auth"
  666. })
  667. })
  668. }
  669. }).$mount("#app")
  670. },
  671. "5c0b": function (t, e, n) {
  672. "use strict";
  673. var r = n("5e27"),
  674. a = n.n(r);
  675. a.a
  676. },
  677. "5e27": function (t, e, n) {},
  678. "6f03": function (t, e, n) {},
  679. bcc9: function (t, e, n) {},
  680. ebfd: function (t, e, n) {
  681. "use strict";
  682. var r = n("6f03"),
  683. a = n.n(r);
  684. a.a
  685. }
  686. });
  687. //# sourceMappingURL=app.911db34a.js.map
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement