Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scrolly

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrolly - npm Package Compare versions

Comparing version 0.4.0 to 0.6.0

public/js/react-dom.js

17

bower.json
{
"name": "scrolly",
"version": "0.4.0",
"version": "0.6.0",
"description": "Scrolly: fast vanilla JS scrollbar plugin.",
"keywords": [
"scroll", "scrollbar", "scrolly", "bar",
"js", "javascript", "vanilla", "amd"
"js", "javascript", "vanilla", "amd",
"react", "reactjs", "component",
"jquery", "zepto", "jbone",
"annexare"
],
"author": {
"name": "Dmytro",
"email": "z@annexare.com",
"url": "https://github.com/z-ax"
},
"dependencies": {
},
"devDependencies": {
"jbone": "*"
"jbone": "*",
"react": "^0.14.3"
},

@@ -27,4 +36,4 @@ "ignore": [

"type": "git",
"url": "https://github.com/annexare/toURI"
"url": "https://github.com/annexare/scrolly.js.git"
}
}

@@ -8,2 +8,4 @@ var gulp = require('gulp'),

autoprefixer = require('gulp-autoprefixer'),
plumber = require('gulp-plumber'),
react = require('gulp-react'),
rename = require('gulp-rename'),

@@ -44,4 +46,6 @@ uglify = require('gulp-uglify'),

src = {
jade: sources + 'jade/*.jade',
jade: sources + 'jade/{,*/}index.jade',
js: sources + 'js/*.js',
jsx: sources + 'jsx/react-*.jsx',
jsxTest: sources + 'jsx/test-*.jsx',
less: sources + 'less/styles*.less'

@@ -80,2 +84,3 @@ },

return gulp.src(src.jade)
.pipe(plumber())
.pipe(jade())

@@ -95,2 +100,41 @@ .pipe(gulp.dest(paths.server))

/*
* React JSX preprocessor
*/
gulp.task('jsx', function () {
return gulp.src([
vendor('dataset.js'),
src.js,
src.jsx
])
.pipe(plumber())
.pipe(concat('react-scrolly.js', {newLine: '\n\n'}))
.pipe(react())
.on('error', function (e) {
console.error(e.message + '\n in ' + e.fileName);
})
.pipe(wrapper({ header: banner() }))
.pipe(gulp.dest(paths.js))
// Production/Minified
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(wrapper({ header: banner() }))
.pipe(gulp.dest(paths.js));
});
/*
* React JSX test component
*/
gulp.task('jsx-test', function () {
return gulp.src([
src.jsxTest
])
.pipe(plumber())
.pipe(concat('react-scrolly-test.js', {newLine: '\n\n'}))
.pipe(react())
.on('error', function (e) {
console.error(e.message + '\n in ' + e.fileName);
})
.pipe(gulp.dest(paths.js))
});
/*
* LESS sources.

@@ -101,2 +145,3 @@ * All CSS files in the root directory are built as separate stylesheets.

return gulp.src(src.less)
.pipe(plumber())
.pipe(less(options.less))

@@ -116,5 +161,8 @@ .pipe(wrapper({ footer: '\n\n' + banner() }))

])
.pipe(plumber())
// Development
.pipe(concat('scrolly.js', { newLine: ';\n\n' }))
.pipe(wrapper({ header: banner() }))
.pipe(gulp.dest(paths.js))
// Production/Minified
.pipe(rename({suffix: '.min'}))

@@ -142,2 +190,12 @@ .pipe(uglify())

});
/*
* Vendor: React.
*/
gulp.task('vendor-react', function () {
return gulp.src([
vendor('react/react.js'),
vendor('react/react-dom.js')
])
.pipe(gulp.dest(paths.js));
});

@@ -149,3 +207,3 @@

*/
gulp.task('build-all', ['jshint', 'build', 'vendor', 'less', 'jade']);
gulp.task('build-all', ['jshint', 'build', 'vendor', 'vendor-react', 'jsx', 'jsx-test', 'less', 'jade']);

