kf5 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/assets/javascripts/kf5.js +69 -22
- data/lib/kf5/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a37d016acb7b368be42ddba7b061c5a7b60ef871
|
4
|
+
data.tar.gz: bd1a96be69ea75a75893dcd5dca8f4e5a5ce6c40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89fd394684e5e7866c227ce912193b7d8aa4432ed98a535121bd7df0332e02ad2fd23c99f2dde6238fcdcd526dc3f9d5c18a0d4acfc5c6a43e93887dd89fde2e
|
7
|
+
data.tar.gz: 39d42976e766e536374ea9cdeb2b1ebd821c1722fea8569b60e04ef47106262520aded37e8ffc5820355569fb969dee1b114b3e95671cb5ce67163f330e07eef
|
data/CHANGELOG.md
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
iframeURL : '//' + kf5Domain + '/supportbox/index',
|
17
17
|
btn_icon : '//assets.kf5.com/supportbox/images/icon2.png',
|
18
18
|
styleURL : '//assets.kf5.com/supportbox/css/btn.css',
|
19
|
-
template : '<div id="kw-tab" class="kf5-support-btn" style="{{bg_color}}"> <img src="{{btn_icon}}" alt=""><span>{{title}}</span> </div> <div id="kw-block" class="kf5-support"> <a id="kw-close" class="kf5-close" title="关闭"><i class="icon-clear"></i></a> <div id="kw-loading" class="kf5-loading"> </div> <iframe id="kw-widget-iframe" src="" scrolling="no" frameborder="0"></iframe> </div>'
|
19
|
+
template : '<div id="kw-tab" class="kf5-support-btn" style="{{bg_color}}"> <img src="{{btn_icon}}" alt=""><span>{{title}}</span> </div> <div id="kw-block" class="kf5-support"> <a id="kw-close" class="kf5-close" title="关闭"><i class="kf5-icon-clear"></i></a> <div id="kw-loading" class="kf5-loading"> </div> <iframe id="kw-widget-iframe" src="" scrolling="no" frameborder="0"></iframe> </div>'
|
20
20
|
};
|
21
21
|
|
22
22
|
function KF5SupportBox(config)
|
@@ -116,6 +116,7 @@
|
|
116
116
|
|
117
117
|
this.el = window.document.createElement('div');
|
118
118
|
this.el.setAttribute('class', className);
|
119
|
+
this.el.setAttribute('id', 'kf5-support-123456789');
|
119
120
|
this.el.innerHTML = this.getOpt('template')
|
120
121
|
.replace('{{title}}', this.getOpt('btn_name') || '获取帮助')
|
121
122
|
.replace('{{btn_icon}}', this.getOpt('btn_icon'))
|
@@ -180,11 +181,11 @@
|
|
180
181
|
{
|
181
182
|
if(!this.isOpened)
|
182
183
|
{
|
183
|
-
|
184
|
+
var self = this;
|
184
185
|
|
185
186
|
this.loadIframe();
|
186
|
-
|
187
|
-
slideUp(
|
187
|
+
slideDown(this.getElement('#kw-tab'), {duration: 200, easing: 'swing'});
|
188
|
+
slideUp(self.getElement('#kw-block'), {duration: 200, easing: 'swing'});
|
188
189
|
|
189
190
|
cookie('kf5-supportBox-autoOpen', 1, {expires: 3 / 24, path: '/'});
|
190
191
|
|
@@ -194,11 +195,27 @@
|
|
194
195
|
|
195
196
|
close: function(e)
|
196
197
|
{
|
197
|
-
// slideDown(this.getElement('#kw-
|
198
|
-
|
198
|
+
// slideDown(this.getElement('#kw-block'), 200);
|
199
|
+
// showElement(this.getElement('#kw-tab'));
|
200
|
+
var self = this;
|
199
201
|
|
200
|
-
|
201
|
-
|
202
|
+
slideDown(
|
203
|
+
this.getElement('#kw-block'),
|
204
|
+
{
|
205
|
+
duration: 200,
|
206
|
+
easing: 'swing',
|
207
|
+
callback: function()
|
208
|
+
{
|
209
|
+
slideUp(
|
210
|
+
self.getElement('#kw-tab'),
|
211
|
+
{
|
212
|
+
duration: 200,
|
213
|
+
easing: 'swing'
|
214
|
+
}
|
215
|
+
);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
);
|
202
219
|
|
203
220
|
cookie('kf5-supportBox-autoOpen', null, {path: '/'});
|
204
221
|
|
@@ -209,6 +226,11 @@
|
|
209
226
|
var supportbox;
|
210
227
|
function onload()
|
211
228
|
{
|
229
|
+
// if(supportbox)
|
230
|
+
// {
|
231
|
+
// return;
|
232
|
+
// }
|
233
|
+
|
212
234
|
var script = window.document.createElement('script'),
|
213
235
|
configURL = supportboxConfigURL;
|
214
236
|
|
@@ -230,6 +252,12 @@
|
|
230
252
|
document.addEventListener('page:load', onload, false);
|
231
253
|
window.addEventListener('load', onload, false);
|
232
254
|
|
255
|
+
if(!window.initializeKF5SupportBox)
|
256
|
+
{
|
257
|
+
// 暴露初始化方法,以解决特殊情况下load事件无法触发
|
258
|
+
window.initializeKF5SupportBox = onload;
|
259
|
+
}
|
260
|
+
|
233
261
|
// allow cross origin operation
|
234
262
|
window.addEventListener('message', function(e)
|
235
263
|
{
|
@@ -417,7 +445,20 @@
|
|
417
445
|
return curCSS && curCSS(el, style);
|
418
446
|
}
|
419
447
|
|
420
|
-
|
448
|
+
var easing = {
|
449
|
+
|
450
|
+
swing: function(p)
|
451
|
+
{
|
452
|
+
return 0.5 - Math.cos( p * Math.PI ) / 2;
|
453
|
+
},
|
454
|
+
|
455
|
+
linear: function(p)
|
456
|
+
{
|
457
|
+
return p;
|
458
|
+
}
|
459
|
+
};
|
460
|
+
|
461
|
+
function slideUp(elem, options)
|
421
462
|
{
|
422
463
|
var originalStyle = elem.getAttribute('style');
|
423
464
|
elem.style.display = 'block';
|
@@ -425,17 +466,18 @@
|
|
425
466
|
|
426
467
|
elem.style.height = '0px';
|
427
468
|
|
428
|
-
duration = duration || 500;
|
469
|
+
var duration = options.duration || 500;
|
429
470
|
var tStart = Date.now(),
|
430
|
-
|
471
|
+
percent = 0,
|
431
472
|
timer = setInterval(function()
|
432
473
|
{
|
433
|
-
|
434
|
-
|
474
|
+
percent = (Date.now() - tStart) / duration;
|
475
|
+
percent = percent > 1 ? 1 : percent;
|
435
476
|
|
436
|
-
elem.style.height =
|
477
|
+
elem.style.height = (easing[options.easing || 'swing'](percent)
|
478
|
+
* originalHeight) + 'px';
|
437
479
|
|
438
|
-
if(
|
480
|
+
if(percent >= 1)
|
439
481
|
{
|
440
482
|
clearInterval(timer);
|
441
483
|
timer = null;
|
@@ -449,28 +491,31 @@
|
|
449
491
|
elem.removeAttribute('style');
|
450
492
|
}
|
451
493
|
elem.style.display = 'block';
|
494
|
+
|
495
|
+
options.callback && options.callback.call(elem);
|
452
496
|
}
|
453
497
|
}, 1000 / 60);
|
454
498
|
}
|
455
499
|
|
456
|
-
function slideDown(elem,
|
500
|
+
function slideDown(elem, options)
|
457
501
|
{
|
458
502
|
var originalStyle = elem.getAttribute('style');
|
459
503
|
elem.style.display = 'block';
|
460
504
|
|
461
505
|
var originalHeight = parseInt(getStyle(elem, 'height'));
|
462
506
|
|
463
|
-
duration = duration || 500;
|
507
|
+
var duration = options.duration || 500;
|
464
508
|
var tStart = Date.now(),
|
465
|
-
|
509
|
+
percent = 0,
|
466
510
|
timer = setInterval(function()
|
467
511
|
{
|
468
|
-
|
469
|
-
|
512
|
+
percent = (Date.now() - tStart) / duration;
|
513
|
+
percent = percent > 1 ? 1 : percent;
|
470
514
|
|
471
|
-
elem.style.height = (1 -
|
515
|
+
elem.style.height = (easing[options.easing || 'swing'](1 - percent)
|
516
|
+
* originalHeight) + 'px';
|
472
517
|
|
473
|
-
if(
|
518
|
+
if(percent >= 1)
|
474
519
|
{
|
475
520
|
clearInterval(timer);
|
476
521
|
timer = null;
|
@@ -484,6 +529,8 @@
|
|
484
529
|
elem.removeAttribute('style');
|
485
530
|
}
|
486
531
|
elem.style.display = 'none';
|
532
|
+
|
533
|
+
options.callback && options.callback.call(elem);
|
487
534
|
}
|
488
535
|
}, 1000 / 60);
|
489
536
|
}
|
data/lib/kf5/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kf5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chen Yi-Cyuan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|