Skip to content

Instantly share code, notes, and snippets.

View akoppela's full-sized avatar

Andrey Koppel akoppela

View GitHub Profile
-------------------------------------------
var mergeOne = function(source, key, current){
if (current && typeof(current) == 'object' && current.indexOf != stringish && current.exec != regexpish && !(current.nodeName && current.nodeType) && (!current.$family || current.$family() == 'object')) {
console.info(current.clone);
if (current.indexOf != arrayish) {
var target = source[key];
if (target && typeof(target) == 'object' && current.indexOf != stringish && target.exec != regexpish && target.indexOf != arrayish) Object.merge(source[key], current)
else source[key] = Object.clone(current);
} else source[key] = current.clone();
} else source[key] = current;
findDocument: function(target) {
if (target.documentElement) return target;
if (target.document) return target.document;
if (target.lsd) return;
var body = target.ownerDocument.body;
var document = (target != body) && Element.retrieve(body, 'widget');
while (!document && (target = target.parentNode)) {
var widget = Element.retrieve(target, 'widget')
if (widget) document = (widget instanceof LSD.Document) ? widget : widget.document;
}
%section.lightbox
.overlay
.container
%a.button#closer Close
IGC.Widget.Body.Dialog = new Class({
Includes: [
LSD.Native.Body,
LSD.Trait.Fieldset
],
options: {
classes: Array.fast('dialog'),
pseudos: Array.fast('submittable'),
states: Array.fast('hidden'),
getTarget: function(target, anchor) {
if (!target && !(target = this.attributes.target)) return false;
var parsed = this.parseTargetSelector(target);
var results = [];
parsed.each(function(expression) {
if (!anchor) anchor = expression.anchor ? expression.anchor.call(this) : (this.document || document.body);
if (expression.selector) results.push.apply(results, Slick.search(anchor, expression.selector));
else if (anchor) results.push(anchor)
}, this);
return results.length > 0 && results.map(function(result) {
getTarget: function(target, anchor) {
if (!target && !(target = this.attributes.target)) return false;
var parsed = this.parseTargetSelector(target);
var results = [];
parsed.each(function(expression) {
if (!anchor) anchor = expression.anchor ? expression.anchor.call(this) : (this.document || document.body);
if (expression.selector) results.push.apply(results, Slick.search(anchor, expression.selector));
else if (anchor) results.push(anchor)
}, this);
return results.length > 0 && results.map(function(result) {