@@ -169,2 +227,4 @@ gulp.task('serve', ['build-all'], function() {

gulp.watch(src.js, ['jshint', 'build']);
gulp.watch(src.jsx, ['jsx']);
gulp.watch(src.jsxTest, ['jsx-test']);
gulp.watch(src.less, ['less']);

@@ -171,0 +231,0 @@

{
"name": "scrolly",
"version": "0.4.0",
"version": "0.6.0",
"description": "Scrolly: fast vanilla JS scrollbar plugin.",
"keywords": [
"scroll", "scrollbar", "scrolly", "bar",
"js", "javascript", "vanilla", "amd"
"js", "javascript", "vanilla", "amd",
"react", "reactjs", "component",
"jquery", "zepto", "jbone",
"annexare"
],

@@ -13,2 +16,3 @@ "repository": {

},
"main": "public/js/scrolly.js",
"dependencies": {},

@@ -23,2 +27,4 @@ "devDependencies": {

"gulp-livereload": "*",
"gulp-plumber": "*",
"gulp-react": "^3.1",
"gulp-rename": "*",

@@ -32,3 +38,11 @@ "gulp-uglify": "*",

},
"main": "public/js/scrolly.js",
"author": {
"name": "Dmytro",
"email": "z@annexare.com",
"url": "https://github.com/z-ax"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/annexare/scrolly.js/issues"
},
"engines": {

@@ -35,0 +49,0 @@ "node": ">=0.10.31"

@@ -1,3 +0,3 @@

/* scrolly v0.4.0, 2014.12.26 */
var dataset = function initDataSet() {
/* scrolly v0.6.0, 2015.11.26 */
var dataSet = function initDataSet() {
if (document.documentElement.dataset) {

@@ -25,14 +25,20 @@ return function native(el, prop, value) {

/**
* Scrolly.js
*
* @todo Prepare for React.js
* @todo Add more options: keep thumb pos on update, etc
* Scrolly: fast vanilla JS scrollbar plugin.
*/
;(function () {
;(function (factory) {
if (typeof module !== 'undefined' && module.exports) {
factory.call(module.exports);
} else if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else {
factory.call(window, window.$ || window.jQuery || window.Zepto || window.jBone);
}
}(function ($) {
'use strict';
var title = 'Scrolly',
prefix = function (param) {
return 'scroll' + param;
name = title.toLowerCase(),
dataPrefix = function (param) {
return name + param;
},

@@ -43,2 +49,7 @@ message = function (text) {

// Timeouts for Event callbacks
timeouts = {},
TIMER_EDGE = 'e',
TIMER_UP = 'u',
// Node helpers

@@ -55,3 +66,3 @@ // classList is not supported by IE9

hasClass = function (className, node) {
var list = (node.className || '').split(/\s+/);
var list = (node ? node.className || '' : '').split(/\s+/);

@@ -61,3 +72,3 @@ return (list.indexOf(className) !== -1);

removeClass = function (className, node) {
var list = (node.className || '').split(/\s+/),
var list = (node ? node.className || '' : '').split(/\s+/),
id = list.indexOf(className);

@@ -112,2 +123,18 @@ if (id !== -1) {

clearTimer = function (key) {
if (!timeouts[key]) {
return;
}
clearTimeout(timeouts[key]);
delete timeouts[key];
},
dummyTimer = function (key) {
clearTimer(key);
return (
timeouts[key] = setTimeout(function () {
clearTimer(key);
}, 500)
);
},
hasTouch = ('ontouchstart' in document.documentElement),

@@ -126,3 +153,3 @@ wheelEventName = ('onwheel' in document || document.documentMode >= 9)

removeClass(this.noUserSelectClass, document.body);
removeClass(this.onDragClass, data.bar);
removeClass(this.dragClass, data.bar);
},

@@ -148,3 +175,3 @@ onBegin = function (data, e) {

addClass(this.noUserSelectClass, document.body);
addClass(this.onDragClass, data.bar);
addClass(this.dragClass, data.bar);

@@ -162,2 +189,15 @@ if (hasTouch) {

},
onWheelEdge = function (data, offset) {
if (typeof data.onEdge !== 'function') {
return;
}
if (timeouts[TIMER_EDGE]) {
dummyTimer(TIMER_EDGE);
return;
}
// Bottom edge if (offset > 0)
data.onEdge.call(data, offset > 0);
dummyTimer(TIMER_EDGE);
},
onWheel = function (data, e) {

@@ -172,4 +212,8 @@ if (data.wrapRatio === 1) {

if ((offset > 0) && (offset + data.wrapSize < getNodeSize(data.area, data.axis))) {
// Scrolling inside
e.preventDefault();
e.stopPropagation();
} else if (offset !== 0) {
onWheelEdge(data, offset);
return;
}

@@ -191,3 +235,3 @@

axis: 'Y',
onDragClass: 'on-drag',
dragClass: 'on-drag',
onResize: false,

@@ -198,2 +242,8 @@ noUserSelectClass: 'no-user-select',

// Public methods
/**
* Main init, accepts string, nodes|node or $ as query.
* @param query
* @param params
* @returns Array|boolean
*/
bar: function (query, params) {

@@ -209,7 +259,3 @@ if (!query) {

if (!$query.length) {
if ($query instanceof HTMLElement) {
return [this.barNode($query, params)];
}
console.log(message('Couldn\'t query:'), typeof query, query, params);
return false;
return [this.barNode($query, params)];
}

@@ -224,6 +270,18 @@

},
/**
* Init for a single node.
* @param node
* @param params
* @returns Number|boolean
*/
barNode: function (node, params) {
if (typeof dataset(node, prefix('id')) !== 'undefined') {
this.dispose(dataset(node, prefix('id')));
// Check Node type
if (!node || !node.nodeType) {
console.log(message('Couldn\'t query:'), typeof node, node, params);
return false;
}
// Check if already initialized
if (typeof dataSet(node, dataPrefix('id')) !== 'undefined') {
this.dispose(dataSet(node, dataPrefix('id')));
}
// Window Resize

@@ -239,2 +297,3 @@ if (!this.onResize) {

data = {
dispose: {},
params: opts,

@@ -247,2 +306,3 @@ scrolled: 0,

data.axis = opts.axis || this.axis;
data.onEdge = opts.onEdge || false;
data.thumbMinSize = opts.thumbMinSize || this.thumbMinSize;

@@ -252,15 +312,39 @@

addClass('area', node);
data.wrap = wrap(node, 'scrolly');
if (hasClass(name, node.parentNode)) {
// Wrap exists
data.wrap = node.parentNode;
} else {
data.wrap = wrap(node, name);
data.dispose.wrap = true;
}
data.area = node;
// Bar
// TODO Check for existing Bar
var bar = div('bar');
data.thumb = bar.appendChild(div('thumb'));
data.bar = data.wrap.parentNode
.insertBefore(bar, data.wrap.nextSibling);
var barClassName = 'bar',
thumbClassName = 'thumb';
if (hasClass(barClassName, data.wrap.nextSibling)) {
// Bar exists
data.bar = data.wrap.nextSibling;
if (hasClass(thumbClassName, data.bar.firstChild)) {
// Thumb exists
data.thumb = data.bar.firstChild;
} else {
data.bar.innerHTML = '';
data.thumb = data.bar.appendChild(div(thumbClassName));
data.dispose.thumb = true;
}
} else {
var bar = div(barClassName);
data.thumb = bar.appendChild(div(thumbClassName));
data.bar = data.wrap.parentNode
.insertBefore(bar, data.wrap.nextSibling);
data.dispose.bar = true;
}
// Store Data
var id = dataset(node, prefix('id'), scrls.push(data) - 1);
this.update(id, true);
var id = dataSet(node, dataPrefix('id'), scrls.push(data) - 1);
timeouts[TIMER_UP] = setTimeout(function () {
scrl.update(id, true);
}, 0);

@@ -272,6 +356,10 @@ return id;

* @param id
* @returns {boolean}
* @returns boolean
*/
dispose: function (id) {
var no = (typeof id === 'number') ? id : false;
var no = (
typeof id === 'string'
? parseInt(id, 10)
: (typeof id === 'number' ? id : false)
);

@@ -286,10 +374,23 @@ if (no === false) {

}
// First update() Timeout
clearTimer(TIMER_EDGE);
clearTimer(TIMER_UP);
// Unwatch
data.observer.disconnect();
if (data.observer) {
data.observer.disconnect();
}
// Cleanup
removeClass('area', data.area);
data.area.removeAttribute('data-' + prefix('id'));
data.wrap.parentNode.insertBefore(data.area, data.wrap);
data.wrap.parentNode.removeChild(data.wrap);
data.bar.parentNode.removeChild(data.bar);
data.area.removeAttribute('data-' + dataPrefix('id'));
// Extra Nodes
if (data.dispose.wrap) {
data.wrap.parentNode.insertBefore(data.area, data.wrap);
data.wrap.parentNode.removeChild(data.wrap);
}
if (data.dispose.thumb) {
data.thumb.parentNode.removeChild(data.thumb);
}
if (data.dispose.bar) {
data.bar.parentNode.removeChild(data.bar);
}
// Well, we won't change all IDs to remove it

@@ -308,6 +409,6 @@ scrls[no] = false;

* @param data
* @returns {*}
* @returns String
*/
getID: function (data) {
return dataset(data.area, prefix('id'));
return dataSet(data.area, dataPrefix('id'));
},

@@ -343,4 +444,4 @@ /**

// Observe changes in future
data.observer = new MutationObserver(function (mutations) {
console.log(' > mutations for ' + data.area.className, mutations.length);
data.observer = new MutationObserver(function (/*mutations*/) {
// console.log(' > mutations for ' + data.area.className, mutations.length);
self.update(self.getID(data));

@@ -439,13 +540,29 @@ });

if (typeof module !== 'undefined' && module.exports) {
module.exports = scrl;
} else if (typeof define !== 'undefined' && define.amd) {
define([], function () {
return scrl;
});
} else {
this.scrolly = scrl;
this.scrollyst = scrls;
// jQuery Plugin
if ($ && $.fn) {
$.fn.scrolly = function(param) {
// Empty selector
if (!this.length) {
return this;
}
// Initialize with params
if (typeof param !== 'string') {
scrl.bar(this, param || {});
return this;
}
// Available Methods
if (['dispose', 'update'].indexOf(param) > -1) {
this.forEach(function (el) {
var id = dataSet(el, dataPrefix('id'));
scrl[param](id);
});
}
return this;
};
}
}.call(this));
this.scrolly = scrl;
this.scrollyst = scrls;
}));

@@ -1,2 +0,2 @@

/* scrolly v0.4.0, 2014.12.26 */
var dataset=function(){return document.documentElement.dataset?function(e,t,n){return"undefined"!=typeof n?e.dataset[t]=n:e.dataset[t]}:function(e,t,n){return"undefined"!=typeof n?e.setAttribute("data-"+t,n):e.getAttribute("data-"+t)}}();(function(){"use strict";var e="Scrolly",t=function(e){return"scroll"+e},n=function(t){return e+": "+t},a=function(e,t){var n=(t.className||"").split(/\s+/);return-1===n.indexOf(e)&&n.push.apply(n,[e]),t.className=n.join(" ")},r=function(e,t){var n=(t.className||"").split(/\s+/);return-1!==n.indexOf(e)},o=function(e,t){var n=(t.className||"").split(/\s+/),a=n.indexOf(e);return-1!==a&&n.splice(a,1),t.className=n.join(" ")},i=function(e){var t=document.createElement("div");return t.className=e||"",t},s=function(e,t){var n=e.parentNode;if(r(t,n))return n;var a=i(t);return n.insertBefore(a,e),a.appendChild(e),a},u={X:"Width",Y:"Height"},l={X:"Left",Y:"Top"},d=function(e,t){return t["page"+e]||t["client"+e]},c=function(e,t,n){return e[(n||"scroll")+l[t]]},f=function(e,t,n){return e[(n||"scroll")+u[t]]},p=function(e){var t=c(e.wrap,e.axis)||0;return Math.floor((t+e.wrapSize/2)*e.wrapRatio)},h=function(e){return e+"px"},m="ontouchstart"in document.documentElement,b="onwheel"in document||document.documentMode>=9?"wheel":"undefined"==typeof document.onmousewheel?"DOMMouseScroll":"mousewheel",v=function(e){document.body.onmousemove=document.body.onmouseup=null,document.ontouchmove=document.ontouchend=null,o(this.noUserSelectClass,document.body),o(this.onDragClass,e.bar)},w=function(e,t){var n=this,r=d(e.axis,t),o=0,i=1*e.thumb.style.top.replace("px",""),s=function(t){o=d(e.axis,t)-r+e.thumbSize/2,m&&(o*=-.5),n.setThumbPos.call(n,e,i+o,!0)},u=function(){v.call(n,e)};a(this.noUserSelectClass,document.body),a(this.onDragClass,e.bar),m?(document.ontouchmove=function(e){e.preventDefault(),s(e.touches[0])},document.ontouchend=u):(document.body.onmousemove=s,document.body.onmouseup=u)},y=function(e,t){if(1!==e.wrapRatio){var n=c(e.wrap,e.axis)+t["delta"+e.axis];e.wrapRatio=e.wrapSize/f(e.area,e.axis),n>0&&n+e.wrapSize<f(e.area,e.axis)&&(t.preventDefault(),t.stopPropagation()),e.wrap["scroll"+l[e.axis]]+=t["delta"+e.axis],this.setThumbPos(e)}},x=[],S={axis:"Y",onDragClass:"on-drag",onResize:!1,noUserSelectClass:"no-user-select",thumbMinSize:24,bar:function(e,t){if(!e)return console.log(n("No Query specified.")),!1;var a="string"==typeof e?document.querySelectorAll(e):e;if(!a.length)return a instanceof HTMLElement?[this.barNode(a,t)]:(console.log(n("Couldn't query:"),typeof e,e,t),!1);for(var r=[],o=0;o<a.length;o++)r.push(this.barNode(a[o],t));return r},barNode:function(e,n){"undefined"!=typeof dataset(e,t("id"))&&this.dispose(dataset(e,t("id"))),this.onResize||window.addEventListener("resize",this.updateAll.bind(this),!0);var r=n||{},o={params:r,scrolled:0,visible:!1};o.axis=r.axis||this.axis,o.thumbMinSize=r.thumbMinSize||this.thumbMinSize,a("area",e),o.wrap=s(e,"scrolly"),o.area=e;var u=i("bar");o.thumb=u.appendChild(i("thumb")),o.bar=o.wrap.parentNode.insertBefore(u,o.wrap.nextSibling);var l=dataset(e,t("id"),x.push(o)-1);return this.update(l,!0),l},dispose:function(e){var n="number"==typeof e?e:!1;if(n===!1)return!1;var a=x[n];return a&&"undefined"!=typeof a?(a.observer.disconnect(),o("area",a.area),a.area.removeAttribute("data-"+t("id")),a.wrap.parentNode.insertBefore(a.area,a.wrap),a.wrap.parentNode.removeChild(a.wrap),a.bar.parentNode.removeChild(a.bar),x[n]=!1,!0):!0},disposeAll:function(){for(var e=0;e<x.length;e++)this.dispose(e)},getID:function(e){return dataset(e.area,t("id"))},update:function(e,t){var n=x[e];n&&(this.setSize(n),t&&this.setEvents(n))},updateAll:function(){for(var e=0;e<x.length;e++)this.update(e)},setEvents:function(e){var t=this;e.observer=new MutationObserver(function(n){console.log(" > mutations for "+e.area.className,n.length),t.update(t.getID(e))}),e.observer.observe(e.area,{attributes:!0,childList:!0});var n=function(n){w.call(t,e,n)};m?e.wrap.ontouchstart=function(e){1===e.touches.length&&(e.preventDefault(),e.stopPropagation(),n(e.touches[0]))}:(e.wrap.addEventListener(b,function(n){y.call(t,e,n)}),e.bar.addEventListener("mousedown",n)),e.thumb.addEventListener("click",function(e){e&&(e.preventDefault(),e.stopPropagation())}),e.bar.addEventListener("click",function(n){var a=n["layer"+e.axis];t.setThumbPos.call(t,e,a,!0)})},setSize:function(e){var t=e.wrapSize=f(e.wrap,e.axis,"offset"),n=f(e.area,e.axis);if(e.visible=n>t,!e.visible)return void(e.bar.style.visibility="hidden");var a=e.wrapRatio=t/n,r=e.thumbSize=Math.min(t,Math.max(e.thumbMinSize,t*a));e.thumb.style.height=h(r),e.thumbSize=f(e.thumb,e.axis,"offset"),this.setThumbPos(e),e.bar.style.height=h(t),e.bar.style.visibility="visible"},setThumbPos:function(e,t,n){var a="number"==typeof t?t:p(e),r=e.thumbSize/2,o=e.wrapSize-e.thumbSize,i=r>a?0:a-r;i=i>o?o:i,e.thumb.style[l[e.axis].toLowerCase()]=h(i),n&&(i=i===o?e.wrapSize:i,e.wrap["scroll"+l[e.axis]]=Math.floor(i/e.wrapSize*f(e.area,e.axis)))}};"undefined"!=typeof module&&module.exports?module.exports=S:"undefined"!=typeof define&&define.amd?define([],function(){return S}):(this.scrolly=S,this.scrollyst=x)}).call(this);
/* scrolly v0.6.0, 2015.11.26 */
var dataSet=function(){return document.documentElement.dataset?function(e,t,n){return"undefined"!=typeof n?e.dataset[t]=n:e.dataset[t]}:function(e,t,n){return"undefined"!=typeof n?e.setAttribute("data-"+t,n):e.getAttribute("data-"+t)}}();!function(e){"undefined"!=typeof module&&module.exports?e.call(module.exports):"function"==typeof define&&define.amd?define(["jquery"],e):e.call(window,window.$||window.jQuery||window.Zepto||window.jBone)}(function(e){"use strict";var t="Scrolly",n=t.toLowerCase(),i=function(e){return n+e},r=function(e){return t+": "+e},o={},a="e",s="u",u=function(e,t){var n=(t.className||"").split(/\s+/);return-1===n.indexOf(e)&&n.push.apply(n,[e]),t.className=n.join(" ")},d=function(e,t){var n=(t?t.className||"":"").split(/\s+/);return-1!==n.indexOf(e)},l=function(e,t){var n=(t?t.className||"":"").split(/\s+/),i=n.indexOf(e);return-1!==i&&n.splice(i,1),t.className=n.join(" ")},c=function(e){var t=document.createElement("div");return t.className=e||"",t},p=function(e,t){var n=e.parentNode;if(d(t,n))return n;var i=c(t);return n.insertBefore(i,e),i.appendChild(e),i},f={X:"Width",Y:"Height"},h={X:"Left",Y:"Top"},m=function(e,t){return t["page"+e]||t["client"+e]},b=function(e,t,n){return e[(n||"scroll")+h[t]]},v=function(e,t,n){return e[(n||"scroll")+f[t]]},w=function(e){var t=b(e.wrap,e.axis)||0;return Math.floor((t+e.wrapSize/2)*e.wrapRatio)},y=function(e){return e+"px"},S=function(e){o[e]&&(clearTimeout(o[e]),delete o[e])},g=function(e){return S(e),o[e]=setTimeout(function(){S(e)},500)},x="ontouchstart"in document.documentElement,z="onwheel"in document||document.documentMode>=9?"wheel":"undefined"==typeof document.onmousewheel?"DOMMouseScroll":"mousewheel",N=function(e){document.body.onmousemove=document.body.onmouseup=null,document.ontouchmove=document.ontouchend=null,l(this.noUserSelectClass,document.body),l(this.dragClass,e.bar)},C=function(e,t){var n=this,i=m(e.axis,t),r=0,o=1*e.thumb.style.top.replace("px",""),a=function(t){r=m(e.axis,t)-i+e.thumbSize/2,x&&(r*=-.5),n.setThumbPos.call(n,e,o+r,!0)},s=function(){N.call(n,e)};u(this.noUserSelectClass,document.body),u(this.dragClass,e.bar),x?(document.ontouchmove=function(e){e.preventDefault(),a(e.touches[0])},document.ontouchend=s):(document.body.onmousemove=a,document.body.onmouseup=s)},E=function(e,t){if("function"==typeof e.onEdge){if(o[a])return void g(a);e.onEdge.call(e,t>0),g(a)}},M=function(e,t){if(1!==e.wrapRatio){var n=b(e.wrap,e.axis)+t["delta"+e.axis];if(e.wrapRatio=e.wrapSize/v(e.area,e.axis),n>0&&n+e.wrapSize<v(e.area,e.axis))t.preventDefault(),t.stopPropagation();else if(0!==n)return void E(e,n);e.wrap["scroll"+h[e.axis]]+=t["delta"+e.axis],this.setThumbPos(e)}},T=[],L={axis:"Y",dragClass:"on-drag",onResize:!1,noUserSelectClass:"no-user-select",thumbMinSize:24,bar:function(e,t){if(!e)return console.log(r("No Query specified.")),!1;var n="string"==typeof e?document.querySelectorAll(e):e;if(!n.length)return[this.barNode(n,t)];for(var i=[],o=0;o<n.length;o++)i.push(this.barNode(n[o],t));return i},barNode:function(e,t){if(!e||!e.nodeType)return console.log(r("Couldn't query:"),typeof e,e,t),!1;"undefined"!=typeof dataSet(e,i("id"))&&this.dispose(dataSet(e,i("id"))),this.onResize||window.addEventListener("resize",this.updateAll.bind(this),!0);var a=t||{},l={dispose:{},params:a,scrolled:0,visible:!1};l.axis=a.axis||this.axis,l.onEdge=a.onEdge||!1,l.thumbMinSize=a.thumbMinSize||this.thumbMinSize,u("area",e),d(n,e.parentNode)?l.wrap=e.parentNode:(l.wrap=p(e,n),l.dispose.wrap=!0),l.area=e;var f="bar",h="thumb";if(d(f,l.wrap.nextSibling))l.bar=l.wrap.nextSibling,d(h,l.bar.firstChild)?l.thumb=l.bar.firstChild:(l.bar.innerHTML="",l.thumb=l.bar.appendChild(c(h)),l.dispose.thumb=!0);else{var m=c(f);l.thumb=m.appendChild(c(h)),l.bar=l.wrap.parentNode.insertBefore(m,l.wrap.nextSibling),l.dispose.bar=!0}var b=dataSet(e,i("id"),T.push(l)-1);return o[s]=setTimeout(function(){L.update(b,!0)},0),b},dispose:function(e){var t="string"==typeof e?parseInt(e,10):"number"==typeof e?e:!1;if(t===!1)return!1;var n=T[t];return n&&"undefined"!=typeof n?(S(a),S(s),n.observer&&n.observer.disconnect(),l("area",n.area),n.area.removeAttribute("data-"+i("id")),n.dispose.wrap&&(n.wrap.parentNode.insertBefore(n.area,n.wrap),n.wrap.parentNode.removeChild(n.wrap)),n.dispose.thumb&&n.thumb.parentNode.removeChild(n.thumb),n.dispose.bar&&n.bar.parentNode.removeChild(n.bar),T[t]=!1,!0):!0},disposeAll:function(){for(var e=0;e<T.length;e++)this.dispose(e)},getID:function(e){return dataSet(e.area,i("id"))},update:function(e,t){var n=T[e];n&&(this.setSize(n),t&&this.setEvents(n))},updateAll:function(){for(var e=0;e<T.length;e++)this.update(e)},setEvents:function(e){var t=this;e.observer=new MutationObserver(function(){t.update(t.getID(e))}),e.observer.observe(e.area,{attributes:!0,childList:!0});var n=function(n){C.call(t,e,n)};x?e.wrap.ontouchstart=function(e){1===e.touches.length&&(e.preventDefault(),e.stopPropagation(),n(e.touches[0]))}:(e.wrap.addEventListener(z,function(n){M.call(t,e,n)}),e.bar.addEventListener("mousedown",n)),e.thumb.addEventListener("click",function(e){e&&(e.preventDefault(),e.stopPropagation())}),e.bar.addEventListener("click",function(n){var i=n["layer"+e.axis];t.setThumbPos.call(t,e,i,!0)})},setSize:function(e){var t=e.wrapSize=v(e.wrap,e.axis,"offset"),n=v(e.area,e.axis);if(e.visible=n>t,!e.visible)return void(e.bar.style.visibility="hidden");var i=e.wrapRatio=t/n,r=e.thumbSize=Math.min(t,Math.max(e.thumbMinSize,t*i));e.thumb.style.height=y(r),e.thumbSize=v(e.thumb,e.axis,"offset"),this.setThumbPos(e),e.bar.style.height=y(t),e.bar.style.visibility="visible"},setThumbPos:function(e,t,n){var i="number"==typeof t?t:w(e),r=e.thumbSize/2,o=e.wrapSize-e.thumbSize,a=r>i?0:i-r;a=a>o?o:a,e.thumb.style[h[e.axis].toLowerCase()]=y(a),n&&(a=a===o?e.wrapSize:a,e.wrap["scroll"+h[e.axis]]=Math.floor(a/e.wrapSize*v(e.area,e.axis)))}};e&&e.fn&&(e.fn.scrolly=function(e){return this.length?"string"!=typeof e?(L.bar(this,e||{}),this):(["dispose","update"].indexOf(e)>-1&&this.forEach(function(t){var n=dataSet(t,i("id"));L[e](n)}),this):this}),this.scrolly=L,this.scrollyst=T});

@@ -1,4 +0,4 @@

/* scrolly v0.4.0, 2014.12.26 */
/* scrolly v0.6.0, 2015.11.26 */
!function(t){function e(e){var n=e.length,i=typeof e;return p(i)||e===t?!1:1===e.nodeType&&n?!0:v(i)||0===n||"number"==typeof n&&n>0&&n-1 in e}function n(t,e){var n,i;this.originalEvent=t,i=function(t,e){this[t]="preventDefault"===t?function(){return this.defaultPrevented=!0,e[t]()}:p(e[t])?function(){return e[t]()}:e[t]};for(n in t)(t[n]||"function"==typeof t[n])&&i.call(this,n,t);g.extend(this,e)}var i,r=t.$,o=t.jBone,s=/^<(\w+)\s*\/?>$/,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,a=[].slice,f=[].splice,c=Object.keys,h=document,l=function(t){return"string"==typeof t},d=function(t){return t instanceof Object},p=function(t){var e={};return t&&"[object Function]"===e.toString.call(t)},v=function(t){return Array.isArray(t)},g=function(t,e){return new i.init(t,e)};g.noConflict=function(){return t.$=r,t.jBone=o,g},i=g.fn=g.prototype={init:function(t,e){var n,i,r,o;if(!t)return this;if(l(t)){if(i=s.exec(t))return this[0]=h.createElement(i[1]),this.length=1,d(e)&&this.attr(e),this;if((i=u.exec(t))&&i[1]){for(o=h.createDocumentFragment(),r=h.createElement("div"),r.innerHTML=t;r.lastChild;)o.appendChild(r.firstChild);return n=a.call(o.childNodes),g.merge(this,n)}if(g.isElement(e))return g(e).find(t);try{return n=h.querySelectorAll(t),g.merge(this,n)}catch(f){return this}}return t.nodeType?(this[0]=t,this.length=1,this):p(t)?t():t instanceof g?t:g.makeArray(t,this)},pop:[].pop,push:[].push,reverse:[].reverse,shift:[].shift,sort:[].sort,splice:[].splice,slice:[].slice,indexOf:[].indexOf,forEach:[].forEach,unshift:[].unshift,concat:[].concat,join:[].join,every:[].every,some:[].some,filter:[].filter,map:[].map,reduce:[].reduce,reduceRight:[].reduceRight,length:0},i.constructor=g,i.init.prototype=i,g.setId=function(e){var n=e.jid;e===t?n="window":void 0===e.jid&&(e.jid=n=++g._cache.jid),g._cache.events[n]||(g._cache.events[n]={})},g.getData=function(e){e=e instanceof g?e[0]:e;var n=e===t?"window":e.jid;return{jid:n,events:g._cache.events[n]}},g.isElement=function(t){return t&&t instanceof g||t instanceof HTMLElement||l(t)},g._cache={events:{},jid:0},g.merge=function(t,e){for(var n=e.length,i=t.length,r=0;n>r;)t[i++]=e[r++];return t.length=i,t},g.contains=function(t,e){var n;return t.reverse().some(function(t){return t.contains(e)?n=t:void 0}),n},g.extend=function(t){var e,n,i,r;return f.call(arguments,1).forEach(function(o){if(o)for(e=c(o),n=e.length,i=0,r=t;n>i;i++)r[e[i]]=o[e[i]]}),t},g.makeArray=function(t,n){var i=n||[];return null!==t&&(e(t)?g.merge(i,l(t)?[t]:t):i.push(t)),i},g.Event=function(t,e){var n,i;return t.type&&!e&&(e=t,t=t.type),n=t.split(".").splice(1).join("."),i=t.split(".")[0],t=h.createEvent("Event"),t.initEvent(i,!0,!0),g.extend(t,{namespace:n,isDefaultPrevented:function(){return t.defaultPrevented}},e)},i.on=function(t){var e,i,r,o,s,u,a,f,c=arguments,h=this.length,l=0;for(2===c.length?e=c[1]:(i=c[1],e=c[2]),f=function(f){g.setId(f),s=g.getData(f).events,t.split(" ").forEach(function(t){u=t.split(".")[0],r=t.split(".").splice(1).join("."),s[u]=s[u]||[],o=function(t){t.namespace&&t.namespace!==r||(a=null,i?(~g(f).find(i).indexOf(t.target)||(a=g.contains(g(f).find(i),t.target)))&&(a=a||t.target,t=new n(t,{currentTarget:a}),e.call(a,t)):e.call(f,t))},s[u].push({namespace:r,fn:o,originfn:e}),f.addEventListener&&f.addEventListener(u,o,!1)})};h>l;l++)f(this[l]);return this},i.one=function(t){var e,n,i,r=arguments,o=0,s=this.length;for(2===r.length?e=r[1]:(n=r[1],e=r[2]),i=function(i){t.split(" ").forEach(function(t){var r=function(n){g(i).off(t,r),e.call(i,n)};n?g(i).on(t,n,r):g(i).on(t,r)})};s>o;o++)i(this[o]);return this},i.trigger=function(t){var e,n=[],i=0,r=this.length;if(!t)return this;for(l(t)?n=t.split(" ").map(function(t){return g.Event(t)}):(t=t instanceof Event?t:g.Event(t),n=[t]),e=function(t){n.forEach(function(e){e.type&&t.dispatchEvent&&t.dispatchEvent(e)})};r>i;i++)e(this[i]);return this},i.off=function(t,e){var n,i,r,o,s=0,u=this.length,a=function(t,n,i,r,o){var s;(e&&o.originfn===e||!e)&&(s=o.fn),t[n][i].fn===s&&(r.removeEventListener(n,s),g._cache.events[g.getData(r).jid][n].splice(i,1))};for(r=function(e){var r,s,u;return(n=g.getData(e).events)?!t&&n?c(n).forEach(function(t){for(s=n[t],r=s.length;r--;)a(n,t,r,e,s[r])}):void t.split(" ").forEach(function(t){if(o=t.split(".")[0],i=t.split(".").splice(1).join("."),n[o])for(s=n[o],r=s.length;r--;)u=s[r],(!i||i&&u.namespace===i)&&a(n,o,r,e,u);else i&&c(n).forEach(function(t){for(s=n[t],r=s.length;r--;)u=s[r],u.namespace.split(".")[0]===i.split(".")[0]&&a(n,t,r,e,u)})}):void 0};u>s;s++)r(this[s]);return this},i.find=function(t){for(var e=[],n=0,i=this.length,r=function(n){p(n.querySelectorAll)&&[].forEach.call(n.querySelectorAll(t),function(t){e.push(t)})};i>n;n++)r(this[n]);return g(e)},i.get=function(t){return this[t]},i.eq=function(t){return g(this[t])},i.parent=function(){for(var t,e=[],n=0,i=this.length;i>n;n++)!~e.indexOf(t=this[n].parentElement)&&t&&e.push(t);return g(e)},i.toArray=function(){return a.call(this)},i.is=function(){var t=arguments;return this.some(function(e){return e.tagName.toLowerCase()===t[0]})},i.has=function(){var t=arguments;return this.some(function(e){return e.querySelectorAll(t[0]).length})},i.attr=function(t,e){var n,i=arguments,r=0,o=this.length;if(l(t)&&1===i.length)return this[0]&&this[0].getAttribute(t);for(2===i.length?n=function(n){n.setAttribute(t,e)}:d(t)&&(n=function(e){c(t).forEach(function(n){e.setAttribute(n,t[n])})});o>r;r++)n(this[r]);return this},i.removeAttr=function(t){for(var e=0,n=this.length;n>e;e++)this[e].removeAttribute(t);return this},i.val=function(t){var e=0,n=this.length;if(0===arguments.length)return this[0]&&this[0].value;for(;n>e;e++)this[e].value=t;return this},i.css=function(e,n){var i,r=arguments,o=0,s=this.length;if(l(e)&&1===r.length)return this[0]&&t.getComputedStyle(this[0])[e];for(2===r.length?i=function(t){t.style[e]=n}:d(e)&&(i=function(t){c(e).forEach(function(n){t.style[n]=e[n]})});s>o;o++)i(this[o]);return this},i.data=function(t,e){var n,i=arguments,r={},o=0,s=this.length,u=function(t,e,n){d(n)?(t.jdata=t.jdata||{},t.jdata[e]=n):t.dataset[e]=n},a=function(t){return"true"===t?!0:"false"===t?!1:t};if(0===i.length)return this[0].jdata&&(r=this[0].jdata),c(this[0].dataset).forEach(function(t){r[t]=a(this[0].dataset[t])},this),r;if(1===i.length&&l(t))return this[0]&&a(this[0].dataset[t]||this[0].jdata&&this[0].jdata[t]);for(1===i.length&&d(t)?n=function(e){c(t).forEach(function(n){u(e,n,t[n])})}:2===i.length&&(n=function(n){u(n,t,e)});s>o;o++)n(this[o]);return this},i.removeData=function(t){for(var e,n,i=0,r=this.length;r>i;i++)if(e=this[i].jdata,n=this[i].dataset,t)e&&e[t]&&delete e[t],delete n[t];else{for(t in e)delete e[t];for(t in n)delete n[t]}return this},i.html=function(t){var e,n=arguments;return 1===n.length&&void 0!==t?this.empty().append(t):0===n.length&&(e=this[0])?e.innerHTML:this},i.append=function(t){var e,n=0,i=this.length;for(l(t)&&u.exec(t)?t=g(t):d(t)||(t=document.createTextNode(t)),t=t instanceof g?t:g(t),e=function(e,n){t.forEach(function(t){e.appendChild(n?t.cloneNode(!0):t)})};i>n;n++)e(this[n],n);return this},i.appendTo=function(t){return g(t).append(this),this},i.empty=function(){for(var t,e=0,n=this.length;n>e;e++)for(t=this[e];t.lastChild;)t.removeChild(t.lastChild);return this},i.remove=function(){var t,e=0,n=this.length;for(this.off();n>e;e++)t=this[e],delete t.jdata,t.parentNode&&t.parentNode.removeChild(t);return this},"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=g:"function"==typeof define&&define.amd?(define(function(){return g}),t.jBone=t.$=g):"object"==typeof t&&"object"==typeof t.document&&(t.jBone=t.$=g)}(window);;
!function(t){function e(e){var n=e.length,i=typeof e;return p(i)||e===t?!1:1===e.nodeType&&n?!0:g(i)||0===n||"number"==typeof n&&n>0&&n-1 in e}function n(t,e){var n,i;this.originalEvent=t,i=function(t,e){this[t]="preventDefault"===t?function(){return this.defaultPrevented=!0,e[t]()}:"stopImmediatePropagation"===t?function(){return this.immediatePropagationStopped=!0,e[t]()}:p(e[t])?function(){return e[t]()}:e[t]};for(n in t)(t[n]||"function"==typeof t[n])&&i.call(this,n,t);v.extend(this,e,{isImmediatePropagationStopped:function(){return!!this.immediatePropagationStopped}})}var i,r=t.$,o=t.jBone,s=/^<(\w+)\s*\/?>$/,a=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,u=[].slice,f=[].splice,c=Object.keys,h=document,l=function(t){return"string"==typeof t},d=function(t){return t instanceof Object},p=function(t){return"[object Function]"==={}.toString.call(t)},g=function(t){return Array.isArray(t)},v=function(t,e){return new i.init(t,e)};v.noConflict=function(){return t.$=r,t.jBone=o,v},i=v.fn=v.prototype={init:function(t,e){var n,i,r,o;if(!t)return this;if(l(t)){if(i=s.exec(t))return this[0]=h.createElement(i[1]),this.length=1,d(e)&&this.attr(e),this;if((i=a.exec(t))&&i[1]){for(o=h.createDocumentFragment(),r=h.createElement("div"),r.innerHTML=t;r.lastChild;)o.appendChild(r.firstChild);return n=u.call(o.childNodes),v.merge(this,n)}if(v.isElement(e))return v(e).find(t);try{return n=h.querySelectorAll(t),v.merge(this,n)}catch(f){return this}}return t.nodeType?(this[0]=t,this.length=1,this):p(t)?t():t instanceof v?t:v.makeArray(t,this)},pop:[].pop,push:[].push,reverse:[].reverse,shift:[].shift,sort:[].sort,splice:[].splice,slice:[].slice,indexOf:[].indexOf,forEach:[].forEach,unshift:[].unshift,concat:[].concat,join:[].join,every:[].every,some:[].some,filter:[].filter,map:[].map,reduce:[].reduce,reduceRight:[].reduceRight,length:0},i.constructor=v,i.init.prototype=i,v.setId=function(e){var n=e.jid;e===t?n="window":void 0===e.jid&&(e.jid=n=++v._cache.jid),v._cache.events[n]||(v._cache.events[n]={})},v.getData=function(e){e=e instanceof v?e[0]:e;var n=e===t?"window":e.jid;return{jid:n,events:v._cache.events[n]}},v.isElement=function(t){return t&&t instanceof v||t instanceof HTMLElement||l(t)},v._cache={events:{},jid:0},i.pushStack=function(t){var e=v.merge(this.constructor(),t);return e},v.merge=function(t,e){for(var n=e.length,i=t.length,r=0;n>r;)t[i++]=e[r++];return t.length=i,t},v.contains=function(t,e){return t.contains(e)},v.extend=function(t){var e;return f.call(arguments,1).forEach(function(n){if(e=t,n)for(var i in n)e[i]=n[i]}),t},v.makeArray=function(t,n){var i=n||[];return null!==t&&(e(t)?v.merge(i,l(t)?[t]:t):i.push(t)),i},v.unique=function(t){if(null==t)return[];for(var e=[],n=0,i=t.length;i>n;n++){var r=t[n];e.indexOf(r)<0&&e.push(r)}return e},v.Event=function(t,e){var n,i;return t.type&&!e&&(e=t,t=t.type),n=t.split(".").splice(1).join("."),i=t.split(".")[0],t=h.createEvent("Event"),t.initEvent(i,!0,!0),v.extend(t,{namespace:n,isDefaultPrevented:function(){return t.defaultPrevented}},e)},v.event={add:function(t,e,n,i,r){v.setId(t);var o,s,a,u=function(e){v.event.dispatch.call(t,e)},f=v.getData(t).events;for(e=e.split(" "),s=e.length;s--;)a=e[s],o=a.split(".")[0],f[o]=f[o]||[],f[o].length?u=f[o][0].fn:t.addEventListener&&t.addEventListener(o,u,!1),f[o].push({namespace:a.split(".").splice(1).join("."),fn:u,selector:r,data:i,originfn:n})},remove:function(t,e,n){var i,r,o=function(t,e,i,r,o){var s;(n&&o.originfn===n||!n)&&(s=o.fn),t[e][i].fn===s&&(t[e].splice(i,1),t[e].length||r.removeEventListener(e,s))},s=v.getData(t).events;return s?!e&&s?c(s).forEach(function(e){for(r=s[e],i=r.length;i--;)o(s,e,i,t,r[i])}):void e.split(" ").forEach(function(e){var n,a=e.split(".")[0],u=e.split(".").splice(1).join(".");if(s[a])for(r=s[a],i=r.length;i--;)n=r[i],(!u||u&&n.namespace===u)&&o(s,a,i,t,n);else u&&c(s).forEach(function(e){for(r=s[e],i=r.length;i--;)n=r[i],n.namespace.split(".")[0]===u.split(".")[0]&&o(s,e,i,t,n)})}):void 0},trigger:function(t,e){var n=[];l(e)?n=e.split(" ").map(function(t){return v.Event(t)}):(e=e instanceof Event?e:v.Event(e),n=[e]),n.forEach(function(e){e.type&&t.dispatchEvent&&t.dispatchEvent(e)})},dispatch:function(t){for(var e,i,r,o,s,a=0,u=0,f=this,c=v.getData(f).events[t.type],h=c.length,l=[],d=[];h>a;a++)l.push(c[a]);for(a=0,h=l.length;h>a&&~c.indexOf(l[a])&&(!o||!o.isImmediatePropagationStopped());a++)if(i=null,s={},r=l[a],r.data&&(s.data=r.data),r.selector){if(~(d=v(f).find(r.selector)).indexOf(t.target)&&(i=t.target)||f!==t.target&&f.contains(t.target)){if(!i)for(e=d.length,u=0;e>u;u++)d[u]&&d[u].contains(t.target)&&(i=d[u]);if(!i)continue;s.currentTarget=i,o=new n(t,s),t.namespace&&t.namespace!==r.namespace||r.originfn.call(i,o)}}else o=new n(t,s),t.namespace&&t.namespace!==r.namespace||r.originfn.call(f,o)}},i.on=function(t,e,n,i){var r=this.length,o=0;if(null==n&&null==i?(i=e,n=e=void 0):null==i&&("string"==typeof e?(i=n,n=void 0):(i=n,n=e,e=void 0)),!i)return this;for(;r>o;o++)v.event.add(this[o],t,i,n,e);return this},i.one=function(t){var e,n=arguments,i=0,r=this.length,o=u.call(n,1,n.length-1),s=u.call(n,-1)[0];for(e=function(e){var n=v(e);t.split(" ").forEach(function(t){var i=function(r){n.off(t,i),s.call(e,r)};n.on.apply(n,[t].concat(o,i))})};r>i;i++)e(this[i]);return this},i.trigger=function(t){var e=0,n=this.length;if(!t)return this;for(;n>e;e++)v.event.trigger(this[e],t);return this},i.off=function(t,e){for(var n=0,i=this.length;i>n;n++)v.event.remove(this[n],t,e);return this},i.find=function(t){for(var e=[],n=0,i=this.length,r=function(n){p(n.querySelectorAll)&&[].forEach.call(n.querySelectorAll(t),function(t){e.push(t)})};i>n;n++)r(this[n]);return v(e)},i.get=function(t){return null!=t?0>t?this[t+this.length]:this[t]:u.call(this)},i.eq=function(t){return v(this[t])},i.parent=function(){for(var t,e=[],n=0,i=this.length;i>n;n++)!~e.indexOf(t=this[n].parentElement)&&t&&e.push(t);return v(e)},i.toArray=function(){return u.call(this)},i.is=function(){var t=arguments;return this.some(function(e){return e.tagName.toLowerCase()===t[0]})},i.has=function(){var t=arguments;return this.some(function(e){return e.querySelectorAll(t[0]).length})},i.add=function(t,e){return this.pushStack(v.unique(v.merge(this.get(),v(t,e))))},i.attr=function(t,e){var n,i=arguments,r=0,o=this.length;if(l(t)&&1===i.length)return this[0]&&this[0].getAttribute(t);for(2===i.length?n=function(n){n.setAttribute(t,e)}:d(t)&&(n=function(e){c(t).forEach(function(n){e.setAttribute(n,t[n])})});o>r;r++)n(this[r]);return this},i.removeAttr=function(t){for(var e=0,n=this.length;n>e;e++)this[e].removeAttribute(t);return this},i.val=function(t){var e=0,n=this.length;if(0===arguments.length)return this[0]&&this[0].value;for(;n>e;e++)this[e].value=t;return this},i.css=function(e,n){var i,r=arguments,o=0,s=this.length;if(l(e)&&1===r.length)return this[0]&&t.getComputedStyle(this[0])[e];for(2===r.length?i=function(t){t.style[e]=n}:d(e)&&(i=function(t){c(e).forEach(function(n){t.style[n]=e[n]})});s>o;o++)i(this[o]);return this},i.data=function(t,e){var n,i=arguments,r={},o=0,s=this.length,a=function(t,e,n){d(n)?(t.jdata=t.jdata||{},t.jdata[e]=n):t.dataset[e]=n},u=function(t){return"true"===t?!0:"false"===t?!1:t};if(0===i.length)return this[0].jdata&&(r=this[0].jdata),c(this[0].dataset).forEach(function(t){r[t]=u(this[0].dataset[t])},this),r;if(1===i.length&&l(t))return this[0]&&u(this[0].dataset[t]||this[0].jdata&&this[0].jdata[t]);for(1===i.length&&d(t)?n=function(e){c(t).forEach(function(n){a(e,n,t[n])})}:2===i.length&&(n=function(n){a(n,t,e)});s>o;o++)n(this[o]);return this},i.removeData=function(t){for(var e,n,i=0,r=this.length;r>i;i++)if(e=this[i].jdata,n=this[i].dataset,t)e&&e[t]&&delete e[t],delete n[t];else{for(t in e)delete e[t];for(t in n)delete n[t]}return this},i.addClass=function(t){for(var e=0,n=0,i=this.length,r=t?t.trim().split(/\s+/):[];i>e;e++)for(n=0,n=0;n<r.length;n++)this[e].classList.add(r[n]);return this},i.removeClass=function(t){for(var e=0,n=0,i=this.length,r=t?t.trim().split(/\s+/):[];i>e;e++)for(n=0,n=0;n<r.length;n++)this[e].classList.remove(r[n]);return this},i.toggleClass=function(t,e){var n=0,i=this.length,r="toggle";if(e===!0&&(r="add")||e===!1&&(r="remove"),t)for(;i>n;n++)this[n].classList[r](t);return this},i.hasClass=function(t){var e=0,n=this.length;if(t)for(;n>e;e++)if(this[e].classList.contains(t))return!0;return!1},i.html=function(t){var e,n=arguments;return 1===n.length&&void 0!==t?this.empty().append(t):0===n.length&&(e=this[0])?e.innerHTML:this},i.append=function(t){var e,n=0,i=this.length;for(l(t)&&a.exec(t)?t=v(t):d(t)||(t=document.createTextNode(t)),t=t instanceof v?t:v(t),e=function(e,n){t.forEach(function(t){e.appendChild(n?t.cloneNode(!0):t)})};i>n;n++)e(this[n],n);return this},i.appendTo=function(t){return v(t).append(this),this},i.empty=function(){for(var t,e=0,n=this.length;n>e;e++)for(t=this[e];t.lastChild;)t.removeChild(t.lastChild);return this},i.remove=function(){var t,e=0,n=this.length;for(this.off();n>e;e++)t=this[e],delete t.jdata,t.parentNode&&t.parentNode.removeChild(t);return this},"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=v:"function"==typeof define&&define.amd?(define(function(){return v}),t.jBone=t.$=v):"object"==typeof t&&"object"==typeof t.document&&(t.jBone=t.$=v)}(window);;
$ = jBone;
# Scrolly: fast vanilla JS scrollbar plugin
Aim is a fast + good looking scrollbar with zero dependencies, small size &amp; major browsers support.
At the moment `MutationObserver` requires IE11, but works in all major desktop &amp; mobile browsers.
So, the **Browser Support** is same as for [`MutationObserver`](https://developer.mozilla.org/en/docs/Web/API/MutationObserver#Browser_compatibility), works in all modern browsers for Desktop and Mobile.
## Usage
## Install, via Bower or NPM
* `bower install scrolly`
* `npm install scrolly`
## Features &amp; Usage
* Small (~**6KB** minified), fast, vanilla JS (zero dependencies)
* Nested scrollbars
* Touch support
* jQuery/Zepto/jBone plugin
* React.js Component
* Infinite scroll (top/bottom edge reach) callbacks
```js

@@ -14,2 +26,7 @@ // Initialize

// Update
scrolly.update(id);
// or update everything
scrolly.updateAll();
// Dispose

@@ -21,2 +38,31 @@ scrolly.dispose(id);

### React Component
See example usage: `gulp watch` and open [/react](http://localhost:3001/react/). Or just look at `public/react/index.html` in this repo.
```jsx
<Scrolly params={ params }>
<h1>Some test contents here</h1>
<p>Contents to be scrolled...</p>
</Scrolly>
```
### jQuery/Zepto/jBone Plugin flavour
```js
// jQuery Plugin
$('.selector').scrolly();
// ...and it's chained as well
// Update
$('.selector').scrolly('update');
// Dispose
$('.selector').scrolly('dispose');
```
### Demo
Just open `public/index.html`, or check the [Live demo](https://annexare.com/js/scrolly/). For React Component demo check `public/react/index.html` or [scrolly/react](https://annexare.com/js/scrolly/react/).
## Details

@@ -26,7 +72,9 @@

```
data: LESS:
data LESS:
{
wrap .scrolly
area .area
bar .area + .bar
thumb .thumb
bar .scrolly + .bar
thumb .thumb
}
```

@@ -38,7 +86,2 @@

### Planned
* Infinite Scroll callback
* React.js Component
### Setup

@@ -45,0 +88,0 @@

/**
* Scrolly.js
*
* @todo Prepare for React.js
* @todo Add more options: keep thumb pos on update, etc
* Scrolly: fast vanilla JS scrollbar plugin.
*/
;(function () {
;(function (factory) {
if (typeof module !== 'undefined' && module.exports) {
factory.call(module.exports);
} else if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else {
factory.call(window, window.$ || window.jQuery || window.Zepto || window.jBone);
}
}(function ($) {
'use strict';
var title = 'Scrolly',
prefix = function (param) {
return 'scroll' + param;
name = title.toLowerCase(),
dataPrefix = function (param) {
return name + param;
},

@@ -19,2 +25,7 @@ message = function (text) {

// Timeouts for Event callbacks
timeouts = {},
TIMER_EDGE = 'e',
TIMER_UP = 'u',
// Node helpers

@@ -31,3 +42,3 @@ // classList is not supported by IE9

hasClass = function (className, node) {
var list = (node.className || '').split(/\s+/);
var list = (node ? node.className || '' : '').split(/\s+/);

@@ -37,3 +48,3 @@ return (list.indexOf(className) !== -1);

removeClass = function (className, node) {
var list = (node.className || '').split(/\s+/),
var list = (node ? node.className || '' : '').split(/\s+/),
id = list.indexOf(className);

@@ -88,2 +99,18 @@ if (id !== -1) {

clearTimer = function (key) {
if (!timeouts[key]) {
return;
}
clearTimeout(timeouts[key]);
delete timeouts[key];
},
dummyTimer = function (key) {
clearTimer(key);
return (
timeouts[key] = setTimeout(function () {
clearTimer(key);
}, 500)
);
},
hasTouch = ('ontouchstart' in document.documentElement),

@@ -102,3 +129,3 @@ wheelEventName = ('onwheel' in document || document.documentMode >= 9)

removeClass(this.noUserSelectClass, document.body);
removeClass(this.onDragClass, data.bar);
removeClass(this.dragClass, data.bar);
},

@@ -124,3 +151,3 @@ onBegin = function (data, e) {

addClass(this.noUserSelectClass, document.body);
addClass(this.onDragClass, data.bar);
addClass(this.dragClass, data.bar);

@@ -138,2 +165,15 @@ if (hasTouch) {

},
onWheelEdge = function (data, offset) {
if (typeof data.onEdge !== 'function') {
return;
}
if (timeouts[TIMER_EDGE]) {
dummyTimer(TIMER_EDGE);
return;
}
// Bottom edge if (offset > 0)
data.onEdge.call(data, offset > 0);
dummyTimer(TIMER_EDGE);
},
onWheel = function (data, e) {

@@ -148,4 +188,8 @@ if (data.wrapRatio === 1) {

if ((offset > 0) && (offset + data.wrapSize < getNodeSize(data.area, data.axis))) {
// Scrolling inside
e.preventDefault();
e.stopPropagation();
} else if (offset !== 0) {
onWheelEdge(data, offset);
return;
}

@@ -167,3 +211,3 @@

axis: 'Y',
onDragClass: 'on-drag',
dragClass: 'on-drag',
onResize: false,

@@ -174,2 +218,8 @@ noUserSelectClass: 'no-user-select',

// Public methods
/**
* Main init, accepts string, nodes|node or $ as query.
* @param query
* @param params
* @returns Array|boolean
*/
bar: function (query, params) {

@@ -185,7 +235,3 @@ if (!query) {

if (!$query.length) {
if ($query instanceof HTMLElement) {
return [this.barNode($query, params)];
}
console.log(message('Couldn\'t query:'), typeof query, query, params);
return false;
return [this.barNode($query, params)];
}

@@ -200,6 +246,18 @@

},
/**
* Init for a single node.
* @param node
* @param params
* @returns Number|boolean
*/
barNode: function (node, params) {
if (typeof dataset(node, prefix('id')) !== 'undefined') {
this.dispose(dataset(node, prefix('id')));
// Check Node type
if (!node || !node.nodeType) {
console.log(message('Couldn\'t query:'), typeof node, node, params);
return false;
}
// Check if already initialized
if (typeof dataSet(node, dataPrefix('id')) !== 'undefined') {
this.dispose(dataSet(node, dataPrefix('id')));
}
// Window Resize

@@ -215,2 +273,3 @@ if (!this.onResize) {

data = {
dispose: {},
params: opts,

@@ -223,2 +282,3 @@ scrolled: 0,

data.axis = opts.axis || this.axis;
data.onEdge = opts.onEdge || false;
data.thumbMinSize = opts.thumbMinSize || this.thumbMinSize;

@@ -228,15 +288,39 @@

addClass('area', node);
data.wrap = wrap(node, 'scrolly');
if (hasClass(name, node.parentNode)) {
// Wrap exists
data.wrap = node.parentNode;
} else {
data.wrap = wrap(node, name);
data.dispose.wrap = true;
}
data.area = node;
// Bar
// TODO Check for existing Bar
var bar = div('bar');
data.thumb = bar.appendChild(div('thumb'));
data.bar = data.wrap.parentNode
.insertBefore(bar, data.wrap.nextSibling);
var barClassName = 'bar',
thumbClassName = 'thumb';
if (hasClass(barClassName, data.wrap.nextSibling)) {
// Bar exists
data.bar = data.wrap.nextSibling;
if (hasClass(thumbClassName, data.bar.firstChild)) {
// Thumb exists
data.thumb = data.bar.firstChild;
} else {
data.bar.innerHTML = '';
data.thumb = data.bar.appendChild(div(thumbClassName));
data.dispose.thumb = true;
}
} else {
var bar = div(barClassName);
data.thumb = bar.appendChild(div(thumbClassName));
data.bar = data.wrap.parentNode
.insertBefore(bar, data.wrap.nextSibling);
data.dispose.bar = true;
}
// Store Data
var id = dataset(node, prefix('id'), scrls.push(data) - 1);
this.update(id, true);
var id = dataSet(node, dataPrefix('id'), scrls.push(data) - 1);
timeouts[TIMER_UP] = setTimeout(function () {
scrl.update(id, true);
}, 0);

@@ -248,6 +332,10 @@ return id;

* @param id
* @returns {boolean}
* @returns boolean
*/
dispose: function (id) {
var no = (typeof id === 'number') ? id : false;
var no = (
typeof id === 'string'
? parseInt(id, 10)
: (typeof id === 'number' ? id : false)
);

@@ -262,10 +350,23 @@ if (no === false) {

}
// First update() Timeout
clearTimer(TIMER_EDGE);
clearTimer(TIMER_UP);
// Unwatch
data.observer.disconnect();
if (data.observer) {
data.observer.disconnect();
}
// Cleanup
removeClass('area', data.area);
data.area.removeAttribute('data-' + prefix('id'));
data.wrap.parentNode.insertBefore(data.area, data.wrap);
data.wrap.parentNode.removeChild(data.wrap);
data.bar.parentNode.removeChild(data.bar);
data.area.removeAttribute('data-' + dataPrefix('id'));
// Extra Nodes
if (data.dispose.wrap) {
data.wrap.parentNode.insertBefore(data.area, data.wrap);
data.wrap.parentNode.removeChild(data.wrap);
}
if (data.dispose.thumb) {
data.thumb.parentNode.removeChild(data.thumb);
}
if (data.dispose.bar) {
data.bar.parentNode.removeChild(data.bar);
}
// Well, we won't change all IDs to remove it

@@ -284,6 +385,6 @@ scrls[no] = false;

* @param data
* @returns {*}
* @returns String
*/
getID: function (data) {
return dataset(data.area, prefix('id'));
return dataSet(data.area, dataPrefix('id'));
},

@@ -319,4 +420,4 @@ /**

// Observe changes in future
data.observer = new MutationObserver(function (mutations) {
console.log(' > mutations for ' + data.area.className, mutations.length);
data.observer = new MutationObserver(function (/*mutations*/) {
// console.log(' > mutations for ' + data.area.className, mutations.length);
self.update(self.getID(data));

@@ -415,13 +516,29 @@ });

if (typeof module !== 'undefined' && module.exports) {
module.exports = scrl;
} else if (typeof define !== 'undefined' && define.amd) {
define([], function () {
return scrl;
});
} else {
this.scrolly = scrl;
this.scrollyst = scrls;
// jQuery Plugin
if ($ && $.fn) {
$.fn.scrolly = function(param) {
// Empty selector
if (!this.length) {
return this;
}
// Initialize with params
if (typeof param !== 'string') {
scrl.bar(this, param || {});
return this;
}
// Available Methods
if (['dispose', 'update'].indexOf(param) > -1) {
this.forEach(function (el) {
var id = dataSet(el, dataPrefix('id'));
scrl[param](id);
});
}
return this;
};
}
}.call(this));
this.scrolly = scrl;
this.scrollyst = scrls;
}));

@@ -1,2 +0,2 @@

var dataset = function initDataSet() {
var dataSet = function initDataSet() {
if (document.documentElement.dataset) {

@@ -3,0 +3,0 @@ return function native(el, prop, value) {

{
"name": "jbone",
"version": "1.0.20",
"version": "1.1.2",
"description": "Library for DOM manipulation",
"main": "dist/jbone.js",
"homepage": "http://jbone.js.org",
"ignore": [
"**/.*",
"node_modules",
"bower_components"
".gitignore",
".travis.yml",
"component.json",
"Gruntfile.js",
"package.json",
"perf",
"src",
"build",
"test"
],

@@ -15,8 +23,24 @@ "devDependencies": {

},
"homepage": "https://github.com/kupriyanenko/jbone",
"_release": "1.0.20",
"keywords": [
"jquery",
"jbone",
"backbone",
"javascript",
"DOM",
"events",
"library"
],
"authors": [
"Alexey Kupriyanenko <a.kupriyanenko@gmail.com>"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/kupriyanenko/jbone"
},
"_release": "1.1.2",
"_resolution": {
"type": "version",
"tag": "1.0.20",
"commit": "f9a5dacc5f4ed3a7df32953b269684b5745a030a"
"tag": "1.1.2",
"commit": "54e8ad263492b7e7253674f4ceeb59feb1094be7"
},

@@ -23,0 +47,0 @@ "_source": "git://github.com/kupriyanenko/jbone.git",

{
"name": "jbone",
"version": "1.0.20",
"version": "1.1.2",
"description": "Library for DOM manipulation",
"main": "dist/jbone.js",
"homepage": "http://jbone.js.org",
"ignore": [
"**/.*",
"node_modules",
"bower_components"
".gitignore",
".travis.yml",
"component.json",
"Gruntfile.js",
"package.json",
"perf",
"src",
"build",
"test"
],

@@ -14,3 +22,20 @@ "devDependencies": {

"astrobench": "0.1.1"
},
"keywords": [
"jquery",
"jbone",
"backbone",
"javascript",
"DOM",
"events",
"library"
],
"authors": [
"Alexey Kupriyanenko <a.kupriyanenko@gmail.com>"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/kupriyanenko/jbone"
}
}
/*!
* jBone v1.0.20 - 2014-11-27 - Library for DOM manipulation
* jBone v1.1.2 - 2015-10-09 - Library for DOM manipulation
*
* https://github.com/kupriyanenko/jbone
* http://jbone.js.org
*
* Copyright 2014 Alexey Kupriyanenko
* Copyright 2015 Alexey Kupriyanenko
* Released under the MIT license.

@@ -39,4 +39,3 @@ */

isFunction = function(el) {
var getType = {};
return el && getType.toString.call(el) === "[object Function]";
return ({}).toString.call(el) === "[object Function]";
},

@@ -198,2 +197,8 @@ isArray = function(el) {

fn.pushStack = function(elems) {
var ret = jBone.merge(this.constructor(), elems);
return ret;
};
jBone.merge = function(first, second) {

@@ -214,28 +219,15 @@ var l = second.length,

jBone.contains = function(container, contained) {
var result;
container.reverse().some(function(el) {
if (el.contains(contained)) {
return result = el;
}
});
return result;
return container.contains(contained);
};
jBone.extend = function(target) {
var k, kl, i, tg;
var tg;
splice.call(arguments, 1).forEach(function(object) {
if (!object) {
return;
}
k = keys(object);
kl = k.length;
i = 0;
splice.call(arguments, 1).forEach(function(source) {
tg = target; //caching target for perf improvement
for (; i < kl; i++) {
tg[k[i]] = object[k[i]];
if (source) {
for (var prop in source) {
tg[prop] = source[prop];
}
}

@@ -261,2 +253,18 @@ });

jBone.unique = function(array) {
if (array == null) {
return [];
}
var result = [];
for (var i = 0, length = array.length; i < length; i++) {
var value = array[i];
if (result.indexOf(value) < 0) {
result.push(value);
}
}
return result;
};
function BoneEvent(e, data) {

@@ -273,2 +281,7 @@ var key, setter;

};
} else if (key === "stopImmediatePropagation") {
this[key] = function() {
this.immediatePropagationStopped = true;
return e[key]();
};
} else if (isFunction(e[key])) {

@@ -289,3 +302,7 @@ this[key] = function() {

jBone.extend(this, data);
jBone.extend(this, data, {
isImmediatePropagationStopped: function() {
return !!this.immediatePropagationStopped;
}
});
}

@@ -315,153 +332,74 @@

fn.on = function(event) {
var args = arguments,
length = this.length,
i = 0,
callback, target, namespace, fn, events, eventType, expectedTarget, addListener;
jBone.event = {
if (args.length === 2) {
callback = args[1];
} else {
target = args[1];
callback = args[2];
}
addListener = function(el) {
/**
* Attach a handler to an event for the elements
* @param {Node} el - Events will be attached to this DOM Node
* @param {String} types - One or more space-separated event types and optional namespaces
* @param {Function} handler - A function to execute when the event is triggered
* @param {Object} [data] - Data to be passed to the handler in event.data
* @param {String} [selector] - A selector string to filter the descendants of the selected elements
*/
add: function(el, types, handler, data, selector) {
jBone.setId(el);
events = jBone.getData(el).events;
event.split(" ").forEach(function(event) {
eventType = event.split(".")[0];
namespace = event.split(".").splice(1).join(".");
events[eventType] = events[eventType] || [];
fn = function(e) {
if (e.namespace && e.namespace !== namespace) {
return;
}
var eventHandler = function(e) {
jBone.event.dispatch.call(el, e);
},
events = jBone.getData(el).events,
eventType, t, event;
expectedTarget = null;
if (!target) {
callback.call(el, e);
} else if (~jBone(el).find(target).indexOf(e.target) || (expectedTarget = jBone.contains(jBone(el).find(target), e.target))) {
expectedTarget = expectedTarget || e.target;
e = new BoneEvent(e, {
currentTarget: expectedTarget
});
types = types.split(" ");
t = types.length;
while (t--) {
event = types[t];
callback.call(expectedTarget, e);
}
};
eventType = event.split(".")[0];
events[eventType] = events[eventType] || [];
events[eventType].push({
namespace: namespace,
fn: fn,
originfn: callback
});
el.addEventListener && el.addEventListener(eventType, fn, false);
});
};
for (; i < length; i++) {
addListener(this[i]);
}
return this;
};
fn.one = function(event) {
var args = arguments,
i = 0,
length = this.length,
callback, target, addListener;
if (args.length === 2) {
callback = args[1];
} else {
target = args[1], callback = args[2];
}
addListener = function(el) {
event.split(" ").forEach(function(event) {
var fn = function(e) {
jBone(el).off(event, fn);
callback.call(el, e);
};
if (!target) {
jBone(el).on(event, fn);
if (events[eventType].length) {
// override with previous event handler
eventHandler = events[eventType][0].fn;
} else {
jBone(el).on(event, target, fn);
el.addEventListener && el.addEventListener(eventType, eventHandler, false);
}
});
};
for (; i < length; i++) {
addListener(this[i]);
}
events[eventType].push({
namespace: event.split(".").splice(1).join("."),
fn: eventHandler,
selector: selector,
data: data,
originfn: handler
});
}
},
return this;
};
/**
* Remove an event handler
* @param {Node} el - Events will be deattached from this DOM Node
* @param {String} types - One or more space-separated event types and optional namespaces
* @param {Function} handler - A handler function previously attached for the event(s)
*/
remove: function(el, types, handler) {
var removeListener = function(events, eventType, index, el, e) {
var callback;
fn.trigger = function(event) {
var events = [],
i = 0,
length = this.length,
dispatchEvents;
// get callback
if ((handler && e.originfn === handler) || !handler) {
callback = e.fn;
}
if (!event) {
return this;
}
if (events[eventType][index].fn === callback) {
// remove handler from cache
events[eventType].splice(index, 1);
if (isString(event)) {
events = event.split(" ").map(function(event) {
return jBone.Event(event);
});
} else {
event = event instanceof Event ? event : jBone.Event(event);
events = [event];
}
if (!events[eventType].length) {
el.removeEventListener(eventType, callback);
}
}
},
events = jBone.getData(el).events,
l,
eventsByType;
dispatchEvents = function(el) {
events.forEach(function(event) {
if (!event.type) {
return;
}
el.dispatchEvent && el.dispatchEvent(event);
});
};
for (; i < length; i++) {
dispatchEvents(this[i]);
}
return this;
};
fn.off = function(event, fn) {
var i = 0,
length = this.length,
removeListener = function(events, eventType, index, el, e) {
var callback;
// get callback
if ((fn && e.originfn === fn) || !fn) {
callback = e.fn;
}
if (events[eventType][index].fn === callback) {
el.removeEventListener(eventType, callback);
// remove handler from cache
jBone._cache.events[jBone.getData(el).jid][eventType].splice(index, 1);
}
},
events, namespace, removeListeners, eventType;
removeListeners = function(el) {
var l, eventsByType, e;
events = jBone.getData(el).events;
if (!events) {

@@ -472,3 +410,3 @@ return;

// remove all events
if (!event && events) {
if (!types && events) {
return keys(events).forEach(function(eventType) {

@@ -484,5 +422,6 @@ eventsByType = events[eventType];

event.split(" ").forEach(function(event) {
eventType = event.split(".")[0];
namespace = event.split(".").splice(1).join(".");
types.split(" ").forEach(function(eventName) {
var eventType = eventName.split(".")[0],
namespace = eventName.split(".").splice(1).join("."),
e;

@@ -516,6 +455,162 @@ // remove named events

});
},
/**
* Execute all handlers and behaviors attached to the matched elements for the given event type.
* @param {Node} el - Events will be triggered for thie DOM Node
* @param {String} event - One or more space-separated event types and optional namespaces
*/
trigger: function(el, event) {
var events = [];
if (isString(event)) {
events = event.split(" ").map(function(event) {
return jBone.Event(event);
});
} else {
event = event instanceof Event ? event : jBone.Event(event);
events = [event];
}
events.forEach(function(event) {
if (!event.type) {
return;
}
el.dispatchEvent && el.dispatchEvent(event);
});
},
dispatch: function(e) {
var i = 0,
j = 0,
el = this,
handlers = jBone.getData(el).events[e.type],
length = handlers.length,
handlerQueue = [],
targets = [],
l,
expectedTarget,
handler,
event,
eventOptions;
// cache all events handlers, fix issue with multiple handlers (issue #45)
for (; i < length; i++) {
handlerQueue.push(handlers[i]);
}
i = 0;
length = handlerQueue.length;
for (;
// if event exists
i < length &&
// if handler is not removed from stack
~handlers.indexOf(handlerQueue[i]) &&
// if propagation is not stopped
!(event && event.isImmediatePropagationStopped());
i++) {
expectedTarget = null;
eventOptions = {};
handler = handlerQueue[i];
handler.data && (eventOptions.data = handler.data);
// event handler without selector
if (!handler.selector) {
event = new BoneEvent(e, eventOptions);
if (!(e.namespace && e.namespace !== handler.namespace)) {
handler.originfn.call(el, event);
}
}
// event handler with selector
else if (
// if target and selected element the same
~(targets = jBone(el).find(handler.selector)).indexOf(e.target) && (expectedTarget = e.target) ||
// if one of element matched with selector contains target
(el !== e.target && el.contains(e.target))
) {
// get element matched with selector
if (!expectedTarget) {
l = targets.length;
j = 0;
for (; j < l; j++) {
if (targets[j] && targets[j].contains(e.target)) {
expectedTarget = targets[j];
}
}
}
if (!expectedTarget) {
continue;
}
eventOptions.currentTarget = expectedTarget;
event = new BoneEvent(e, eventOptions);
if (!(e.namespace && e.namespace !== handler.namespace)) {
handler.originfn.call(expectedTarget, event);
}
}
}
}
};
fn.on = function(types, selector, data, fn) {
var length = this.length,
i = 0;
if (data == null && fn == null) {
// (types, fn)
fn = selector;
data = selector = undefined;
} else if (fn == null) {
if (typeof selector === "string") {
// (types, selector, fn)
fn = data;
data = undefined;
} else {
// (types, data, fn)
fn = data;
data = selector;
selector = undefined;
}
}
if (!fn) {
return this;
}
for (; i < length; i++) {
jBone.event.add(this[i], types, fn, data, selector);
}
return this;
};
fn.one = function(event) {
var args = arguments,
i = 0,
length = this.length,
oneArgs = slice.call(args, 1, args.length - 1),
callback = slice.call(args, -1)[0],
addListener;
addListener = function(el) {
var $el = jBone(el);
event.split(" ").forEach(function(event) {
var fn = function(e) {
$el.off(event, fn);
callback.call(el, e);
};
$el.on.apply($el, [event].concat(oneArgs, fn));
});
};
for (; i < length; i++) {
removeListeners(this[i]);
addListener(this[i]);
}

@@ -526,2 +621,28 @@

fn.trigger = function(event) {
var i = 0,
length = this.length;
if (!event) {
return this;
}
for (; i < length; i++) {
jBone.event.trigger(this[i], event);
}
return this;
};
fn.off = function(types, handler) {
var i = 0,
length = this.length;
for (; i < length; i++) {
jBone.event.remove(this[i], types, handler);
}
return this;
};
fn.find = function(selector) {

@@ -547,3 +668,9 @@ var results = [],

fn.get = function(index) {
return this[index];
return index != null ?
// Return just one element from the set
(index < 0 ? this[index + this.length] : this[index]) :
// Return all the elements in a clean array
slice.call(this);
};

@@ -590,2 +717,10 @@

fn.add = function(selector, context) {
return this.pushStack(
jBone.unique(
jBone.merge(this.get(), jBone(selector, context))
)
);
};
fn.attr = function(key, value) {

@@ -761,2 +896,66 @@ var args = arguments,

fn.addClass = function(className) {
var i = 0,
j = 0,
length = this.length,
classes = className ? className.trim().split(/\s+/) : [];
for (; i < length; i++) {
j = 0;
for (j = 0; j < classes.length; j++) {
this[i].classList.add(classes[j]);
}
}
return this;
};
fn.removeClass = function(className) {
var i = 0,
j = 0,
length = this.length,
classes = className ? className.trim().split(/\s+/) : [];
for (; i < length; i++) {
j = 0;
for (j = 0; j < classes.length; j++) {
this[i].classList.remove(classes[j]);
}
}
return this;
};
fn.toggleClass = function(className, force) {
var i = 0,
length = this.length,
method = "toggle";
force === true && (method = "add") || force === false && (method = "remove");
if (className) {
for (; i < length; i++) {
this[i].classList[method](className);
}
}
return this;
};
fn.hasClass = function(className) {
var i = 0, length = this.length;
if (className) {
for (; i < length; i++) {
if (this[i].classList.contains(className)) {
return true;
}
}
}
return false;
};
fn.html = function(value) {

@@ -787,3 +986,3 @@ var args = arguments,

}
// create text node for inserting
// create text node for insertion
else if (!isObject(appended)) {

@@ -839,3 +1038,3 @@ appended = document.createTextNode(appended);

// remove all listners
// remove all listeners
this.off();

@@ -842,0 +1041,0 @@

/*!
* jBone v1.0.20 - 2014-11-27 - Library for DOM manipulation
* jBone v1.1.2 - 2015-10-09 - Library for DOM manipulation
*
* https://github.com/kupriyanenko/jbone
* http://jbone.js.org
*
* Copyright 2014 Alexey Kupriyanenko
* Copyright 2015 Alexey Kupriyanenko
* Released under the MIT license.
*/
!function(a){function b(b){var c=b.length,d=typeof b;return o(d)||b===a?!1:1===b.nodeType&&c?!0:p(d)||0===c||"number"==typeof c&&c>0&&c-1 in b}function c(a,b){var c,d;this.originalEvent=a,d=function(a,b){this[a]="preventDefault"===a?function(){return this.defaultPrevented=!0,b[a]()}:o(b[a])?function(){return b[a]()}:b[a]};for(c in a)(a[c]||"function"==typeof a[c])&&d.call(this,c,a);q.extend(this,b)}var d,e=a.$,f=a.jBone,g=/^<(\w+)\s*\/?>$/,h=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,i=[].slice,j=[].splice,k=Object.keys,l=document,m=function(a){return"string"==typeof a},n=function(a){return a instanceof Object},o=function(a){var b={};return a&&"[object Function]"===b.toString.call(a)},p=function(a){return Array.isArray(a)},q=function(a,b){return new d.init(a,b)};q.noConflict=function(){return a.$=e,a.jBone=f,q},d=q.fn=q.prototype={init:function(a,b){var c,d,e,f;if(!a)return this;if(m(a)){if(d=g.exec(a))return this[0]=l.createElement(d[1]),this.length=1,n(b)&&this.attr(b),this;if((d=h.exec(a))&&d[1]){for(f=l.createDocumentFragment(),e=l.createElement("div"),e.innerHTML=a;e.lastChild;)f.appendChild(e.firstChild);return c=i.call(f.childNodes),q.merge(this,c)}if(q.isElement(b))return q(b).find(a);try{return c=l.querySelectorAll(a),q.merge(this,c)}catch(j){return this}}return a.nodeType?(this[0]=a,this.length=1,this):o(a)?a():a instanceof q?a:q.makeArray(a,this)},pop:[].pop,push:[].push,reverse:[].reverse,shift:[].shift,sort:[].sort,splice:[].splice,slice:[].slice,indexOf:[].indexOf,forEach:[].forEach,unshift:[].unshift,concat:[].concat,join:[].join,every:[].every,some:[].some,filter:[].filter,map:[].map,reduce:[].reduce,reduceRight:[].reduceRight,length:0},d.constructor=q,d.init.prototype=d,q.setId=function(b){var c=b.jid;b===a?c="window":void 0===b.jid&&(b.jid=c=++q._cache.jid),q._cache.events[c]||(q._cache.events[c]={})},q.getData=function(b){b=b instanceof q?b[0]:b;var c=b===a?"window":b.jid;return{jid:c,events:q._cache.events[c]}},q.isElement=function(a){return a&&a instanceof q||a instanceof HTMLElement||m(a)},q._cache={events:{},jid:0},q.merge=function(a,b){for(var c=b.length,d=a.length,e=0;c>e;)a[d++]=b[e++];return a.length=d,a},q.contains=function(a,b){var c;return a.reverse().some(function(a){return a.contains(b)?c=a:void 0}),c},q.extend=function(a){var b,c,d,e;return j.call(arguments,1).forEach(function(f){if(f)for(b=k(f),c=b.length,d=0,e=a;c>d;d++)e[b[d]]=f[b[d]]}),a},q.makeArray=function(a,c){var d=c||[];return null!==a&&(b(a)?q.merge(d,m(a)?[a]:a):d.push(a)),d},q.Event=function(a,b){var c,d;return a.type&&!b&&(b=a,a=a.type),c=a.split(".").splice(1).join("."),d=a.split(".")[0],a=l.createEvent("Event"),a.initEvent(d,!0,!0),q.extend(a,{namespace:c,isDefaultPrevented:function(){return a.defaultPrevented}},b)},d.on=function(a){var b,d,e,f,g,h,i,j,k=arguments,l=this.length,m=0;for(2===k.length?b=k[1]:(d=k[1],b=k[2]),j=function(j){q.setId(j),g=q.getData(j).events,a.split(" ").forEach(function(a){h=a.split(".")[0],e=a.split(".").splice(1).join("."),g[h]=g[h]||[],f=function(a){a.namespace&&a.namespace!==e||(i=null,d?(~q(j).find(d).indexOf(a.target)||(i=q.contains(q(j).find(d),a.target)))&&(i=i||a.target,a=new c(a,{currentTarget:i}),b.call(i,a)):b.call(j,a))},g[h].push({namespace:e,fn:f,originfn:b}),j.addEventListener&&j.addEventListener(h,f,!1)})};l>m;m++)j(this[m]);return this},d.one=function(a){var b,c,d,e=arguments,f=0,g=this.length;for(2===e.length?b=e[1]:(c=e[1],b=e[2]),d=function(d){a.split(" ").forEach(function(a){var e=function(c){q(d).off(a,e),b.call(d,c)};c?q(d).on(a,c,e):q(d).on(a,e)})};g>f;f++)d(this[f]);return this},d.trigger=function(a){var b,c=[],d=0,e=this.length;if(!a)return this;for(m(a)?c=a.split(" ").map(function(a){return q.Event(a)}):(a=a instanceof Event?a:q.Event(a),c=[a]),b=function(a){c.forEach(function(b){b.type&&a.dispatchEvent&&a.dispatchEvent(b)})};e>d;d++)b(this[d]);return this},d.off=function(a,b){var c,d,e,f,g=0,h=this.length,i=function(a,c,d,e,f){var g;(b&&f.originfn===b||!b)&&(g=f.fn),a[c][d].fn===g&&(e.removeEventListener(c,g),q._cache.events[q.getData(e).jid][c].splice(d,1))};for(e=function(b){var e,g,h;return(c=q.getData(b).events)?!a&&c?k(c).forEach(function(a){for(g=c[a],e=g.length;e--;)i(c,a,e,b,g[e])}):void a.split(" ").forEach(function(a){if(f=a.split(".")[0],d=a.split(".").splice(1).join("."),c[f])for(g=c[f],e=g.length;e--;)h=g[e],(!d||d&&h.namespace===d)&&i(c,f,e,b,h);else d&&k(c).forEach(function(a){for(g=c[a],e=g.length;e--;)h=g[e],h.namespace.split(".")[0]===d.split(".")[0]&&i(c,a,e,b,h)})}):void 0};h>g;g++)e(this[g]);return this},d.find=function(a){for(var b=[],c=0,d=this.length,e=function(c){o(c.querySelectorAll)&&[].forEach.call(c.querySelectorAll(a),function(a){b.push(a)})};d>c;c++)e(this[c]);return q(b)},d.get=function(a){return this[a]},d.eq=function(a){return q(this[a])},d.parent=function(){for(var a,b=[],c=0,d=this.length;d>c;c++)!~b.indexOf(a=this[c].parentElement)&&a&&b.push(a);return q(b)},d.toArray=function(){return i.call(this)},d.is=function(){var a=arguments;return this.some(function(b){return b.tagName.toLowerCase()===a[0]})},d.has=function(){var a=arguments;return this.some(function(b){return b.querySelectorAll(a[0]).length})},d.attr=function(a,b){var c,d=arguments,e=0,f=this.length;if(m(a)&&1===d.length)return this[0]&&this[0].getAttribute(a);for(2===d.length?c=function(c){c.setAttribute(a,b)}:n(a)&&(c=function(b){k(a).forEach(function(c){b.setAttribute(c,a[c])})});f>e;e++)c(this[e]);return this},d.removeAttr=function(a){for(var b=0,c=this.length;c>b;b++)this[b].removeAttribute(a);return this},d.val=function(a){var b=0,c=this.length;if(0===arguments.length)return this[0]&&this[0].value;for(;c>b;b++)this[b].value=a;return this},d.css=function(b,c){var d,e=arguments,f=0,g=this.length;if(m(b)&&1===e.length)return this[0]&&a.getComputedStyle(this[0])[b];for(2===e.length?d=function(a){a.style[b]=c}:n(b)&&(d=function(a){k(b).forEach(function(c){a.style[c]=b[c]})});g>f;f++)d(this[f]);return this},d.data=function(a,b){var c,d=arguments,e={},f=0,g=this.length,h=function(a,b,c){n(c)?(a.jdata=a.jdata||{},a.jdata[b]=c):a.dataset[b]=c},i=function(a){return"true"===a?!0:"false"===a?!1:a};if(0===d.length)return this[0].jdata&&(e=this[0].jdata),k(this[0].dataset).forEach(function(a){e[a]=i(this[0].dataset[a])},this),e;if(1===d.length&&m(a))return this[0]&&i(this[0].dataset[a]||this[0].jdata&&this[0].jdata[a]);for(1===d.length&&n(a)?c=function(b){k(a).forEach(function(c){h(b,c,a[c])})}:2===d.length&&(c=function(c){h(c,a,b)});g>f;f++)c(this[f]);return this},d.removeData=function(a){for(var b,c,d=0,e=this.length;e>d;d++)if(b=this[d].jdata,c=this[d].dataset,a)b&&b[a]&&delete b[a],delete c[a];else{for(a in b)delete b[a];for(a in c)delete c[a]}return this},d.html=function(a){var b,c=arguments;return 1===c.length&&void 0!==a?this.empty().append(a):0===c.length&&(b=this[0])?b.innerHTML:this},d.append=function(a){var b,c=0,d=this.length;for(m(a)&&h.exec(a)?a=q(a):n(a)||(a=document.createTextNode(a)),a=a instanceof q?a:q(a),b=function(b,c){a.forEach(function(a){b.appendChild(c?a.cloneNode(!0):a)})};d>c;c++)b(this[c],c);return this},d.appendTo=function(a){return q(a).append(this),this},d.empty=function(){for(var a,b=0,c=this.length;c>b;b++)for(a=this[b];a.lastChild;)a.removeChild(a.lastChild);return this},d.remove=function(){var a,b=0,c=this.length;for(this.off();c>b;b++)a=this[b],delete a.jdata,a.parentNode&&a.parentNode.removeChild(a);return this},"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=q:"function"==typeof define&&define.amd?(define(function(){return q}),a.jBone=a.$=q):"object"==typeof a&&"object"==typeof a.document&&(a.jBone=a.$=q)}(window);
!function(a){function b(b){var c=b.length,d=typeof b;return o(d)||b===a?!1:1===b.nodeType&&c?!0:p(d)||0===c||"number"==typeof c&&c>0&&c-1 in b}function c(a,b){var c,d;this.originalEvent=a,d=function(a,b){this[a]="preventDefault"===a?function(){return this.defaultPrevented=!0,b[a]()}:"stopImmediatePropagation"===a?function(){return this.immediatePropagationStopped=!0,b[a]()}:o(b[a])?function(){return b[a]()}:b[a]};for(c in a)(a[c]||"function"==typeof a[c])&&d.call(this,c,a);q.extend(this,b,{isImmediatePropagationStopped:function(){return!!this.immediatePropagationStopped}})}var d,e=a.$,f=a.jBone,g=/^<(\w+)\s*\/?>$/,h=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,i=[].slice,j=[].splice,k=Object.keys,l=document,m=function(a){return"string"==typeof a},n=function(a){return a instanceof Object},o=function(a){return"[object Function]"==={}.toString.call(a)},p=function(a){return Array.isArray(a)},q=function(a,b){return new d.init(a,b)};q.noConflict=function(){return a.$=e,a.jBone=f,q},d=q.fn=q.prototype={init:function(a,b){var c,d,e,f;if(!a)return this;if(m(a)){if(d=g.exec(a))return this[0]=l.createElement(d[1]),this.length=1,n(b)&&this.attr(b),this;if((d=h.exec(a))&&d[1]){for(f=l.createDocumentFragment(),e=l.createElement("div"),e.innerHTML=a;e.lastChild;)f.appendChild(e.firstChild);return c=i.call(f.childNodes),q.merge(this,c)}if(q.isElement(b))return q(b).find(a);try{return c=l.querySelectorAll(a),q.merge(this,c)}catch(j){return this}}return a.nodeType?(this[0]=a,this.length=1,this):o(a)?a():a instanceof q?a:q.makeArray(a,this)},pop:[].pop,push:[].push,reverse:[].reverse,shift:[].shift,sort:[].sort,splice:[].splice,slice:[].slice,indexOf:[].indexOf,forEach:[].forEach,unshift:[].unshift,concat:[].concat,join:[].join,every:[].every,some:[].some,filter:[].filter,map:[].map,reduce:[].reduce,reduceRight:[].reduceRight,length:0},d.constructor=q,d.init.prototype=d,q.setId=function(b){var c=b.jid;b===a?c="window":void 0===b.jid&&(b.jid=c=++q._cache.jid),q._cache.events[c]||(q._cache.events[c]={})},q.getData=function(b){b=b instanceof q?b[0]:b;var c=b===a?"window":b.jid;return{jid:c,events:q._cache.events[c]}},q.isElement=function(a){return a&&a instanceof q||a instanceof HTMLElement||m(a)},q._cache={events:{},jid:0},d.pushStack=function(a){var b=q.merge(this.constructor(),a);return b},q.merge=function(a,b){for(var c=b.length,d=a.length,e=0;c>e;)a[d++]=b[e++];return a.length=d,a},q.contains=function(a,b){return a.contains(b)},q.extend=function(a){var b;return j.call(arguments,1).forEach(function(c){if(b=a,c)for(var d in c)b[d]=c[d]}),a},q.makeArray=function(a,c){var d=c||[];return null!==a&&(b(a)?q.merge(d,m(a)?[a]:a):d.push(a)),d},q.unique=function(a){if(null==a)return[];for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];b.indexOf(e)<0&&b.push(e)}return b},q.Event=function(a,b){var c,d;return a.type&&!b&&(b=a,a=a.type),c=a.split(".").splice(1).join("."),d=a.split(".")[0],a=l.createEvent("Event"),a.initEvent(d,!0,!0),q.extend(a,{namespace:c,isDefaultPrevented:function(){return a.defaultPrevented}},b)},q.event={add:function(a,b,c,d,e){q.setId(a);var f,g,h,i=function(b){q.event.dispatch.call(a,b)},j=q.getData(a).events;for(b=b.split(" "),g=b.length;g--;)h=b[g],f=h.split(".")[0],j[f]=j[f]||[],j[f].length?i=j[f][0].fn:a.addEventListener&&a.addEventListener(f,i,!1),j[f].push({namespace:h.split(".").splice(1).join("."),fn:i,selector:e,data:d,originfn:c})},remove:function(a,b,c){var d,e,f=function(a,b,d,e,f){var g;(c&&f.originfn===c||!c)&&(g=f.fn),a[b][d].fn===g&&(a[b].splice(d,1),a[b].length||e.removeEventListener(b,g))},g=q.getData(a).events;if(g)return!b&&g?k(g).forEach(function(b){for(e=g[b],d=e.length;d--;)f(g,b,d,a,e[d])}):void b.split(" ").forEach(function(b){var c,h=b.split(".")[0],i=b.split(".").splice(1).join(".");if(g[h])for(e=g[h],d=e.length;d--;)c=e[d],(!i||i&&c.namespace===i)&&f(g,h,d,a,c);else i&&k(g).forEach(function(b){for(e=g[b],d=e.length;d--;)c=e[d],c.namespace.split(".")[0]===i.split(".")[0]&&f(g,b,d,a,c)})})},trigger:function(a,b){var c=[];m(b)?c=b.split(" ").map(function(a){return q.Event(a)}):(b=b instanceof Event?b:q.Event(b),c=[b]),c.forEach(function(b){b.type&&a.dispatchEvent&&a.dispatchEvent(b)})},dispatch:function(a){for(var b,d,e,f,g,h=0,i=0,j=this,k=q.getData(j).events[a.type],l=k.length,m=[],n=[];l>h;h++)m.push(k[h]);for(h=0,l=m.length;l>h&&~k.indexOf(m[h])&&(!f||!f.isImmediatePropagationStopped());h++)if(d=null,g={},e=m[h],e.data&&(g.data=e.data),e.selector){if(~(n=q(j).find(e.selector)).indexOf(a.target)&&(d=a.target)||j!==a.target&&j.contains(a.target)){if(!d)for(b=n.length,i=0;b>i;i++)n[i]&&n[i].contains(a.target)&&(d=n[i]);if(!d)continue;g.currentTarget=d,f=new c(a,g),a.namespace&&a.namespace!==e.namespace||e.originfn.call(d,f)}}else f=new c(a,g),a.namespace&&a.namespace!==e.namespace||e.originfn.call(j,f)}},d.on=function(a,b,c,d){var e=this.length,f=0;if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),!d)return this;for(;e>f;f++)q.event.add(this[f],a,d,c,b);return this},d.one=function(a){var b,c=arguments,d=0,e=this.length,f=i.call(c,1,c.length-1),g=i.call(c,-1)[0];for(b=function(b){var c=q(b);a.split(" ").forEach(function(a){var d=function(e){c.off(a,d),g.call(b,e)};c.on.apply(c,[a].concat(f,d))})};e>d;d++)b(this[d]);return this},d.trigger=function(a){var b=0,c=this.length;if(!a)return this;for(;c>b;b++)q.event.trigger(this[b],a);return this},d.off=function(a,b){for(var c=0,d=this.length;d>c;c++)q.event.remove(this[c],a,b);return this},d.find=function(a){for(var b=[],c=0,d=this.length,e=function(c){o(c.querySelectorAll)&&[].forEach.call(c.querySelectorAll(a),function(a){b.push(a)})};d>c;c++)e(this[c]);return q(b)},d.get=function(a){return null!=a?0>a?this[a+this.length]:this[a]:i.call(this)},d.eq=function(a){return q(this[a])},d.parent=function(){for(var a,b=[],c=0,d=this.length;d>c;c++)!~b.indexOf(a=this[c].parentElement)&&a&&b.push(a);return q(b)},d.toArray=function(){return i.call(this)},d.is=function(){var a=arguments;return this.some(function(b){return b.tagName.toLowerCase()===a[0]})},d.has=function(){var a=arguments;return this.some(function(b){return b.querySelectorAll(a[0]).length})},d.add=function(a,b){return this.pushStack(q.unique(q.merge(this.get(),q(a,b))))},d.attr=function(a,b){var c,d=arguments,e=0,f=this.length;if(m(a)&&1===d.length)return this[0]&&this[0].getAttribute(a);for(2===d.length?c=function(c){c.setAttribute(a,b)}:n(a)&&(c=function(b){k(a).forEach(function(c){b.setAttribute(c,a[c])})});f>e;e++)c(this[e]);return this},d.removeAttr=function(a){for(var b=0,c=this.length;c>b;b++)this[b].removeAttribute(a);return this},d.val=function(a){var b=0,c=this.length;if(0===arguments.length)return this[0]&&this[0].value;for(;c>b;b++)this[b].value=a;return this},d.css=function(b,c){var d,e=arguments,f=0,g=this.length;if(m(b)&&1===e.length)return this[0]&&a.getComputedStyle(this[0])[b];for(2===e.length?d=function(a){a.style[b]=c}:n(b)&&(d=function(a){k(b).forEach(function(c){a.style[c]=b[c]})});g>f;f++)d(this[f]);return this},d.data=function(a,b){var c,d=arguments,e={},f=0,g=this.length,h=function(a,b,c){n(c)?(a.jdata=a.jdata||{},a.jdata[b]=c):a.dataset[b]=c},i=function(a){return"true"===a?!0:"false"===a?!1:a};if(0===d.length)return this[0].jdata&&(e=this[0].jdata),k(this[0].dataset).forEach(function(a){e[a]=i(this[0].dataset[a])},this),e;if(1===d.length&&m(a))return this[0]&&i(this[0].dataset[a]||this[0].jdata&&this[0].jdata[a]);for(1===d.length&&n(a)?c=function(b){k(a).forEach(function(c){h(b,c,a[c])})}:2===d.length&&(c=function(c){h(c,a,b)});g>f;f++)c(this[f]);return this},d.removeData=function(a){for(var b,c,d=0,e=this.length;e>d;d++)if(b=this[d].jdata,c=this[d].dataset,a)b&&b[a]&&delete b[a],delete c[a];else{for(a in b)delete b[a];for(a in c)delete c[a]}return this},d.addClass=function(a){for(var b=0,c=0,d=this.length,e=a?a.trim().split(/\s+/):[];d>b;b++)for(c=0,c=0;c<e.length;c++)this[b].classList.add(e[c]);return this},d.removeClass=function(a){for(var b=0,c=0,d=this.length,e=a?a.trim().split(/\s+/):[];d>b;b++)for(c=0,c=0;c<e.length;c++)this[b].classList.remove(e[c]);return this},d.toggleClass=function(a,b){var c=0,d=this.length,e="toggle";if(b===!0&&(e="add")||b===!1&&(e="remove"),a)for(;d>c;c++)this[c].classList[e](a);return this},d.hasClass=function(a){var b=0,c=this.length;if(a)for(;c>b;b++)if(this[b].classList.contains(a))return!0;return!1},d.html=function(a){var b,c=arguments;return 1===c.length&&void 0!==a?this.empty().append(a):0===c.length&&(b=this[0])?b.innerHTML:this},d.append=function(a){var b,c=0,d=this.length;for(m(a)&&h.exec(a)?a=q(a):n(a)||(a=document.createTextNode(a)),a=a instanceof q?a:q(a),b=function(b,c){a.forEach(function(a){b.appendChild(c?a.cloneNode(!0):a)})};d>c;c++)b(this[c],c);return this},d.appendTo=function(a){return q(a).append(this),this},d.empty=function(){for(var a,b=0,c=this.length;c>b;b++)for(a=this[b];a.lastChild;)a.removeChild(a.lastChild);return this},d.remove=function(){var a,b=0,c=this.length;for(this.off();c>b;b++)a=this[b],delete a.jdata,a.parentNode&&a.parentNode.removeChild(a);return this},"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=q:"function"==typeof define&&define.amd?(define(function(){return q}),a.jBone=a.$=q):"object"==typeof a&&"object"==typeof a.document&&(a.jBone=a.$=q)}(window);

@@ -1,22 +0,30 @@

# jBone
# Meet jBone
[![Build Status](https://travis-ci.org/kupriyanenko/jbone.png?branch=master)](https://travis-ci.org/kupriyanenko/jbone)
[![Bower version](https://badge.fury.io/bo/jbone.png)](http://badge.fury.io/bo/jbone)
[![NPM version](https://badge.fury.io/js/jbone.png)](http://badge.fury.io/js/jbone)
[![Join the chat at https://gitter.im/kupriyanenko/jbone](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kupriyanenko/jbone?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
http://kupriyanenko.github.io/jbone/
[![Build Status](https://travis-ci.org/kupriyanenko/jbone.svg?branch=master)](https://travis-ci.org/kupriyanenko/jbone)
[![Bower version](https://badge.fury.io/bo/jbone.svg)](http://jbone.js.org)
[![npm version](https://badge.fury.io/js/jbone.svg)](https://www.npmjs.com/package/jbone)
[![JS.ORG](https://img.shields.io/badge/js.org-jbone-ffb400.svg)](http://jbone.js.org)
[![CDNJS.COM](https://img.shields.io/badge/cdnjs.com-jbone-ffb400.svg)](https://cdnjs.com/libraries/jbone)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kupriyanenko/jbone)
[![GitHub Stats](https://img.shields.io/badge/github-stats-ff5500.svg)](http://githubstats.com/kupriyanenko/jbone)
JavaScript Library for DOM manipulation in modern browsers with jQuery-compatible API.
jBone is very small and fast abstraction for Events and DOM manipulation in modern browsers with identical jQuery interfaces in most cases.
Replacement jQuery for Backbone in browsers (2.5kb gzipped, faster than jQuery/Zepto)
It replaces jQuery for Backbone in web and mobile applications (about 2.5kb gzipped, much faster than jQuery and Zepto).
## Why jBone?
jBone is extremely small (2.5kb) and realy fast library. Main jBone idea - it's as much as possible to use native JavaScript methods in your project.
The main idea of jBone is to use native JavaScript methods as much as possible in your project.
jBone it is ideal solutions for applications based on Backbone and running on mobile devices. jBone project was created to allow people using Backbone without jQuery.
It is superior solution for applications based on Backbone and running on mobile devices as it is extremely small (2.5kb) and really fast library.
jBone project was created to allow people to use Backbone without jQuery.
See benchmark results [here](http://kupriyanenko.github.io/jbone/perf.html).
## Get it
##### With bower
##### Via bower

@@ -27,3 +35,3 @@ ```

##### With component
##### Via component

@@ -34,3 +42,3 @@ ```

##### With nodejs or browserify
##### Via nodejs or browserify

@@ -49,3 +57,3 @@ ```

Or include like npm module (with nodejs or browserify)
Or include it like npm module (with nodejs or browserify)

@@ -91,7 +99,7 @@ ```javascript

This part is not covered on jBone. Yuo can select one of a huge amount implementations AJAX and Promises/A+.
This part is not covered in jBone. You can choose one of a huge amount of AJAX implementations as well as standard Promises/A+ implementations.
For example: [when](https://github.com/cujojs/when), [Q](https://github.com/kriskowal/q), [simply-deferred](https://github.com/sudhirj/simply-deferred), [AJAX](microjs.com/#ajax).
Example AJAX connecting:
Example of AJAX connection:

@@ -108,3 +116,3 @@ ```javascript

Example Deferred connecting:
Example of connection with Deferred Object:

@@ -123,2 +131,22 @@ ```javascript

## Browser support
Internet Explorer 11+
Safari 6+
iOS 5+ Safari
Android 2.3+ Browser
Chrome
Firefox
## IE9 polyfills
* [classList](https://github.com/remy/polyfills/blob/master/classList.js) (since IE10)
* [dataset](https://github.com/remy/polyfills/blob/master/dataset.js) (since IE11)
## API

@@ -144,2 +172,7 @@

* [.css(properties)](https://github.com/kupriyanenko/jbone/wiki/Attributes#cssproperties)
* [.addClass(className)](https://github.com/kupriyanenko/jbone/wiki/Attributes#addclassclassname)
* [.removeClass(className)](https://github.com/kupriyanenko/jbone/wiki/Attributes#removeclassclassname)
* [.toggleClass(className)](https://github.com/kupriyanenko/jbone/wiki/Attributes#toggleclassclassname)
* [.toggleClass(className, state)](https://github.com/kupriyanenko/jbone/wiki/Attributes#toggleclassclassname-state)
* [.hasClass(className)](https://github.com/kupriyanenko/jbone/wiki/Attributes#hasclassclassname)

@@ -157,4 +190,4 @@ [Data](https://github.com/kupriyanenko/jbone/wiki/Data)

* [.on(event[, selector], handler)](https://github.com/kupriyanenko/jbone/wiki/Event#onevent-selector-handler)
* [.one(event[, selector], handler)](https://github.com/kupriyanenko/jbone/wiki/Event#oneevent-selector-handler)
* [.on(event[, selector, data], handler)](https://github.com/kupriyanenko/jbone/wiki/Event#onevent-selector-data-handler)
* [.one(event[, selector, data], handler)](https://github.com/kupriyanenko/jbone/wiki/Event#oneevent-selector-data-handler)
* [.off(event[, handler])](https://github.com/kupriyanenko/jbone/wiki/Event#offevent-handler)

@@ -168,3 +201,3 @@ * [.trigger(event)](https://github.com/kupriyanenko/jbone/wiki/Event#triggerevent)

* [.append(content)](https://github.com/kupriyanenko/jbone/wiki/Manipulation#appendcontent)
* [.appendTo(target)](https://github.com/kupriyanenko/jbone/wiki/Manipulation#appendtotarget)
* [.appendTo(element)](https://github.com/kupriyanenko/jbone/wiki/Manipulation#appendtoelement)
* [.empty()](https://github.com/kupriyanenko/jbone/wiki/Manipulation#empty)

@@ -180,2 +213,7 @@ * [.remove()](https://github.com/kupriyanenko/jbone/wiki/Manipulation#remove)

* [.toArray()](https://github.com/kupriyanenko/jbone/wiki/Traversing#toarray)
* [.add(selector)](https://github.com/kupriyanenko/jbone/wiki/Traversing#addselector)
* [.add(elements)](https://github.com/kupriyanenko/jbone/wiki/Traversing#addelements)
* [.add(html)](https://github.com/kupriyanenko/jbone/wiki/Traversing#addhtml)
* [.add(selection)](https://github.com/kupriyanenko/jbone/wiki/Traversing#addselection)
* [.add(selector, context)](https://github.com/kupriyanenko/jbone/wiki/Traversing#addselector-context)

@@ -187,2 +225,4 @@ [Utilities](https://github.com/kupriyanenko/jbone/wiki/Utilities)

* [jBone.extend(target[, object1][, objectN])](https://github.com/kupriyanenko/jbone/wiki/Utilities#jboneextendtarget-object1-objectn)
* [jBone.makeArray(obj)](https://github.com/kupriyanenko/jbone/wiki/Utilities#jbonemakearrayobj)
* [jBone.unique(array)](https://github.com/kupriyanenko/jbone/wiki/Utilities#jboneuniquearray)

@@ -210,2 +250,6 @@ [Array methods](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype#Methods)

[Internals](https://github.com/kupriyanenko/jbone/wiki/Internals)
* [.pushStack(elements)](https://github.com/kupriyanenko/jbone/wiki/Internals#pushstackelements)
## Running the Tests

@@ -212,0 +256,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc