-
Notifications
You must be signed in to change notification settings - Fork 0
/
sharp.html
835 lines (732 loc) · 19.4 KB
/
sharp.html
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
<!DOCTYPE html>
<html>
<head>
<title>javascript class collection and testing center</title>
<meta charset="utf-8">
<script type="text/javascript" src="js/jquery-1.11.3.js"></script>
<style type="text/css">
/*comment*/
.commentWrap {
}
.commonItem > .imgWrap {
width:25px;
height:25px;
overflow:hidden;
float:left;
}
.commonItem > .reply1 {
border-left:2px solid skyblue;
margin-left:30px;
padding-left:8px;
}
.commonItem > .reply2 {
padding-left:8px;
margin-left:30px;
}
.commonItem > p > a {
float:right;
font-size:12px;
text-decoration:none;
}
.voting > div > label {
display: block;
height: 30px;
line-height: 30px;
padding: 0px 10px;
}
.voting > div > label > span {
float: right;
}
.voting > div > label:hover {
background-color: #eaeaea;
}
.voting > div.voteItem {
width: 300px;
}
.voting > div > .vote {
display: block;
width: 100%;
border: 0px;
background-color: #eaeaea;
height: 30px;
line-height: 30px;
cursor: pointer;
}
.voting > .addVoting > input {
float: left;
}
.voting > .addVoting > input, .voting > .addVoting > button {
padding: 10px;
}
</style>
</head>
<body>
<h1>小组件的大功能</h1>
<h3>scene svg 场景</h3>
<div>
<svg>
<circle r="100" cx="100" cy="100" stroke="red" stroke-width="5" fill="green"></circle>
</svg>
</div>
<q>in this strage, I rely on jquery.</q>
<div class="commentWrap">
<input type="text" id="user" value='{"name": "liduanjie", "avatar": "http://www.baidu.com"}'>
<h3>多级回复示例</h3>
<div class="commonItem">
<div class="imgWrap">
<img src="svg.svg">
</div>
<div >name : name ; age: age</div>
<div class="reply1">this is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is replythis is reply</div>
<div class="reply2">this is reply</div>
<p><a href="" class="showReply">回复</a></p>
</div>
</div>
<ul>
<li>极少依赖dom的是最好的。</li>
</ul>
迷宫
图标字体
react
app, angular, webapp
播放器buffer
流媒体
http://he91-com.iteye.com/blog/1907749
<!-- <div class="voting">
<div class="addVoting">
<input type="" name="">
<button class="addBtn">add</button>
数据库有的东西可以通过查找。
<div class="searchResult">
<ul>
<li>someting in the woerld</li>
<li>someting in the woerld</li>
<li>someting in the woerld</li>
</ul>
</div>
</div>
<div class="voteItem">
<label><input type="radio" name=""> 采茶季 <span>★★★</span></label>
<label><input type="radio" name=""> 半道英雄 <span>★★★</span></label>
<button class="vote">确定</button>
</div>
</div> -->
<div id="voting"></div>
<style type="text/css">
.audio {
width: 100%;
position: fixed;
bottom: 0px;
left: 0px;
background-color: #333;
height: 56px;
}
.audio > .btns {
display: inline-block;
float: left;
position: relative;
top: 20px;
}
.audio > .btns > a {
color: #fff;
font-weight: bold;
text-align: center;
font-size: 12px;
line-height: 20px;
width: 20px;
height: 20px;
border: 1px solid #fff;
border-radius: 50%;
margin-right: 10px;
display: inline-block;
}
.audio > .play {
width: 500px;
display: inline-block;
position: relative;
top: 10px;
}
.audio > .play > .imgWrap {
float: left;
width: 25px;
height: 25px;
overflow: hidden;
}
.audio > .play > .content {
margin-left: 41px;
}
.audio > .play > .content > p {
color: #fff;
margin: 0px;
margin-bottom: 6px;
font-size: 12px;
line-height: normal;
}
.audio > .play > .content > .proWrap {
width:500px;
}
.audio > .play > .content > .proWrap > .time {
float: right;
display: inline-block;
width: 100px;
font-size: 12px;
color: #fff;
position: relative;
top: -2px;
}
.audio > .play > .content > .proWrap >.progress {
position: relative;
margin-right: 110px;
cursor: pointer;
}
.audio > .play > .content > .proWrap >.progress > .bar {
width: 100%;
height: 9px;
background-color: #ddd;
opacity: .7;
border-radius: 30px;
position: absolute;
top: 0px;
left: 0px;
z-index: -1;
transition: 1s all;
}
.audio > .play > .content > .proWrap >.progress > .pbar {
width:200px;
background-color: red;
height: 9px;
position: relative;
border-radius: 30px;
z-index: 10;
transition: 1s all;
}
.audio > .play > .content > .proWrap >.progress > .pbar > i {
content: '';
display: inline-block;
width: 5px;
height: 5px;
border: 8px solid #fff;
background-color: red;
border-radius: 50%;
position: absolute;
right: -5px;
top: -6px;
}
.audio > .ctrl {
color: #fff;
font-size: 14px;
float: right;
}
.audio > .ctrl > a{
margin-right: 10px;
height: 56px;
line-height: 56px;
display: inline-block;
width: 3em;
text-align:center;
cursor: pointer;
}
.audio > .ctrl > a:hover {
background-color: #ddd;
color: #333;
}
.playlist {
height: 300px;
border-radius: 5px;
}
.playlist > .pl-title {
background-color: #333;
height: 40px;
line-height: 40px;
font-size: 14px;
font-weight: bold;
color: #fff;
padding: 0px 20px;
}
.playlist > .pl-body {
position: relative;
}
.playlist > .pl-body > .listb {
position: absolute;
top: 0px;
left: 2px;
width: 558px;
height: 260px;
background-color: #121212;
opacity: .2;
color: #fff;
}
.playlist > .pl-body > .listb > ul {
padding: 0px;
}
.playlist > .pl-body > .listb > ul > li {
list-style: none;
}
.playlist > .pl-body > .listb > ul > li:after{
content: '';
display: table;
clear: both;
}
.playlist > .pl-body > .listb > ul > li > .col {
float: left;
padding-left: 10px;
line-height: 28px;
height: 28px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.playlist > .pl-body > .listb > ul > li > div.playicon {
width: 10px;
}
.playlist > .pl-body > .listb > ul > li > div.name {
width: 256px;
}
.playlist > .pl-body > .listb > ul > li > .icons {
width: 78px;
visibility: hidden;
}
.playlist > .pl-body > .listb > ul > li > .time {
width: 35px;
}
.playlist > .pl-body > .listb > ul > li > .link {
width: 37px;
padding-left: 6px;
}
.playlist > .pl-body > .listb > ul > li:hover {
background-color: red;
}
.playlist > .pl-body > .listb > ul > li:hover > .icons{
visibility: visible;
}
.playlist > .pl-body > .listlyric {
position: absolute;
left: 560px;
top: 0px;
z-index: 4;
width: 420px;
height: 250px;
background-color: #121212;
}
</style>
<div class="playlist">
<div class="pl-title">
<h3>播放列表(<span>330</span>)</h3>
<!-- <div>
<span>收藏全部</span>
<span>清除</span>
</div> -->
</div>
<div class="pl-body">
<div class="listb">
<ul>
<li>
<div class="playicon col">df</div>
<div class="name col">阿凡提</div>
<div class="icons col">
<span class="add">a</span>
<span class="share">e</span>
<span class="download">d</span>
<span class="delete">l</span>
</div>
<div class="composer col"><a href="">群星</a></div>
<div class="time col">01:02</div>
<div class="link col">icon</div>
</li>
<li>
<div class="playicon col">df</div>
<div class="name col">阿凡提</div>
<div class="icons col">
<span class="add">a</span>
<span class="share">e</span>
<span class="download">d</span>
<span class="delete">l</span>
</div>
<div class="composer col"><a href="">群星</a></div>
<div class="time col">01:02</div>
<div class="link col">icon</div>
</li>
<li>
<div class="playicon col">df</div>
<div class="name col">阿凡提</div>
<div class="icons col">
<span class="add">a</span>
<span class="share">e</span>
<span class="download">d</span>
<span class="delete">l</span>
</div>
<div class="composer col"><a href="">群星</a></div>
<div class="time col">01:02</div>
<div class="link col">icon</div>
</li>
</ul>
</div>
<div class="bline" style="display:none;"></div>
<div class="listlyric">
</div>
</div>
</div>
<div class="audio">
<!-- <button>playlist</button> -->
<div class="btns">
<a class="prev"><</a>
<a class="play">||</a>
<a class="next">></a>
</div>
<div class="play">
<div class="imgWrap">
<img src="http://placehold.it/200x200">
</div>
<div class="content">
<p>
<span class="name">含笑</span>
<span class="composer">含笑</span>
</p>
<div class="proWrap">
<span class="time">02:55/04:55</span>
<div class="progress">
<div class="pbar"><i></i></div>
<div class="bar"></div>
</div>
</div>
</div>
</div>
<div class="ctrl">
<a class="add">add</a>
<a class="add">share</a>
<a class="add">volumn</a>
<a class="playlistBtn">playlist</a>
</div>
</div>
如何控制音乐的速度
关于音乐刘: <a href="https://www.google.com/search?q=%E9%9F%B3%E4%B9%90%E6%B5%81%E6%98%AF%E6%80%8E%E6%A0%B7buffer%E8%BF%87%E6%9D%A5%E7%9A%84&oq=%E9%9F%B3%E4%B9%90%E6%B5%81%E6%98%AF%E6%80%8E%E6%A0%B7buffer%E8%BF%87%E6%9D%A5%E7%9A%84&aqs=chrome..69i57.12212j0j4&sourceid=chrome&ie=UTF-8">music</a>
<script type="text/javascript">
var $pbar = $('.pbar');
var $progress = $('.progress');
var $i = $pbar.find('i');
var locationX = $i.offset().left;
var correcting = 4;
$progress.bind('click', function(e) {
$pbar.css({
'width': 200 + e.pageX - locationX - correcting + 'px'
})
console.log(e.pageX)
})
// $pbar.find('i').on('mousemove', function(e) {
// var $this = $(this);
// var distance = e.pageX -200;
// console.log(distance)
// $pbar.css({
// width: 200 + distance + 'px'
// })
// })
</script>
<div>
<h3>网页书评</h3>
<div class="books">
个逻辑绑定在了一起。点回复按钮的时候,会append,textarea, 点提交按钮的时候,会append整块commentItem;append之后,重新执行一次这个过程。
* 尝试一下不用类来写。
* 私有作用域如果不变成对象作用域,那么未来的动作就可能相互影响。也就是说可能两个点击的按钮会公用同一个对象
* 问题,在ajax加载完成之后拿不到对象的ajaxData,因为没有设置async,相当于异步了,没有线程阻塞,结果在后面的步骤返回数据,不过已经晚了。在前面执行的函数,到了后面才能拿到数据。
* 浏览器创建多少个类才会卡斯
* 字符串转json
</div>
</div>
</body>
<script type="text/javascript">
/**
* 最好自己可以研究一些什么东西出来啦。
**/
/**
* 多级回复
* 评价: 两个逻辑绑定在了一起。点回复按钮的时候,会append,textarea, 点提交按钮的时候,会append整块commentItem;append之后,重新执行一次这个过程。
* 尝试一下不用类来写。
* 私有作用域如果不变成对象作用域,那么未来的动作就可能相互影响。也就是说可能两个点击的按钮会公用同一个对象
* 问题,在ajax加载完成之后拿不到对象的ajaxData,因为没有设置async,相当于异步了,没有线程阻塞,结果在后面的步骤返回数据,不过已经晚了。在前面执行的函数,到了后面才能拿到数据。
* 浏览器创建多少个类才会卡斯
* 字符串转json
**/
var Comment = function() {
this.template = '<div class="reply">' +
'<label>comment</label>' +
'<textarea></textarea>' +
'<button class="replayBtn">提交</button>' +
'</div>';
this.template1 = '<div class="commonItem">' +
'<div class="imgWrap">' +
'<img src="#avatar#">' +
'</div>' +
'<div ><span>name : #name#</span> <span>age: #age#</span></div>' +
'<div class="reply1">#reply1#</div>' +
'<div class="reply2">#reply2#</div>' +
'<p><a href="" class="showReply">回复</a></p>' +
'</div>';
this.$showReply;
this.ajaxData;
this.once = true;
}
Comment.prototype = {
showReply: function($elem) {
var _self = this;
_self.$showReply = $elem;
_self.$commentItem = $elem.closest('.commonItem');
$elem.bind('click', function(e) {
e.preventDefault();
_self.reply1 = _self.$commentItem.find('.reply2').html();
if (_self.once) {
_self.$template = $(_self.template);
_self.$template.find('.replayBtn').bind('click', function() {
_self.reply2 = $(this).closest('.reply').find('textarea').val();
//ajax加载数据之后判断数据的完整性
_self.ajaxCB(function() {
_self.checkHandle();
});
var newTpl = _self.template1.replace('#avatar#', _self.ajaxData.data.avatar)
.replace('#name#', _self.ajaxData.data.name)
.replace('#age#', _self.ajaxData.data.age)
.replace('#reply1#', _self.ajaxData.data.reply1)
.replace('#reply2#', _self.ajaxData.data.reply2);
_self.$newTpl = $(newTpl);
var xx = new Comment();
xx.showReply(_self.$newTpl.find('.showReply'));
$('.commentWrap > h3').after(_self.$newTpl);
})
_self.$commentItem.after(_self.$template);
_self.once = false;
} else {
_self.$template.remove();
_self.once = true;
}
})
},
ajaxCB: function(success) {
var _self = this;
// 这个作为虚拟数据的时候用到
var data = JSON.parse($('#user').val());
this.ajaxData = {
success: true,
data: {
avatar: data.avatar,
name: data.name,
age: new Date(),
reply1:_self.reply1,
reply2:_self.reply2
}
}
// 下面这个作为异步加载
// $.ajax({
// type: 'post',
// async: false,
// url: 'http://localhost/projects/blog/leejie/data.json',
// success: function(data) {
// _self.ajaxData = data;
// }
// })
if(success) {
success()
}
},
checkHandle: function() {
var _self = this;
if (_self.ajaxData) {
_self.ajaxData.data.avatar == 'undefined' ? _self.ajaxData.data.avatar = _self.ajaxData.data.avatar : 'default';
_self.ajaxData.data.name == 'undefined' ? _self.ajaxData.data.name = _self.ajaxData.data.name : 'default';
_self.ajaxData.data.age == 'undefined' ? _self.ajaxData.data.age = _self.ajaxData.data.age : 'default';
_self.ajaxData.data.reply1 == 'undefined' ? _self.ajaxData.data.reply1 = _self.ajaxData.data.reply1 : 'default';
_self.ajaxData.data.reply2 == 'undefined' ? _self.ajaxData.data.reply2 = _self.ajaxData.data.reply2 : 'default';
}
},
test: function() {
// 作为测试之用
}
}
var $showReply = $('.showReply');
$.each($showReply, function() {
var xx = new Comment();
xx.showReply($(this));
})
/**
* 级联动菜单
* 传入的是一个container,最好能够自定义样式,而且初始化能够有更多扩展性。
**/
var Cascad = function() {
this.data = [
{
name: '一级菜单',
id: 22,
child: [
{
'name': '二级菜单1',
'id': 111
},
{
'name': '二级菜单1',
'id': 111
}
]
},
{
name: '一级菜单',
id: 22,
child: [
{
'name': '二级菜单1',
'id': 111
},
{
'name': '二级菜单1',
'id': 111
}
]
}
]
}
Cascad.prototype = {
loop: function(data) {
console.log(data)
$.each(data, function(k,v) {
} )
},
main: function() {
var _self = this;
_self.loop(_self.data);
}
}
var xi = new Cascad();
xi.main();
/**
* 上传图片的研究
**/
var Upload = function () {
}
Upload.prototype = {
}
/**
* 网站笔记
**/
var Noting = function() {
}
Noting.prototype = {
}
$('.books').bind('mouseup', function(e) {
var parentOffset = $(this).offset();
var x = e.pageX - parentOffset.left;
var y = e.pageY - parentOffset.top;
var txt = window.getSelection();
})
/**
* 手势库
**/
/**
* 标签云图
**/
/**
clandar
**/
/**
* imageload
**/
/**
* 瀑布流
**/
/**
* 投票系统(voting system)
**/
var Voting = function() {
this.template = '<div class="voting">' +
'<div class="addVoting">' +
'<input type="" name="">' +
'<button class="addBtn">add</button>' +
'<div class="searchResult">' +
'<ul>' +
'</ul>' +
'</div>' +
'</div>' +
'<div class="voteItem">' +
'<label><input type="radio" name=""> 采茶季 <span>★★★</span></label>' +
'<button class="vote">确定</button>' +
'</div>' +
'</div>';
this.searchResultTpl = '<li>#resultItem#</li>';
this.searchResult = '';
this.$parent = $('#voting');
this.labelTpl = '<label><input type="radio" name="#name#"> #value# <span>#rate#</span></label>';
this.recommand = ['采茶季', 'all soul waltz','xx1','xx3', 'hello','adsdad'];
this.search = [];
this.voted = ['xx1', 'xx2', 'xx3', 'xx4'];
}
Voting.prototype = {
main: function() {
var _self = this;
_self.$template = $(_self.template);
var $addBtn = _self.$template.find('.addBtn'),
$input = _self.$template.find('input');
_self.votedItem();
$input.bind('keyup', function() {
var value = $(this).val();
_self.search = [];
for (var i = 0; i<_self.recommand.length;i++) {
if (_self.recommand[i].indexOf(value) > -1) {
_self.search.push(_self.recommand[i]);
}
}
_self.searchR();
})
$addBtn.bind('click', function() {
var value = $input.val();
if (_self.voted.indexOf(value) !== -1) {
alert('already voted, select another to add.');
return;
} else {
_self.voted.push(value);
_self.votedItem();
}
})
_self.$parent.append(_self.$template)
},
votedItem: function() {
var _self = this;
_self.votedItem = '';
for (var i=0;i<_self.voted.length;i++) {
_self.votedItem += _self.labelTpl.replace('#value#', _self.voted[i]);
}
$voteItem = $(_self.votedItem);
_self.$template.find('.voteItem > button').before($voteItem);
},
searchR: function() {
var _self = this;
for(var j = 0;j < _self.search.length; j++) {
_self.searchResult = '';
_self.searchResult += _self.searchResultTpl.replace('#resultItem#',_self.search[j]);
}
_self.$searchResult = $(_self.searchResult);
_self.$searchResult.bind('click', function() {
_self.$template.find('input').val($(this).html());
})
_self.$template.find('.searchResult > ul').empty().append(_self.$searchResult);
},
efficient: function() {
// 判断浏览器的性能,不行就不执行查询
}
}
var xxx = new Voting();
xxx.main();
/**
* 迷宫(game)
**/
/**
* 音乐播放器
* 包含歌曲调用组件。,歌曲分类组件,歌曲展示组件,分享组件
**/
var Audio = function() {
}
Audio.prototype = {
init: function() {
alert()
}
}
/**
* 信息架构,其实可以从另外的一些方面来,就是目标搜索,推荐浏览,画廊浏览,可以用路由决定用户想要什么。一级一级分离,然后再达到受众手中的信息,应该比较精确。全局,自定义的面向受众的标签
**/
</script>
</html>