Autofix small errors

This commit is contained in:
Igor Barkov [iwork]
2019-01-16 19:45:30 +02:00
parent d330721114
commit 094b8a6027
313 changed files with 736 additions and 2280 deletions
+50 -48
View File
@@ -21,23 +21,25 @@
(function($){
$.fn.tipTip = function(options) {
var defaults = {
activation: "hover",
keepAlive: false,
maxWidth: "150px",
edgeOffset: 0,
defaultPosition: "right",
delay: 0,
fadeIn: 200,
fadeOut: 200,
attribute: "title",
content: false, // HTML or String to fill TipTIp with
enter: function(){},
exit: function(){}
};
var opts = $.extend(defaults, options);
// Setup tip tip elements and render them to the DOM
const defaults = {
activation: "hover",
keepAlive: false,
maxWidth: "150px",
edgeOffset: 0,
defaultPosition: "right",
delay: 0,
fadeIn: 200,
fadeOut: 200,
attribute: "title",
content: false, // HTML or String to fill TipTIp with
enter: function () {
},
exit: function () {
}
};
const opts = $.extend(defaults, options);
// Setup tip tip elements and render them to the DOM
if($("#tiptip_holder").length <= 0){
var tiptip_holder = $('<div id="tiptip_holder" style="max-width:'+ opts.maxWidth +';"></div>');
var tiptip_content = $('<div id="tiptip_content"></div>');
@@ -50,8 +52,8 @@
}
return this.each(function(){
var org_elem = $(this);
if(opts.content){
const org_elem = $(this);
if(opts.content){
var org_title = opts.content;
} else {
var org_title = org_elem.attr(opts.attribute);
@@ -60,9 +62,9 @@
if(!opts.content){
org_elem.removeAttr(opts.attribute); //remove original Attribute
}
var timeout = false;
if(opts.activation == "hover"){
let timeout = false;
if(opts.activation == "hover"){
org_elem.hover(function(){
active_tiptip();
}, function(){
@@ -102,20 +104,20 @@
tiptip_content.html(org_title);
tiptip_holder.hide().removeAttr("class").css("margin","0");
tiptip_arrow.removeAttr("style");
var top = parseInt(org_elem.offset()['top']);
var left = parseInt(org_elem.offset()['left']);
var org_width = parseInt(org_elem.outerWidth());
var org_height = parseInt(org_elem.outerHeight());
var tip_w = tiptip_holder.outerWidth();
var tip_h = tiptip_holder.outerHeight();
var w_compare = Math.round((org_width - tip_w) / 2);
var h_compare = Math.round((org_height - tip_h) / 2);
var marg_left = Math.round(left + w_compare);
var marg_top = Math.round(top + org_height + opts.edgeOffset);
var t_class = "";
var arrow_top = "";
var arrow_left = Math.round(tip_w - 12) / 2;
const top = parseInt(org_elem.offset()['top']);
const left = parseInt(org_elem.offset()['left']);
const org_width = parseInt(org_elem.outerWidth());
const org_height = parseInt(org_elem.outerHeight());
const tip_w = tiptip_holder.outerWidth();
const tip_h = tiptip_holder.outerHeight();
const w_compare = Math.round((org_width - tip_w) / 2);
const h_compare = Math.round((org_height - tip_h) / 2);
let marg_left = Math.round(left + w_compare);
let marg_top = Math.round(top + org_height + opts.edgeOffset);
let t_class = "";
let arrow_top = "";
let arrow_left = Math.round(tip_w - 12) / 2;
if(opts.defaultPosition == "bottom"){
t_class = "_bottom";
@@ -126,11 +128,11 @@
} else if(opts.defaultPosition == "right"){
t_class = "_right";
}
var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
var left_compare = (tip_w + left) > parseInt($(window).width());
if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
let right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
let left_compare = (tip_w + left) > parseInt($(window).width());
if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
t_class = "_right";
arrow_top = Math.round(tip_h - 13) / 2;
arrow_left = -12;
@@ -147,10 +149,10 @@
marg_top = Math.round(top + h_compare);
}
var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
let top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
let bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
if(t_class == "_top" || t_class == "_bottom"){
t_class = "_top";
} else {
@@ -177,9 +179,9 @@
marg_left = marg_left + 5;
}
tiptip_arrow.css({"margin-left": arrow_left+"px", "margin-top": 200+arrow_top+"px"});
var art_top = top + org_height - tip_h/2;
if(art_top < 0){art_top=10;}
let art_top = top + org_height - tip_h / 2;
if(art_top < 0){art_top=10;}
// old one - marg_top
tiptip_holder.css({"margin-left": marg_left+10+"px", "margin-top": art_top+"px"}).attr("class","tip");