Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function (t) {
- function e(e) {
- for (var r, a, o = e[0], u = e[1], c = e[2], l = 0, d = []; l < o.length; l++) a = o[l],
- s[a] && d.push(s[a][0]),
- s[a] = 0;
- for (r in u) Object.prototype.hasOwnProperty.call(u, r) && (t[r] = u[r]);
- p && p(e);
- while (d.length) d.shift()();
- return i.push.apply(i, c || []),
- n()
- }
- function n() {
- for (var t, e = 0; e < i.length; e++) {
- for (var n = i[e], r = !0, a = 1; a < n.length; a++) {
- var o = n[a];
- 0 !== s[o] && (r = !1)
- }
- r && (i.splice(e--, 1), t = u(u.s = n[0]))
- }
- return t
- }
- var r = {},
- a = {
- app: 0
- },
- s = {
- app: 0
- },
- i = [];
- function o(t) {
- return u.p + "js/" + ({}[t] || t) + "." + {
- "chunk-663e2646": "4e8d6fc2"
- }[t] + ".js"
- }
- function u(e) {
- if (r[e]) return r[e].exports;
- var n = r[e] = {
- i: e,
- l: !1,
- exports: {}
- };
- return t[e].call(n.exports, n, n.exports, u),
- n.l = !0,
- n.exports
- }
- u.e = function (t) {
- var e = [],
- n = {
- "chunk-663e2646": 1
- };
- a[t] ? e.push(a[t]) : 0 !== a[t] && n[t] && e.push(a[t] = new Promise(function (e, n) {
- for (var r = "css/" + ({}[t] || t) + "." + {
- "chunk-663e2646": "f5bf4c0a"
- }[t] + ".css", s = u.p + r, i = document.getElementsByTagName("link"), o = 0; o < i.length; o++) {
- var c = i[o],
- l = c.getAttribute("data-href") || c.getAttribute("href");
- if ("stylesheet" === c.rel && (l === r || l === s)) return e()
- }
- var d = document.getElementsByTagName("style");
- for (o = 0; o < d.length; o++) {
- c = d[o],
- l = c.getAttribute("data-href");
- if (l === r || l === s) return e()
- }
- var p = document.createElement("link");
- p.rel = "stylesheet",
- p.type = "text/css",
- p.onload = e,
- p.onerror = function (e) {
- var r = e && e.target && e.target.src || s,
- i = new Error("Loading CSS chunk " + t + " failed.\n(" + r + ")");
- i.request = r,
- delete a[t],
- p.parentNode.removeChild(p),
- n(i)
- },
- p.href = s;
- var m = document.getElementsByTagName("head")[0];
- m.appendChild(p)
- }).then(function () {
- a[t] = 0
- }));
- var r = s[t];
- if (0 !== r) if (r) e.push(r[2]);
- else {
- var i = new Promise(function (e, n) {
- r = s[t] = [e, n]
- });
- e.push(r[2] = i);
- var c, l = document.createElement("script");
- l.charset = "utf-8",
- l.timeout = 120,
- u.nc && l.setAttribute("nonce", u.nc),
- l.src = o(t),
- c = function (e) {
- l.onerror = l.onload = null,
- clearTimeout(d);
- var n = s[t];
- if (0 !== n) {
- if (n) {
- var r = e && ("load" === e.type ? "missing" : e.type),
- a = e && e.target && e.target.src,
- i = new Error("Loading chunk " + t + " failed.\n(" + r + ": " + a + ")");
- i.type = r,
- i.request = a,
- n[1](i)
- }
- s[t] = void 0
- }
- };
- var d = setTimeout(function () {
- c({
- type: "timeout",
- target: l
- })
- }, 12e4);
- l.onerror = l.onload = c,
- document.head.appendChild(l)
- }
- return Promise.all(e)
- },
- u.m = t,
- u.c = r,
- u.d = function (t, e, n) {
- u.o(t, e) || Object.defineProperty(t, e, {
- enumerable: !0,
- get: n
- })
- },
- u.r = function (t) {
- "undefined" !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {
- value: "Module"
- }),
- Object.defineProperty(t, "__esModule", {
- value: !0
- })
- },
- u.t = function (t, e) {
- if (1 & e && (t = u(t)), 8 & e) return t;
- if (4 & e && "object" === typeof t && t && t.__esModule) return t;
- var n = Object.create(null);
- if (u.r(n), Object.defineProperty(n, "default", {
- enumerable: !0,
- value: t
- }), 2 & e && "string" != typeof t) for (var r in t) u.d(n, r, function (e) {
- return t[e]
- }.bind(null, r));
- return n
- },
- u.n = function (t) {
- var e = t && t.__esModule ?
- function () {
- return t["default"]
- } : function () {
- return t
- };
- return u.d(e, "a", e),
- e
- },
- u.o = function (t, e) {
- return Object.prototype.hasOwnProperty.call(t, e)
- },
- u.p = "/",
- u.oe = function (t) {
- throw console.error(t),
- t
- };
- var c = window["webpackJsonp"] = window["webpackJsonp"] || [],
- l = c.push.bind(c);
- c.push = e,
- c = c.slice();
- for (var d = 0; d < c.length; d++) e(c[d]);
- var p = l;
- i.push([0, "chunk-vendors"]),
- n()
- })({
- 0: function (t, e, n) {
- t.exports = n("56d7")
- },
- "21bb": function (t, e, n) {
- "use strict";
- var r = n("bcc9"),
- a = n.n(r);
- a.a
- },
- "56d7": function (t, e, n) {
- "use strict";
- n.r(e);
- n("a481"),
- n("cadf"),
- n("551c"),
- n("f751"),
- n("097d");
- var r = n("2b0e"),
- a = function () {
- var t = this,
- e = t.$createElement,
- n = t._self._c || e;
- return "auth" === t.$route.name || t.$root.user ? n("router-view") : t._e()
- },
- s = [],
- i = (n("5c0b"), n("2877")),
- o = {},
- u = Object(i["a"])(o, a, s, !1, null, null, null),
- c = u.exports,
- l = n("8c4f"),
- d = function () {
- var t = this,
- e = t.$createElement,
- n = t._self._c || e;
- return n("div", [t._m(0), n("div", {
- staticClass: "ui vertical stripe segment",
- attrs: {
- id: "shop"
- }
- }, [n("div", {
- staticClass: "ui container",
- staticStyle: {
- "min-height": "100vh"
- }
- }, [n("h1", {
- staticClass: "ui red header"
- }, [t._v("\n Our Flags:\n ")]), n("sui-menu", {
- attrs: {
- text: ""
- }
- }, [n("sui-menu-item", {
- attrs: {
- header: ""
- }
- }, [t._v("Sort By")]), t._l(t.sorting_items, function (e) {
- return n("sui-menu-item", {
- key: e.value,
- tag: "a",
- attrs: {
- content: e.name,
- active: e.value === t.constraints.order
- },
- on: {
- click: function (n) {
- t.constraints.order = e.value
- }
- }
- })
- })], 2), t.goods.length && !t.loading ? n("sui-card-group", {
- attrs: {
- "items-per-row": 5
- }
- }, t._l(t.goods, function (e) {
- return n("sui-card", [n("sui-image", {
- attrs: {
- src: "/img/" + e.id + ".jpg"
- }
- }), e.props.fake ? t._e() : n("sui-label", {
- attrs: {
- color: "orange",
- ribbon: ""
- },
- domProps: {
- textContent: t._s("Real")
- }
- }), 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", {
- domProps: {
- textContent: t._s(e.description)
- }
- })], 1), n("sui-card-content", {
- attrs: {
- extra: ""
- }
- }, [n("sui-icon", {
- attrs: {
- name: "money"
- }
- }), t._v(" " + t._s(e.price) + " $\n ")], 1), n("sui-button", {
- attrs: {
- attached: "bottom"
- },
- on: {
- click: function (n) {
- t.currentGood = e
- }
- }
- }, [n("sui-icon", {
- attrs: {
- name: "cart"
- }
- }), t._v(" Purchase\n ")], 1)], 1)
- }), 1) : n("sui-dimmer", {
- attrs: {
- active: ""
- }
- }, [n("sui-loader", [t._v("Loading")])], 1)], 1)]), n("sui-modal", {
- attrs: {
- open: !! t.currentGood
- },
- on: {
- changed: function (e) {
- t.currentGood = !1
- }
- }
- }, [n("sui-modal-header", [t._v("Flag purchase")]), n("sui-modal-content", {
- attrs: {
- image: ""
- }
- }, [n("sui-image", {
- attrs: {
- wrapped: "",
- size: "medium",
- src: "/img/" + t.currentGood.id + ".jpg"
- }
- }), 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) {
- return n("sui-label", {
- tag: "a",
- attrs: {
- color: "orange"
- }
- }, [t._v("\n " + t._s(r) + "\n "), n("sui-label-detail", [t._v(t._s(e))])], 1)
- }), n("div", {
- staticClass: "amount-selector"
- }, [n("span", {
- staticClass: "amount"
- }, [t._v(t._s(t.amount) + " pcs.")]), n("sui-button-group", [n("sui-button", {
- attrs: {
- icon: "minus",
- disabled: 1 === t.amount
- },
- on: {
- click: function (e) {
- t.amount--
- }
- }
- }), n("sui-button", {
- attrs: {
- icon: "plus"
- },
- on: {
- click: function (e) {
- t.amount++
- }
- }
- })], 1), n("span", {
- staticClass: "summ"
- }, [t._v(t._s(t.amount * t.currentGood.price) + " $")])], 1), t.canBuy ? t._e() : n("sui-message", {
- attrs: {
- color: "red"
- },
- domProps: {
- textContent: t._s("Too expensive 4 U")
- }
- })], 2)], 1), n("sui-modal-actions", [n("sui-button", {
- attrs: {
- disabled: !t.canBuy,
- positive: ""
- },
- nativeOn: {
- click: function (e) {
- return t.purchase()
- }
- }
- }, [t._v("\n Purchase flag for " + t._s(t.amount * t.currentGood.price) + " $\n ")])], 1)], 1), n("sui-modal", {
- attrs: {
- open: !! t.recievedFlag
- },
- on: {
- changed: function (e) {
- t.recievedFlag = !1
- }
- }
- }, [n("sui-modal-content", [t._v("\n " + t._s(t.recievedFlag) + "\n ")])], 1)], 1)
- },
- p = [function () {
- var t = this,
- e = t.$createElement,
- n = t._self._c || e;
- return n("div", {
- staticClass: "ui vertical masthead center aligned segment"
- }, [n("div", {
- staticClass: "ui text container"
- }, [n("h1", {
- staticClass: "ui red header"
- }, [t._v("\n Вперед за флагами!\n ")]), n("h2", {
- staticClass: "ui orange header"
- }, [t._v("Нам 10 лет! Не упустите скидки!")]), n("a", {
- staticClass: "ui huge primary button",
- attrs: {
- href: "#shop"
- }
- }, [t._v("\n РђРђРђРђ "), n("i", {
- staticClass: "right arrow icon"
- })])])])
- }],
- m = (n("96cf"), n("3b8d")),
- h = {
- name: "home",
- data: function () {
- return {
- constraints: {
- order: "created_at",
- fields: ["id", "name", "description", "price", "purchase_count", "props"]
- },
- goods: [],
- currentGood: !1,
- amount: 1,
- loading: !0,
- recievedFlag: !1,
- sorting_items: [{
- name: "Latest",
- value: "created_at"
- },
- {
- name: "Oldest",
- value: "-created_at"
- },
- {
- name: "Cheapest",
- value: "price"
- },
- {
- name: "Most Expensive",
- value: "-price"
- },
- {
- name: "Most Popular",
- value: "-purchase_count"
- }]
- }
- },
- computed: {
- canBuy: function (t) {
- return (t.currentGood.price || 0) * t.amount < (t.$root.user.balance || 150)
- }
- },
- methods: {
- refresh: function () {
- var t = Object(m["a"])(regeneratorRuntime.mark(function t() {
- return regeneratorRuntime.wrap(function (t) {
- while (1) switch (t.prev = t.next) {
- case 0:
- return this.loading = !0,
- t.next = 3,
- this.$http.get("goods", {
- params: this.constraints
- });
- case 3:
- this.goods = t.sent.data,
- this.loading = !1;
- case 5:
- case "end":
- return t.stop()
- }
- }, t, this)
- }));
- function e() {
- return t.apply(this, arguments)
- }
- return e
- }(),
- purchase: function () {
- var t = Object(m["a"])(regeneratorRuntime.mark(function t() {
- var e;
- return regeneratorRuntime.wrap(function (t) {
- while (1) switch (t.prev = t.next) {
- case 0:
- return t.next = 2,
- this.$http.post("goods/".concat(this.currentGood.id, "/purchase"), {
- amount: this.amount
- });
- case 2:
- e = t.sent.data.content,
- this.$root.user.balance -= this.currentGood.price * this.amount,
- this.currentGood = !1,
- this.recievedFlag = e;
- case 6:
- case "end":
- return t.stop()
- }
- }, t, this)
- }));
- function e() {
- return t.apply(this, arguments)
- }
- return e
- }()
- },
- watch: {
- constraints: {
- handler: function () {
- this.refresh()
- },
- deep: !0
- }
- },
- created: function () {
- var t = Object(m["a"])(regeneratorRuntime.mark(function t() {
- return regeneratorRuntime.wrap(function (t) {
- while (1) switch (t.prev = t.next) {
- case 0:
- return this.$root.user || this.$router.replace({
- name: "auth"
- }),
- t.next = 3,
- this.refresh();
- case 3:
- case "end":
- return t.stop()
- }
- }, t, this)
- }));
- function e() {
- return t.apply(this, arguments)
- }
- return e
- }()
- },
- f = h,
- v = (n("21bb"), Object(i["a"])(f, d, p, !1, null, null, null)),
- g = v.exports,
- _ = function () {
- var t = this,
- e = t.$createElement,
- n = t._self._c || e;
- return n("div", [n("header", [n("div", {
- staticClass: "ui large top fixed menu"
- }, [n("div", {
- staticClass: "ui container"
- }, [t._m(0), n("div", {
- staticClass: "right menu "
- }, [t.$root.user ? [n("div", {
- staticClass: "item"
- }, [n("img", {
- staticClass: "ui mini circular image",
- attrs: {
- src: "https://semantic-ui.com/images/avatar2/large/patrick.png"
- }
- }), n("div", {
- staticClass: "content",
- staticStyle: {
- "margin-left": "1rem"
- }
- }, [n("div", {
- staticClass: "ui sub header"
- }, [t._v(t._s(t.$root.user.name))]), t._v("\n " + t._s(t.$root.user.email) + "\n ")])]), n("div", {
- staticClass: "item"
- }, [n("span", {
- staticClass: "ui green header"
- }, [t._v(t._s(t.$root.user.balance || "150") + " $")])]), n("div", {
- staticClass: "item"
- }, [n("a", {
- staticClass: "ui button",
- on: {
- click: function (e) {
- return t.logout()
- }
- }
- }, [t._v("Log out")])])] : [n("div", {
- staticClass: "item"
- }, [n("router-link", {
- staticClass: "ui button",
- attrs: {
- to: {
- name: "auth"
- }
- }
- }, [t._v("Log in")])], 1), n("div", {
- staticClass: "item"
- }, [n("router-link", {
- staticClass: "ui primary button",
- attrs: {
- to: {
- name: "auth"
- }
- }
- }, [t._v("Sign Up")])], 1)]], 2)])])]), n("main", [n("div", {
- staticClass: "pusher"
- }, [n("router-view")], 1)]), t._m(1)])
- },
- b = [function () {
- var t = this,
- e = t.$createElement,
- n = t._self._c || e;
- return n("span", {
- staticClass: "logo"
- }, [n("span", {
- staticClass: "alt"
- }, [t._v("Flag")]), t._v("Express")])
- },
- function () {
- var t = this,
- e = t.$createElement,
- n = t._self._c || e;
- return n("footer", {
- staticClass: "ui inverted vertical footer segment",
- staticStyle: {
- "text-align": "center"
- }
- }, [n("span", [t._v("FlagExpress | 2019")])])
- }],
- y = {
- name: "Layout",
- methods: {
- logout: function () {
- this.$router.replace({
- name: "auth"
- }),
- this.$root.user = void 0
- }
- }
- },
- C = y,
- w = (n("ebfd"), Object(i["a"])(C, _, b, !1, null, "160df892", null)),
- x = w.exports;
- r["a"].use(l["a"]);
- var $ = new l["a"]({
- mode: "history",
- base: "/",
- routes: [{
- path: "/auth",
- name: "auth",
- component: function () {
- return n.e("chunk-663e2646").then(n.bind(null, "a55b"))
- }
- },
- {
- path: "",
- component: x,
- children: [{
- path: "/",
- name: "home",
- component: g
- }]
- }]
- }),
- k = n("92d5"),
- j = n.n(k),
- O = n("bc3a"),
- E = n.n(O),
- P = n("a7fe"),
- G = n.n(P);
- E.a.defaults.baseURL = "/api/",
- r["a"].use(j.a),
- r["a"].use(G.a, E.a),
- r["a"].config.productionTip = !1,
- new r["a"]({
- router: $,
- render: function (t) {
- return t(c)
- },
- data: {
- user: void 0
- },
- created: function () {
- var t = this;
- this.$http.get("me").then(function (e) {
- var n = e.data;
- t.$root.user = n
- }).
- catch (function (e) {
- t.$router.replace({
- name: "auth"
- })
- })
- }
- }).$mount("#app")
- },
- "5c0b": function (t, e, n) {
- "use strict";
- var r = n("5e27"),
- a = n.n(r);
- a.a
- },
- "5e27": function (t, e, n) {},
- "6f03": function (t, e, n) {},
- bcc9: function (t, e, n) {},
- ebfd: function (t, e, n) {
- "use strict";
- var r = n("6f03"),
- a = n.n(r);
- a.a
- }
- });
- //# sourceMappingURL=app.911db34a.js.map
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement