Skip to content

Commit be041df

Browse files
author
shengyonggen
committed
优化点击图刷新数据按钮
1 parent 4a6f231 commit be041df

File tree

4 files changed

+45
-19
lines changed

4 files changed

+45
-19
lines changed

sensorsdata.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sdk.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,9 @@ _.draggable = function(elementToDrag, event) {
628628
else event.cancelBubble = true;
629629
if (event.preventDefault) event.preventDefault();
630630
else event.returnValue = false;
631+
632+
elementToDrag.style.bottom = 'auto';
633+
631634
function moveHandler(e) {
632635
e = e || window.event;
633636
var scroll = getScrollOffsets();
@@ -2609,13 +2612,22 @@ var heatmap_render = {
26092612
setRefresh: function(){
26102613
var me = this;
26112614
var div = document.createElement('div');
2612-
div.setAttribute('style','border-radius:3px;font-size:14px;cursor:pointer;z-index:99999;padding:8px 10px;background:#3790e9;color:#fff;position: fixed;left:10px;bottom:10px;');
2613-
div.innerHTML = '<svg width="15px" height="13px" viewBox="0 0 15 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-145.000000, -1953.000000)" fill="#FFFFFF"><g transform="translate(132.000000, 1941.000000)"><path d="M27.8813854,14.6046259 L25.720853,15.6691713 C24.4905498,13.2443736 21.804888,11.6623409 18.7741412,12.0615454 C15.7734018,12.4607499 13.3728103,14.900333 13.042729,17.8574034 C12.592618,21.8494485 15.7583981,25.2352941 19.7193742,25.2352941 C22.5700766,25.2352941 24.9706681,23.4906226 25.9459084,21.0214688 L24.2804981,20.4744107 L24.2654944,20.4744107 C23.3952799,22.5295747 21.1297217,23.8602564 18.639108,23.342769 C16.7936532,22.9583499 15.2932835,21.4798147 14.9031874,19.646431 C14.2430247,16.5119364 16.6436163,13.7470755 19.7193742,13.7470755 C21.6548511,13.7470755 23.3052578,14.8411916 24.1154574,16.4380096 L21.8649028,17.5616964 C21.804888,17.5912671 21.804888,17.6947645 21.8799065,17.7095499 L26.3960193,19.1732998 C26.4410304,19.1880851 26.4860415,19.1585144 26.5010452,19.1141583 L27.9864112,14.6637674 C28.0314223,14.6341967 27.9564038,14.5750552 27.8813854,14.6046259 L27.8813854,14.6046259 Z" id="refresh"></path></g></g></g></svg> <span title="当页面有内容更切换时候,点击刷新数据,重新计算">刷新点击图数据</span>';
2615+
div.setAttribute('style','border-radius:3px;font-size:14px;cursor:move;z-index:99999;padding:10px 16px;background:#3790e9;color:#fff;position: fixed;left:10px;bottom:10px;');
2616+
div.innerHTML = '<!-- <svg width="15px" height="13px" viewBox="0 0 15 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-145.000000, -1953.000000)" fill="#FFFFFF"><g transform="translate(132.000000, 1941.000000)"><path d="M27.8813854,14.6046259 L25.720853,15.6691713 C24.4905498,13.2443736 21.804888,11.6623409 18.7741412,12.0615454 C15.7734018,12.4607499 13.3728103,14.900333 13.042729,17.8574034 C12.592618,21.8494485 15.7583981,25.2352941 19.7193742,25.2352941 C22.5700766,25.2352941 24.9706681,23.4906226 25.9459084,21.0214688 L24.2804981,20.4744107 L24.2654944,20.4744107 C23.3952799,22.5295747 21.1297217,23.8602564 18.639108,23.342769 C16.7936532,22.9583499 15.2932835,21.4798147 14.9031874,19.646431 C14.2430247,16.5119364 16.6436163,13.7470755 19.7193742,13.7470755 C21.6548511,13.7470755 23.3052578,14.8411916 24.1154574,16.4380096 L21.8649028,17.5616964 C21.804888,17.5912671 21.804888,17.6947645 21.8799065,17.7095499 L26.3960193,19.1732998 C26.4410304,19.1880851 26.4860415,19.1585144 26.5010452,19.1141583 L27.9864112,14.6637674 C28.0314223,14.6341967 27.9564038,14.5750552 27.8813854,14.6046259 L27.8813854,14.6046259 Z" id="refresh"></path></g></g></g></svg> --> <span style="cursor:pointer;" title="当页面有内容更切换时候,点击刷新数据,重新计算">刷新数据</span>';
26142617
document.body.appendChild(div);
2615-
_.addEvent(div,'click',function(){
2616-
me.refreshHeatData();
2617-
me.showErrorInfo(5);
2618+
_.addEvent(div,'click',function(e){
2619+
console.log()
2620+
if(e.target && e.target.tagName && e.target.tagName.toLowerCase() === 'span'){
2621+
me.refreshHeatData();
2622+
me.showErrorInfo(5);
2623+
}
26182624
});
2625+
_.addEvent(div,'mousedown',function(e){
2626+
if(e.target && e.target.tagName && e.target.tagName.toLowerCase() !== 'span'){
2627+
_.draggable(div,e);
2628+
}
2629+
});
2630+
26192631
},
26202632
showErrorInfo: function(error_type,error_msg){
26212633
var div = document.createElement('div');
@@ -2930,6 +2942,7 @@ var heatmap_render = {
29302942
target_is_on_float = true;
29312943
}
29322944
});
2945+
29332946
/*
29342947
_.addEvent(eleSlideDown,'mousedown',function(e){
29352948
if(e.target.id === 'sa_heat_float_right_box_slidedown'){

src/sensorsdata.full.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ sd.initPara = function(para){
122122
, slice = ArrayProto.slice
123123
, toString = ObjProto.toString
124124
, hasOwnProperty = ObjProto.hasOwnProperty
125-
, LIB_VERSION = '1.7.1.2';
125+
, LIB_VERSION = '1.7.1.3';
126126

127127
sd.lib_version = LIB_VERSION;
128128

@@ -746,6 +746,9 @@ _.draggable = function(elementToDrag, event) {
746746
else event.cancelBubble = true;
747747
if (event.preventDefault) event.preventDefault();
748748
else event.returnValue = false;
749+
750+
elementToDrag.style.bottom = 'auto';
751+
749752
function moveHandler(e) {
750753
e = e || window.event;
751754
var scroll = getScrollOffsets();
@@ -2721,13 +2724,22 @@ var heatmap_render = {
27212724
setRefresh: function(){
27222725
var me = this;
27232726
var div = document.createElement('div');
2724-
div.setAttribute('style','border-radius:3px;font-size:14px;cursor:pointer;z-index:99999;padding:8px 10px;background:#3790e9;color:#fff;position: fixed;left:10px;bottom:10px;');
2725-
div.innerHTML = '<svg width="15px" height="13px" viewBox="0 0 15 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-145.000000, -1953.000000)" fill="#FFFFFF"><g transform="translate(132.000000, 1941.000000)"><path d="M27.8813854,14.6046259 L25.720853,15.6691713 C24.4905498,13.2443736 21.804888,11.6623409 18.7741412,12.0615454 C15.7734018,12.4607499 13.3728103,14.900333 13.042729,17.8574034 C12.592618,21.8494485 15.7583981,25.2352941 19.7193742,25.2352941 C22.5700766,25.2352941 24.9706681,23.4906226 25.9459084,21.0214688 L24.2804981,20.4744107 L24.2654944,20.4744107 C23.3952799,22.5295747 21.1297217,23.8602564 18.639108,23.342769 C16.7936532,22.9583499 15.2932835,21.4798147 14.9031874,19.646431 C14.2430247,16.5119364 16.6436163,13.7470755 19.7193742,13.7470755 C21.6548511,13.7470755 23.3052578,14.8411916 24.1154574,16.4380096 L21.8649028,17.5616964 C21.804888,17.5912671 21.804888,17.6947645 21.8799065,17.7095499 L26.3960193,19.1732998 C26.4410304,19.1880851 26.4860415,19.1585144 26.5010452,19.1141583 L27.9864112,14.6637674 C28.0314223,14.6341967 27.9564038,14.5750552 27.8813854,14.6046259 L27.8813854,14.6046259 Z" id="refresh"></path></g></g></g></svg> <span title="当页面有内容更切换时候,点击刷新数据,重新计算">刷新点击图数据</span>';
2727+
div.setAttribute('style','border-radius:3px;font-size:14px;cursor:move;z-index:99999;padding:10px 16px;background:#3790e9;color:#fff;position: fixed;left:10px;bottom:10px;');
2728+
div.innerHTML = '<!-- <svg width="15px" height="13px" viewBox="0 0 15 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-145.000000, -1953.000000)" fill="#FFFFFF"><g transform="translate(132.000000, 1941.000000)"><path d="M27.8813854,14.6046259 L25.720853,15.6691713 C24.4905498,13.2443736 21.804888,11.6623409 18.7741412,12.0615454 C15.7734018,12.4607499 13.3728103,14.900333 13.042729,17.8574034 C12.592618,21.8494485 15.7583981,25.2352941 19.7193742,25.2352941 C22.5700766,25.2352941 24.9706681,23.4906226 25.9459084,21.0214688 L24.2804981,20.4744107 L24.2654944,20.4744107 C23.3952799,22.5295747 21.1297217,23.8602564 18.639108,23.342769 C16.7936532,22.9583499 15.2932835,21.4798147 14.9031874,19.646431 C14.2430247,16.5119364 16.6436163,13.7470755 19.7193742,13.7470755 C21.6548511,13.7470755 23.3052578,14.8411916 24.1154574,16.4380096 L21.8649028,17.5616964 C21.804888,17.5912671 21.804888,17.6947645 21.8799065,17.7095499 L26.3960193,19.1732998 C26.4410304,19.1880851 26.4860415,19.1585144 26.5010452,19.1141583 L27.9864112,14.6637674 C28.0314223,14.6341967 27.9564038,14.5750552 27.8813854,14.6046259 L27.8813854,14.6046259 Z" id="refresh"></path></g></g></g></svg> --> <span style="cursor:pointer;" title="当页面有内容更切换时候,点击刷新数据,重新计算">刷新数据</span>';
27262729
document.body.appendChild(div);
2727-
_.addEvent(div,'click',function(){
2728-
me.refreshHeatData();
2729-
me.showErrorInfo(5);
2730+
_.addEvent(div,'click',function(e){
2731+
console.log()
2732+
if(e.target && e.target.tagName && e.target.tagName.toLowerCase() === 'span'){
2733+
me.refreshHeatData();
2734+
me.showErrorInfo(5);
2735+
}
27302736
});
2737+
_.addEvent(div,'mousedown',function(e){
2738+
if(e.target && e.target.tagName && e.target.tagName.toLowerCase() !== 'span'){
2739+
_.draggable(div,e);
2740+
}
2741+
});
2742+
27312743
},
27322744
showErrorInfo: function(error_type,error_msg){
27332745
var div = document.createElement('div');
@@ -3042,6 +3054,7 @@ var heatmap_render = {
30423054
target_is_on_float = true;
30433055
}
30443056
});
3057+
30453058
/*
30463059
_.addEvent(eleSlideDown,'mousedown',function(e){
30473060
if(e.target.id === 'sa_heat_float_right_box_slidedown'){

vtrack.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)