Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boostrap 5.0(beta) updated #35

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
78fa6b1
불필요한 텍스트 블록 삭제
SoyaNyan Jan 18, 2021
3d766c4
Bootstrap v5.0으로 업데이트, 소스파일 경로 변경
SoyaNyan Jan 18, 2021
556b2cc
Bootstrap 버전 설명 수정
SoyaNyan Jan 18, 2021
addbd50
플러그인 소스파일 경로 fix
SoyaNyan Jan 18, 2021
d2173a6
font-awesome JS/CSS 추가
SoyaNyan Jan 18, 2021
a542b5a
Bootstrap 5.0 샘플 템플릿 css 적용
yuiopna Jan 18, 2021
7e62638
HTML 탬플릿 적용, 코드 인덴트 수정
yuiopna Jan 18, 2021
da5a154
네비게이션바 Github 링크 버튼 추가
yuiopna Jan 18, 2021
ad8d1e3
html파일 내의 css코드 분리
SoyaNyan Jan 18, 2021
1df0e18
이전 버전 minified css/js 파일 삭제
SoyaNyan Jan 18, 2021
2403265
Merge branch 'sample/html'
SoyaNyan Jan 18, 2021
3dd7711
불필요한 node.js 모듈 관련 파일 삭제
SoyaNyan Jan 18, 2021
34e92a3
author, version정보 수정
SoyaNyan Jan 19, 2021
67a68ae
샘플페이지 네비게이션 메뉴 수정
yuiopna Jan 19, 2021
fc961b0
Toast, Snack 버튼에 position옵션을 위한 select박스 추가
yuiopna Jan 19, 2021
883ed50
Toast, Snack position 옵션 select 통합
yuiopna Jan 19, 2021
07f9fae
Github Repo 위젯 추가(iframe)
SoyaNyan Jan 19, 2021
a06c86e
Merge remote-tracking branch 'origin/example/html'
SoyaNyan Jan 19, 2021
79c29dd
Position select 박스 이벤트 등록
Phudal Jan 19, 2021
eab5600
샘플 페이지 global constant 수정
Phudal Jan 19, 2021
03e4412
Toast, Snack 버튼 이벤트 수정
Phudal Jan 19, 2021
2a3a1ec
ECMAScript6 문법 적용
SoyaNyan Jan 19, 2021
b4fed78
플러그인 초기화 메서드 toastInit 추가
SoyaNyan Jan 19, 2021
159bb76
샘플 페이지 Toast 플러그인 초기값 변경(stackable, pauseDelayOnHover)
Phudal Jan 19, 2021
efc1c69
position 변경시 초기화 메서드 호출
Phudal Jan 19, 2021
035c2b3
Merge remote-tracking branch 'origin/master' into sample/js
Phudal Jan 19, 2021
d4ccb1c
Toast 옵션에 icon 추가
SoyaNyan Jan 19, 2021
357d1b6
Merge remote-tracking branch 'origin/sample/js'
SoyaNyan Jan 19, 2021
31b1b87
toastDefaults 기본값 추가(types)
SoyaNyan Jan 19, 2021
c515afa
type별 background class 추가
SoyaNyan Jan 19, 2021
7586560
Bootstrap 5.0버전 toast 이벤트, 메서드 업데이트
SoyaNyan Jan 19, 2021
2c99c30
pauseDelayOnHover 기능 undefined 오류 수정
SoyaNyan Jan 19, 2021
d474023
README.md 플러그인 설명 수정
shd5632 Jan 20, 2021
d7bfd81
플러그인 global variables, 플러그인 초기화 메서드 설명 추가
shd5632 Jan 20, 2021
080af1e
Toast global variables 테이블 추가
shd5632 Jan 20, 2021
3b2187c
stackable 옵션이 동작하지 않는 오류 수정
SoyaNyan Jan 20, 2021
00b6715
Toast & Snack 옵션, 사용 예제 추가
shd5632 Jan 20, 2021
7fcc5a6
Contributors, Live Demo 페이지 링크 추가
shd5632 Jan 20, 2021
8b2f048
원본 프로젝트에서 변경된 사항 updates 섹션에 기록
shd5632 Jan 20, 2021
59040fe
Merge branch 'master' into sample/doc
shd5632 Jan 20, 2021
1a7eeb6
함께 쓸 수없는 stackable, pauseDelayOnHover 옵션 처리
SoyaNyan Jan 20, 2021
6a0512d
Merge remote-tracking branch 'origin/sample/doc'
SoyaNyan Jan 20, 2021
3946eb3
toastInit 초기화 메서드 설명 수정
SoyaNyan Jan 20, 2021
7a48128
Toast 배경 색깔이 light일경우 텍스트를 어둡게 표시하게 수정
shd5632 Jan 20, 2021
b020e88
Toast에서 모서리가 둥글지 않게 표시되는 현상 수정
shd5632 Jan 20, 2021
c993dfe
Snack render시 잘못된 인자 전달 수정
SoyaNyan Jan 20, 2021
bea90c4
toastInit 초기화 메서드 설명 수정
SoyaNyan Jan 20, 2021
4d7aebe
Toast type별 커스텀 클래스 처리 수정
SoyaNyan Jan 20, 2021
a888869
Javascript syntax fixed
SoyaNyan Jan 20, 2021
5c326da
Toast, Snack 미리보기 이미지 소스 변경
SoyaNyan Jan 20, 2021
e4ce0d2
Update README.md
SoyaNyan Jan 20, 2021
12ecb47
Update README.md
SoyaNyan Jan 20, 2021
fec60ee
Update README.md
SoyaNyan Jan 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 123 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,153 @@
# Toast - A Bootstrap 4.2+ jQuery plugin
# Toast - A Bootstrap 5.0 jQuery plugin

