cleverstyle-widgets
Advanced tools
Comparing version 0.8.1 to 0.9.0
@@ -26,3 +26,3 @@ { | ||
], | ||
"version" : "0.8.1", | ||
"version" : "0.9.0", | ||
"homepage" : "https://github.com/nazar-pc/CleverStyle-Widgets", | ||
@@ -29,0 +29,0 @@ "author" : "Nazar Mokrynskyi <nazar@mokrynskyi.com>", |
@@ -210,2 +210,3 @@ // Generated by LiveScript 1.5.0 | ||
} | ||
notify.noIcon = true; | ||
for (i$ = 0, len$ = options.length; i$ < len$; ++i$) { | ||
@@ -221,5 +222,5 @@ option = options[i$]; | ||
} | ||
document.documentElement.appendChild(notify); | ||
document.documentElement.insertBefore(notify, document.querySelector(notify.is)); | ||
return notify; | ||
}; | ||
}).call(this); |
@@ -34,2 +34,6 @@ // Generated by LiveScript 1.5.0 | ||
}, | ||
selectable: { | ||
reflectToAttribute: true, | ||
type: Boolean | ||
}, | ||
show: { | ||
@@ -56,3 +60,3 @@ reflectToAttribute: true, | ||
if (!this.parentNode.matches('html')) { | ||
document.documentElement.appendChild(this); | ||
document.documentElement.insertBefore(this, document.querySelector(this.is)); | ||
return; | ||
@@ -63,6 +67,7 @@ } | ||
} | ||
setTimeout(bind$(this, '_show')); | ||
this.offsetLeft; | ||
this._show(); | ||
}, | ||
_tap: function(e){ | ||
if (e.target === this.$.content || e.target === this.$.icon) { | ||
if (!this.selectable || e.target === this.$.content || e.target === this.$.icon) { | ||
this._hide(); | ||
@@ -77,11 +82,4 @@ } | ||
} | ||
this$._for_similar(function(child){ | ||
var interesting_margin; | ||
interesting_margin = this$.top ? 'marginTop' : 'marginBottom'; | ||
if (child !== this$ && parseFloat(child.style[interesting_margin] || 0) >= parseFloat(this$.style[interesting_margin] || 0)) { | ||
child._shift(); | ||
} | ||
}); | ||
this$._initialized = true; | ||
this$.show = true; | ||
this$._update_position(); | ||
this$.fire('show'); | ||
@@ -91,3 +89,3 @@ return new Promise(function(resolve){ | ||
if (this$.timeout) { | ||
setTimeout(bind$(this$, '_hide'), this$.timeout * 1000); | ||
setTimeout(this$._hide.bind(this$), this$.timeout * 1000); | ||
} | ||
@@ -102,10 +100,4 @@ resolve(); | ||
promise = promise.then(function(){ | ||
var interesting_margin; | ||
this$.show = false; | ||
interesting_margin = this$.top ? 'marginTop' : 'marginBottom'; | ||
this$._for_similar(function(child){ | ||
if (parseFloat(child.style[interesting_margin] || 0) > parseFloat(this$.style[interesting_margin] || 0)) { | ||
child._unshift(); | ||
} | ||
}); | ||
this$._update_position(); | ||
this$.fire('hide'); | ||
@@ -123,5 +115,5 @@ return new Promise(function(resolve){ | ||
}, | ||
_for_similar: function(callback){ | ||
var tagName, bottom, left, right, top, i$, ref$, len$, child; | ||
tagName = this.tagName; | ||
_get_similar: function(){ | ||
var _is, bottom, left, right, top, this$ = this; | ||
_is = this.is; | ||
bottom = this.bottom; | ||
@@ -131,25 +123,31 @@ left = this.left; | ||
top = this.top; | ||
for (i$ = 0, len$ = (ref$ = document.querySelector('html').children).length; i$ < len$; ++i$) { | ||
child = ref$[i$]; | ||
if (child !== this && child.is === this.is && child.bottom === bottom && child.left === left && child.right === right && child.top === top, child.show) { | ||
callback(child); | ||
} | ||
return Array.from(document.querySelector('html').children).filter(function(element){ | ||
return element.is === _is && element.bottom === bottom && element.left === left && element.right === right && element.top === top && element.show; | ||
}); | ||
}, | ||
_update_position: function(callback){ | ||
var children, i$, len$, i, current, previous; | ||
children = this._get_similar(); | ||
for (i$ = 0, len$ = children.length; i$ < len$; ++i$) { | ||
i = i$; | ||
current = children[i$]; | ||
previous = children[i - 1]; | ||
current._update_own_position(previous); | ||
} | ||
}, | ||
_shift: function(){ | ||
var style; | ||
style = getComputedStyle(this); | ||
if (this.top) { | ||
this.style.marginTop = parseFloat(this.style.marginTop || 0) + parseFloat(style.height) + 'px'; | ||
_update_own_position: function(previous){ | ||
var previous_bottom, previous_height, previous_top; | ||
if (previous) { | ||
previous_bottom = parseFloat(previous.style.marginBottom || 0); | ||
previous_height = parseFloat(getComputedStyle(previous).height); | ||
previous_top = parseFloat(previous.style.marginTop || 0); | ||
} else { | ||
this.style.marginBottom = parseFloat(this.style.marginBottom || 0) + parseFloat(style.height) + 'px'; | ||
previous_bottom = 0; | ||
previous_height = 0; | ||
previous_top = 0; | ||
} | ||
}, | ||
_unshift: function(){ | ||
var style; | ||
style = getComputedStyle(this); | ||
if (this.top) { | ||
this.style.marginTop = parseFloat(this.style.marginTop || 0) - parseFloat(style.height) + 'px'; | ||
this.style.marginTop = previous_top + previous_height + 'px'; | ||
} else { | ||
this.style.marginBottom = parseFloat(this.style.marginBottom || 0) - parseFloat(style.height) + 'px'; | ||
this.style.marginBottom = previous_bottom + previous_height + 'px'; | ||
} | ||
@@ -168,5 +166,2 @@ }, | ||
]; | ||
function bind$(obj, key, target){ | ||
return function(){ return (target || obj)[key].apply(obj, arguments) }; | ||
} | ||
}).call(this); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
282727
2713