Autofix small errors
This commit is contained in:
+123
-109
@@ -1,90 +1,100 @@
|
||||
// Simple Set Clipboard System
|
||||
// Author: Joseph Huckaby
|
||||
|
||||
var ZeroClipboard = {
|
||||
|
||||
version: "1.0.6",
|
||||
clients: {}, // registered upload clients on page, indexed by id
|
||||
moviePath: 'i/popup/ZeroClipboard.swf', // URL to movie
|
||||
nextId: 1, // ID of next movie
|
||||
|
||||
$: function(thingy) {
|
||||
// simple DOM lookup utility function
|
||||
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
|
||||
if (!thingy.addClass) {
|
||||
// extend element with a few useful methods
|
||||
thingy.hide = function() { this.style.display = 'none'; };
|
||||
thingy.show = function() { this.style.display = ''; };
|
||||
thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
|
||||
thingy.removeClass = function(name) {
|
||||
var classes = this.className.split(/\s+/);
|
||||
var idx = -1;
|
||||
for (var k = 0; k < classes.length; k++) {
|
||||
if (classes[k] == name) { idx = k; k = classes.length; }
|
||||
}
|
||||
if (idx > -1) {
|
||||
classes.splice( idx, 1 );
|
||||
this.className = classes.join(' ');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
thingy.hasClass = function(name) {
|
||||
return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
|
||||
};
|
||||
}
|
||||
return thingy;
|
||||
},
|
||||
|
||||
setMoviePath: function(path) {
|
||||
// set path to ZeroClipboard.swf
|
||||
this.moviePath = path;
|
||||
},
|
||||
|
||||
dispatch: function(id, eventName, args) {
|
||||
// receive event from flash movie, send to client
|
||||
var client = this.clients[id];
|
||||
if (client) {
|
||||
client.receiveEvent(eventName, args);
|
||||
}
|
||||
},
|
||||
|
||||
register: function(id, client) {
|
||||
// register new client to receive events
|
||||
this.clients[id] = client;
|
||||
},
|
||||
|
||||
getDOMObjectPosition: function(obj, stopObj) {
|
||||
// get absolute coordinates for dom element
|
||||
var info = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: obj.width ? obj.width : obj.offsetWidth,
|
||||
height: obj.height ? obj.height : obj.offsetHeight
|
||||
};
|
||||
const ZeroClipboard = {
|
||||
|
||||
while (obj && (obj != stopObj)) {
|
||||
info.left += obj.offsetLeft;
|
||||
info.top += obj.offsetTop;
|
||||
obj = obj.offsetParent;
|
||||
}
|
||||
version: "1.0.6",
|
||||
clients: {}, // registered upload clients on page, indexed by id
|
||||
moviePath: 'i/popup/ZeroClipboard.swf', // URL to movie
|
||||
nextId: 1, // ID of next movie
|
||||
|
||||
return info;
|
||||
},
|
||||
|
||||
Client: function(elem) {
|
||||
// constructor for new simple upload client
|
||||
this.handlers = {};
|
||||
|
||||
// unique ID
|
||||
this.id = ZeroClipboard.nextId++;
|
||||
this.movieId = 'ZeroClipboardMovie_' + this.id;
|
||||
|
||||
// register client with singleton to receive flash events
|
||||
ZeroClipboard.register(this.id, this);
|
||||
|
||||
// create movie
|
||||
if (elem) this.glue(elem);
|
||||
}
|
||||
$: function (thingy) {
|
||||
// simple DOM lookup utility function
|
||||
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
|
||||
if (!thingy.addClass) {
|
||||
// extend element with a few useful methods
|
||||
thingy.hide = function () {
|
||||
this.style.display = 'none';
|
||||
};
|
||||
thingy.show = function () {
|
||||
this.style.display = '';
|
||||
};
|
||||
thingy.addClass = function (name) {
|
||||
this.removeClass(name);
|
||||
this.className += ' ' + name;
|
||||
};
|
||||
thingy.removeClass = function (name) {
|
||||
const classes = this.className.split(/\s+/);
|
||||
let idx = -1;
|
||||
for (let k = 0; k < classes.length; k++) {
|
||||
if (classes[k] == name) {
|
||||
idx = k;
|
||||
k = classes.length;
|
||||
}
|
||||
}
|
||||
if (idx > -1) {
|
||||
classes.splice(idx, 1);
|
||||
this.className = classes.join(' ');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
thingy.hasClass = function (name) {
|
||||
return !!this.className.match(new RegExp("\\s*" + name + "\\s*"));
|
||||
};
|
||||
}
|
||||
return thingy;
|
||||
},
|
||||
|
||||
setMoviePath: function (path) {
|
||||
// set path to ZeroClipboard.swf
|
||||
this.moviePath = path;
|
||||
},
|
||||
|
||||
dispatch: function (id, eventName, args) {
|
||||
// receive event from flash movie, send to client
|
||||
const client = this.clients[id];
|
||||
if (client) {
|
||||
client.receiveEvent(eventName, args);
|
||||
}
|
||||
},
|
||||
|
||||
register: function (id, client) {
|
||||
// register new client to receive events
|
||||
this.clients[id] = client;
|
||||
},
|
||||
|
||||
getDOMObjectPosition: function (obj, stopObj) {
|
||||
// get absolute coordinates for dom element
|
||||
const info = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: obj.width ? obj.width : obj.offsetWidth,
|
||||
height: obj.height ? obj.height : obj.offsetHeight
|
||||
};
|
||||
|
||||
while (obj && (obj != stopObj)) {
|
||||
info.left += obj.offsetLeft;
|
||||
info.top += obj.offsetTop;
|
||||
obj = obj.offsetParent;
|
||||
}
|
||||
|
||||
return info;
|
||||
},
|
||||
|
||||
Client: function (elem) {
|
||||
// constructor for new simple upload client
|
||||
this.handlers = {};
|
||||
|
||||
// unique ID
|
||||
this.id = ZeroClipboard.nextId++;
|
||||
this.movieId = 'ZeroClipboardMovie_' + this.id;
|
||||
|
||||
// register client with singleton to receive flash events
|
||||
ZeroClipboard.register(this.id, this);
|
||||
|
||||
// create movie
|
||||
if (elem) this.glue(elem);
|
||||
}
|
||||
};
|
||||
|
||||
ZeroClipboard.Client.prototype = {
|
||||
@@ -103,8 +113,8 @@ ZeroClipboard.Client.prototype = {
|
||||
this.domElement = ZeroClipboard.$(elem);
|
||||
|
||||
// float just above object, or zIndex 99 if dom element isn't set
|
||||
var zIndex = 99;
|
||||
if (this.domElement.style.zIndex) {
|
||||
let zIndex = 99;
|
||||
if (this.domElement.style.zIndex) {
|
||||
zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
|
||||
}
|
||||
|
||||
@@ -116,12 +126,12 @@ ZeroClipboard.Client.prototype = {
|
||||
}
|
||||
|
||||
// find X/Y position of domElement
|
||||
var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
|
||||
|
||||
// create floating DIV above element
|
||||
const box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
|
||||
|
||||
// create floating DIV above element
|
||||
this.div = document.createElement('div');
|
||||
var style = this.div.style;
|
||||
style.position = 'absolute';
|
||||
const style = this.div.style;
|
||||
style.position = 'absolute';
|
||||
style.left = '' + box.left + 'px';
|
||||
style.top = '' + box.top + 'px';
|
||||
style.width = '' + box.width + 'px';
|
||||
@@ -143,15 +153,15 @@ ZeroClipboard.Client.prototype = {
|
||||
|
||||
getHTML: function(width, height) {
|
||||
// return HTML for movie
|
||||
var html = '';
|
||||
var flashvars = 'id=' + this.id +
|
||||
'&width=' + width +
|
||||
'&height=' + height;
|
||||
|
||||
if (navigator.userAgent.match(/MSIE/)) {
|
||||
let html = '';
|
||||
const flashvars = 'id=' + this.id +
|
||||
'&width=' + width +
|
||||
'&height=' + height;
|
||||
|
||||
if (navigator.userAgent.match(/MSIE/)) {
|
||||
// IE gets an OBJECT tag
|
||||
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
|
||||
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
|
||||
const protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
|
||||
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
|
||||
}
|
||||
else {
|
||||
// all other browsers get an EMBED tag
|
||||
@@ -178,11 +188,13 @@ ZeroClipboard.Client.prototype = {
|
||||
if (this.domElement && this.div) {
|
||||
this.hide();
|
||||
this.div.innerHTML = '';
|
||||
|
||||
var body = document.getElementsByTagName('body')[0];
|
||||
try { body.removeChild( this.div ); } catch(e) {;}
|
||||
|
||||
this.domElement = null;
|
||||
|
||||
const body = document.getElementsByTagName('body')[0];
|
||||
try {
|
||||
body.removeChild(this.div);
|
||||
} catch (e) {
|
||||
}
|
||||
this.domElement = null;
|
||||
this.div = null;
|
||||
}
|
||||
},
|
||||
@@ -196,9 +208,9 @@ ZeroClipboard.Client.prototype = {
|
||||
}
|
||||
|
||||
if (this.domElement && this.div) {
|
||||
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
|
||||
var style = this.div.style;
|
||||
style.left = '' + box.left + 'px';
|
||||
const box = ZeroClipboard.getDOMObjectPosition(this.domElement);
|
||||
const style = this.div.style;
|
||||
style.left = '' + box.left + 'px';
|
||||
style.top = '' + box.top + 'px';
|
||||
}
|
||||
},
|
||||
@@ -290,10 +302,12 @@ ZeroClipboard.Client.prototype = {
|
||||
} // switch eventName
|
||||
|
||||
if (this.handlers[eventName]) {
|
||||
for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
|
||||
var func = this.handlers[eventName][idx];
|
||||
|
||||
if (typeof(func) == 'function') {
|
||||
let idx = 0;
|
||||
const len = this.handlers[eventName].length;
|
||||
for (; idx < len; idx++) {
|
||||
const func = this.handlers[eventName][idx];
|
||||
|
||||
if (typeof(func) == 'function') {
|
||||
// actual function reference
|
||||
func(this, args);
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ function ajaxLoad(url, iid, params) {
|
||||
|
||||
xmlHttpp[iid] = GetXmlHttpObject1();
|
||||
if(xmlHttpp[iid] == null){
|
||||
alert("Browser does not support HTTP Request")
|
||||
alert("Browser does not support HTTP Request");
|
||||
return
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ function ajaxLoad(url, iid, params) {
|
||||
}
|
||||
$(window).trigger('ajaxLoadComplete');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xmlHttpp[iid].setRequestHeader("Accept-Charset", "windows-1251");
|
||||
xmlHttpp[iid].setRequestHeader("Accept-Language", "ru, en");
|
||||
|
||||
@@ -26,6 +26,9 @@ var flagpop=0;
|
||||
cMenu();
|
||||
} );
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
function OpenMenu(evt,level){
|
||||
evt = evt || window.event;
|
||||
evt.cancelBubble = true;
|
||||
|
||||
+6
-11
@@ -2,7 +2,7 @@ var sml_img = { };
|
||||
|
||||
Element.prototype.remove = function() {
|
||||
this.parentElement.removeChild(this);
|
||||
}
|
||||
};
|
||||
|
||||
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
|
||||
for(var i = 0, len = this.length; i < len; i++) {
|
||||
@@ -10,7 +10,7 @@ NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
|
||||
this[i].parentElement.removeChild(this[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var chat = {
|
||||
key:'',
|
||||
@@ -650,12 +650,7 @@ var chat = {
|
||||
},
|
||||
isNumber:function(s)
|
||||
{
|
||||
if(!isNaN(s))
|
||||
{
|
||||
s = true;
|
||||
}else{
|
||||
s = false;
|
||||
}
|
||||
s = !isNaN(s);
|
||||
return s;
|
||||
},
|
||||
testSmile:function(txt)
|
||||
@@ -744,7 +739,7 @@ var chat = {
|
||||
}else if(this.sound == 2) {
|
||||
svolm = 100;
|
||||
}
|
||||
var M$ = navigator.appName.indexOf("Microsoft")!=-1
|
||||
var M$ = navigator.appName.indexOf("Microsoft")!=-1;
|
||||
if(!M$ && this.getSwf('Sound').SetVariable == undefined) {
|
||||
document.getElementById('Sound2').SetVariable("Volume",svolm);
|
||||
document.getElementById('Sound2').SetVariable("Sndplay",s);
|
||||
@@ -754,7 +749,7 @@ var chat = {
|
||||
}
|
||||
},
|
||||
getSwf:function(val) {
|
||||
var M$ = navigator.appName.indexOf("Microsoft")!=-1
|
||||
var M$ = navigator.appName.indexOf("Microsoft")!=-1;
|
||||
return (M$ ? window : document)[val]
|
||||
},
|
||||
trim:function(s)
|
||||
@@ -830,4 +825,4 @@ var chat = {
|
||||
if(data.key!=undefined){ this.key = data.key; }
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
+6
-6
@@ -60,9 +60,9 @@ function dump(arr,level) {
|
||||
Загрузить HTML в контейнер
|
||||
*/
|
||||
function ajaxLoad(url,iid,params){
|
||||
xmlHttpp[iid]=GetXmlHttpObject1()
|
||||
xmlHttpp[iid]=GetXmlHttpObject1();
|
||||
if (xmlHttpp[iid]==null){
|
||||
alert ("Browser does not support HTTP Request")
|
||||
alert ("Browser does not support HTTP Request");
|
||||
return
|
||||
}
|
||||
//document.getElementById(iid).innerHTML="<img src='./i/loading2.gif' />";
|
||||
@@ -75,7 +75,7 @@ function ajaxLoad(url,iid,params){
|
||||
if(xmlHttpp[iid].responseText.indexOf('<!--CONTAINER=') == 0){
|
||||
var a = xmlHttpp[iid].responseText.indexOf('-->');
|
||||
if(a >= 0){
|
||||
var b = xmlHttpp[iid].responseText.substr(14,a-14)
|
||||
var b = xmlHttpp[iid].responseText.substr(14,a-14);
|
||||
if(document.getElementById(b) != undefined){
|
||||
container = document.getElementById(b);
|
||||
} else{
|
||||
@@ -110,7 +110,7 @@ function ajaxLoad(url,iid,params){
|
||||
// Вызываем своё событие
|
||||
$(window).trigger('ajaxLoadComplete');
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttpp[iid].setRequestHeader("Accept-Charset", "windows-1251");
|
||||
xmlHttpp[iid].setRequestHeader("Accept-Language","ru, en");
|
||||
xmlHttpp[iid].setRequestHeader("Content-Type","application/x-www-form-urlencoded");
|
||||
@@ -155,7 +155,7 @@ appearance = {
|
||||
error: function(){
|
||||
$('div#appearance_out').text('error');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
core = {
|
||||
|
||||
@@ -202,7 +202,7 @@ core = {
|
||||
document.location = document.location;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
function str_replace ( search, replace, subject ) {
|
||||
if(!(replace instanceof Array)){
|
||||
|
||||
+10
-10
@@ -145,14 +145,14 @@ ImageSizeDetector.init = function (src, callback) {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
ImageSizeDetector.isNotEmpty = function () {
|
||||
return ImageSizeDetector.width != null && ImageSizeDetector.width > 0 &&
|
||||
ImageSizeDetector.height != null && ImageSizeDetector.height > 0;
|
||||
}
|
||||
};
|
||||
ImageSizeDetector.isEmpty = function () {
|
||||
return !ImageSizeDetector.isNotEmpty();
|
||||
}
|
||||
};
|
||||
|
||||
SmileParser = new Object();
|
||||
SmileParser.map = null;
|
||||
@@ -174,7 +174,7 @@ SmileParser.init = function (callback) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
SmileParser.replace = function (str) {
|
||||
var result = str;
|
||||
for (smileCode in SmileParser.map) {
|
||||
@@ -186,14 +186,14 @@ SmileParser.replace = function (str) {
|
||||
result = result.replace(smileCode, "<img src='" + smileURL + "'/>");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
SmileParser.proceed = function () {
|
||||
jQuery("p.pleft").each(function (index, value) {
|
||||
var html = jQuery(value).html();
|
||||
jQuery(value).html(SmileParser.replace(html));
|
||||
});
|
||||
}
|
||||
};
|
||||
SmileParser.smileList = [];
|
||||
SmileParser.prepareSmileList = function () {
|
||||
SmileParser.smileList = [];
|
||||
@@ -207,13 +207,13 @@ SmileParser.prepareSmileList = function () {
|
||||
SmileParser.smileList.push(smileListItem);
|
||||
}
|
||||
return SmileParser.smileList;
|
||||
}
|
||||
};
|
||||
SmileParser.oldMap = {
|
||||
":)":"/i/forum/icon7.gif",
|
||||
":(":"/i/smile/grust.gif",
|
||||
":D":"/i/smile/laugh.gif",
|
||||
";)":"/i/smile/wink.gif"
|
||||
}
|
||||
};
|
||||
|
||||
function storeCaret(text) {
|
||||
if (text.createTextRange) {
|
||||
@@ -254,7 +254,7 @@ function cs(s1, s2, formname) {
|
||||
} else {
|
||||
if ((str.text != "") && (s.indexOf(str.text) >= 0)) {
|
||||
if (str.text.indexOf(s1) == 0)
|
||||
return ''
|
||||
return '';
|
||||
str.text = s1 + str.text + s2;
|
||||
} else {
|
||||
if (document[formname].text.createTextRange
|
||||
@@ -365,4 +365,4 @@ var $addFavoriteSet = function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
+9
-9
@@ -15,9 +15,9 @@ jQuery.cookie = function(name, value, options) {
|
||||
value = '';
|
||||
options.expires = -1;
|
||||
}
|
||||
var expires = '';
|
||||
let expires = '';
|
||||
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||||
var date;
|
||||
let date;
|
||||
if (typeof options.expires == 'number') {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
||||
@@ -29,16 +29,16 @@ jQuery.cookie = function(name, value, options) {
|
||||
// CAUTION: Needed to parenthesize options.path and options.domain
|
||||
// in the following expressions, otherwise they evaluate to undefined
|
||||
// in the packed version for some reason...
|
||||
var path = options.path ? '; path=' + (options.path) : '';
|
||||
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
||||
var secure = options.secure ? '; secure' : '';
|
||||
const path = options.path ? '; path=' + (options.path) : '';
|
||||
const domain = options.domain ? '; domain=' + (options.domain) : '';
|
||||
const secure = options.secure ? '; secure' : '';
|
||||
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
||||
} else { // only name given, get cookie
|
||||
var cookieValue = null;
|
||||
let cookieValue = null;
|
||||
if (document.cookie && document.cookie != '') {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim(cookies[i]);
|
||||
const cookies = document.cookie.split(';');
|
||||
for (let i = 0; i < cookies.length; i++) {
|
||||
const cookie = jQuery.trim(cookies[i]);
|
||||
// Does this cookie string begin with the name we want?
|
||||
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||
|
||||
Vendored
+1
-1
@@ -3537,7 +3537,7 @@ var Expr = Sizzle.selectors = {
|
||||
match[3] = Sizzle(match[3], null, null, curLoop);
|
||||
|
||||
} else {
|
||||
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
|
||||
var ret = Sizzle.filter(match[3], curLoop, inplace, !not);
|
||||
|
||||
if ( !inplace ) {
|
||||
result.push.apply( result, ret );
|
||||
|
||||
File diff suppressed because one or more lines are too long
+50
-48
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user