Delete other-sites/me directory

pull/296/head
MomentQYC 2022-06-27 18:01:03 +08:00 committed by GitHub
parent 43a4703c85
commit 2d5f40b5c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 0 additions and 2474 deletions

View File

@ -1,21 +0,0 @@
files:
- package.json
plugins:
prerelease:
Linting config files:
plugin: bumped-finepack
postrelease:
Building:
plugin: bumped-terminal
command: 'NODE_ENV=production gulp'
Generating CHANGELOG file:
plugin: bumped-changelog
Committing new version:
plugin: bumped-terminal
command: 'git add --all && git commit -m "Release $newVersion"'
Publishing tag to GitHub:
plugin: bumped-terminal
command: 'git tag $newVersion && git push origin master && git push --tags'
Publishing to NPM:
plugin: bumped-terminal
command: npm publish

View File

@ -1,4 +0,0 @@
package-lock.json
test
node_modules
.DS_Store

View File

@ -1,10 +0,0 @@
src
test
test.html
Gulpfile.js
node_modules
.DS_Store
preview.png
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md

View File

@ -1,97 +0,0 @@
<a name="0.3.4"></a>
## 0.3.4 (2017-07-30)
* Added support for extra information in button action #8 ([0fea725](https://github.com/moinism/botui/commit/0fea725))
* cleanup ([fc9f429](https://github.com/moinism/botui/commit/fc9f429))
* Replaces the text action submit button by a button used for the button action. Thus text actions now ([41a2868](https://github.com/moinism/botui/commit/41a2868))
* chore: add vue dependencies ([31d5e5e](https://github.com/moinism/botui/commit/31d5e5e))
* chore: change .d.ts file ([3d8d75f](https://github.com/moinism/botui/commit/3d8d75f))
* chore: remove test dependencies ([97622cf](https://github.com/moinism/botui/commit/97622cf))
* fix: fix index.d.ts ([32a1be3](https://github.com/moinism/botui/commit/32a1be3))
* fix: fix package.json ([fdc9fef](https://github.com/moinism/botui/commit/fdc9fef))
* add: add typings file ([58e88f8](https://github.com/moinism/botui/commit/58e88f8))
<a name="0.3.3"></a>
## 0.3.3 (2017-07-17)
* adds "build" and "watch" commands to package.json ([f576bb4](https://github.com/moinism/botui/commit/f576bb4))
* adds "viewport" metatag to `test.html` ([1ae01d9](https://github.com/moinism/botui/commit/1ae01d9))
* chanded vue ver in test file ([ad7367d](https://github.com/moinism/botui/commit/ad7367d))
* compiles build files ([920400b](https://github.com/moinism/botui/commit/920400b))
* delegates submit button visibility to stylesheet ([9630ee8](https://github.com/moinism/botui/commit/9630ee8))
* Fix width of iframe inside message box. ([9de1608](https://github.com/moinism/botui/commit/9de1608))
* fixes cp notice ([9bbae1a](https://github.com/moinism/botui/commit/9bbae1a))
<a name="0.3.2"></a>
## 0.3.2 (2017-07-16)
* allow delayed loading ([69f668b](https://github.com/moinism/botui/commit/69f668b))
* ignored some files for npm ([4c2396e](https://github.com/moinism/botui/commit/4c2396e))
<a name="0.3.1"></a>
## 0.3.1 (2017-07-16)
* added 'loading' to message object ([6d52547](https://github.com/moinism/botui/commit/6d52547))
* added bumped ([912ff88](https://github.com/moinism/botui/commit/912ff88))
* added eg. URL ([8d95e9b](https://github.com/moinism/botui/commit/8d95e9b))
* added embed support ([8b9b1d8](https://github.com/moinism/botui/commit/8b9b1d8))
* added icon support and cssClass ([8560b71](https://github.com/moinism/botui/commit/8560b71))
* Added icon support with text ([b9d434f](https://github.com/moinism/botui/commit/b9d434f))
* added preview ([70e38fa](https://github.com/moinism/botui/commit/70e38fa))
* bit of change ([0c0b228](https://github.com/moinism/botui/commit/0c0b228))
* Code of conduct ([358a12a](https://github.com/moinism/botui/commit/358a12a))
* Contribute ([7684689](https://github.com/moinism/botui/commit/7684689))
* escape quotes ([cff977c](https://github.com/moinism/botui/commit/cff977c))
* first ([a22d4d4](https://github.com/moinism/botui/commit/a22d4d4))
* fixed issue #3 ([00e8a83](https://github.com/moinism/botui/commit/00e8a83)), closes [#3](https://github.com/moinism/botui/issues/3)
* Initial commit ([6b8c625](https://github.com/moinism/botui/commit/6b8c625))
* license linked ([4b87ba3](https://github.com/moinism/botui/commit/4b87ba3))
* link, image support + mod structure ([79dc3ed](https://github.com/moinism/botui/commit/79dc3ed))
* markdown parsing on insertion only ([1ed9849](https://github.com/moinism/botui/commit/1ed9849))
* messages also accept string instead of object ([ef241ec](https://github.com/moinism/botui/commit/ef241ec))
* Readme added ([7951729](https://github.com/moinism/botui/commit/7951729))
* Release 0.3.1 ([06469d8](https://github.com/moinism/botui/commit/06469d8))
* removed nested styling ([d3d9a39](https://github.com/moinism/botui/commit/d3d9a39))
* some style changes ([2086886](https://github.com/moinism/botui/commit/2086886))
* type ([6954a9c](https://github.com/moinism/botui/commit/6954a9c))
* verion bump ([a957d28](https://github.com/moinism/botui/commit/a957d28))
* proposal: add loading dots animation to message ([e3fc5d4](https://github.com/moinism/botui/commit/e3fc5d4))
<a name="0.3.1"></a>
## 0.3.1 (2017-07-16)
* added 'loading' to message object ([6d52547](https://github.com/moinism/botui/commit/6d52547))
* added bumped ([912ff88](https://github.com/moinism/botui/commit/912ff88))
* added eg. URL ([8d95e9b](https://github.com/moinism/botui/commit/8d95e9b))
* added embed support ([8b9b1d8](https://github.com/moinism/botui/commit/8b9b1d8))
* added icon support and cssClass ([8560b71](https://github.com/moinism/botui/commit/8560b71))
* Added icon support with text ([b9d434f](https://github.com/moinism/botui/commit/b9d434f))
* added preview ([70e38fa](https://github.com/moinism/botui/commit/70e38fa))
* bit of change ([0c0b228](https://github.com/moinism/botui/commit/0c0b228))
* Code of conduct ([358a12a](https://github.com/moinism/botui/commit/358a12a))
* Contribute ([7684689](https://github.com/moinism/botui/commit/7684689))
* escape quotes ([cff977c](https://github.com/moinism/botui/commit/cff977c))
* first ([a22d4d4](https://github.com/moinism/botui/commit/a22d4d4))
* fixed issue #3 ([00e8a83](https://github.com/moinism/botui/commit/00e8a83)), closes [#3](https://github.com/moinism/botui/issues/3)
* Initial commit ([6b8c625](https://github.com/moinism/botui/commit/6b8c625))
* license linked ([4b87ba3](https://github.com/moinism/botui/commit/4b87ba3))
* link, image support + mod structure ([79dc3ed](https://github.com/moinism/botui/commit/79dc3ed))
* markdown parsing on insertion only ([1ed9849](https://github.com/moinism/botui/commit/1ed9849))
* messages also accept string instead of object ([ef241ec](https://github.com/moinism/botui/commit/ef241ec))
* Readme added ([7951729](https://github.com/moinism/botui/commit/7951729))
* removed nested styling ([d3d9a39](https://github.com/moinism/botui/commit/d3d9a39))
* some style changes ([2086886](https://github.com/moinism/botui/commit/2086886))
* type ([6954a9c](https://github.com/moinism/botui/commit/6954a9c))
* verion bump ([a957d28](https://github.com/moinism/botui/commit/a957d28))
* proposal: add loading dots animation to message ([e3fc5d4](https://github.com/moinism/botui/commit/e3fc5d4))

View File

@ -1,46 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at team@botui.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -1,17 +0,0 @@
There many ways to contribute to BotUI.
### Help with issues
See if there are any open issues you help with.
### Write examples
You can also [write examples](https://github.com/moinism/botui-examples) for BotUI.
### Code contribution
You can read about code contribution [here](https://docs.botui.org/contribute.html).

View File

@ -1,82 +0,0 @@
var fs = require('fs'),
gulp = require('gulp'),
sass = require('gulp-sass'),
banner = require('gulp-banner'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
pkg = require('./package.json'),
htmlclean = require('htmlclean'),
replace = require('gulp-replace'),
minify = require('gulp-clean-css');
function escape (text) {
return text.replace(/'/g, "\\'").replace(/"/g, "\\\"");
}
function htmlTemplate() {
return replace('BOTUI_TEMPLATE', escape(
htmlclean(fs.readFileSync('./src/botui.html', 'utf8'))
));
}
var comment = '/*\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' * <%= pkg.description %>\n' +
' * <%= pkg.homepage %>\n' +
' *\n' +
' * Copyright <%= year %>, <%= pkg.author.name %>\n' +
' * Released under the <%= pkg.license %> license.\n' +
'*/\n\n';
gulp.task('styles', function() {
gulp.src(['./src/styles/normal.scss',
'./src/styles/botui.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(minify())
.pipe(concat('botui.min.css'))
.pipe(banner(comment, {
pkg: pkg,
year: new Date().getFullYear()
}))
.pipe(gulp.dest('./build/'));
});
gulp.task('themes', function() {
gulp.src('./src/styles/themes/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(minify())
.pipe(rename(function (path) {
path.basename = 'botui-theme-' + path.basename;
}))
.pipe(gulp.dest('./build/'));
});
gulp.task('scripts', function () {
gulp.src('./src/scripts/botui.js') // simply copy the original one
.pipe(htmlTemplate())
.pipe(banner(comment, {
pkg: pkg,
year: new Date().getFullYear()
}))
.pipe(gulp.dest('./build/'));
gulp.src('./src/scripts/botui.js') // minified version
.pipe(uglify())
.pipe(htmlTemplate())
.pipe(rename('botui.min.js'))
.pipe(banner(comment, {
pkg: pkg,
year: new Date().getFullYear()
}))
.pipe(gulp.dest('./build/'));
});
gulp.task('watch',function() {
gulp.watch('./src/styles/*.scss', ['styles']);
gulp.watch('./src/styles/themes/*.scss', ['themes']);
gulp.watch(['./src/scripts/botui.js', './src/botui.html'], ['scripts']);
});
gulp.task('default', ['styles', 'scripts', 'themes']);

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017 Moin Uddin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,56 +0,0 @@
# BotUI
[![Join the chat at https://gitter.im/BotUIChat/botui](https://badges.gitter.im/BotUIChat/botui.svg)](https://gitter.im/BotUIChat/botui?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm](https://img.shields.io/npm/v/botui.svg?style=flat-square)](https://www.npmjs.com/package/botui) [![npm](https://img.shields.io/npm/dm/botui.svg?style=flat-square)](https://www.npmjs.com/package/botui)
> A JavaScript framework to create conversational UIs.
[Main Site](https://botui.org) - [Read Docs](https://docs.botui.org) - [Examples](https://github.com/moinism/botui-examples)
### Quick look
![preview](preview.png)
```html
<div class="botui-app-container" id="botui-app">
<bot-ui></bot-ui>
</div>
```
```javascript
var botui = new BotUI('botui-app'); // give it the id of container
botui.message.bot({ // show first message
delay: 200,
content: 'hello'
}).then(function () {
return botui.message.bot({ // second one
delay: 1000, // wait 1 sec.
content: 'how are you?'
});
}).then(function () {
return botui.action.button({ // let user do something
delay: 1000,
action: [
{
text: 'Good',
value: 'good'
},
{
text: 'Really Good',
value: 'really_good'
}
]
});
}).then(function (res) {
return botui.message.bot({
delay: 1000,
content: 'You are feeling ' + res.text + '!'
});
});
```
### License
[MIT License](https://github.com/moinism/botui/blob/master/LICENSE) - Copyrights (c) 2017 - Moin Uddin

View File

@ -1,195 +0,0 @@
html,
body {
height: 100%;
margin: 0px;
padding: 0px;
overflow: hidden;
}
html {
overflow-x: hidden;
}
body {
background: #FC5C7D;
/* fallback for old browsers */
background: -webkit-linear-gradient(to right, #6A82FB, #FC5C7D);
/* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #6A82FB, #FC5C7D);
/* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
overflow-x: hidden;
}
h3 {
margin: 10px auto -30px 0;
font-family: sans-serif;
font-weight: bold;
color: #fff
}
.botui-container {
font-size: 14px;
background-color: rgba(255, 255, 255, 0);
font-family: sans-serif;
font-weight: normal;
overflow-y: hidden !important;
height: auto !important;
}
.botui-messages-container {
padding: 10px 20px
}
.botui-actions-container {
padding: 0px 20px 30px 20px
}
.botui-message {
min-height: 30px
}
.botui-message-content {
padding: 7px 13px;
border-radius: 15px;
color: #595a5a;
background-color: #ebebeb
}
.botui-message-content.human {
color: #f7f8f8;
background-color: #919292
}
.botui-message-content.text {
line-height: 1.3
}
.botui-message-content.loading {
background-color: rgba(206, 206, 206, .5);
line-height: 1.3;
text-align: center
}
.botui-message-content.embed {
padding: 5px;
border-radius: 5px
}
.botui-message-content-link {
color: #919292
}
.botui-actions-text-input {
border: 0;
outline: 0;
border-radius: 0;
padding: 5px 7px;
font-family: "Open Sans", sans-serif;
background-color: transparent;
color: #595a5a;
border-bottom: 1px solid #919292
}
.botui-actions-text-submit {
color: #fff;
width: 30px;
padding: 5px;
height: 30px;
line-height: 1;
border-radius: 50%;
border: 1px solid #919292;
background: #777979
}
.botui-actions-buttons-button {
border: 0;
color: #fff;
line-height: 1;
cursor: pointer;
font-size: 14px;
font-weight: 500;
padding: 7px 15px;
border-radius: 4px;
font-family: "Open Sans", sans-serif;
background: #777979;
box-shadow: 2px 3px 4px 0 rgba(0, 0, 0, .25)
}
.poptitle {
width: 100%;
height: 100%;
line-height: 3;
background-color: rgba(255, 255, 255, 0.3);
overflow-y: auto;
}
.popfooter {
width: 100%;
height: 100%;
line-height: 1;
background-color: rgba(255, 255, 255, 0.7)
}
.popcontainer {
width: 100%;
height: 100%;
}
.slide-fade-enter-active {
transition: all .3s ease
}
.slide-fade-enter,
.slide-fade-leave-to {
opacity: 0;
transform: translateX(-10px)
}
.dot {
width: .5rem;
height: .5rem;
border-radius: .5rem;
display: inline-block;
background-color: #919292
}
.dot:nth-last-child(1) {
margin-left: .3rem;
animation: loading .6s .3s linear infinite
}
.dot:nth-last-child(2) {
margin-left: .3rem;
animation: loading .6s .2s linear infinite
}
.dot:nth-last-child(3) {
animation: loading .6s .1s linear infinite
}
@keyframes loading {
0 {
transform: translate(0, 0);
background-color: #ababab
}
25% {
transform: translate(0, -3px)
}
50% {
transform: translate(0, 0);
background-color: #ababab
}
75% {
transform: translate(0, 3px)
}
100% {
transform: translate(0, 0)
}
}
button.botui-actions-buttons-button {
-webkit-user-select: none; /* Safari 3.1+ */
-moz-user-select: none; /* Firefox 2+ */
-ms-user-select: none; /* IE 10+ */
user-select: none; /* Standard syntax */
}

View File

@ -1,322 +0,0 @@
/*
* botui 0.3.4
* A JS library to build the UI for your bot
* https://botui.org
*
* Copyright 2017, Moin Uddin
* Released under the MIT license.
*/
(function (root, factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define([], function () {
return (root.BotUI = factory(root));
});
} else {
root.BotUI = factory(root);
}
}(typeof window !== 'undefined' ? window : this, function (root, undefined) {
"use strict";
var BotUI = (function (id, opts) {
opts = opts || {};
if(!id) {
throw Error('BotUI: Container id is required as first argument.');
}
if(!document.getElementById(id)) {
throw Error('BotUI: Element with id #' + id + ' does not exist.');
}
if(!root.Vue && !opts.vue) {
throw Error('BotUI: Vue is required but not found.');
}
var _botApp, // current vue instance.
_options = {
debug: false,
fontawesome: true
},
_container, // the outermost Element. Needed to scroll to bottom, for now.
_interface = {}, // methods returned by a BotUI() instance.
_actionResolve,
_markDownRegex = {
icon: /!\(([^\)]+)\)/igm, // !(icon)
image: /!\[(.*?)\]\((.*?)\)/igm, // ![aleternate text](src)
link: /\[([^\[]+)\]\(([^\)]+)\)(\^?)/igm // [text](link) ^ can be added at end to set the target as 'blank'
},
_fontAwesome = 'https://use.fontawesome.com/ea731dcb6f.js',
_esPromisePollyfill = 'https://cdn.jsdelivr.net/es6-promise/4.1.0/es6-promise.min.js'; // mostly for IE
root.Vue = root.Vue || opts.vue;
// merge opts passed to constructor with _options
for (var prop in _options) {
if (opts.hasOwnProperty(prop)) {
_options[prop] = opts[prop];
}
}
if(!root.Promise && !Promise && !options.promise) {
loadScript(_esPromisePollyfill);
}
function _linkReplacer(match, $1, $2, $3) {
var _target = $3 ? 'blank' : ''; // check if '^' sign is present with link syntax
return "<a class='botui-message-content-link' target='" + _target + "' href='" + $2 +"'>" + $1 + "</a>";
}
function _parseMarkDown(text) {
return text
.replace(_markDownRegex.image, "<img class='botui-message-content-image' src='$2' alt='$1' />")
.replace(_markDownRegex.icon, "<i class='botui-icon botui-message-content-icon fa fa-$1'></i>")
.replace(_markDownRegex.link, _linkReplacer);
}
function loadScript(src, cb) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
if(cb) {
script.onload = cb;
}
document.body.appendChild(script);
}
function _handleAction(text) {
if(_instance.action.addMessage) {
_interface.message.human({
delay: 100,
content: text
});
}
_instance.action.show = !_instance.action.autoHide;
}
var _botuiComponent = {
template: '<div class=\"botui botui-container\" v-botui-container><div class=\"botui-messages-container\"><div v-for=\"msg in messages\" class=\"botui-message\" :class=\"msg.cssClass\" v-botui-scroll><transition name=\"slide-fade\"><div v-if=\"msg.visible\" :class=\"[{human: msg.human, \'botui-message-content\': true}, msg.type]\"><span v-if=\"msg.type == \'text\'\" v-text=\"msg.content\" v-botui-markdown></span> <iframe v-if=\"msg.type == \'embed\'\" :src=\"msg.content\" frameborder=\"0\" allowfullscreen></iframe></div></transition><div v-if=\"msg.loading\" class=\"botui-message-content loading\"><i class=\"dot\"></i><i class=\"dot\"></i><i class=\"dot\"></i></div></div></div><div class=\"botui-actions-container\"><transition name=\"slide-fade\"><div v-if=\"action.show\" v-botui-scroll><form v-if=\"action.type == \'text\'\" class=\"botui-actions-text\" @submit.prevent=\"handle_action_text()\" :class=\"action.cssClass\"><i v-if=\"action.text.icon\" class=\"botui-icon botui-action-text-icon fa\" :class=\"\'fa-\' + action.text.icon\"></i> <input type=\"text\" ref=\"input\" :type=\"action.text.sub_type\" v-model=\"action.text.value\" class=\"botui-actions-text-input\" :placeholder=\"action.text.placeholder\" :size=\"action.text.size\" :value=\"action.text.value\" :class=\"action.text.cssClass\" required v-focus/> <button type=\"submit\" :class=\"{\'botui-actions-buttons-button\': !!action.text.button, \'botui-actions-text-submit\': !action.text.button}\"><i v-if=\"action.text.button && action.text.button.icon\" class=\"botui-icon botui-action-button-icon fa\" :class=\"\'fa-\' + action.text.button.icon\"></i> <span>{{(action.text.button && action.text.button.label) || \'Go\'}}</span></button></form><div v-if=\"action.type == \'button\'\" class=\"botui-actions-buttons\" :class=\"action.cssClass\"> <button type=\"button\" :class=\"button.cssClass\" class=\"botui-actions-buttons-button\" v-for=\"button in action.button.buttons\" @click=\"handle_action_button(button)\" autofocus><i v-if=\"button.icon\" class=\"botui-icon botui-action-button-icon fa\" :class=\"\'fa-\' + button.icon\"></i> {{button.text}}</button></div></div></transition></div></div>', // replaced by HTML template during build. see Gulpfile.js
data: function () {
return {
action: {
text: {
size: 30,
placeholder: 'Write here ..'
},
button: {},
show: false,
type: 'text',
autoHide: true,
addMessage: true
},
messages: []
};
},
computed: {
isMobile: function () {
return root.innerWidth && root.innerWidth <= 768;
}
},
methods: {
handle_action_button: function (button) {
_handleAction(button.text);
var defaultActionObj = {
type: 'button',
text: button.text,
value: button.value
};
for (var eachProperty in button) {
if (button.hasOwnProperty(eachProperty)) {
if (eachProperty !== 'type' && eachProperty !== 'text' && eachProperty !== 'value') {
defaultActionObj[eachProperty] = button[eachProperty];
}
}
}
_actionResolve(defaultActionObj);
},
handle_action_text: function () {
if(!this.action.text.value) return;
_handleAction(this.action.text.value);
_actionResolve({
type: 'text',
value: this.action.text.value
});
this.action.text.value = '';
}
}
};
root.Vue.directive('botui-markdown', function (el, binding) {
if(binding.value == 'false') return; // v-botui-markdown="false"
el.innerHTML = _parseMarkDown(el.textContent);
});
root.Vue.directive('botui-scroll', {
inserted: function (el) {
_container.scrollTop = _container.scrollHeight;
}
});
root.Vue.directive('focus', {
inserted: function (el) {
el.focus();
}
});
root.Vue.directive('botui-container', {
inserted: function (el) {
_container = el;
}
});
_botApp = new root.Vue({
components: {
'bot-ui': _botuiComponent
}
}).$mount('#' + id);
var _instance = _botApp.$children[0]; // to access the component's data
function _addMessage(_msg) {
if(!_msg.loading && !_msg.content) {
throw Error('BotUI: "content" is required in a non-loading message object.');
}
_msg.type = _msg.type || 'text';
_msg.visible = (_msg.delay || _msg.loading) ? false : true;
var _index = _instance.messages.push(_msg) - 1;
return new Promise(function (resolve, reject) {
setTimeout(function () {
if(_msg.delay) {
_msg.visible = true;
if(_msg.loading) {
_msg.loading = false;
}
}
resolve(_index);
}, _msg.delay || 0);
});
}
function _checkOpts(_opts) {
if(typeof _opts === 'string') {
_opts = {
content: _opts
};
}
return _opts || {};
}
_interface.message = {
add: function (addOpts) {
return _addMessage( _checkOpts(addOpts) );
},
bot: function (addOpts) {
addOpts = _checkOpts(addOpts);
return _addMessage(addOpts);
},
human: function (addOpts) {
addOpts = _checkOpts(addOpts);
addOpts.human = true;
return _addMessage(addOpts);
},
get: function (index) {
return Promise.resolve(_instance.messages[index]);
},
remove: function (index) {
_instance.messages.splice(index, 1);
return Promise.resolve();
},
update: function (index, msg) { // only content can be updated, not the message type.
var _msg = _instance.messages[index];
_msg.content = msg.content;
_msg.visible = !msg.loading;
_msg.loading = !!msg.loading;
return Promise.resolve(msg.content);
},
removeAll: function () {
_instance.messages.splice(0, _instance.messages.length);
return Promise.resolve();
}
};
function mergeAtoB(objA, objB) {
for (var prop in objA) {
if (!objB.hasOwnProperty(prop)) {
objB[prop] = objA[prop];
}
}
}
function _checkAction(_opts) {
if(!_opts.action) {
throw Error('BotUI: "action" property is required.');
}
}
function _showActions(_opts) {
_checkAction(_opts);
mergeAtoB({
type: 'text',
cssClass: '',
autoHide: true,
addMessage: true
}, _opts);
_instance.action.type = _opts.type;
_instance.action.cssClass = _opts.cssClass;
_instance.action.autoHide = _opts.autoHide;
_instance.action.addMessage = _opts.addMessage;
return new Promise(function(resolve, reject) {
_actionResolve = resolve; // resolved when action is performed, i.e: button clicked, text submitted, etc.
setTimeout(function () {
_instance.action.show = true;
}, _opts.delay || 0);
});
};
_interface.action = {
show: _showActions,
hide: function () {
_instance.action.show = false;
return Promise.resolve();
},
text: function (_opts) {
_checkAction(_opts);
_instance.action.text = _opts.action;
return _showActions(_opts);
},
button: function (_opts) {
_checkAction(_opts);
_opts.type = 'button';
_instance.action.button.buttons = _opts.action;
return _showActions(_opts);
}
};
if(_options.fontawesome) {
loadScript(_fontAwesome);
}
if(_options.debug) {
_interface._botApp = _botApp; // current Vue instance
}
return _interface;
});
return BotUI;
}));

View File

@ -1,11 +0,0 @@
/*
* botui 0.3.4
* A JS library to build the UI for your bot
* https://botui.org
*
* Copyright 2017, Moin Uddin
* Released under the MIT license.
*/
a.botui-message-content-link:focus{outline:thin dotted}a.botui-message-content-link:focus:active,a.botui-message-content-link:focus:hover{outline:0}form.botui-actions-text{margin:0}button.botui-actions-buttons-button,input.botui-actions-text-input{margin:0;font-size:100%;line-height:normal;vertical-align:baseline}button.botui-actions-buttons-button::-moz-focus-inner,input.botui-actions-text-input::-moz-focus-inner{border:0;padding:0}button.botui-actions-buttons-button{cursor:pointer;-webkit-appearance:button}
.botui-app-container{width:100%;height:100%;line-height:1}@media (min-width:400px){.botui-app-container{width:400px;height:500px;margin:0 auto}}.botui-container{width:100%;height:100%;overflow-y:auto;overflow-x:hidden}.botui-message{margin:10px 0;min-height:20px}.botui-message-content{width:auto;max-width:85%;display:inline-block}.botui-message-content.human{float:right}.botui-message-content iframe{width:100%}.botui-message-content-image{margin:5px 0;display:block;max-width:200px;max-height:200px}.botui-message-content-link{text-decoration:underline}.botui-actions-buttons-button+.botui-actions-buttons-button{margin-left:10px}@media (min-width:400px){.botui-actions-text-submit{display:none}}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
var botui=new BotUI('hello-mashiro');botui.message.add({delay:800,content:'你好👋'}).then(function(){botui.message.add({delay:1100,content:'我是 Mashiro'}).then(function(){botui.message.add({delay:1100,content:'一个可爱的蓝孩子~'}).then(function(){botui.message.add({delay:1500,content:'就读于上海财经大学'}).then(function(){botui.message.add({delay:1500,content:'向往技术却误入商科,但后来喜欢上了经济学…'}).then(function(){botui.message.add({delay:1800,content:'因为数据分析也需要Coder嘛'}).then(function(){botui.action.button({delay:1600,action:[{text:'然后呢? 😕',value:'sure'},{text:'少废话! 🙄',value:'skip'}]}).then(function(res){if(res.value=='sure'){sure()}if(res.value=='skip'){end()}})})})})})})});var sure=function(){botui.message.add({delay:1000,content:"谢谢😘"}).then(function(){secondpart()})};var end=function(){botui.message.add({delay:1000,content:"😒我猜你大概很着急"}).then(function(){secondpart()})};var secondpart=function(){botui.message.add({delay:1000,content:'平时我主攻R和Python偶尔也折腾HTML/CSS/JS/PHP'}).then(function(){botui.message.add({delay:1800,content:'喜欢画画,希望有一天能够被称为画师'}).then(function(){botui.action.button({delay:1100,action:[{text:'为什么叫Mashiro呢 🤔',value:'why-mashiro'}]}).then(function(res){thirdpart()})})})};var thirdpart=function(){botui.message.add({delay:1000,content:'Mashiro以及站名都来自一部动画因为和主角有一样的爱好呀'}).then(function(){botui.action.button({delay:1500,action:[{text:'为什么是白猫呢? 🤔',value:'why-cat'}]}).then(function(res){fourthpart()})})};var fourthpart=function(){botui.message.add({delay:1000,content:'因为对GitHub有种执念…'}).then(function(){botui.message.add({delay:1100,content:'而且我真的是猫控!'}).then(function(){botui.message.add({delay:1600,content:'那么,仔细看看我的博客吧?^_^'})})})};

View File

@ -1,136 +0,0 @@
var botui = new BotUI('hello-mashiro');
botui.message.add({
delay: 800,
content: '你好👋'
}).then(function() {
botui.message.add({
delay: 1100,
content: '我是 Mashiro'
}).then(function() {
botui.message.add({
delay: 1100,
content: '一个可爱的蓝孩子~'
}).then(function() {
botui.message.add({
delay: 1500,
content: '就读于上海财经大学'
}).then(function() {
botui.message.add({
delay: 1500,
content: '向往技术却误入商科,但后来喜欢上了经济学…'
}).then(function() {
botui.message.add({
delay: 1800,
content: '因为数据分析也需要Coder嘛'
}).then(function() {
botui.action.button({
delay: 1600,
action: [
{
text: '然后呢? 😕',
value: 'sure'
},{
text: '少废话! 🙄',
value: 'skip'
}
]
}).then(function (res) {
if(res.value == 'sure') {
//console.log('然后呢? 😕');
sure();
}
if(res.value == 'skip') {
//console.log('闭嘴! 🙄' );
end();
}
});
});
});
});
});
});
});
var sure = function () {
botui.message.add({
delay: 1000,
content: "谢谢😘"
}).then(function() {
//console.log('进入第二段' );
secondpart();
})
}
var end = function () {
botui.message.add({
delay: 1000,
content: "😒我猜你大概很着急"
}).then(function() {
//console.log('进入第二段' );
secondpart();
})
}
var secondpart = function() {
botui.message.add({
delay: 1000,
content: '平时我主攻R和Python偶尔也折腾HTML/CSS/JS/PHP'
}).then(function() {
botui.message.add({
delay: 1800,
content: '喜欢画画,希望有一天能够被称为画师'
}).then(function() {
botui.action.button({
delay: 1100,
action: [
{
text: '为什么叫Mashiro呢 🤔',
value: 'why-mashiro'
}
]
}).then(function (res) {
//console.log('第三段');
thirdpart();
})
})
})
}
var thirdpart = function() {
botui.message.add({
delay: 1000,
content: 'Mashiro以及站名都来自一部动画因为和主角有一样的爱好呀'
}).then(function() {
botui.action.button({
delay: 1500,
action: [
{ // show only one button
text: '为什么是白猫呢? 🤔',
value: 'why-cat'
}
]
}).then(function (res) {
//console.log('第四段');
fourthpart();
})
})
}
var fourthpart = function() {
botui.message.add({
delay: 1000,
content: '因为对GitHub有种执念…'
}).then(function() {
botui.message.add({
delay: 1100,
content: '而且我真的是猫控!'
}).then(function() {
botui.message.add({
delay: 1600,
content: '那么,仔细看看我的博客吧?^_^'
})
})
})
}

File diff suppressed because one or more lines are too long

View File

@ -1,45 +0,0 @@
{
"name": "botui",
"description": "A JS library to build the UI for your bot",
"homepage": "https://botui.org",
"version": "0.3.4",
"main": "build/botui.min.js",
"author": {
"name": "Moin Uddin",
"url": "https://moin.im"
},
"repository": {
"type": "git",
"url": "git+https://github.com/moinism/botui.git"
},
"bugs": {
"url": "https://github.com/moinism/botui/issues"
},
"keywords": [
"bot",
"chat",
"conversational",
"interface",
"js",
"ui"
],
"dependencies": {},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-banner": "^0.1.3",
"gulp-clean-css": "^3.5.0",
"gulp-concat": "^2.6.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",
"gulp-sass": "^2.3.2",
"gulp-uglify": "^2.0.0",
"htmlclean": "^3.0.2"
},
"scripts": {
"build": "gulp",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "gulp watch"
},
"license": "MIT",
"types": "typings/index.d.ts"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,47 +0,0 @@
<div class="botui botui-container" v-botui-container>
<div class="botui-messages-container">
<div v-for="msg in messages" class="botui-message" :class="msg.cssClass" v-botui-scroll>
<transition name="slide-fade">
<div v-if="msg.visible" :class="[{human: msg.human, 'botui-message-content': true}, msg.type]">
<span v-if="msg.type == 'text'" v-text="msg.content" v-botui-markdown></span>
<iframe v-if="msg.type == 'embed'" :src="msg.content" frameborder="0" allowfullscreen></iframe>
</div>
</transition>
<div v-if="msg.loading" class="botui-message-content loading">
<i class="dot"></i>
<i class="dot"></i>
<i class="dot"></i>
</div>
</div>
</div>
<div class="botui-actions-container">
<transition name="slide-fade">
<div v-if="action.show" v-botui-scroll>
<form v-if="action.type == 'text'" class="botui-actions-text"
@submit.prevent="handle_action_text()" :class="action.cssClass">
<i v-if="action.text.icon"
class="botui-icon botui-action-text-icon fa"
:class="'fa-' + action.text.icon"></i>
<input type="text" ref="input" :type="action.text.sub_type"
v-model="action.text.value" class="botui-actions-text-input" :placeholder="action.text.placeholder"
:size="action.text.size" :value="action.text.value" :class="action.text.cssClass" required v-focus/>
<button type="submit"
:class="{'botui-actions-buttons-button': !!action.text.button, 'botui-actions-text-submit': !action.text.button}">
<i v-if="action.text.button && action.text.button.icon" class="botui-icon botui-action-button-icon fa"
:class="'fa-' + action.text.button.icon"></i>
<span>{{(action.text.button && action.text.button.label) || 'Go'}}</span>
</button>
</form>
<div v-if="action.type == 'button'" class="botui-actions-buttons" :class="action.cssClass">
<button type="button" :class="button.cssClass"
class="botui-actions-buttons-button" v-for="button in action.button.buttons"
@click="handle_action_button(button)"
autofocus>
<i v-if="button.icon" class="botui-icon botui-action-button-icon fa" :class="'fa-' + button.icon"></i>
{{button.text}}
</button>
</div>
</div>
</transition>
</div>
</div>

View File

@ -1,313 +0,0 @@
(function (root, factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define([], function () {
return (root.BotUI = factory(root));
});
} else {
root.BotUI = factory(root);
}
}(typeof window !== 'undefined' ? window : this, function (root, undefined) {
"use strict";
var BotUI = (function (id, opts) {
opts = opts || {};
if(!id) {
throw Error('BotUI: Container id is required as first argument.');
}
if(!document.getElementById(id)) {
throw Error('BotUI: Element with id #' + id + ' does not exist.');
}
if(!root.Vue && !opts.vue) {
throw Error('BotUI: Vue is required but not found.');
}
var _botApp, // current vue instance.
_options = {
debug: false,
fontawesome: true
},
_container, // the outermost Element. Needed to scroll to bottom, for now.
_interface = {}, // methods returned by a BotUI() instance.
_actionResolve,
_markDownRegex = {
icon: /!\(([^\)]+)\)/igm, // !(icon)
image: /!\[(.*?)\]\((.*?)\)/igm, // ![aleternate text](src)
link: /\[([^\[]+)\]\(([^\)]+)\)(\^?)/igm // [text](link) ^ can be added at end to set the target as 'blank'
},
_fontAwesome = 'https://use.fontawesome.com/ea731dcb6f.js',
_esPromisePollyfill = 'https://cdn.jsdelivr.net/es6-promise/4.1.0/es6-promise.min.js'; // mostly for IE
root.Vue = root.Vue || opts.vue;
// merge opts passed to constructor with _options
for (var prop in _options) {
if (opts.hasOwnProperty(prop)) {
_options[prop] = opts[prop];
}
}
if(!root.Promise && !Promise && !options.promise) {
loadScript(_esPromisePollyfill);
}
function _linkReplacer(match, $1, $2, $3) {
var _target = $3 ? 'blank' : ''; // check if '^' sign is present with link syntax
return "<a class='botui-message-content-link' target='" + _target + "' href='" + $2 +"'>" + $1 + "</a>";
}
function _parseMarkDown(text) {
return text
.replace(_markDownRegex.image, "<img class='botui-message-content-image' src='$2' alt='$1' />")
.replace(_markDownRegex.icon, "<i class='botui-icon botui-message-content-icon fa fa-$1'></i>")
.replace(_markDownRegex.link, _linkReplacer);
}
function loadScript(src, cb) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
if(cb) {
script.onload = cb;
}
document.body.appendChild(script);
}
function _handleAction(text) {
if(_instance.action.addMessage) {
_interface.message.human({
delay: 100,
content: text
});
}
_instance.action.show = !_instance.action.autoHide;
}
var _botuiComponent = {
template: 'BOTUI_TEMPLATE', // replaced by HTML template during build. see Gulpfile.js
data: function () {
return {
action: {
text: {
size: 30,
placeholder: 'Write here ..'
},
button: {},
show: false,
type: 'text',
autoHide: true,
addMessage: true
},
messages: []
};
},
computed: {
isMobile: function () {
return root.innerWidth && root.innerWidth <= 768;
}
},
methods: {
handle_action_button: function (button) {
_handleAction(button.text);
var defaultActionObj = {
type: 'button',
text: button.text,
value: button.value
};
for (var eachProperty in button) {
if (button.hasOwnProperty(eachProperty)) {
if (eachProperty !== 'type' && eachProperty !== 'text' && eachProperty !== 'value') {
defaultActionObj[eachProperty] = button[eachProperty];
}
}
}
_actionResolve(defaultActionObj);
},
handle_action_text: function () {
if(!this.action.text.value) return;
_handleAction(this.action.text.value);
_actionResolve({
type: 'text',
value: this.action.text.value
});
this.action.text.value = '';
}
}
};
root.Vue.directive('botui-markdown', function (el, binding) {
if(binding.value == 'false') return; // v-botui-markdown="false"
el.innerHTML = _parseMarkDown(el.textContent);
});
root.Vue.directive('botui-scroll', {
inserted: function (el) {
_container.scrollTop = _container.scrollHeight;
}
});
root.Vue.directive('focus', {
inserted: function (el) {
el.focus();
}
});
root.Vue.directive('botui-container', {
inserted: function (el) {
_container = el;
}
});
_botApp = new root.Vue({
components: {
'bot-ui': _botuiComponent
}
}).$mount('#' + id);
var _instance = _botApp.$children[0]; // to access the component's data
function _addMessage(_msg) {
if(!_msg.loading && !_msg.content) {
throw Error('BotUI: "content" is required in a non-loading message object.');
}
_msg.type = _msg.type || 'text';
_msg.visible = (_msg.delay || _msg.loading) ? false : true;
var _index = _instance.messages.push(_msg) - 1;
return new Promise(function (resolve, reject) {
setTimeout(function () {
if(_msg.delay) {
_msg.visible = true;
if(_msg.loading) {
_msg.loading = false;
}
}
resolve(_index);
}, _msg.delay || 0);
});
}
function _checkOpts(_opts) {
if(typeof _opts === 'string') {
_opts = {
content: _opts
};
}
return _opts || {};
}
_interface.message = {
add: function (addOpts) {
return _addMessage( _checkOpts(addOpts) );
},
bot: function (addOpts) {
addOpts = _checkOpts(addOpts);
return _addMessage(addOpts);
},
human: function (addOpts) {
addOpts = _checkOpts(addOpts);
addOpts.human = true;
return _addMessage(addOpts);
},
get: function (index) {
return Promise.resolve(_instance.messages[index]);
},
remove: function (index) {
_instance.messages.splice(index, 1);
return Promise.resolve();
},
update: function (index, msg) { // only content can be updated, not the message type.
var _msg = _instance.messages[index];
_msg.content = msg.content;
_msg.visible = !msg.loading;
_msg.loading = !!msg.loading;
return Promise.resolve(msg.content);
},
removeAll: function () {
_instance.messages.splice(0, _instance.messages.length);
return Promise.resolve();
}
};
function mergeAtoB(objA, objB) {
for (var prop in objA) {
if (!objB.hasOwnProperty(prop)) {
objB[prop] = objA[prop];
}
}
}
function _checkAction(_opts) {
if(!_opts.action) {
throw Error('BotUI: "action" property is required.');
}
}
function _showActions(_opts) {
_checkAction(_opts);
mergeAtoB({
type: 'text',
cssClass: '',
autoHide: true,
addMessage: true
}, _opts);
_instance.action.type = _opts.type;
_instance.action.cssClass = _opts.cssClass;
_instance.action.autoHide = _opts.autoHide;
_instance.action.addMessage = _opts.addMessage;
return new Promise(function(resolve, reject) {
_actionResolve = resolve; // resolved when action is performed, i.e: button clicked, text submitted, etc.
setTimeout(function () {
_instance.action.show = true;
}, _opts.delay || 0);
});
};
_interface.action = {
show: _showActions,
hide: function () {
_instance.action.show = false;
return Promise.resolve();
},
text: function (_opts) {
_checkAction(_opts);
_instance.action.text = _opts.action;
return _showActions(_opts);
},
button: function (_opts) {
_checkAction(_opts);
_opts.type = 'button';
_instance.action.button.buttons = _opts.action;
return _showActions(_opts);
}
};
if(_options.fontawesome) {
loadScript(_fontAwesome);
}
if(_options.debug) {
_interface._botApp = _botApp; // current Vue instance
}
return _interface;
});
return BotUI;
}));

View File

@ -1,65 +0,0 @@
/*
These are the styles to create an interface of a chat/bot
*/
.botui-app-container {
width: 100%; // mobile-first
height: 100%;
line-height: 1;
@media (min-width: 400px) {
width: 400px;
height: 500px;
margin: 0 auto;
}
}
.botui-container {
width: 100%;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
}
.botui-message {
margin: 10px 0;
min-height: 20px;
}
.botui-message-content {
width: auto;
max-width: 85%;
display: inline-block;
&.human {
float: right;
}
iframe {
width: 100%;
}
}
.botui-message-content-image {
margin: 5px 0;
display: block;
max-width: 200px;
max-height: 200px;
}
.botui-message-content-link {
text-decoration: underline;
}
.botui-actions-buttons-button {
& + .botui-actions-buttons-button {
margin-left: 10px;
}
}
.botui-actions-text-submit {
@media (min-width: 400px) {
display: none;
}
}

View File

@ -1,34 +0,0 @@
/* normalize.css v1.1.3 | MIT License | git.io/normalize */
a.botui-message-content-link:focus {
outline: thin dotted;
&:active,
&:hover {
outline: 0;
}
}
form.botui-actions-text {
margin: 0;
}
button.botui-actions-buttons-button,
input.botui-actions-text-input {
margin: 0;
font-size: 100%;
line-height: normal;
*vertical-align: middle;
vertical-align: baseline;
&::-moz-focus-inner {
border: 0;
padding: 0;
}
}
button.botui-actions-buttons-button {
cursor: pointer;
*overflow: visible;
-webkit-appearance: button;
}

View File

@ -1,152 +0,0 @@
/*
Default theme for BotUI
*/
// you can use your own font.
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
$font-family: 'Open Sans', sans-serif;
$primary-color: #919292;
.botui-container {
font-size: 14px;
background-color: #fff;
font-family: $font-family;
}
.botui-messages-container {
padding: 10px 20px;
}
.botui-actions-container {
padding: 10px 20px;
}
.botui-message {
min-height: 30px;
}
.botui-message-content {
padding: 7px 13px;
border-radius: 15px;
color: darken($primary-color, 22%);
background-color: lighten($primary-color, 35%);
&.human { // if human = true
color: lighten($primary-color, 40%);
background-color: $primary-color;
}
&.text {
line-height: 1.3;
}
&.loading {
background-color: rgba(206,206,206,0.50);
line-height: 1.3;
text-align: center;
}
&.embed {
padding: 5px;
border-radius: 5px;
}
}
.botui-message-content-link {
color: $primary-color;
}
.botui-actions-text-input {
border: 0;
outline: none;
border-radius: 0;
padding: 5px 7px;
font-family: $font-family;
background-color: transparent;
color: darken($primary-color, 22%);
border-bottom: 1px solid $primary-color;
}
.botui-actions-text-submit {
color: #fff;
width: 30px;
padding: 5px;
height: 30px;
line-height: 1;
border-radius: 50%;
border: 1px solid $primary-color;
background: darken($primary-color, 10%);
}
.botui-actions-buttons-button {
border: 0;
color: #fff;
line-height: 1;
cursor: pointer;
font-size: 14px;
font-weight: 500;
padding: 7px 15px;
border-radius: 4px;
font-family: $font-family;
background: darken($primary-color, 10%);
box-shadow: 2px 3px 4px 0 rgba(0,0,0,.25);
}
/*
Animation of messages
For details on how to change, see: https://vuejs.org/v2/guide/transitions.html
*/
.slide-fade-enter-active {
transition: all .3s ease;
}
.slide-fade-enter,
.slide-fade-leave-to {
opacity: 0;
transform: translateX(-10px);
}
/*
Animation of loading dots
*/
.dot {
width: .5rem;
height: .5rem;
border-radius: .5rem;
display: inline-block;
background-color: $primary-color;
&:nth-last-child(1) {
margin-left: .3rem;
animation: loading .6s .3s linear infinite;
}
&:nth-last-child(2) {
margin-left: .3rem;
animation: loading .6s .2s linear infinite;
}
&:nth-last-child(3) {
animation: loading .6s .1s linear infinite;
}
}
@keyframes loading {
0 {
transform: translate(0, 0);
background-color: lighten($primary-color, 10%);
}
25% {
transform: translate(0, -3px);
}
50% {
transform: translate(0, 0px);
background-color: lighten($primary-color, 10%);
}
75% {
transform: translate(0, 3px);
}
100% {
transform: translate(0, 0px);
}
}

View File

@ -1,52 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="build/botui.min.css">
<link rel="stylesheet" href="build/botui-theme-default.css">
</head>
<body>
<div class="botui-app-container" id="hello-world">
<bot-ui></bot-ui>
</div>
<script src="https://cdn.jsdelivr.net/vue/2.0.5/vue.min.js"></script>
<script src="build/botui.js"></script>
<script>
var botui = new BotUI('hello-world');
botui.message.add({
loading: true
}).then(function (index) {
setTimeout(function () {
botui.message.update(index, {
content: 'Hello World from bot!',
loading: false
}).then(function () {
botui.message.add({
delay: 2000,
loading: true,
content: 'Delayed Hello World'
});
});
}, 5000);
});
botui.message.add({
human: true,
content: 'Hello World from human!'
}).then(function () {
botui.action.text({
action: {
button: {
icon: 'check',
label: 'Submit'
}
}
});
});
</script>
</body>
</html>

View File

@ -1,318 +0,0 @@
/**
* BotUI options
*
* @interface BotUIOptions
*/
interface BotUIOptions {
/**
* Set this to true if you want to debug the underlaying Vue instance
*
* @type {boolean}
* @memberof BotUIOptions
*/
debug?: boolean;
/**
* Set this to false if you already have FontAwesome in your project and don't want it to be loaded again by BotUI.
*
* @type {boolean}
* @memberof BotUIOptions
*/
fontawesome?: boolean;
/**
* Set this to vue constructor when you use module loaded system e.g CMD or AMD.
*/
vue?: any;
}
/**
* Message method options
*
* @interface MessageOption
*/
interface MessageOption {
/**
* Set to true if you want to show a loading state '3 animated dots'.
* Available in version >= 0.3.1
*
* @type {boolean}
* @memberof MessageOption
*/
loading?: boolean;
/**
* Wait before showing the message. in milliseconds.
*
* @type {number}
* @memberof MessageOption
*/
delay?: number;
/**
* Either 'text' or 'embed'.
* If you set this to 'embed', BotUI will create an `iframe` element and set `content` as its `src`.
*
* @type {('text' | 'embed')}
* @memberof MessageOption
*/
type: 'text' | 'embed';
/**
* Should be a URL if type is 'embed', text otherwise.
*
* @type {string}
* @memberof MessageOption
*/
content: string;
/**
* Should be shown aligned to right side.
*
* @type {false}
* @memberof MessageOption
*/
human?: false;
/**
* A string or array of custom CSS classes you want to be added.
*
* @type {string|string[]}
* @memberof MessageOption
*/
cssClass?: string | string[];
}
/**
* Actions method option
*
* @interface ActionsOption
*/
interface BaseActionsOption {
/**
* Either 'text' or 'button'.
*
* @type {('text' | 'button')}
* @memberof ActionsOption
*/
type: 'text' | 'button';
/**
* Array of 'ButtonObject' if type is 'button'. Object of 'TextObject' otherwise.
*
* @type {ButtonObject[]|TextObject}
* @memberof ActionsOption
*/
action: ButtonObject[] | TextObject;
/**
* A string or array of custom CSS classes you want to be added.
*
* @type {string|string[]}
* @memberof ActionsOption
*/
cssClass?: string | string[];
/**
* Should the actions sections be hidden when submitted.
*
* @type {boolean}
* @memberof ActionsOption
*/
autoHide?: boolean;
/**
* Text from action is added as a message in UI from human side.
*
* @type {boolean}
* @memberof ActionsOption
*/
addMessage?: boolean;
}
/**
* Text action option.
*
* @interface TextObject
*/
interface TextObject {
/**
* Size of the input to show. Relies on HTML size attribute for input elements.
*
* @type {number}
* @memberof TextObject
*/
size?: number;
/**
* Could be any of the valid types for HTML input elements. e.g.: number, tel, time, date, email, etc.
*
* @type {string}
* @memberof TextObject
*/
sub_type?: string;
/**
* Pre-populates the text field. Only for 'text' type.
*
* @type {string}
* @memberof TextObject
*/
value: string;
/**
* Sets the placeholder text for the input element.
*
* @type {string}
* @memberof TextObject
*/
placeholder?: string;
}
/**
* Button object
*
* @interface ButtonObject
*/
interface ButtonObject {
/**
* Icon to show in button.
*
* @type {string}
* @memberof ButtonObject
*/
icon?: string;
/**
* Text to show in the button. be creative!
*
* @type {string}
* @memberof ButtonObject
*/
text: string;
/**
* This is how you will identify the button when result is returned.
*
* @type {string}
* @memberof ButtonObject
*/
value: string;
/**
* A string or array of custom CSS classes you want to be added.
*
* @type {string|string[]}
* @memberof ButtonObject
*/
cssClass?: string | string[];
}
interface TextActionOption extends BaseActionsOption {
action: TextObject;
}
interface ButtonActionOption extends BaseActionsOption {
action: ButtonObject[];
}
/**
* Result object.
*
* @interface ResultObject
*/
interface ResultObject {
/**
* 'Text' or 'Button' Type of the action it was returned from.
*
* @type {('Text' | 'Button')}
* @memberof ResultObject
*/
type: 'Text' | 'Button';
/**
* Text in the input in case type is 'text'. If type is 'button' then its the same as 'value' in button object.
*
* @type {string}
* @memberof ResultObject
*/
value: string;
/**
* Only present if type of message is 'button'. same as the 'text' in button object.
*
* @type {string}
* @memberof ResultObject
*/
text: string;
}
declare class BotUI {
constructor(id: string, opts?: BotUIOptions);
message: {
/**
* Appends a message to UI.
*
* @param {(MessageOption | string)} message
* @returns {Promise<number>}
*/
add(message: MessageOption | string): Promise<number>;
/**
* Appends a message to UI. Just a shorthand to `message.add`.
*
* @param {(MessageOption | string)} message
* @returns {Promise<number>}
*/
bot(message: MessageOption | string): Promise<number>;
/**
* Appends a message to UI and sets the `human` to `true`.
*
* @param {(MessageOption | string)} message
* @returns {Promise<number>}
*/
human(message: MessageOption | string): Promise<number>;
/**
* Accepts an index of message.
*
* @param {number} index
* @returns {Promise<MessageOption>}
*/
get(index: number): Promise<MessageOption>;
/**
* Updates a message in UI.
* "Only content and loading property of message can updated. type of a message cannot be changed."
*
* @param {number} index
* @param {MessageOption} message
* @returns {Promise<number>}
*/
update(index: number, message: MessageOption): Promise<string>;
/**
* Removes a message from UI.
*
* @param {number} index
* @returns {Promise<void>}
*/
remove(index: number): Promise<void>;
/**
* Removes all the messages from UI.
*
* @param {number} index
* @returns {Promise<void>}
*/
removeAll(index: number): Promise<void>;
}
action: {
/**
* Shows the action section.
*
* @returns {Promise<ResultObject>}
*/
show(action: BaseActionsOption): Promise<ResultObject>;
/**
* Hides the action section.
*
* @returns {Promise<void>}
*/
hide(): Promise<void>;
/**
* Shows the action section and sets the action type to text. Its a shorthand to show.
*
* @param {ActionsOption} action
* @returns {Promise<ResultObject>}
*/
text(action: TextActionOption): Promise<ResultObject>;
/**
* Shows the action section and sets the action type to button. Its a shorthand to show.
*
* @param {ActionsOption} action
* @returns {Promise<ResultObject>}
*/
button(action: ButtonActionOption): Promise<ResultObject>;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,195 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>I'm Mashiro!</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222022">
<link rel="shortcut icon" href="./favicon.ico">
<link rel="stylesheet" href="./botui/build/botui.min.css" />
<link rel="stylesheet" href="./botui/build/botui-theme.css" />
</head>
<body>
<div class="poptitle" id="poptitle">
<div class="popcontainer" id="hello-mashiro">
<center>
<h3>正在与&nbsp;
<ruby>Mashiro&nbsp;
<rp></rp>
<rt>真(ま)白(しろ)</rt>
<rp></rp>
</ruby>对话...</h3>
</center>
<bot-ui></bot-ui>
</div>
</div>
<script src="https://cdn.jsdelivr.net/vue/latest/vue.min.js"></script>
<script src="./botui/build/botui.min.js"></script>
<script>
var botui = new BotUI('hello-mashiro');
botui.message.add({
delay: 800,
content: "Hi, there👋"
}).then(function () {
botui.message.add({
delay: 1100,
content: "这里是 Mashiro"
}).then(function () {
botui.message.add({
delay: 1100,
content: "一个可爱的蓝孩子~"
}).then(function () {
botui.action.button({
delay: 1600,
action: [{
text: "然后呢? 😃",
value: "sure"
}, {
text: "少废话! 🙄",
value: "skip"
}]
}).then(function (a) {
"sure" == a.value && sure();
"skip" == a.value && end()
})
})
})
});
var sure = function () {
botui.message.add({
delay: 600,
content: "😘"
}).then(function () {
secondpart()
})
},
end = function () {
botui.message.add({
delay: 600,
content: "![...](./img.jpg)"
})
},
secondpart = function () {
botui.message.add({
delay: 1500,
content: "目前就读于上海财经大学"
}).then(function () {
botui.message.add({
delay: 1500,
content: "向往技术却误入商科,但后来喜欢上了经济学…"
}).then(function () {
botui.message.add({
delay: 1200,
content: "因为数据分析也需要Coder嘛"
}).then(function () {
botui.message.add({
delay: 1500,
content: "主攻 R 语言和 Python有时也用 STATA对前端也蛮有兴趣全栈不存在的。"
}).then(function () {
botui.message.add({
delay: 1500,
content: "研究的方向,是经济/金融方向的数据分析data science以及机器学习machine learning"
}).then(function () {
botui.message.add({
delay: 1800,
content: "喜欢画画,希望有一天能够被称为画师"
}).then(function () {
botui.action.button({
delay: 1100,
action: [{
text: "为什么叫Mashiro呢 🤔",
value: "why-mashiro"
}]
}).then(function (a) {
thirdpart()
})
})
})
})
})
})
})
},
thirdpart = function () {
botui.message.add({
delay: 1E3,
content: "Mashiro以及站名都来自一部动画因为和主角有一样的爱好~ 如果有兴趣可以找找首页上的视频~"
}).then(function () {
botui.action.button({
delay: 1500,
action: [{
text: "为什么是白猫呢? 🤔",
value: "why-cat"
}]
}).then(function (a) {
fourthpart()
})
})
},
fourthpart = function () {
botui.message.add({
delay: 1E3,
content: "因为对GitHub有种执念… "
}).then(function () {
botui.message.add({
delay: 1100,
content: "而且我真的是猫控!"
}).then(function () {
botui.action.button({
delay: 1500,
action: [{
text: "这个 APP 是怎么回事呢?(ง •_•)ง",
value: "why-domain"
}]
}).then(function (a) {
fifthpart()
})
})
})
},
fifthpart = function () {
botui.message.add({
delay: 1E3,
content: "Emmmm用 Android WebView 做的。。基本就是在 APP 里浏览网页而已~"
}).then(function () {
botui.message.add({
delay: 1600,
content: "那么,好好玩玩吧? ^_^"
})
})
}
</script>
<script>
function updateScroll() {
var element = document.getElementById("poptitle");
element.scrollTop = element.scrollHeight;
}
</script>
</body>
</html>

View File

@ -1,216 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>I'm Mashiro!</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222022">
<link rel="shortcut icon" href="./favicon.ico">
<link rel="stylesheet" href="./botui/build/botui.min.css" />
<link rel="stylesheet" href="./botui/build/botui-theme.css" />
</head>
<body>
<div class="poptitle">
<div class="mylogo">
<!-- <a href="//2heng.xin"><div class="logolink"><span class="brand-logo"> さくら荘の</span>白猫&nbsp;&nbsp;/Home/主页/メインページ</div></a>-->
<a href="//2heng.xin"><div class="logolink"><span class="brand-logo"> さくら荘の</span>白猫<p style="text-align:right;">/Home/主页/メインページ</p></div></a>
</div><br>
<div class="poptitle" style="text-align:right;">
<div class="mylogo">
<a href="//2heng.xin"><div class="logolink"><span class="brand-logo"> さくら荘の</span>白猫</div></a> <div class="popcontainer" id="hello-mashiro">
</div> <bot-ui></bot-ui>
</div>
<div class="poptitle">
<div class="mylogo"> <div class="popooter">
<a href="//2heng.xin"><div class="logolink">/Home/主页/メインページ/</div></a> </div>
</div>
</div>
<div class="popcontainer" id="hello-mashiro">
<bot-ui></bot-ui>
</div>
<script src="https://cdn.jsdelivr.net/vue/latest/vue.min.js"></script>
<div class="popooter"> <script src="./botui/build/botui.min.js"></script>
</div> <script>
var botui = new BotUI('hello-mashiro');
</div>
botui.message.add({
delay: 800,
content: 'Hello! 👋'
}).then(function() {
botui.message.add({
delay: 1100,
content: '我是 Mashiro'
}).then(function() {
botui.message.add({
delay: 1100,
content: '一个可爱的蓝孩子~'
}).then(function() {
botui.action.button({
delay: 1600,
action: [
{
text: '然后呢? 😕',
value: 'sure'
},{
text: '少废话! 🙄',
value: 'skip'
}
]
}).then(function (res) {
if(res.value == 'sure') {
//console.log('然后呢? 😕');
sure();
};
if(res.value == 'skip') {
//console.log('闭嘴! 🙄' );
end();
};
});
});
});
});
var sure = function () {
botui.message.add({
delay: 1000,
content: "谢谢😘"
}).then(function() {
//console.log('进入第二段' );
secondpart();
});
};
var end = function () {
botui.message.add({
delay: 1000,
content: "😒我猜你大概很着急"
}).then(function() {
//console.log('进入第二段' );
secondpart();
});
};
var secondpart = function() {
botui.message.add({
delay: 1500,
content: '目前就读于上海财经大学'
}).then(function() {
botui.message.add({
delay: 1500,
content: '向往技术却误入商科,但后来喜欢上了经济学…'
}).then(function() {
botui.message.add({
delay: 1800,
content: '因为数据分析也需要Coder嘛'
}).then(function() {
botui.message.add({
delay: 1000,
content: '平时主攻R和Python偶尔也折腾HTML/CSS/JS/PHP'
}).then(function() {
botui.message.add({
delay: 1800,
content: '喜欢画画,希望有一天能够被称为画师'
}).then(function() {
botui.action.button({
delay: 1100,
action: [
{
text: '为什么叫Mashiro呢 🤔',
value: 'why-mashiro'
}
]
}).then(function (res) {
//console.log('第三段');
thirdpart();
});
});
});
});
});
});
};
var thirdpart = function() {
botui.message.add({
delay: 1000,
content: 'Mashiro以及站名都来自一部动画因为和主角有一样的爱好呀'
}).then(function() {
botui.action.button({
delay: 1500,
action: [
{ // show only one button
text: '为什么是白猫呢? 🤔',
value: 'why-cat'
}
]
}).then(function (res) {
//console.log('第四段');
fourthpart();
});
});
};
var fourthpart = function() {
botui.message.add({
delay: 1000,
content: '因为对GitHub有种执念…'
}).then(function() {
botui.message.add({
delay: 1100,
content: '而且我真的是猫控!'
}).then(function() {
botui.message.add({
delay: 1600,
content: '那么,进入我的博客吧?'
}).then(function() {
botui.action.button({
delay: 1500,
action: [
{ // show only one button
text: '进入博客',
value: 'to blog'
}
]
}).then(function (res) {
//console.log('to blog');
window.open("https://2heng.xin");
});
});
});
});
};
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-100439904-2', 'auto');
ga('send', 'pageview');
</script>
<div style="display:none">
<script src="https://s19.cnzz.com/z_stat.php?id=1263936154&amp;web_id=1263936154" language="JavaScript"></script><script src="https://c.cnzz.com/core.php?web_id=1263936154&amp;t=z" charset="utf-8" type="text/javascript"></script><a href="http://www.cnzz.com/stat/website.php?web_id=1263936154" target="_blank" title="站长统计">站长统计</a>
</div>
</body>
</html>