Skip to content

Instantly share code, notes, and snippets.

View akoppela's full-sized avatar

Andrey Koppel akoppela

View GitHub Profile
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) {
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'),
%section.lightbox
.overlay
.container
%a.button#closer Close
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;
}
-------------------------------------------
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;
if(!Browser.ie){
Browser.Features.Touch = (function(){
try {
document.createEvent('TouchEvent').initTouchEvent('touchstart');
return true;
} catch (exception){}
return false;
})();
LSD.Mixin.Animation = new Class({
behaviour: '[animation]',
options: {
animation: {}
},
getAnimation: function() {
if (!this.animation) {
this.animation = this.getAnimatedElement().set('tween', this.options.animation).get('tween');
Wrongler.Widget.Input.Date = new Class({
Includes: [
LSD.Widget,
LSD.Trait.Date
],
options: {
tag: 'input',
attributes: {
type: 'date'
%ol
%li
.input
%input{:type => 'text'}
%aside<
%a.button{:href => '#'} Убрать
%li
.input
%input{:type => 'text'}
%aside<