-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.js
132 lines (116 loc) · 3.71 KB
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
let siteNameWords = ['jQuery', 'Material']
$(function() {
$('.jm-header').initHeader({
pageTitle: 'jQuery Material',
siteNameWords,
navContents: ['articles', 'resources', 'events', 'jobs', 'news', 'about'],
})
$('.jm-footer').initFooter({
siteInfo: {
siteNameWords,
siteAuthorName: 'youknowznm',
siteAuthorHomepage: 'https://github.com/youknowznm',
siteSourceLink: 'https://github.com/youknowznm/jqueryMaterial.js',
},
socialInfo: {
wechatQrLink: './_images/footer/wechat-qr.png',
email: 'znm92@icloud.com',
zhihuLink: 'https://www.zhihu.com/people/youkonwznm',
githubLink: 'https://github.com/youknowznm',
},
})
$('.jm-input').initInput()
$('.jm-button').initButton(function($t) {
$.showJmToast(`You clicked one of [${$t.parent().prev().html().toUpperCase()}].`);
})
$('.show-alert').bindClickListener(function() {
$.showJmDialog({
dialogType: 'alert',
title: 'This is an alert title',
content: 'You can specify some description text in here.',
confirmButtonText: 'got it!',
onConfirm() {
$.showJmToast(`You dismissed the alert.`);
}
})
})
$('.show-confirm').bindClickListener(function() {
$.showJmDialog({
dialogType: 'confirm',
title: 'Would you like to delete your debt?',
content: 'All of the banks have agreed to forgive you your debts.',
cancelButtonText: 'sounds like a scam',
confirmButtonText: 'please do it!',
onCancel() {
$.showJmToast(`You were smart enough.`);
},
onConfirm() {
$.showJmToast(`You were cheated.`);
},
})
})
$('.show-prompt').bindClickListener(function() {
$.showJmDialog({
dialogType: 'prompt',
title: 'How would you like to name your dogs?',
content: 'Bowser is a common name.',
cancelButtonText: 'I\'m a cat person',
confirmButtonText: 'OK!',
promptDataArr: [{
name: 'Dog 1',
value: 'Buddy',
},
{
name: 'Dog 2',
value: '',
},
],
onCancel() {
$.showJmToast(`You didn't name your dog.`);
},
onConfirm($t) {
$.showJmToast(`You named your dogs '${$('#jm-prompt-input-1').val()}' and '${$('#jm-prompt-input-2').val()}'.`);
}
})
})
$('.to-top').bindClickListener(function() {
$('body').jmScrollInto()
})
$('.to-input').bindClickListener(function() {
$('.email-input-label').jmScrollInto()
})
$('.jm-radio-group').initRadio({
labels: [{
name: 'apple',
},
{
name: 'banana',
warn: true,
},
{
name: 'grape',
checked: true,
},
{
name: 'orange',
disabled: true,
},
],
})
$('.jm-tag').initTag({
tagGroupName: 'Houses',
tagsArr: ['targaryen', 'stark'],
maxLengthEachTag: 10,
maxTagCount: 3,
})
$('.jm-bg').initBackground()
$('.jm-rte').initRte({
id: '133',
maxLength: 200,
contentToEdit: '<h1>Sample Heading</h1>',
// useRichText: false,
})
$('.show-toast').bindClickListener(function() {
$.showJmToast('This is a sample toast.')
})
})