UNPKG

vue-bbs

Version:

Serverless comment system in Vue

1 lines 10.2 kB
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["vue-bbs"]=t():e["vue-bbs"]=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=69)}({1:function(e,t,n){"use strict";function r(e,t,n,r,o,s,i,a){var c,l="function"===typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),r&&(l.functional=!0),s&&(l._scopeId="data-v-"+s),i?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=c):o&&(c=a?function(){o.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(l.functional){l._injectStyles=c;var u=l.render;l.render=function(e,t){return c.call(t),u(e,t)}}else{var d=l.beforeCreate;l.beforeCreate=d?[].concat(d,c):[c]}return{exports:e,options:l}}n.d(t,"a",(function(){return r}))},15:function(e,t,n){var r=n(35);r.__esModule&&(r=r.default),"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n(3).default)("734e1472",r,!0,{})},18:function(e,t,n){var r=n(33);r.__esModule&&(r=r.default),"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n(3).default)("59bf309a",r,!0,{})},2:function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"===typeof btoa){var o=function(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(t);return"/*# ".concat(n," */")}(r),s=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return[n].concat(s).concat([o]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"===typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var s=0;s<this.length;s++){var i=this[s][0];null!=i&&(o[i]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);r&&o[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},3:function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},o=0;o<t.length;o++){var s=t[o],i=s[0],a={id:e+":"+o,css:s[1],media:s[2],sourceMap:s[3]};r[i]?r[i].parts.push(a):n.push(r[i]={id:i,parts:[a]})}return n}n.r(t),n.d(t,"default",(function(){return b}));var o="undefined"!==typeof document;if("undefined"!==typeof DEBUG&&DEBUG&&!o)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var s={},i=o&&(document.head||document.getElementsByTagName("head")[0]),a=null,c=0,l=!1,u=function(){},d=null,f="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function b(e,t,n,o){l=n,d=o||{};var i=r(e,t);return p(i),function(t){for(var n=[],o=0;o<i.length;o++){var a=i[o];(c=s[a.id]).refs--,n.push(c)}t?p(i=r(e,t)):i=[];for(o=0;o<n.length;o++){var c;if(0===(c=n[o]).refs){for(var l=0;l<c.parts.length;l++)c.parts[l]();delete s[c.id]}}}}function p(e){for(var t=0;t<e.length;t++){var n=e[t],r=s[n.id];if(r){r.refs++;for(var o=0;o<r.parts.length;o++)r.parts[o](n.parts[o]);for(;o<n.parts.length;o++)r.parts.push(h(n.parts[o]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{var i=[];for(o=0;o<n.parts.length;o++)i.push(h(n.parts[o]));s[n.id]={id:n.id,refs:1,parts:i}}}}function v(){var e=document.createElement("style");return e.type="text/css",i.appendChild(e),e}function h(e){var t,n,r=document.querySelector('style[data-vue-ssr-id~="'+e.id+'"]');if(r){if(l)return u;r.parentNode.removeChild(r)}if(f){var o=c++;r=a||(a=v()),t=m.bind(null,r,o,!1),n=m.bind(null,r,o,!0)}else r=v(),t=y.bind(null,r),n=function(){r.parentNode.removeChild(r)};return t(e),function(r){if(r){if(r.css===e.css&&r.media===e.media&&r.sourceMap===e.sourceMap)return;t(e=r)}else n()}}var g=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}();function m(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=g(t,o);else{var s=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(s,i[t]):e.appendChild(s)}}function y(e,t){var n=t.css,r=t.media,o=t.sourceMap;if(r&&e.setAttribute("media",r),d.ssrId&&e.setAttribute("data-vue-ssr-id",t.id),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}},33:function(e,t,n){(t=n(2)(!1)).push([e.i,".serverless-bbs{--bbs-background-color: #fff;--bbs-primary: #199ed9;--bbs-secondary: #d2791b;--bbs-text-primary: rgba(0, 0, 0, 0.87);--bbs-text-secondary: rgba(0, 0, 0, 0.6);--bbs-text-muted: rgba(0, 0, 0, 0.18);--bbs-separator-color: #c1c1c1;--bbs-separator-background: #f1f1f1;--bbs-success-color: #4caf50;--bbs-error-color: #b71c1c;--bbs-info-color: #2196f3;--bbs-warning-color: #FFC107}*{margin:0;padding:0;box-sizing:border-box}.serverless-bbs{background-color:var(--bbs-background-color);color:var(--bbs-text-primary)}.serverless-bbs a{position:relative;text-decoration:none;color:var(--bbs-info-color)}.serverless-bbs a:hover{color:var(--bbs-primary)}.serverless-bbs .position-relative{position:relative}.serverless-bbs .position-absolute{position:absolute}.serverless-bbs .text-md{font-size:1rem}.serverless-bbs .text-sm{font-size:.8rem}.serverless-bbs .text-left{text-align:left}.serverless-bbs .text-center{text-align:center}.serverless-bbs .text-right{text-align:right}.serverless-bbs .text-secondary{color:var(--bbs-text-secondary)}.serverless-bbs .text-muted{color:var(--bbs-text-muted)}.serverless-bbs .pl-1{padding-left:4px}.serverless-bbs .pl-2{padding-left:8px}.serverless-bbs .mt-2{margin-top:8px}.serverless-bbs .mr-2{margin-right:8px}.serverless-bbs .mr-4{margin-right:16px}.serverless-bbs .highlight-ele{background-color:var(--bbs-primary) !important;color:#fff}.serverless-bbs .highlight-ele *{background-color:var(--bbs-primary) !important;color:#fff}",""]),e.exports=t},34:function(e,t,n){"use strict";n(15)},35:function(e,t,n){(t=n(2)(!1)).push([e.i,"\n.lds-ring[data-v-9b15224e] {\n display: inline-block;\n position: relative;\n background: inherit;\n /*width: 80px;*/\n /*height: 80px;*/\n}\n.lds-ring div[data-v-9b15224e] {\n box-sizing: border-box;\n display: block;\n position: absolute;\n width: 80%;\n height: 80%;\n margin: 10%;\n border: 3px solid var(--bbs-primary);\n border-radius: 50%;\n animation: lds-ring-data-v-9b15224e 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n border-color: var(--bbs-primary) transparent transparent transparent;\n}\n.lds-ring div[data-v-9b15224e]:nth-child(1) {\n animation-delay: -0.45s;\n}\n.lds-ring div[data-v-9b15224e]:nth-child(2) {\n animation-delay: -0.3s;\n}\n.lds-ring div[data-v-9b15224e]:nth-child(3) {\n animation-delay: -0.15s;\n}\n@keyframes lds-ring-data-v-9b15224e {\n0% {\n transform: rotate(0deg);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n\n",""]),e.exports=t},4:function(e,t,n){"use strict";var r={name:"Loading",props:{size:{default:64}}},o=(n(34),n(1)),s=Object(o.a)(r,(function(){var e=this.$createElement,t=this._self._c||e;return t("div",{staticClass:"lds-ring serverless-bbs",style:{width:this.size+"px",height:this.size+"px"}},[t("div"),this._v(" "),t("div"),this._v(" "),t("div"),this._v(" "),t("div")])}),[],!1,null,"9b15224e",null);t.a=s.exports},69:function(e,t,n){"use strict";n.r(t);var r=n(9),o=n(4),s=(n(18),{name:"ServerlessBBSCounter",components:{Loading:o.a},extends:r.a,props:{uniqStr:{type:String,default:window.location.origin+window.location.pathname},size:{default:16}},data:function(){return{loading:!0,counts:0,loopTimer:null}},watch:{initialLoading:{immediate:!0,handler:function(e){e||this.init()}}},mounted:function(){var e=this;this.loopTimer=setInterval((function(){e.counts=e.$serverLessBBS.countMap.get(e.uniqStr)}),1e3)},destroyed:function(){clearInterval(this.loopTimer)},methods:{init:function(){var e=this;this.loadCounter({rootId:""}).then((function(t){return e.counts=t})).finally((function(){return e.loading=!1}))},loadCounter:function(){return this.fetchCounts(this.uniqStr)}}}),i=n(1),a=Object(i.a)(s,(function(){var e=this.$createElement,t=this._self._c||e;return this.loading||this.initialLoading?t("Loading",{attrs:{size:this.size}}):t("span",[this._v(this._s(this.counts))])}),[],!1,null,null,null);t.default=a.exports},9:function(e,t,n){"use strict";var r={name:"LayerInterface",data:function(){return{initialLoading:!0}},methods:{serverInit:function(){},fetchPageViews:function(e){},fetchCounts:function(e){},updateComment:function(e,t){},uploadComment:function(e){},fetchCurrentUser:function(){},fetchComments:function(e){}}},o=n(1),s=Object(o.a)(r,(function(){var e=this.$createElement;return(this._self._c||e)("div")}),[],!1,null,"22e30980",null);t.a=s.exports}})}));