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 outputAttributes (element) { | |
var pairs = {}, | |
attrName, | |
attrValue, | |
i, | |
len; | |
for ( i = 0, len = element.attributes.length; i < len; i++ ) { | |
attrName = element.attributes[i].nodeName; | |
attrValue = element.attributes[i].nodeValue; |
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
* html body { | |
/* IE6 behavior must be in HEAD */ | |
/* http://www.xs4all.nl/~peterned/csshover.html */ | |
behavior:url("csshover.htc"); | |
} |
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 fixEvent(e) { | |
e = e || window.event; | |
if (!e.target) e.target = e.srcElement; | |
if (e.pageX == null && e.clientX != null ) { // если нет pageX.. | |
var html = document.documentElement; | |
var body = document.body; | |
e.pageX = e.clientX + (html.scrollLeft || body && body.scrollLeft || 0); |
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 getCoords(elem) { | |
var box = elem.getBoundingClientRect(); | |
var body = document.body; | |
var docEl = document.documentElement; | |
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; | |
var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; | |
var clientTop = docEl.clientTop || body.clientTop || 0; |
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 fixEvent(e, _this) { | |
e = e || window.event; | |
if (!e.currentTarget) e.currentTarget = _this; | |
if (!e.target) e.target = e.srcElement; | |
if (!e.relatedTarget) { | |
if (e.type == 'mouseover') e.relatedTarget = e.fromElement; | |
if (e.type == 'mouseout') e.relatedTarget = e.toElement; | |
} |
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
/** | |
Docs: http://learn.javascript.ru/tutorial/lib | |
*/ | |
/** | |
* Анимация. Параметры: | |
* opts.delta(time) -- временная функция, time=0..1. По умолчанию linear. | |
* opts.step(progress) -- функция рисования, progress=0..1. | |
* opts.complete -- функция, которая выполнится по окончании анимации | |
* opts.delay -- задержка между кадрами, по умолчанию 13 |
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
/** | |
* For modern browsers | |
* 1. The space content is one way to avoid an Opera bug when the | |
* contenteditable attribute is included anywhere else in the document. | |
* Otherwise it causes space to appear at the top and bottom of elements | |
* that are clearfixed. | |
* 2. The use of `table` rather than `block` is only necessary if using | |
* `:before` to contain the top-margins of child elements. | |
*/ | |
.cf:before, |
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.prototype.method = function ( name, func ) { | |
this.prototype[name] = func; | |
return this; | |
}; | |
Function.method('inherits', function ( parent ) { | |
var depth = 0; | |
var proto = this.prototype = new parent(); |
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
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |