├── .gitignore ├── src ├── assets │ ├── variables.scss │ ├── vue-easy-polls.scss │ └── poll.scss ├── index.js ├── plugin.js ├── PollCreator.vue └── PollView.vue ├── demo ├── schema.png ├── vue-easy-polls.png ├── vue-easy-polls-2.png ├── vue-easy-polls-3.png └── index.html ├── .babelrc ├── LICENSE ├── webpack.config.js ├── package.json ├── README.md └── dist ├── vue-easy-polls-plugin.js └── vue-easy-polls.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /src/assets/variables.scss: -------------------------------------------------------------------------------- 1 | $poll-primary: #90ee90; 2 | $poll-secondary: #ff0f00; -------------------------------------------------------------------------------- /src/assets/vue-easy-polls.scss: -------------------------------------------------------------------------------- 1 | @import "./variables.scss"; 2 | @import "./poll.scss"; -------------------------------------------------------------------------------- /demo/schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/updivision/vue-easy-polls/HEAD/demo/schema.png -------------------------------------------------------------------------------- /demo/vue-easy-polls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/updivision/vue-easy-polls/HEAD/demo/vue-easy-polls.png -------------------------------------------------------------------------------- /demo/vue-easy-polls-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/updivision/vue-easy-polls/HEAD/demo/vue-easy-polls-2.png -------------------------------------------------------------------------------- /demo/vue-easy-polls-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/updivision/vue-easy-polls/HEAD/demo/vue-easy-polls-3.png -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-2"], 3 | "plugins": ["transform-runtime"], 4 | "comments": false 5 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import PollView from './PollView.vue'; 2 | import PollCreator from './PollCreator.vue' 3 | 4 | const Poll = { 5 | PollView, 6 | PollCreator 7 | } 8 | 9 | export default Poll 10 | 11 | export { 12 | Poll, 13 | PollView, 14 | PollCreator 15 | } -------------------------------------------------------------------------------- /src/plugin.js: -------------------------------------------------------------------------------- 1 | import PollView from './PollView.vue'; 2 | import PollCreator from './PollCreator.vue' 3 | 4 | module.exports = { 5 | install: function (Vue, options) { 6 | Vue.component('poll-view', PollView); 7 | Vue.component('poll-creator', PollCreator); 8 | } 9 | }; -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | VueEasyPolls 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 |
19 | 20 |
21 | 22 |
23 | 33 | 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 UPDIVISION 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const merge = require('webpack-merge'); 3 | const path = require('path'); 4 | 5 | var config = { 6 | output: { 7 | path: path.resolve(__dirname + '/dist/'), 8 | }, 9 | module: { 10 | loaders: [ 11 | { 12 | test: /\.js$/, 13 | loader: 'babel', 14 | include: __dirname, 15 | exclude: /node_modules/ 16 | }, 17 | { 18 | test: /\.vue$/, 19 | loader: 'vue' 20 | }, 21 | { 22 | test: /\.css$/, 23 | loader: 'style!less!css' 24 | } 25 | ] 26 | }, 27 | vue: { 28 | loaders: { 29 | scss: 'style!css!sass' 30 | } 31 | }, 32 | externals: { 33 | moment: 'moment' 34 | }, 35 | plugins: [ 36 | new webpack.optimize.UglifyJsPlugin( { 37 | minimize : true, 38 | sourceMap : true, 39 | mangle: true, 40 | compress: { 41 | warnings: false 42 | } 43 | } ) 44 | ] 45 | }; 46 | 47 | 48 | module.exports = [ 49 | merge(config, { 50 | entry: path.resolve(__dirname + '/src/plugin.js'), 51 | output: { 52 | filename: 'vue-easy-polls-plugin.js', 53 | libraryTarget: 'window', 54 | library: 'VueEasyPolls', 55 | } 56 | }), 57 | merge(config, { 58 | entry: path.resolve(__dirname + '/src/index.js'), 59 | output: { 60 | filename: 'vue-easy-polls.js', 61 | libraryTarget: 'umd', 62 | library: 'vue-easy-polls', 63 | umdNamedDefine: true 64 | } 65 | }) 66 | ]; 67 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@updivision/vue-easy-polls", 3 | "version": "1.0.5", 4 | "description": "A Vue.js component for creating polls, voting and showing results. It’s easy to implement and easy to customize.", 5 | "main": "dist/vue-easy-polls.js", 6 | "scripts": { 7 | "build": "rimraf ./dist && webpack --config ./webpack.config.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/updivision/vue-easy-polls.git" 12 | }, 13 | "keywords": [ 14 | "vue.js", 15 | "vue-easy-polls", 16 | "vue", 17 | "votes", 18 | "vote", 19 | "poll", 20 | "polls", 21 | "opinion polling", 22 | "vue voting component", 23 | "vue polling component", 24 | "opinion voting", 25 | "creating polls vue component" 26 | ], 27 | "author": "UPDIVISION", 28 | "license": "MIT", 29 | "bugs": { 30 | "url": "https://github.com/updivision/vue-easy-polls/issues" 31 | }, 32 | "homepage": "https://github.com/updivision/vue-easy-polls#readme", 33 | "dependencies": { 34 | "axios": "^0.18.0" 35 | }, 36 | "devDependencies": { 37 | "babel-core": "^6.10.4", 38 | "babel-loader": "^6.2.4", 39 | "babel-plugin-transform-runtime": "^6.9.0", 40 | "babel-preset-es2015": "^6.9.0", 41 | "babel-preset-stage-2": "^6.11.0", 42 | "babel-runtime": "^6.9.2", 43 | "css-loader": "^0.28.11", 44 | "node-sass": "^4.9.2", 45 | "rimraf": "^2.6.1", 46 | "sass-loader": "^7.0.3", 47 | "style-loader": "^0.21.0", 48 | "vue": "^2.5.16", 49 | "vue-html-loader": "^1.2.3", 50 | "vue-loader": "^11.1.4", 51 | "vue-style-loader": "^2.0.3", 52 | "vue-template-compiler": "^2.2.1", 53 | "webpack": "1.13.1", 54 | "webpack-merge": "^4.1.0" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-easy-polls 2 | 3 | > A Vue.js component for creating polls, voting and showing results. It’s easy to implement and easy to customize. 4 | 5 | ### Demo 6 | See live demo [here](https://updivision.github.io/vue-easy-polls/) 7 | 8 | ## Prerequisites 9 | - [Vue.js 2](https://vuejs.org/) 10 | - [Axios](https://github.com/axios/axios) 11 | 12 | ## Installing 13 | 14 | Using npm: 15 | 16 | ```bash 17 | $ npm i @updivision/vue-easy-polls 18 | ``` 19 | 20 | ### Example (NPM) 21 | 22 | ```vue 23 | 30 | 31 | 42 | ``` 43 | 44 | ## Customize 45 | 46 | ```vue 47 | 54 | 55 | 66 | 67 | 74 | 75 | ``` 76 | 77 | ## Poll Attributes 78 | #### PollCreate.vue 79 | 80 | | Attribute | Description | Accepted values | HTTP verb | Required | Default | 81 | | --------- | ----------- | --------------- | --------- | -------- | ------- | 82 | | savePollUrl | This is the endpoint where your server will save the current poll | URL (string) | POST | required | - | 83 | 84 | #### PollView.vue 85 | 86 | | Attribute | Description | Accepted values | HTTP verb | Required | Default | 87 | | --------- | ----------- | --------------- | --------- | -------- | :-----: | 88 | | saveVoteUrl | This is the endpoint where your server will save the vote for the current poll | URL (string) | POST | required | - | 89 | | getPollUrl | This is the endpoint from where your server will return the poll | URL (string) | GET | required | - | 90 | 91 | ## Database schema example 92 | ![Database schema](https://github.com/updivision/vue-easy-polls/blob/master/demo/schema.png?raw=true "Database schema") 93 | 94 | ## Screenshots 95 | ![vue-easy-polls](https://github.com/updivision/vue-easy-polls/blob/master/demo/vue-easy-polls.png?raw=true "vue-easy-polls") 96 | 97 | ![vue-easy-polls](https://github.com/updivision/vue-easy-polls/blob/master/demo/vue-easy-polls-2.png?raw=true "vue-easy-polls") 98 | 99 | ![vue-easy-polls](https://github.com/updivision/vue-easy-polls/blob/master/demo/vue-easy-polls-3.png?raw=true "vue-easy-polls") 100 | 101 | ## Contributors 102 | - [Stanciu Gabriel](https://github.com/gabistanciu) 103 | 104 | ## LICENSE 105 | [MIT License](https://github.com/updivision/vue-easy-polls/blob/master/LICENSE) 106 | -------------------------------------------------------------------------------- /src/PollCreator.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 143 | 144 | 147 | -------------------------------------------------------------------------------- /src/PollView.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 171 | 172 | 175 | -------------------------------------------------------------------------------- /src/assets/poll.scss: -------------------------------------------------------------------------------- 1 | @keyframes popup { 2 | from { 3 | opacity: 0; 4 | } 5 | to { 6 | opacity: 1; 7 | } 8 | } 9 | 10 | @keyframes shownhide { 11 | 0% { 12 | opacity: 0; 13 | } 14 | 50% { 15 | opacity: 1; 16 | } 17 | 100% { 18 | opacity: 0; 19 | } 20 | } 21 | 22 | .poll-view { 23 | font-family: Arial, Helvetica, sans-serif; 24 | max-width: 500px; 25 | margin: auto; 26 | background-color: #fff; 27 | position: relative; 28 | transition: all 0.2s ease-in-out; 29 | border-top: 6px solid $poll-primary; 30 | &__title { 31 | text-align: center; 32 | font-size: 32px; 33 | font-weight: 500; 34 | padding: 20px 16px; 35 | } 36 | &__inner { 37 | padding: 16px; 38 | } 39 | &__help { 40 | font-size: 22px; 41 | padding-bottom: 20px; 42 | } 43 | &__question { 44 | padding-bottom: 30px; 45 | input { 46 | box-sizing: border-box; 47 | background-color: transparent; 48 | width: 100%; 49 | color: #333; 50 | border: 2px solid #4e4c4b8f; 51 | border-radius: 0px; 52 | padding: 5px 40px 5px 10px; 53 | line-height: 30px; 54 | font-size: 30px; 55 | transition: border 0.2s ease-in-out; 56 | &:focus { 57 | outline: none; 58 | border: 2px solid darken($poll-primary, 10%); 59 | } 60 | } 61 | } 62 | &__votes { 63 | .answer { 64 | padding-bottom: 5px; 65 | display: block; 66 | position: relative; 67 | background-color: #fff; 68 | } 69 | } 70 | &__answers { 71 | .answer { 72 | animation-name: popup; 73 | animation-duration: 1s; 74 | padding-bottom: 5px; 75 | display: block; 76 | position: relative; 77 | background-color: #fff; 78 | .delete { 79 | position: absolute; 80 | bottom: 10px; 81 | right: 0; 82 | background-color: #fff; 83 | color: $poll-secondary; 84 | font-weight: 500; 85 | line-height: 14px; 86 | font-size: 14px; 87 | &:hover { 88 | cursor: pointer; 89 | } 90 | } 91 | input { 92 | box-sizing: border-box; 93 | background-color: transparent; 94 | width: 100%; 95 | color: #333; 96 | border: none; 97 | border-bottom: 1px solid #4e4c4b8f; 98 | border-radius: 0px; 99 | padding: 5px 40px 5px 10px; 100 | line-height: 24px; 101 | font-size: 24px; 102 | transition: border 0.2s ease-in-out; 103 | &:focus { 104 | outline: none; 105 | border-bottom: 3px solid $poll-primary; 106 | } 107 | } 108 | } 109 | } 110 | &__options { 111 | padding: 16px 0px; 112 | } 113 | &__results { 114 | padding: 16px; 115 | .title { 116 | font-size: 24px; 117 | .percent { 118 | font-size: 16px; 119 | } 120 | .votes { 121 | font-size: 16px; 122 | } 123 | } 124 | .bar { 125 | width: 100%; 126 | height: 20px; 127 | background-color: #eee; 128 | position: relative; 129 | div { 130 | position: absolute; 131 | left: 0; 132 | top: 0; 133 | z-index: 99; 134 | background-color: $poll-primary; 135 | bottom: 0; 136 | } 137 | } 138 | } 139 | &__submit { 140 | text-align: center; 141 | padding: 16px 0px; 142 | button { 143 | color: #fff; 144 | background-color: $poll-primary; 145 | border: 1px solid lighten($poll-primary, 15%); 146 | padding: 10px 16px; 147 | font-size: 30px; 148 | transition: background-color 0.2s ease-in-out; 149 | &:hover { 150 | cursor: pointer; 151 | background-color: darken($poll-primary, 15%); 152 | } 153 | } 154 | } 155 | &__info { 156 | position: absolute; 157 | top: 0; 158 | left: 0; 159 | right: 0; 160 | bottom: 0; 161 | z-index: 999; 162 | animation-name: shownhide; 163 | animation-duration: 3s; 164 | &.success { 165 | background-color: lighten($poll-primary, 20%); 166 | div { 167 | color: darken($poll-primary, 30%); 168 | } 169 | } 170 | &.error { 171 | background-color: lighten($poll-secondary, 20%); 172 | div { 173 | color: darken($poll-secondary, 30%); 174 | } 175 | } 176 | div { 177 | position: absolute; 178 | left: 50%; 179 | top: 50%; 180 | transform: translate(-50%, -50%); 181 | text-align: center; 182 | background-color: #fff; 183 | border-radius: 50%; 184 | width: 100px; 185 | height: 100px; 186 | font-size: 24px; 187 | line-height: 100px; 188 | } 189 | } 190 | &__footer { 191 | text-align: center; 192 | color: #333; 193 | padding-bottom: 5px; 194 | font-size: 14px; 195 | opacity: 0.6; 196 | a { 197 | color: #1b98cf; 198 | text-decoration: none; 199 | } 200 | } 201 | .checkbox { 202 | display: block; 203 | position: relative; 204 | padding-left: 35px; 205 | margin-bottom: 12px; 206 | cursor: pointer; 207 | font-size: 20px; 208 | -webkit-user-select: none; 209 | -moz-user-select: none; 210 | -ms-user-select: none; 211 | user-select: none; 212 | input { 213 | position: absolute; 214 | opacity: 0; 215 | cursor: pointer; 216 | } 217 | .checkmark { 218 | position: absolute; 219 | top: 0; 220 | left: 0; 221 | height: 25px; 222 | width: 25px; 223 | background-color: #eee; 224 | &:after { 225 | content: ""; 226 | position: absolute; 227 | display: none; 228 | left: 9px; 229 | top: 5px; 230 | width: 5px; 231 | height: 10px; 232 | border: solid white; 233 | border-width: 0 3px 3px 0; 234 | -webkit-transform: rotate(45deg); 235 | -ms-transform: rotate(45deg); 236 | transform: rotate(45deg); 237 | } 238 | } 239 | &:hover { 240 | input ~ .checkmark { 241 | background-color: #ccc; 242 | } 243 | } 244 | input:checked ~ .checkmark { 245 | background-color: $poll-primary; 246 | &:after { 247 | display: block; 248 | } 249 | } 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /dist/vue-easy-polls-plugin.js: -------------------------------------------------------------------------------- 1 | window.VueEasyPolls=function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var r=o(1),i=n(r),s=o(37),a=n(s);e.exports={install:function(e,t){e.component("poll-view",i["default"]),e.component("poll-creator",a["default"])}}},function(e,t,o){o(2);var n=o(7)(o(8),o(36),null,null);e.exports=n.exports},function(e,t,o){var n=o(3);"string"==typeof n&&(n=[[e.id,n,""]]);var r,i={hmr:!0};i.transform=r,i.insertInto=void 0;o(5)(n,i);n.locals&&(e.exports=n.locals)},function(e,t,o){t=e.exports=o(4)(!1),t.push([e.id,'@keyframes popup{0%{opacity:0}to{opacity:1}}@keyframes shownhide{0%{opacity:0}50%{opacity:1}to{opacity:0}}.poll-view{font-family:Arial,Helvetica,sans-serif;max-width:500px;margin:auto;background-color:#fff;position:relative;transition:all .2s ease-in-out;border-top:6px solid #90ee90}.poll-view__title{text-align:center;font-size:32px;font-weight:500;padding:20px 16px}.poll-view__inner{padding:16px}.poll-view__help{font-size:22px;padding-bottom:20px}.poll-view__question{padding-bottom:30px}.poll-view__question input{box-sizing:border-box;background-color:transparent;width:100%;color:#333;border:2px solid #4e4c4b8f;border-radius:0;padding:5px 40px 5px 10px;line-height:30px;font-size:30px;transition:border .2s ease-in-out}.poll-view__question input:focus{outline:none;border:2px solid #64e764}.poll-view__answers .answer,.poll-view__votes .answer{padding-bottom:5px;display:block;position:relative;background-color:#fff}.poll-view__answers .answer{animation-name:popup;animation-duration:1s}.poll-view__answers .answer .delete{position:absolute;bottom:10px;right:0;background-color:#fff;color:#ff0f00;font-weight:500;line-height:14px;font-size:14px}.poll-view__answers .answer .delete:hover{cursor:pointer}.poll-view__answers .answer input{box-sizing:border-box;background-color:transparent;width:100%;color:#333;border:none;border-bottom:1px solid #4e4c4b8f;border-radius:0;padding:5px 40px 5px 10px;line-height:24px;font-size:24px;transition:border .2s ease-in-out}.poll-view__answers .answer input:focus{outline:none;border-bottom:3px solid #90ee90}.poll-view__options{padding:16px 0}.poll-view__results{padding:16px}.poll-view__results .title{font-size:24px}.poll-view__results .title .percent,.poll-view__results .title .votes{font-size:16px}.poll-view__results .bar{width:100%;height:20px;background-color:#eee;position:relative}.poll-view__results .bar div{position:absolute;left:0;top:0;z-index:99;background-color:#90ee90;bottom:0}.poll-view__submit{text-align:center;padding:16px 0}.poll-view__submit button{color:#fff;background-color:#90ee90;border:1px solid #d2f8d2;padding:10px 16px;font-size:30px;transition:background-color .2s ease-in-out}.poll-view__submit button:hover{cursor:pointer;background-color:#4ee44e}.poll-view__info{position:absolute;top:0;left:0;right:0;bottom:0;z-index:999;animation-name:shownhide;animation-duration:3s}.poll-view__info.success{background-color:#e8fce8}.poll-view__info.success div{color:#1ec71e}.poll-view__info.error{background-color:#ff6f66}.poll-view__info.error div{color:#660600}.poll-view__info div{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);text-align:center;background-color:#fff;border-radius:50%;width:100px;height:100px;font-size:24px;line-height:100px}.poll-view__footer{text-align:center;color:#333;padding-bottom:5px;font-size:14px;opacity:.6}.poll-view__footer a{color:#1b98cf;text-decoration:none}.poll-view .checkbox{display:block;position:relative;padding-left:35px;margin-bottom:12px;cursor:pointer;font-size:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.poll-view .checkbox input{position:absolute;opacity:0;cursor:pointer}.poll-view .checkbox .checkmark{position:absolute;top:0;left:0;height:25px;width:25px;background-color:#eee}.poll-view .checkbox .checkmark:after{content:"";position:absolute;display:none;left:9px;top:5px;width:5px;height:10px;border:solid #fff;border-width:0 3px 3px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.poll-view .checkbox:hover input~.checkmark{background-color:#ccc}.poll-view .checkbox input:checked~.checkmark{background-color:#90ee90}.poll-view .checkbox input:checked~.checkmark:after{display:block}',""])},function(e,t){function o(e,t){var o=e[1]||"",r=e[3];if(!r)return o;if(t&&"function"==typeof btoa){var i=n(r),s=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[o].concat(s).concat([i]).join("\n")}return[o].join("\n")}function n(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,"+t;return"/*# "+o+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=o(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,o){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},r=0;r=0&&_.splice(t,1)}function a(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),c(t,e.attrs),i(e,t),t}function l(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",c(t,e.attrs),i(e,t),t}function c(e,t){Object.keys(t).forEach(function(o){e.setAttribute(o,t[o])})}function u(e,t){var o,n,r,i;if(t.transform&&e.css){if(i=t.transform(e.css),!i)return function(){};e.css=i}if(t.singleton){var c=g++;o=b||(b=a(t)),n=p.bind(null,o,c,!1),r=p.bind(null,o,c,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(o=l(t),n=d.bind(null,o,t),r=function(){s(o),o.href&&URL.revokeObjectURL(o.href)}):(o=a(t),n=f.bind(null,o),r=function(){s(o)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}function p(e,t,o,n){var r=o?"":n.css;if(e.styleSheet)e.styleSheet.cssText=k(t,r);else{var i=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function f(e,t){var o=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}function d(e,t,o){var n=o.css,r=o.sourceMap,i=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||i)&&(n=y(n)),r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var s=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}var h={},v=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},w=v(function(){return window&&document&&document.all&&!window.atob}),m=function(e){return document.querySelector(e)},x=function(e){var t={};return function(e){if("function"==typeof e)return e();if("undefined"==typeof t[e]){var o=m.call(this,e);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(n){o=null}t[e]=o}return t[e]}}(),b=null,g=0,_=[],y=o(6);e.exports=function(e,t){t=t||{},t.attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=w()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var o=r(e,t);return n(o,t),function(e){for(var i=[],s=0;sPHP framework?",answers:[{id:1,answer:"Laravel",votes:14021},{id:2,answer:"Symfony",votes:3210},{id:3,answer:"Phalcon",votes:3231},{id:4,answer:"FuelPhp",votes:2004},{id:5,answer:"Zend Framework",votes:3132},{id:6,answer:"PHPixie",votes:2131},{id:7,answer:"CakePHP",votes:1222}],multipleVotes:!0},totalVotes:0,result:!1,success:null,isValid:!1}},mounted:function(){var e=this;i["default"].get(this.getPollUrl,{maxContentLength:2e3}).then(function(t){e.poll=t})["catch"](function(e){console.log(e),e.request.res.destroy()})},methods:{vote:function(){var e=this;this.validate(),this.demo&&this.isValid?(this.alert(!0),this.calculateTotalVotes()):this.isValid?i["default"].post(this.saveVoteUrl,{pollId:this.poll.id,votes:votes},{maxContentLength:2e3}).then(function(t){e.calculateTotalVotes(),e.alert(!0)})["catch"](function(t){e.alert(!1),t.request.res.destroy()}):this.alert(!1)},multipleCheck:function(e){if(1!=this.poll.multipleVotes){var t=this.poll.answers.filter(function(e){return 1==e.voted}).length;t>1&&(this.poll.answers[e].voted=!1)}},validate:function(){var e=this.poll.answers.filter(function(e){return 1==e.voted}).map(function(e){return e.id}).length;e>0?e>1?1==this.poll.multipleVotes?this.isValid=!0:this.isValid=!1:this.isValid=!0:this.isValid=!1},alert:function(e){var t=this;this.success=e,setTimeout(function(){t.success=null,t.result=e},1500)},calculatePercent:function(e){return parseInt(1e4*e/this.totalVotes)/100},calculateTotalVotes:function(){var e=this;this.poll.answers.forEach(function(t){e.totalVotes+=t.votes,t.voted&&(e.totalVotes+=1)})}}}},function(e,t,o){e.exports=o(10)},function(e,t,o){"use strict";function n(e){var t=new s(e),o=i(s.prototype.request,t);return r.extend(o,s.prototype,t),r.extend(o,t),o}var r=o(11),i=o(12),s=o(14),a=o(15),l=n(a);l.Axios=s,l.create=function(e){return n(r.merge(a,e))},l.Cancel=o(33),l.CancelToken=o(34),l.isCancel=o(30),l.all=function(e){return Promise.all(e)},l.spread=o(35),e.exports=l,e.exports["default"]=l},function(e,t,o){"use strict";function n(e){return"[object Array]"===C.call(e)}function r(e){return"[object ArrayBuffer]"===C.call(e)}function i(e){return"undefined"!=typeof FormData&&e instanceof FormData}function s(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function a(e){return"string"==typeof e}function l(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function u(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===C.call(e)}function f(e){return"[object File]"===C.call(e)}function d(e){return"[object Blob]"===C.call(e)}function h(e){return"[object Function]"===C.call(e)}function v(e){return u(e)&&h(e.pipe)}function w(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function m(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function x(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function b(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),n(e))for(var o=0,r=e.length;o 5 | * @license MIT 6 | */ 7 | e.exports=function(e){return null!=e&&(o(e)||n(e)||!!e._isBuffer)}},function(e,t,o){"use strict";function n(e){this.defaults=e,this.interceptors={request:new s,response:new s}}var r=o(15),i=o(11),s=o(27),a=o(28);n.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(r,{method:"get"},this.defaults,e),e.method=e.method.toLowerCase();var t=[a,void 0],o=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)o=o.then(t.shift(),t.shift());return o},i.forEach(["delete","get","head","options"],function(e){n.prototype[e]=function(t,o){return this.request(i.merge(o||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){n.prototype[e]=function(t,o,n){return this.request(i.merge(n||{},{method:e,url:t,data:o}))}}),e.exports=n},function(e,t,o){(function(t){"use strict";function n(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function r(){var e;return"undefined"!=typeof XMLHttpRequest?e=o(18):"undefined"!=typeof t&&(e=o(18)),e}var i=o(11),s=o(17),a={"Content-Type":"application/x-www-form-urlencoded"},l={adapter:r(),transformRequest:[function(e,t){return s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(n(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(n(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){l.headers[e]={}}),i.forEach(["post","put","patch"],function(e){l.headers[e]=i.merge(a)}),e.exports=l}).call(t,o(16))},function(e,t){function o(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(e){if(u===setTimeout)return setTimeout(e,0);if((u===o||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function i(e){if(p===clearTimeout)return clearTimeout(e);if((p===n||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function s(){v&&d&&(v=!1,d.length?h=d.concat(h):w=-1,h.length&&a())}function a(){if(!v){var e=r(s);v=!0;for(var t=h.length;t;){for(d=h,h=[];++w1)for(var o=1;o=0)return;"set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([o]):s[t]=s[t]?s[t]+", "+o:o}}),s):s}},function(e,t,o){"use strict";var n=o(11);e.exports=n.isStandardBrowserEnv()?function(){function e(e){var t=e;return o&&(r.setAttribute("href",t),t=r.href),r.setAttribute("href",t),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}var t,o=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");return t=e(window.location.href),function(o){var r=n.isString(o)?e(o):o;return r.protocol===t.protocol&&r.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function o(){this.message="String contains an invalid character"}function n(e){for(var t,n,i=String(e),s="",a=0,l=r;i.charAt(0|a)||(l="=",a%1);s+=l.charAt(63&t>>8-a%1*8)){if(n=i.charCodeAt(a+=.75),n>255)throw new o;t=t<<8|n}return s}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.prototype=new Error,o.prototype.code=5,o.prototype.name="InvalidCharacterError",e.exports=n},function(e,t,o){"use strict";var n=o(11);e.exports=n.isStandardBrowserEnv()?function(){return{write:function(e,t,o,r,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(o)&&a.push("expires="+new Date(o).toGMTString()),n.isString(r)&&a.push("path="+r),n.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,o){"use strict";function n(){this.handlers=[]}var r=o(11);n.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){r.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=n},function(e,t,o){"use strict";function n(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var r=o(11),i=o(29),s=o(30),a=o(15),l=o(31),c=o(32);e.exports=function(e){n(e),e.baseURL&&!l(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||a.adapter;return t(e).then(function(t){return n(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return s(t)||(n(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,o){"use strict";var n=o(11);e.exports=function(e,t,o){return n.forEach(o,function(o){e=o(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,e.exports=o},function(e,t,o){"use strict";function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var o=this;e(function(e){o.reason||(o.reason=new r(e),t(o.reason))})}var r=o(33);n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var e,t=new n(function(t){e=t});return{token:t,cancel:e}},e.exports=n},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"poll-view"},[o("div",{staticClass:"poll-view__title",domProps:{innerHTML:e._s(e.poll.question)}}),e._v(" "),e.result?e._e():o("div",{staticClass:"poll-view__inner"},[o("div",{staticClass:"poll-view__help"},[e.poll.multipleVotes?o("span",[e._v("Choose many answers:")]):o("span",[e._v("Choose one answer:")])]),e._v(" "),o("div",{staticClass:"poll-view__votes"},e._l(e.poll.answers,function(t,n){return o("div",{key:t.id,staticClass:"answer"},[o("label",{staticClass:"checkbox"},[e._v(e._s(t.answer)+"\n "),o("input",{directives:[{name:"model",rawName:"v-model",value:e.poll.answers[n].voted,expression:"poll.answers[index].voted"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.poll.answers[n].voted)?e._i(e.poll.answers[n].voted,null)>-1:e.poll.answers[n].voted},on:{change:[function(t){var o=e.poll.answers[n].voted,r=t.target,i=!!r.checked;if(Array.isArray(o)){var s=null,a=e._i(o,s);r.checked?a<0&&e.$set(e.poll.answers[n],"voted",o.concat([s])):a>-1&&e.$set(e.poll.answers[n],"voted",o.slice(0,a).concat(o.slice(a+1)))}else e.$set(e.poll.answers[n],"voted",i)},function(t){e.multipleCheck(n)}]}}),e._v(" "),o("span",{staticClass:"checkmark"})])])})),e._v(" "),o("div",{staticClass:"poll-view__submit"},[o("button",{on:{click:e.vote}},[e._v("Vote")])]),e._v(" "),null!==e.success?o("div",{staticClass:"poll-view__info","class":{success:e.success===!0,error:e.success===!1}},[e.success===!0?o("div",[e._v("Voted")]):e._e(),e._v(" "),e.success===!1?o("div",[e._v("Error")]):e._e()]):e._e()]),e._v(" "),e.result?o("div",{staticClass:"poll-view__results"},e._l(this.poll.answers,function(t,n){return o("div",{key:n,staticClass:"result"},[o("div",{staticClass:"title"},[e._v("\n "+e._s(t.answer)+"\n "),o("span",{staticClass:"percent"},[e._v(e._s(e.calculatePercent(t.votes))+"% ")]),e._v(" "),o("span",{staticClass:"votes"},[e._v("("+e._s(t.votes)+" votes)")])]),e._v(" "),o("div",{staticClass:"bar"},[o("div",{style:{width:e.calculatePercent(t.votes)+"%"}})])])})):e._e(),e._v(" "),e.demo?o("div",{staticClass:"poll-view__footer"},[e._v("\n Made with ♥ by\n "),o("a",{attrs:{href:"https://updivision.com/"}},[e._v("updivision.com")])]):e._e()])},staticRenderFns:[]}},function(e,t,o){o(38);var n=o(7)(o(40),o(41),null,null);e.exports=n.exports},function(e,t,o){var n=o(39);"string"==typeof n&&(n=[[e.id,n,""]]);var r,i={hmr:!0};i.transform=r,i.insertInto=void 0;o(5)(n,i);n.locals&&(e.exports=n.locals)},function(e,t,o){t=e.exports=o(4)(!1),t.push([e.id,'@keyframes popup{0%{opacity:0}to{opacity:1}}@keyframes shownhide{0%{opacity:0}50%{opacity:1}to{opacity:0}}.poll-view{font-family:Arial,Helvetica,sans-serif;max-width:500px;margin:auto;background-color:#fff;position:relative;transition:all .2s ease-in-out;border-top:6px solid #90ee90}.poll-view__title{text-align:center;font-size:32px;font-weight:500;padding:20px 16px}.poll-view__inner{padding:16px}.poll-view__help{font-size:22px;padding-bottom:20px}.poll-view__question{padding-bottom:30px}.poll-view__question input{box-sizing:border-box;background-color:transparent;width:100%;color:#333;border:2px solid #4e4c4b8f;border-radius:0;padding:5px 40px 5px 10px;line-height:30px;font-size:30px;transition:border .2s ease-in-out}.poll-view__question input:focus{outline:none;border:2px solid #64e764}.poll-view__answers .answer,.poll-view__votes .answer{padding-bottom:5px;display:block;position:relative;background-color:#fff}.poll-view__answers .answer{animation-name:popup;animation-duration:1s}.poll-view__answers .answer .delete{position:absolute;bottom:10px;right:0;background-color:#fff;color:#ff0f00;font-weight:500;line-height:14px;font-size:14px}.poll-view__answers .answer .delete:hover{cursor:pointer}.poll-view__answers .answer input{box-sizing:border-box;background-color:transparent;width:100%;color:#333;border:none;border-bottom:1px solid #4e4c4b8f;border-radius:0;padding:5px 40px 5px 10px;line-height:24px;font-size:24px;transition:border .2s ease-in-out}.poll-view__answers .answer input:focus{outline:none;border-bottom:3px solid #90ee90}.poll-view__options{padding:16px 0}.poll-view__results{padding:16px}.poll-view__results .title{font-size:24px}.poll-view__results .title .percent,.poll-view__results .title .votes{font-size:16px}.poll-view__results .bar{width:100%;height:20px;background-color:#eee;position:relative}.poll-view__results .bar div{position:absolute;left:0;top:0;z-index:99;background-color:#90ee90;bottom:0}.poll-view__submit{text-align:center;padding:16px 0}.poll-view__submit button{color:#fff;background-color:#90ee90;border:1px solid #d2f8d2;padding:10px 16px;font-size:30px;transition:background-color .2s ease-in-out}.poll-view__submit button:hover{cursor:pointer;background-color:#4ee44e}.poll-view__info{position:absolute;top:0;left:0;right:0;bottom:0;z-index:999;animation-name:shownhide;animation-duration:3s}.poll-view__info.success{background-color:#e8fce8}.poll-view__info.success div{color:#1ec71e}.poll-view__info.error{background-color:#ff6f66}.poll-view__info.error div{color:#660600}.poll-view__info div{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);text-align:center;background-color:#fff;border-radius:50%;width:100px;height:100px;font-size:24px;line-height:100px}.poll-view__footer{text-align:center;color:#333;padding-bottom:5px;font-size:14px;opacity:.6}.poll-view__footer a{color:#1b98cf;text-decoration:none}.poll-view .checkbox{display:block;position:relative;padding-left:35px;margin-bottom:12px;cursor:pointer;font-size:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.poll-view .checkbox input{position:absolute;opacity:0;cursor:pointer}.poll-view .checkbox .checkmark{position:absolute;top:0;left:0;height:25px;width:25px;background-color:#eee}.poll-view .checkbox .checkmark:after{content:"";position:absolute;display:none;left:9px;top:5px;width:5px;height:10px;border:solid #fff;border-width:0 3px 3px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.poll-view .checkbox:hover input~.checkmark{background-color:#ccc}.poll-view .checkbox input:checked~.checkmark{background-color:#90ee90}.poll-view .checkbox input:checked~.checkmark:after{display:block}',""])},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(9),i=n(r);t["default"]={name:"poll-creator",props:{savePollUrl:{type:String},demo:{type:Boolean,"default":!1}},data:function(){return{poll:{question:"How old are you?",answers:[{answer:"10-20"},{answer:"21-30"},{answer:"31-40"},{answer:""}],multipleVotes:!1},isValid:!1,success:null}},mounted:function(){0==this.poll.answers.length&&this.poll.answers.push({answer:""})},methods:{createNewInput:function(e){this.poll.answers.length-1==e&&this.poll.answers.push({answer:""})},deleteInput:function(e){(e>0||this.poll.answers.length>1)&&this.poll.answers.splice(e,1)},createPoll:function(){var e=this;this.validate(),this.demo&&this.isValid?(this.alert(!0),setTimeout(function(){e.resetPoll()},1500)):this.demo&&!this.isValid?(this.alert(!1),setTimeout(function(){e.resetPoll()},1500)):this.isValid?i["default"].post(this.savePollUrl,{poll:this.poll},{maxContentLength:2e3}).then(function(t){e.alert(!0),setTimeout(function(){e.resetPoll()},1500)})["catch"](function(t){e.alert(!1),t.request.res.destroy()}):this.alert(!1)},resetPoll:function(){this.poll.multipleVotes=!1,this.poll.answers=[],this.poll.answers.push({answer:""}),this.poll.answers.push({answer:""}),this.poll.answers.push({answer:""}),this.poll.answers.push({answer:""}),this.poll.question="",this.isValid=!1},validate:function(){this.poll.answers=this.poll.answers.filter(function(e){if(e.answer.length>0)return e});var e=this.poll.answers.length;e>1?this.isValid=!0:this.isValid=!1},alert:function(e){var t=this;this.success=e,setTimeout(function(){t.success=null},3e3)}}}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"poll-view"},[o("div",{staticClass:"poll-view__title"},[e._v("\n New poll\n ")]),e._v(" "),o("div",{staticClass:"poll-view__inner"},[o("div",{staticClass:"poll-view__question"},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.poll.question,expression:"poll.question"}],attrs:{type:"text",placeholder:"Your Question..."},domProps:{value:e.poll.question},on:{input:function(t){t.target.composing||e.$set(e.poll,"question",t.target.value)}}})]),e._v(" "),o("div",{staticClass:"poll-view__answers"},e._l(e.poll.answers,function(t,n){return o("div",{key:n,staticClass:"answer",style:{zIndex:e.poll.answers.length-n}},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.poll.answers[n].answer,expression:"poll.answers[index].answer"}],attrs:{placeholder:"Answer "+(n+1),type:"text"},domProps:{value:e.poll.answers[n].answer},on:{focus:function(t){e.createNewInput(n)},input:function(t){t.target.composing||e.$set(e.poll.answers[n],"answer",t.target.value)}}}),e._v(" "),o("span",{staticClass:"delete",on:{click:function(t){e.deleteInput(n)}}},[e._v("delete")])])})),e._v(" "),o("div",{staticClass:"poll-view__options"},[o("label",{staticClass:"checkbox"},[e._v("Allow multiple votes\n "),o("input",{directives:[{name:"model",rawName:"v-model",value:e.poll.multipleVotes,expression:"poll.multipleVotes"}],attrs:{type:"checkbox",checked:"checked"},domProps:{checked:Array.isArray(e.poll.multipleVotes)?e._i(e.poll.multipleVotes,null)>-1:e.poll.multipleVotes},on:{change:function(t){var o=e.poll.multipleVotes,n=t.target,r=!!n.checked;if(Array.isArray(o)){var i=null,s=e._i(o,i);n.checked?s<0&&e.$set(e.poll,"multipleVotes",o.concat([i])):s>-1&&e.$set(e.poll,"multipleVotes",o.slice(0,s).concat(o.slice(s+1)))}else e.$set(e.poll,"multipleVotes",r)}}}),e._v(" "),o("span",{staticClass:"checkmark"})])]),e._v(" "),o("div",{staticClass:"poll-view__submit"},[o("button",{on:{click:e.createPoll}},[e._v("Create")])]),e._v(" "),null!==e.success?o("div",{staticClass:"poll-view__info","class":{success:e.success===!0,error:e.success===!1}},[e.success===!0?o("div",[e._v("Created")]):e._e(),e._v(" "),e.success===!1?o("div",[e._v("Error")]):e._e()]):e._e()]),e._v(" "),e.demo?o("div",{staticClass:"poll-view__footer"},[e._v("\n Made with ♥ by "),o("a",{attrs:{href:"https://updivision.com/"}},[e._v("updivision.com")])]):e._e()])},staticRenderFns:[]}}]); -------------------------------------------------------------------------------- /dist/vue-easy-polls.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue-easy-polls",[],t):"object"==typeof exports?exports["vue-easy-polls"]=t():e["vue-easy-polls"]=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.PollCreator=t.PollView=t.Poll=void 0;var r=o(1),i=n(r),s=o(37),a=n(s),l={PollView:i["default"],PollCreator:a["default"]};t["default"]=l,t.Poll=l,t.PollView=i["default"],t.PollCreator=a["default"]},function(e,t,o){o(2);var n=o(7)(o(8),o(36),null,null);e.exports=n.exports},function(e,t,o){var n=o(3);"string"==typeof n&&(n=[[e.id,n,""]]);var r,i={hmr:!0};i.transform=r,i.insertInto=void 0;o(5)(n,i);n.locals&&(e.exports=n.locals)},function(e,t,o){t=e.exports=o(4)(!1),t.push([e.id,'@keyframes popup{0%{opacity:0}to{opacity:1}}@keyframes shownhide{0%{opacity:0}50%{opacity:1}to{opacity:0}}.poll-view{font-family:Arial,Helvetica,sans-serif;max-width:500px;margin:auto;background-color:#fff;position:relative;transition:all .2s ease-in-out;border-top:6px solid #90ee90}.poll-view__title{text-align:center;font-size:32px;font-weight:500;padding:20px 16px}.poll-view__inner{padding:16px}.poll-view__help{font-size:22px;padding-bottom:20px}.poll-view__question{padding-bottom:30px}.poll-view__question input{box-sizing:border-box;background-color:transparent;width:100%;color:#333;border:2px solid #4e4c4b8f;border-radius:0;padding:5px 40px 5px 10px;line-height:30px;font-size:30px;transition:border .2s ease-in-out}.poll-view__question input:focus{outline:none;border:2px solid #64e764}.poll-view__answers .answer,.poll-view__votes .answer{padding-bottom:5px;display:block;position:relative;background-color:#fff}.poll-view__answers .answer{animation-name:popup;animation-duration:1s}.poll-view__answers .answer .delete{position:absolute;bottom:10px;right:0;background-color:#fff;color:#ff0f00;font-weight:500;line-height:14px;font-size:14px}.poll-view__answers .answer .delete:hover{cursor:pointer}.poll-view__answers .answer input{box-sizing:border-box;background-color:transparent;width:100%;color:#333;border:none;border-bottom:1px solid #4e4c4b8f;border-radius:0;padding:5px 40px 5px 10px;line-height:24px;font-size:24px;transition:border .2s ease-in-out}.poll-view__answers .answer input:focus{outline:none;border-bottom:3px solid #90ee90}.poll-view__options{padding:16px 0}.poll-view__results{padding:16px}.poll-view__results .title{font-size:24px}.poll-view__results .title .percent,.poll-view__results .title .votes{font-size:16px}.poll-view__results .bar{width:100%;height:20px;background-color:#eee;position:relative}.poll-view__results .bar div{position:absolute;left:0;top:0;z-index:99;background-color:#90ee90;bottom:0}.poll-view__submit{text-align:center;padding:16px 0}.poll-view__submit button{color:#fff;background-color:#90ee90;border:1px solid #d2f8d2;padding:10px 16px;font-size:30px;transition:background-color .2s ease-in-out}.poll-view__submit button:hover{cursor:pointer;background-color:#4ee44e}.poll-view__info{position:absolute;top:0;left:0;right:0;bottom:0;z-index:999;animation-name:shownhide;animation-duration:3s}.poll-view__info.success{background-color:#e8fce8}.poll-view__info.success div{color:#1ec71e}.poll-view__info.error{background-color:#ff6f66}.poll-view__info.error div{color:#660600}.poll-view__info div{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);text-align:center;background-color:#fff;border-radius:50%;width:100px;height:100px;font-size:24px;line-height:100px}.poll-view__footer{text-align:center;color:#333;padding-bottom:5px;font-size:14px;opacity:.6}.poll-view__footer a{color:#1b98cf;text-decoration:none}.poll-view .checkbox{display:block;position:relative;padding-left:35px;margin-bottom:12px;cursor:pointer;font-size:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.poll-view .checkbox input{position:absolute;opacity:0;cursor:pointer}.poll-view .checkbox .checkmark{position:absolute;top:0;left:0;height:25px;width:25px;background-color:#eee}.poll-view .checkbox .checkmark:after{content:"";position:absolute;display:none;left:9px;top:5px;width:5px;height:10px;border:solid #fff;border-width:0 3px 3px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.poll-view .checkbox:hover input~.checkmark{background-color:#ccc}.poll-view .checkbox input:checked~.checkmark{background-color:#90ee90}.poll-view .checkbox input:checked~.checkmark:after{display:block}',""])},function(e,t){function o(e,t){var o=e[1]||"",r=e[3];if(!r)return o;if(t&&"function"==typeof btoa){var i=n(r),s=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[o].concat(s).concat([i]).join("\n")}return[o].join("\n")}function n(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,"+t;return"/*# "+o+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=o(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,o){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},r=0;r=0&&_.splice(t,1)}function a(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),c(t,e.attrs),i(e,t),t}function l(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",c(t,e.attrs),i(e,t),t}function c(e,t){Object.keys(t).forEach(function(o){e.setAttribute(o,t[o])})}function u(e,t){var o,n,r,i;if(t.transform&&e.css){if(i=t.transform(e.css),!i)return function(){};e.css=i}if(t.singleton){var c=g++;o=b||(b=a(t)),n=p.bind(null,o,c,!1),r=p.bind(null,o,c,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(o=l(t),n=d.bind(null,o,t),r=function(){s(o),o.href&&URL.revokeObjectURL(o.href)}):(o=a(t),n=f.bind(null,o),r=function(){s(o)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}function p(e,t,o,n){var r=o?"":n.css;if(e.styleSheet)e.styleSheet.cssText=k(t,r);else{var i=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function f(e,t){var o=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}function d(e,t,o){var n=o.css,r=o.sourceMap,i=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||i)&&(n=y(n)),r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var s=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}var h={},v=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},w=v(function(){return window&&document&&document.all&&!window.atob}),m=function(e){return document.querySelector(e)},x=function(e){var t={};return function(e){if("function"==typeof e)return e();if("undefined"==typeof t[e]){var o=m.call(this,e);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(n){o=null}t[e]=o}return t[e]}}(),b=null,g=0,_=[],y=o(6);e.exports=function(e,t){t=t||{},t.attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=w()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var o=r(e,t);return n(o,t),function(e){for(var i=[],s=0;sPHP framework?",answers:[{id:1,answer:"Laravel",votes:14021},{id:2,answer:"Symfony",votes:3210},{id:3,answer:"Phalcon",votes:3231},{id:4,answer:"FuelPhp",votes:2004},{id:5,answer:"Zend Framework",votes:3132},{id:6,answer:"PHPixie",votes:2131},{id:7,answer:"CakePHP",votes:1222}],multipleVotes:!0},totalVotes:0,result:!1,success:null,isValid:!1}},mounted:function(){var e=this;i["default"].get(this.getPollUrl,{maxContentLength:2e3}).then(function(t){e.poll=t})["catch"](function(e){console.log(e),e.request.res.destroy()})},methods:{vote:function(){var e=this;this.validate(),this.demo&&this.isValid?(this.alert(!0),this.calculateTotalVotes()):this.isValid?i["default"].post(this.saveVoteUrl,{pollId:this.poll.id,votes:votes},{maxContentLength:2e3}).then(function(t){e.calculateTotalVotes(),e.alert(!0)})["catch"](function(t){e.alert(!1),t.request.res.destroy()}):this.alert(!1)},multipleCheck:function(e){if(1!=this.poll.multipleVotes){var t=this.poll.answers.filter(function(e){return 1==e.voted}).length;t>1&&(this.poll.answers[e].voted=!1)}},validate:function(){var e=this.poll.answers.filter(function(e){return 1==e.voted}).map(function(e){return e.id}).length;e>0?e>1?1==this.poll.multipleVotes?this.isValid=!0:this.isValid=!1:this.isValid=!0:this.isValid=!1},alert:function(e){var t=this;this.success=e,setTimeout(function(){t.success=null,t.result=e},1500)},calculatePercent:function(e){return parseInt(1e4*e/this.totalVotes)/100},calculateTotalVotes:function(){var e=this;this.poll.answers.forEach(function(t){e.totalVotes+=t.votes,t.voted&&(e.totalVotes+=1)})}}}},function(e,t,o){e.exports=o(10)},function(e,t,o){"use strict";function n(e){var t=new s(e),o=i(s.prototype.request,t);return r.extend(o,s.prototype,t),r.extend(o,t),o}var r=o(11),i=o(12),s=o(14),a=o(15),l=n(a);l.Axios=s,l.create=function(e){return n(r.merge(a,e))},l.Cancel=o(33),l.CancelToken=o(34),l.isCancel=o(30),l.all=function(e){return Promise.all(e)},l.spread=o(35),e.exports=l,e.exports["default"]=l},function(e,t,o){"use strict";function n(e){return"[object Array]"===C.call(e)}function r(e){return"[object ArrayBuffer]"===C.call(e)}function i(e){return"undefined"!=typeof FormData&&e instanceof FormData}function s(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function a(e){return"string"==typeof e}function l(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function u(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===C.call(e)}function f(e){return"[object File]"===C.call(e)}function d(e){return"[object Blob]"===C.call(e)}function h(e){return"[object Function]"===C.call(e)}function v(e){return u(e)&&h(e.pipe)}function w(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function m(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function x(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function b(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),n(e))for(var o=0,r=e.length;o 5 | * @license MIT 6 | */ 7 | e.exports=function(e){return null!=e&&(o(e)||n(e)||!!e._isBuffer)}},function(e,t,o){"use strict";function n(e){this.defaults=e,this.interceptors={request:new s,response:new s}}var r=o(15),i=o(11),s=o(27),a=o(28);n.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(r,{method:"get"},this.defaults,e),e.method=e.method.toLowerCase();var t=[a,void 0],o=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)o=o.then(t.shift(),t.shift());return o},i.forEach(["delete","get","head","options"],function(e){n.prototype[e]=function(t,o){return this.request(i.merge(o||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){n.prototype[e]=function(t,o,n){return this.request(i.merge(n||{},{method:e,url:t,data:o}))}}),e.exports=n},function(e,t,o){(function(t){"use strict";function n(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function r(){var e;return"undefined"!=typeof XMLHttpRequest?e=o(18):"undefined"!=typeof t&&(e=o(18)),e}var i=o(11),s=o(17),a={"Content-Type":"application/x-www-form-urlencoded"},l={adapter:r(),transformRequest:[function(e,t){return s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(n(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(n(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){l.headers[e]={}}),i.forEach(["post","put","patch"],function(e){l.headers[e]=i.merge(a)}),e.exports=l}).call(t,o(16))},function(e,t){function o(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(e){if(u===setTimeout)return setTimeout(e,0);if((u===o||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function i(e){if(p===clearTimeout)return clearTimeout(e);if((p===n||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function s(){v&&d&&(v=!1,d.length?h=d.concat(h):w=-1,h.length&&a())}function a(){if(!v){var e=r(s);v=!0;for(var t=h.length;t;){for(d=h,h=[];++w1)for(var o=1;o=0)return;"set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([o]):s[t]=s[t]?s[t]+", "+o:o}}),s):s}},function(e,t,o){"use strict";var n=o(11);e.exports=n.isStandardBrowserEnv()?function(){function e(e){var t=e;return o&&(r.setAttribute("href",t),t=r.href),r.setAttribute("href",t),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}var t,o=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");return t=e(window.location.href),function(o){var r=n.isString(o)?e(o):o;return r.protocol===t.protocol&&r.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function o(){this.message="String contains an invalid character"}function n(e){for(var t,n,i=String(e),s="",a=0,l=r;i.charAt(0|a)||(l="=",a%1);s+=l.charAt(63&t>>8-a%1*8)){if(n=i.charCodeAt(a+=.75),n>255)throw new o;t=t<<8|n}return s}var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.prototype=new Error,o.prototype.code=5,o.prototype.name="InvalidCharacterError",e.exports=n},function(e,t,o){"use strict";var n=o(11);e.exports=n.isStandardBrowserEnv()?function(){return{write:function(e,t,o,r,i,s){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(o)&&a.push("expires="+new Date(o).toGMTString()),n.isString(r)&&a.push("path="+r),n.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,o){"use strict";function n(){this.handlers=[]}var r=o(11);n.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){r.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=n},function(e,t,o){"use strict";function n(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var r=o(11),i=o(29),s=o(30),a=o(15),l=o(31),c=o(32);e.exports=function(e){n(e),e.baseURL&&!l(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||a.adapter;return t(e).then(function(t){return n(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return s(t)||(n(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,o){"use strict";var n=o(11);e.exports=function(e,t,o){return n.forEach(o,function(o){e=o(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,e.exports=o},function(e,t,o){"use strict";function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var o=this;e(function(e){o.reason||(o.reason=new r(e),t(o.reason))})}var r=o(33);n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var e,t=new n(function(t){e=t});return{token:t,cancel:e}},e.exports=n},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"poll-view"},[o("div",{staticClass:"poll-view__title",domProps:{innerHTML:e._s(e.poll.question)}}),e._v(" "),e.result?e._e():o("div",{staticClass:"poll-view__inner"},[o("div",{staticClass:"poll-view__help"},[e.poll.multipleVotes?o("span",[e._v("Choose many answers:")]):o("span",[e._v("Choose one answer:")])]),e._v(" "),o("div",{staticClass:"poll-view__votes"},e._l(e.poll.answers,function(t,n){return o("div",{key:t.id,staticClass:"answer"},[o("label",{staticClass:"checkbox"},[e._v(e._s(t.answer)+"\n "),o("input",{directives:[{name:"model",rawName:"v-model",value:e.poll.answers[n].voted,expression:"poll.answers[index].voted"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.poll.answers[n].voted)?e._i(e.poll.answers[n].voted,null)>-1:e.poll.answers[n].voted},on:{change:[function(t){var o=e.poll.answers[n].voted,r=t.target,i=!!r.checked;if(Array.isArray(o)){var s=null,a=e._i(o,s);r.checked?a<0&&e.$set(e.poll.answers[n],"voted",o.concat([s])):a>-1&&e.$set(e.poll.answers[n],"voted",o.slice(0,a).concat(o.slice(a+1)))}else e.$set(e.poll.answers[n],"voted",i)},function(t){e.multipleCheck(n)}]}}),e._v(" "),o("span",{staticClass:"checkmark"})])])})),e._v(" "),o("div",{staticClass:"poll-view__submit"},[o("button",{on:{click:e.vote}},[e._v("Vote")])]),e._v(" "),null!==e.success?o("div",{staticClass:"poll-view__info","class":{success:e.success===!0,error:e.success===!1}},[e.success===!0?o("div",[e._v("Voted")]):e._e(),e._v(" "),e.success===!1?o("div",[e._v("Error")]):e._e()]):e._e()]),e._v(" "),e.result?o("div",{staticClass:"poll-view__results"},e._l(this.poll.answers,function(t,n){return o("div",{key:n,staticClass:"result"},[o("div",{staticClass:"title"},[e._v("\n "+e._s(t.answer)+"\n "),o("span",{staticClass:"percent"},[e._v(e._s(e.calculatePercent(t.votes))+"% ")]),e._v(" "),o("span",{staticClass:"votes"},[e._v("("+e._s(t.votes)+" votes)")])]),e._v(" "),o("div",{staticClass:"bar"},[o("div",{style:{width:e.calculatePercent(t.votes)+"%"}})])])})):e._e(),e._v(" "),e.demo?o("div",{staticClass:"poll-view__footer"},[e._v("\n Made with ♥ by\n "),o("a",{attrs:{href:"https://updivision.com/"}},[e._v("updivision.com")])]):e._e()])},staticRenderFns:[]}},function(e,t,o){o(38);var n=o(7)(o(40),o(41),null,null);e.exports=n.exports},function(e,t,o){var n=o(39);"string"==typeof n&&(n=[[e.id,n,""]]);var r,i={hmr:!0};i.transform=r,i.insertInto=void 0;o(5)(n,i);n.locals&&(e.exports=n.locals)},function(e,t,o){t=e.exports=o(4)(!1),t.push([e.id,'@keyframes popup{0%{opacity:0}to{opacity:1}}@keyframes shownhide{0%{opacity:0}50%{opacity:1}to{opacity:0}}.poll-view{font-family:Arial,Helvetica,sans-serif;max-width:500px;margin:auto;background-color:#fff;position:relative;transition:all .2s ease-in-out;border-top:6px solid #90ee90}.poll-view__title{text-align:center;font-size:32px;font-weight:500;padding:20px 16px}.poll-view__inner{padding:16px}.poll-view__help{font-size:22px;padding-bottom:20px}.poll-view__question{padding-bottom:30px}.poll-view__question input{box-sizing:border-box;background-color:transparent;width:100%;color:#333;border:2px solid #4e4c4b8f;border-radius:0;padding:5px 40px 5px 10px;line-height:30px;font-size:30px;transition:border .2s ease-in-out}.poll-view__question input:focus{outline:none;border:2px solid #64e764}.poll-view__answers .answer,.poll-view__votes .answer{padding-bottom:5px;display:block;position:relative;background-color:#fff}.poll-view__answers .answer{animation-name:popup;animation-duration:1s}.poll-view__answers .answer .delete{position:absolute;bottom:10px;right:0;background-color:#fff;color:#ff0f00;font-weight:500;line-height:14px;font-size:14px}.poll-view__answers .answer .delete:hover{cursor:pointer}.poll-view__answers .answer input{box-sizing:border-box;background-color:transparent;width:100%;color:#333;border:none;border-bottom:1px solid #4e4c4b8f;border-radius:0;padding:5px 40px 5px 10px;line-height:24px;font-size:24px;transition:border .2s ease-in-out}.poll-view__answers .answer input:focus{outline:none;border-bottom:3px solid #90ee90}.poll-view__options{padding:16px 0}.poll-view__results{padding:16px}.poll-view__results .title{font-size:24px}.poll-view__results .title .percent,.poll-view__results .title .votes{font-size:16px}.poll-view__results .bar{width:100%;height:20px;background-color:#eee;position:relative}.poll-view__results .bar div{position:absolute;left:0;top:0;z-index:99;background-color:#90ee90;bottom:0}.poll-view__submit{text-align:center;padding:16px 0}.poll-view__submit button{color:#fff;background-color:#90ee90;border:1px solid #d2f8d2;padding:10px 16px;font-size:30px;transition:background-color .2s ease-in-out}.poll-view__submit button:hover{cursor:pointer;background-color:#4ee44e}.poll-view__info{position:absolute;top:0;left:0;right:0;bottom:0;z-index:999;animation-name:shownhide;animation-duration:3s}.poll-view__info.success{background-color:#e8fce8}.poll-view__info.success div{color:#1ec71e}.poll-view__info.error{background-color:#ff6f66}.poll-view__info.error div{color:#660600}.poll-view__info div{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);text-align:center;background-color:#fff;border-radius:50%;width:100px;height:100px;font-size:24px;line-height:100px}.poll-view__footer{text-align:center;color:#333;padding-bottom:5px;font-size:14px;opacity:.6}.poll-view__footer a{color:#1b98cf;text-decoration:none}.poll-view .checkbox{display:block;position:relative;padding-left:35px;margin-bottom:12px;cursor:pointer;font-size:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.poll-view .checkbox input{position:absolute;opacity:0;cursor:pointer}.poll-view .checkbox .checkmark{position:absolute;top:0;left:0;height:25px;width:25px;background-color:#eee}.poll-view .checkbox .checkmark:after{content:"";position:absolute;display:none;left:9px;top:5px;width:5px;height:10px;border:solid #fff;border-width:0 3px 3px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.poll-view .checkbox:hover input~.checkmark{background-color:#ccc}.poll-view .checkbox input:checked~.checkmark{background-color:#90ee90}.poll-view .checkbox input:checked~.checkmark:after{display:block}',""])},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(9),i=n(r);t["default"]={name:"poll-creator",props:{savePollUrl:{type:String},demo:{type:Boolean,"default":!1}},data:function(){return{poll:{question:"How old are you?",answers:[{answer:"10-20"},{answer:"21-30"},{answer:"31-40"},{answer:""}],multipleVotes:!1},isValid:!1,success:null}},mounted:function(){0==this.poll.answers.length&&this.poll.answers.push({answer:""})},methods:{createNewInput:function(e){this.poll.answers.length-1==e&&this.poll.answers.push({answer:""})},deleteInput:function(e){(e>0||this.poll.answers.length>1)&&this.poll.answers.splice(e,1)},createPoll:function(){var e=this;this.validate(),this.demo&&this.isValid?(this.alert(!0),setTimeout(function(){e.resetPoll()},1500)):this.demo&&!this.isValid?(this.alert(!1),setTimeout(function(){e.resetPoll()},1500)):this.isValid?i["default"].post(this.savePollUrl,{poll:this.poll},{maxContentLength:2e3}).then(function(t){e.alert(!0),setTimeout(function(){e.resetPoll()},1500)})["catch"](function(t){e.alert(!1),t.request.res.destroy()}):this.alert(!1)},resetPoll:function(){this.poll.multipleVotes=!1,this.poll.answers=[],this.poll.answers.push({answer:""}),this.poll.answers.push({answer:""}),this.poll.answers.push({answer:""}),this.poll.answers.push({answer:""}),this.poll.question="",this.isValid=!1},validate:function(){this.poll.answers=this.poll.answers.filter(function(e){if(e.answer.length>0)return e});var e=this.poll.answers.length;e>1?this.isValid=!0:this.isValid=!1},alert:function(e){var t=this;this.success=e,setTimeout(function(){t.success=null},3e3)}}}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"poll-view"},[o("div",{staticClass:"poll-view__title"},[e._v("\n New poll\n ")]),e._v(" "),o("div",{staticClass:"poll-view__inner"},[o("div",{staticClass:"poll-view__question"},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.poll.question,expression:"poll.question"}],attrs:{type:"text",placeholder:"Your Question..."},domProps:{value:e.poll.question},on:{input:function(t){t.target.composing||e.$set(e.poll,"question",t.target.value)}}})]),e._v(" "),o("div",{staticClass:"poll-view__answers"},e._l(e.poll.answers,function(t,n){return o("div",{key:n,staticClass:"answer",style:{zIndex:e.poll.answers.length-n}},[o("input",{directives:[{name:"model",rawName:"v-model",value:e.poll.answers[n].answer,expression:"poll.answers[index].answer"}],attrs:{placeholder:"Answer "+(n+1),type:"text"},domProps:{value:e.poll.answers[n].answer},on:{focus:function(t){e.createNewInput(n)},input:function(t){t.target.composing||e.$set(e.poll.answers[n],"answer",t.target.value)}}}),e._v(" "),o("span",{staticClass:"delete",on:{click:function(t){e.deleteInput(n)}}},[e._v("delete")])])})),e._v(" "),o("div",{staticClass:"poll-view__options"},[o("label",{staticClass:"checkbox"},[e._v("Allow multiple votes\n "),o("input",{directives:[{name:"model",rawName:"v-model",value:e.poll.multipleVotes,expression:"poll.multipleVotes"}],attrs:{type:"checkbox",checked:"checked"},domProps:{checked:Array.isArray(e.poll.multipleVotes)?e._i(e.poll.multipleVotes,null)>-1:e.poll.multipleVotes},on:{change:function(t){var o=e.poll.multipleVotes,n=t.target,r=!!n.checked;if(Array.isArray(o)){var i=null,s=e._i(o,i);n.checked?s<0&&e.$set(e.poll,"multipleVotes",o.concat([i])):s>-1&&e.$set(e.poll,"multipleVotes",o.slice(0,s).concat(o.slice(s+1)))}else e.$set(e.poll,"multipleVotes",r)}}}),e._v(" "),o("span",{staticClass:"checkmark"})])]),e._v(" "),o("div",{staticClass:"poll-view__submit"},[o("button",{on:{click:e.createPoll}},[e._v("Create")])]),e._v(" "),null!==e.success?o("div",{staticClass:"poll-view__info","class":{success:e.success===!0,error:e.success===!1}},[e.success===!0?o("div",[e._v("Created")]):e._e(),e._v(" "),e.success===!1?o("div",[e._v("Error")]):e._e()]):e._e()]),e._v(" "),e.demo?o("div",{staticClass:"poll-view__footer"},[e._v("\n Made with ♥ by "),o("a",{attrs:{href:"https://updivision.com/"}},[e._v("updivision.com")])]):e._e()])},staticRenderFns:[]}}])}); --------------------------------------------------------------------------------