This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getNearestTextNode(node, forward) { | |
var body = node.ownerDocument.body, | |
sibling = forward ? 'nextSibling' : 'previousSibling', | |
child = forward ? 'firstChild' : 'lastChild', | |
current = node; | |
do { | |
node = current[sibling], current = node || current.parentNode; | |
if (current == body) return; | |
} | |
while (!node); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* QWE - Browser | |
* | |
* Copyright (c) 2009 [Daniel Steigerwald](http://daniel.steigerwald.cz) | |
*/ | |
QWE()(function(Q) { | |
Browser = { | |
platform: (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase(), | |
features: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type.extend({ | |
/* | |
* BOM/DOM iterable objects are: array, arguments, nodeList | |
* - from bigger picture, iterable javascript objects has to support length and [] -> index access | |
* - but index access can't be tested.. :-( | |
* - also, for safari typeof nodeList == function.. | |
* - and length property has also string or function, which are uniterable | |
* - so duck typing ftw! | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class = new Type('Class', function(object) { | |
object.Extends = object.Extends || Class; | |
var newClass = function() { | |
return this.initialize ? this.initialize.apply(this, arguments) : this; | |
} .extend(this); | |
for (var key in Class.Mutators) { | |
if (object[key]) Class.Mutators[key].call(newClass, object[key]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QWE()(function() { | |
Array.supplement({ | |
forEach: function(fn, context) { | |
for (var i = 0, l = this.length >>> 0; i < l; i++) { | |
if (i in this) fn.call(context, this[i], i, this); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Resource Manager | |
- change app language just in time -> AUI.ResourceManager.setLocales(swahilstina) | |
- give localized text to element - el.set('locale', 'fileOpen') | |
- locale value could be: 'fileOpen' or ['fileOpen', 'title(anyProperty)'] or custom localize function | |
- if custom localization function returns value, that value will be used for localization | |
- .. but first of all you have to create locale storage (exported .net or own localization to JSON { dictionaryKey: term}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unselectable: { | |
set: function(value) { | |
Browser.Engine.gecko && (this.style.MozUserSelect = value ? 'none' : 'text') || | |
Browser.Engine.webkit && (this.style.KhtmlUserSelect = value ? 'none' : 'text') || | |
(Browser.Engine.trident || Browser.Engine.opera) && (this.unselectable = value ? 'on' : 'off'); | |
this.getChildren('*').set('unselectable', value); | |
return this; | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ImageCanvas - image drawn by canvas with methods for scaling and rotation | |
* | |
* License: MIT-style license. | |
* Copyright: Copyright (c) 2009 [Daniel Steigerwald](http://daniel.steigerwald.cz/). | |
* | |
*/ | |
var ImageCanvas = new Class({ | |
Extends: Canvas, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Class - JavaScript prototype inheritance sugar | |
* | |
* - reference to parent class is stored in static property superclass | |
* - in every method, you can call parent method .parent(..) | |
* - todo: methods with underscore prefix are protected | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title></title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/qwe/compressed.js"></script> | |
<script type="text/javascript"> | |
QWE({ | |
version: '0.2', | |
debug: true, |