UNPKG

3.31 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory(require("./actions.js"));
4 else if(typeof define === 'function' && define.amd)
5 define(["./actions.js"], factory);
6 else if(typeof exports === 'object')
7 exports["plugins.js"] = factory(require("./actions.js"));
8 else
9 root["plugins.js"] = factory(root["./actions.js"]);
10})(this, function(__WEBPACK_EXTERNAL_MODULE_13__) {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId])
20/******/ return installedModules[moduleId].exports;
21
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ exports: {},
25/******/ id: moduleId,
26/******/ loaded: false
27/******/ };
28
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
32/******/ // Flag the module as loaded
33/******/ module.loaded = true;
34
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38
39
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45
46/******/ // __webpack_public_path__
47/******/ __webpack_require__.p = "";
48
49/******/ // Load entry module and return exports
50/******/ return __webpack_require__(0);
51/******/ })
52/************************************************************************/
53/******/ ({
54
55/***/ 0:
56/***/ function(module, exports, __webpack_require__) {
57
58 'use strict';
59
60 Object.defineProperty(exports, "__esModule", {
61 value: true
62 });
63 exports.dispatchInitialShell = undefined;
64
65 var _actions = __webpack_require__(13);
66
67 var _actions2 = _interopRequireDefault(_actions);
68
69 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
70
71 var dispatchInitialShell = exports.dispatchInitialShell = function dispatchInitialShell(ctx, dispatch) {
72 // If user is a bot, or if user has a "nojs" querystring or cookie, do full
73 // server-side rendering. Otherwise, use logic to bypass API requests.
74 var isBot = (ctx.headers['user-agent'] || '').indexOf('bot') > -1;
75 var hasNoJsCookie = !!ctx.cookies.get('nojs');
76 var hasNoJsQuerystring = !!ctx.query.nojs;
77
78 // Use should get a shell if not a bot and has not asked for the no-js version
79 // via querystring or cookie.
80 var useShell = !(isBot || hasNoJsCookie || hasNoJsQuerystring);
81
82 // If the user is a bot or has the querystring, but doesn't have a cookie, set
83 // a cookie for next time for 30 days.
84 if (!useShell && !hasNoJsCookie) {
85 var expires = new Date();
86 expires.setDate(expires.getDate() + 30);
87
88 ctx.cookies.set('shell', 'false', {
89 expires: expires
90 });
91 }
92
93 dispatch(_actions2.default.setShell(useShell));
94 };
95
96/***/ },
97
98/***/ 13:
99/***/ function(module, exports) {
100
101 module.exports = __WEBPACK_EXTERNAL_MODULE_13__;
102
103/***/ }
104
105/******/ })
106});
107;
\No newline at end of file