* [About](#about)
* [Usage](#usage)
* [Live Example](https://jsfiddle.net/47n5ygth/)
* [Contributing](#contributing)
- [About](#about)
- [Updates](#updates)
- [Usage](#usage)
- [Live Example](https://romantic-wozniak-01d0b4.netlify.app/)
- [Contributing](#contributing)
- [Contributors](#contributors)

### About
## About

As of Bootstrap 4.2, [toasts](https://getbootstrap.com/docs/4.2/components/toasts/) have been introduced and the aim of this plugin is to make them easier to use.
As of **Bootstrap 4.2**, [toasts](https://getbootstrap.com/docs/4.2/components/toasts/) have been introduced and the aim of this plugin is to make them easier to use. (original)

### Usage
## Updates

#### Gloabls
As Bootstrap was updated to version 5.0(beta), the usage of the toast component changed. So, we fixed some code that was not compatible with Bootstrap 4 and added some new features.

- Bootstrap Core updated to 5.0(beta)
- Deleted incompatible codes and fixed
- jQuery updated to latest version
- Icon and more background colors are supported
- Minor code errors and mistakes fixed

## Usage

### Global Variables (or default values)

Modify the global variables to apply specific rules/styles to all your toasts.

```javascript
```js
// default option values
$.toastDefaults = {
position: 'top-right', /** top-left/top-right/top-center/bottom-left/bottom-right/bottom-center - Where the toast will show up **/
dismissible: true, /** true/false - If you want to show the button to dismiss the toast manually **/
stackable: true, /** true/false - If you want the toasts to be stackable **/
pauseDelayOnHover: true, /** true/false - If you want to pause the delay of toast when hovering over the toast **/
position: "top-right",
dismissible: true,
stackable: true, // stackable & pauseDelayOnHover options are incompatible
pauseDelayOnHover: false,
style: {
toast: '', /** Classes you want to apply separated my a space to each created toast element (.toast) **/
info: '', /** Classes you want to apply separated my a space to modify the "info" type style **/
success: '', /** Classes you want to apply separated my a space to modify the "success" type style **/
warning: '', /** Classes you want to apply separated my a space to modify the "warning" type style **/
error: '', /** Classes you want to apply separated my a space to modify the "error" type style **/
// user custom style classname
toast: "",
info: "",
success: "",
warning: "",
error: "",
primary: "",
secondary: "",
light: "",
dark: "",
},
};
```

### Initializing Global Variables

| Option Name | Type | Description | Values |
| :-------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| $.toastDefaults.position | String | Set toast & snack position from the container(or viewport). | 'top-right' \| 'top-center' \| 'top-left' \| 'bottom-right' \| 'bottom-center' \| 'bottom-left' (middle option currently not-supported) |
| $.toastDefaults.dismissible | Boolean | Enables toast & snack dismissible with dismiss button. | true \| false |
| $.toastDefaults.stackable | Boolean | Enables toast & snack stackable. (not compatible with 'pauseDelayOnHover' option.) | true \| false |
| $.toastDefaults.pauseDelayOnHover | Boolean | Enables toast & snack to stop auto-hide when hover mouse pointer on specific toast or snack. (not compatible with 'stackable' option.) | true \| false |

```js
// plugin initializing function
$.toastInit = function (opts) {
const { position, dismissible, stackable, pauseDelayOnHover } = opts;

// set values
$.toastDefaults.position = position ?? $.toastDefaults.position;
$.toastDefaults.dismissible = dismissible ?? $.toastDefaults.dismissible;
$.toastDefaults.stackable = stackable ?? $.toastDefaults.stackable;
$.toastDefaults.pauseDelayOnHover = pauseDelayOnHover ?? $.toastDefaults.pauseDelayOnHover;

// check incompatible variables
if ($.toastDefaults.stackable) {
$.toastDefaults.pauseDelayOnHover = false;
} else {
$.toastDefaults.pauseDelayOnHover = true;
}
};
```

#### Snack
```js
// initializing example in sample.html
$.toastInit({
position: "bottom-center",
dismissible: true,
stackable: true, // stackable & pauseDelayOnHover options are incompatible
pauseDelayOnHover: false,
});
```

---

A "snack" is a bitesized "toast".
### Snack (customized toast)

```javascript
$.snack(type, title, delay)
<center><img src="http://soya.moe:463/CDN/snack.png" width="60%"></center>

```js
$.snack = function (type, content, delay) {
return render({
type,
content,
delay,
});
};
```
<img src="https://i.gyazo.com/165671094c4c956bf89a05f4d9f089b1.png">

**Note:** The final argument `delay` is omitable. If omitted, the toast will remain forever.
**Note:** The final argument `delay` is omittable (optional). If omitted, the toast will remain forever.

#### Toast
### Toast

```javascript
<center><img src="http://soya.moe:463/CDN/toast.png" width="60%"></center>

```js
$.toast({
type: 'info',
title: 'Notice!',
subtitle: '11 mins ago',
content: 'Hello, world! This is a toast message.',
type: type,
title: title,
subtitle: "11 mins ago",
content: content,
delay: 5000,
icon: "fab fa-github", // font-awesome6 icon class
img: {
src: 'https://via.placeholder.com/20',
class: 'rounded-0', /** Classes you want to apply separated my a space to modify the image **/
alt: 'Image'
}
src: IMG_URL,
alt: "Image",
},
});
```

<img src="https://i.gyazo.com/63c444e180d5d18ef8a71df2969cc0cc.png">
**Note:** The `icon` and `img` options are compatible but not recommended to use them together.

---

### Live Example (from Netlify)

[Live Demo](https://romantic-wozniak-01d0b4.netlify.app/)

![live-demo](http://soya.moe:463/CDN/live-demo.png)

### Contributing
---

## Contributing

Feel free to contribute in any of the ways outlined:

- Submit issues/pull requests
- Tell us how you're using this plugin in *your* project
- Submit issues/pull requests
- Tell us how you're using this plugin in _your_ project

[@Script47/Toast](https://github.com/Script47/Toast)

### Contributors

Thanks to all contributors.

[@yuiopna](https://github.com/yuiopna), [@shd5632](https://github.com/shd5632), [@Phudal](https://github.com/Phudal)
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

1 change: 0 additions & 1 deletion dist/toast.min.css

This file was deleted.

6 changes: 0 additions & 6 deletions dist/toast.min.js

This file was deleted.

Loading