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
/*! $.ajaxCache | RubaXa <trash@rubaxa.org> | MIT */ | |
(function ($){ | |
var _cache = {}; | |
var _cacheKey = function (options){ | |
return options.url + $.param(options.data || {}); | |
}; | |
/** | |
* Get cache storage |
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
/** | |
* jQuery event "tap" (Based on https://developers.google.com/mobile/articles/fast_buttons) | |
* | |
* @author RubaXa <trash@rubaxa.org> | |
* @license MIT | |
*/ | |
(function (window, $){ | |
var | |
support = window.TapSupportEnabled && ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch |
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
(new UISequence) | |
.on('click', '.js-cbx') // начало цепочки | |
.choose() // любое следующее действие | |
.group() // группа действий | |
.choose() // опять выбор любого | |
.scrollDY(-200) // либо scrollUp на 200px | |
.group() // либо группа из | |
.scrollDY(100) // scrollDown на 100px | |
.endPage() // и достигли конца страницы | |
.end() // закрываем группу |
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
/** | |
* @author RubaXa <trash@rubaxa.org> | |
* @license MIT | |
*/ | |
(function () { | |
"use strict"; | |
function _then(promise, method, callback) { | |
return function () { |
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
/** | |
* @author RubaXa <trash@rubaxa.org> | |
* @license MIT | |
*/ | |
(function (){ | |
"use strict"; | |
var _rspace = /\s+/; | |
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
/** | |
* Set/get dataset | |
* | |
* @param {String|Object} [data] | |
* @param {Mixed} [value] | |
* @retuns {Mixed} | |
*/ | |
jQuery.fn.dataset = function (data, value){ | |
var | |
argsNum = arguments.length |
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
/** | |
* User Timing polyfill (http://www.w3.org/TR/user-timing/) | |
* @author RubaXa <trash@rubaxa.org> | |
*/ | |
(function (window){ | |
var | |
startOffset = Date.now ? Date.now() : +(new Date) | |
, performance = window.performance || {} | |
, _entries = [] |
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
// ==UserScript== | |
// @name lepratranslate | |
// @author RubaXa <trash@rubaxa.org> | |
// @license MIT | |
// @version 0.0.1 | |
// @include http://leprosorium.ru/* | |
// ==/UserScript== | |
/*global unsafeWindow*/ |
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
/** | |
* OOP | |
* @author RubaXa <trash@rubaxa.org> | |
*/ | |
(function (){ | |
/** | |
* Создание «родительского» метода | |
* @param {*} fn | |
* @param {*} 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
(function () { 'use strict'; | |
var indent = 0, tags = [], close, begin, rshort = /^(img|input|hr|br)$/; | |
window['absurdTpl'] = function _(name, template) { | |
return _[name] = Function('ctx', ('var buf = "";\n' + (template || name).toString().split('\n').slice(1, -1).map(function (line, idx, lines) { | |
return line.replace(/\/\/.+|\/\*.*?\*\//g, '') | |
.replace(/~([\w+_-]+)/i, 'buf += absurdTpl["$1"]') | |
.replace(/^(\s*)(?:([a-z]+[0-9]*)((?:\.[a-z_-]+[\w_-]+)*)((?:\[.*?\])*)(?:\s+\|\s+(.*?))?($|;)|.)/, function (_, ind, tag, classes, attrs, html) { | |
begin = (indent >= ind.length) && (close = tags.splice(0, indent/ind.length).filter(isNaN)).length ? 'buf += "</' + close.join('></') + '>";\n' : ''; | |
indent = ind.length; | |
!rshort.test(tag) && tags.unshift(tag || 0); |