Comparing version 0.8.1 to 1.0.0
@@ -1,2 +0,2 @@ | ||
Copyright 2012, 2013, 2014 Hay Kranen < hay@bykr.org > | ||
Copyright 2012, 2013, 2014, 2015, 2016 Hay Kranen < hay@bykr.org > | ||
All rights reserved. | ||
@@ -3,0 +3,0 @@ |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.8.1", | ||
"version": "1.0.0", | ||
"repository" : { | ||
@@ -13,0 +13,0 @@ "type" : "git", |
@@ -19,3 +19,3 @@ // | ||
var VERSION = "0.8.1"; | ||
var VERSION = "1.0.0"; | ||
@@ -330,3 +330,3 @@ // Global counter for all events in all modules (including mixed in objects) | ||
"newValue" : value, | ||
"oldValue" : oldValue || null | ||
"oldValue" : (typeof oldValue !== 'undefined') ? oldValue : null | ||
}; | ||
@@ -333,0 +333,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*! Stapes.js v0.8.0 < http://hay.github.com/stapes > */ | ||
;(function(){"use strict";var a="0.8.1",b=1;if(!Object.create)var c=function(){};var d=Array.prototype.slice,e={attributes:{},eventHandlers:{"-1":{}},guid:-1,addEvent:function(a){e.eventHandlers[a.guid][a.type]||(e.eventHandlers[a.guid][a.type]=[]),e.eventHandlers[a.guid][a.type].push({guid:a.guid,handler:a.handler,scope:a.scope,type:a.type})},addEventHandler:function(a,b,c){var d={},f;typeof a=="string"?(f=c||!1,d[a]=b):(f=b||!1,d=a);for(var g in d){var h=d[g],i=g.split(" ");for(var j=0,k=i.length;j<k;j++){var l=i[j];e.addEvent.call(this,{guid:this._guid||this._.guid,handler:h,scope:f,type:l})}}},addGuid:function(a,c){if(!a._guid||!!c)a._guid=b++,e.attributes[a._guid]={},e.eventHandlers[a._guid]={}},attr:function(a){return e.attributes[a]},clone:function(a){var b=e.typeOf(a);if(b==="object")return e.extend({},a);if(b==="array")return a.slice(0)},create:function(a){if(Object.create)return Object.create(a);c.prototype=a;return new c},createSubclass:function(a,b){function g(){if(this instanceof g)this.on&&e.addGuid(this,!0),d.apply(this,arguments);else throw new Error("Please use 'new' when initializing Stapes classes")}a=a||{},b=b||!1;var c=a.superclass.prototype,d=a.hasOwnProperty("constructor")?a.constructor:function(){};b&&e.extend(c,f),g.prototype=e.create(c),g.prototype.constructor=g,e.extend(g,{extend:function(){return e.extendThis.apply(this,arguments)},parent:c,proto:function(){return e.extendThis.apply(this.prototype,arguments)},subclass:function(a){a=a||{},a.superclass=this;return e.createSubclass(a)}});for(var h in a)h!=="constructor"&&h!=="superclass"&&(g.prototype[h]=a[h]);return g},emitEvents:function(a,b,c,f){c=c||!1,f=f||this._guid;var g=d.call(e.eventHandlers[f][a]);for(var h=0,i=g.length;h<i;h++){var j=e.extend({},g[h]),k=j.scope?j.scope:this;c&&(j.type=c),j.scope=k,j.handler.call(j.scope,b,j)}},extend:function(){var a=d.call(arguments),b=a.shift();for(var c=0,e=a.length;c<e;c++){var f=a[c];for(var g in f)b[g]=f[g]}return b},extendThis:function(){var a=d.call(arguments);a.unshift(this);return e.extend.apply(this,a)},makeUuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)})},removeAttribute:function(a,b){b=b||!1;var c=e.trim(a).split(" "),d={};for(var f=0,g=c.length;f<g;f++){var h=e.trim(c[f]);h&&(d.key=h,d.oldValue=e.attr(this._guid)[h],delete e.attr(this._guid)[h],b||(this.emit("change",h),this.emit("change:"+h),this.emit("mutate",d),this.emit("mutate:"+h,d),this.emit("remove",h),this.emit("remove:"+h)),delete d.oldValue)}},removeEventHandler:function(a,b){var c=e.eventHandlers[this._guid];if(a&&b){c=c[a];if(!c)return;for(var d=0,f=c.length,g;d<f;d++)g=c[d].handler,g&&g===b&&(c.splice(d--,1),f--)}else a?delete c[a]:e.eventHandlers[this._guid]={}},setAttribute:function(a,b,c){c=c||!1;var d=this.has(a),f=e.attr(this._guid)[a];if(b!==f){e.attr(this._guid)[a]=b;if(c)return;this.emit("change",a),this.emit("change:"+a,b);var g={key:a,newValue:b,oldValue:f||null};this.emit("mutate",g),this.emit("mutate:"+a,g);var h=d?"update":"create";this.emit(h,a),this.emit(h+":"+a,b)}},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},typeOf:function(a){return a===null||typeof a=="undefined"?String(a):Object.prototype.toString.call(a).replace(/\[object |\]/g,"").toLowerCase()},updateAttribute:function(a,b,c){var d=this.get(a),f=e.typeOf(d);if(f==="object"||f==="array")d=e.clone(d);var g=b.call(this,d,a);e.setAttribute.call(this,a,g,c||!1)}},f={emit:function(a,b){b=typeof b=="undefined"?null:b;var c=a.split(" ");for(var d=0,f=c.length;d<f;d++){var g=c[d];e.eventHandlers[-1].all&&e.emitEvents.call(this,"all",b,g,-1),e.eventHandlers[-1][g]&&e.emitEvents.call(this,g,b,g,-1),typeof this._guid=="number"&&(e.eventHandlers[this._guid].all&&e.emitEvents.call(this,"all",b,g),e.eventHandlers[this._guid][g]&&e.emitEvents.call(this,g,b))}},off:function(){e.removeEventHandler.apply(this,arguments)},on:function(){e.addEventHandler.apply(this,arguments)}};e.Module=function(){},e.Module.prototype={each:function(a,b){var c=e.attr(this._guid);for(var d in c){var f=c[d];a.call(b||this,f,d)}},extend:function(){return e.extendThis.apply(this,arguments)},filter:function(a){var b=[],c=e.attr(this._guid);for(var d in c)a.call(this,c[d],d)&&b.push(c[d]);return b},get:function(a){if(typeof a=="string"){if(arguments.length>1){var b={};for(var c=0,d=arguments.length;c<d;c++){var f=arguments[c];b[f]=this.get(f)}return b}return this.has(a)?e.attr(this._guid)[a]:null}if(typeof a=="function"){var g=this.filter(a);return g.length?g[0]:null}},getAll:function(){return e.clone(e.attr(this._guid))},getAllAsArray:function(){var a=[],b=e.attr(this._guid);for(var c in b){var d=b[c];e.typeOf(d)==="object"&&!d.id&&(d.id=c),a.push(d)}return a},has:function(a){return typeof e.attr(this._guid)[a]!="undefined"},map:function(a,b){var c=[];this.each(function(d,e){c.push(a.call(b||this,d,e))},b||this);return c},push:function(a,b){if(e.typeOf(a)==="array")for(var c=0,d=a.length;c<d;c++)e.setAttribute.call(this,e.makeUuid(),a[c],b||!1);else e.setAttribute.call(this,e.makeUuid(),a,b||!1);return this},remove:function(a,b){typeof a=="undefined"?(e.attributes[this._guid]={},this.emit("change remove")):typeof a=="function"?this.each(function(c,d){a(c)&&e.removeAttribute.call(this,d,b)}):e.removeAttribute.call(this,a,b||!1);return this},set:function(a,b,c){if(typeof a=="object")for(var d in a)e.setAttribute.call(this,d,a[d],b||!1);else e.setAttribute.call(this,a,b,c||!1);return this},size:function(){var a=0,b=e.attr(this._guid);for(var c in b)a++;return a},update:function(a,b,c){typeof a=="string"?e.updateAttribute.call(this,a,b,c||!1):typeof a=="function"&&this.each(function(b,c){e.updateAttribute.call(this,c,a)});return this}};var g={_:e,extend:function(){return e.extendThis.apply(e.Module.prototype,arguments)},mixinEvents:function(a){a=a||{},e.addGuid(a);return e.extend(a,f)},on:function(){e.addEventHandler.apply(this,arguments)},subclass:function(a,b){b=b||!1,a=a||{},a.superclass=b?function(){}:e.Module;return e.createSubclass(a,!b)},version:a};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=g),exports.Stapes=g):typeof define=="function"&&define.amd?define(function(){return g}):window.Stapes=g})() | ||
/*! Stapes.js < http://hay.github.com/stapes > */ | ||
;(function(){"use strict";var a="1.0.0",b=1;if(!Object.create)var c=function(){};var d=Array.prototype.slice,e={attributes:{},eventHandlers:{"-1":{}},guid:-1,addEvent:function(a){e.eventHandlers[a.guid][a.type]||(e.eventHandlers[a.guid][a.type]=[]),e.eventHandlers[a.guid][a.type].push({guid:a.guid,handler:a.handler,scope:a.scope,type:a.type})},addEventHandler:function(a,b,c){var d={},f;typeof a=="string"?(f=c||!1,d[a]=b):(f=b||!1,d=a);for(var g in d){var h=d[g],i=g.split(" ");for(var j=0,k=i.length;j<k;j++){var l=i[j];e.addEvent.call(this,{guid:this._guid||this._.guid,handler:h,scope:f,type:l})}}},addGuid:function(a,c){if(!a._guid||!!c)a._guid=b++,e.attributes[a._guid]={},e.eventHandlers[a._guid]={}},attr:function(a){return e.attributes[a]},clone:function(a){var b=e.typeOf(a);if(b==="object")return e.extend({},a);if(b==="array")return a.slice(0)},create:function(a){if(Object.create)return Object.create(a);c.prototype=a;return new c},createSubclass:function(a,b){function g(){if(this instanceof g)this.on&&e.addGuid(this,!0),d.apply(this,arguments);else throw new Error("Please use 'new' when initializing Stapes classes")}a=a||{},b=b||!1;var c=a.superclass.prototype,d=a.hasOwnProperty("constructor")?a.constructor:function(){};b&&e.extend(c,f),g.prototype=e.create(c),g.prototype.constructor=g,e.extend(g,{extend:function(){return e.extendThis.apply(this,arguments)},parent:c,proto:function(){return e.extendThis.apply(this.prototype,arguments)},subclass:function(a){a=a||{},a.superclass=this;return e.createSubclass(a)}});for(var h in a)h!=="constructor"&&h!=="superclass"&&(g.prototype[h]=a[h]);return g},emitEvents:function(a,b,c,f){c=c||!1,f=f||this._guid;var g=d.call(e.eventHandlers[f][a]);for(var h=0,i=g.length;h<i;h++){var j=e.extend({},g[h]),k=j.scope?j.scope:this;c&&(j.type=c),j.scope=k,j.handler.call(j.scope,b,j)}},extend:function(){var a=d.call(arguments),b=a.shift();for(var c=0,e=a.length;c<e;c++){var f=a[c];for(var g in f)b[g]=f[g]}return b},extendThis:function(){var a=d.call(arguments);a.unshift(this);return e.extend.apply(this,a)},makeUuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)})},removeAttribute:function(a,b){b=b||!1;var c=e.trim(a).split(" "),d={};for(var f=0,g=c.length;f<g;f++){var h=e.trim(c[f]);h&&(d.key=h,d.oldValue=e.attr(this._guid)[h],delete e.attr(this._guid)[h],b||(this.emit("change",h),this.emit("change:"+h),this.emit("mutate",d),this.emit("mutate:"+h,d),this.emit("remove",h),this.emit("remove:"+h)),delete d.oldValue)}},removeEventHandler:function(a,b){var c=e.eventHandlers[this._guid];if(a&&b){c=c[a];if(!c)return;for(var d=0,f=c.length,g;d<f;d++)g=c[d].handler,g&&g===b&&(c.splice(d--,1),f--)}else a?delete c[a]:e.eventHandlers[this._guid]={}},setAttribute:function(a,b,c){c=c||!1;var d=this.has(a),f=e.attr(this._guid)[a];if(b!==f){e.attr(this._guid)[a]=b;if(c)return;this.emit("change",a),this.emit("change:"+a,b);var g={key:a,newValue:b,oldValue:typeof f!="undefined"?f:null};this.emit("mutate",g),this.emit("mutate:"+a,g);var h=d?"update":"create";this.emit(h,a),this.emit(h+":"+a,b)}},trim:function(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},typeOf:function(a){return a===null||typeof a=="undefined"?String(a):Object.prototype.toString.call(a).replace(/\[object |\]/g,"").toLowerCase()},updateAttribute:function(a,b,c){var d=this.get(a),f=e.typeOf(d);if(f==="object"||f==="array")d=e.clone(d);var g=b.call(this,d,a);e.setAttribute.call(this,a,g,c||!1)}},f={emit:function(a,b){b=typeof b=="undefined"?null:b;var c=a.split(" ");for(var d=0,f=c.length;d<f;d++){var g=c[d];e.eventHandlers[-1].all&&e.emitEvents.call(this,"all",b,g,-1),e.eventHandlers[-1][g]&&e.emitEvents.call(this,g,b,g,-1),typeof this._guid=="number"&&(e.eventHandlers[this._guid].all&&e.emitEvents.call(this,"all",b,g),e.eventHandlers[this._guid][g]&&e.emitEvents.call(this,g,b))}},off:function(){e.removeEventHandler.apply(this,arguments)},on:function(){e.addEventHandler.apply(this,arguments)}};e.Module=function(){},e.Module.prototype={each:function(a,b){var c=e.attr(this._guid);for(var d in c){var f=c[d];a.call(b||this,f,d)}},extend:function(){return e.extendThis.apply(this,arguments)},filter:function(a){var b=[],c=e.attr(this._guid);for(var d in c)a.call(this,c[d],d)&&b.push(c[d]);return b},get:function(a){if(typeof a=="string"){if(arguments.length>1){var b={};for(var c=0,d=arguments.length;c<d;c++){var f=arguments[c];b[f]=this.get(f)}return b}return this.has(a)?e.attr(this._guid)[a]:null}if(typeof a=="function"){var g=this.filter(a);return g.length?g[0]:null}},getAll:function(){return e.clone(e.attr(this._guid))},getAllAsArray:function(){var a=[],b=e.attr(this._guid);for(var c in b){var d=b[c];e.typeOf(d)==="object"&&!d.id&&(d.id=c),a.push(d)}return a},has:function(a){return typeof e.attr(this._guid)[a]!="undefined"},map:function(a,b){var c=[];this.each(function(d,e){c.push(a.call(b||this,d,e))},b||this);return c},push:function(a,b){if(e.typeOf(a)==="array")for(var c=0,d=a.length;c<d;c++)e.setAttribute.call(this,e.makeUuid(),a[c],b||!1);else e.setAttribute.call(this,e.makeUuid(),a,b||!1);return this},remove:function(a,b){typeof a=="undefined"?(e.attributes[this._guid]={},this.emit("change remove")):typeof a=="function"?this.each(function(c,d){a(c)&&e.removeAttribute.call(this,d,b)}):e.removeAttribute.call(this,a,b||!1);return this},set:function(a,b,c){if(typeof a=="object")for(var d in a)e.setAttribute.call(this,d,a[d],b||!1);else e.setAttribute.call(this,a,b,c||!1);return this},size:function(){var a=0,b=e.attr(this._guid);for(var c in b)a++;return a},update:function(a,b,c){typeof a=="string"?e.updateAttribute.call(this,a,b,c||!1):typeof a=="function"&&this.each(function(b,c){e.updateAttribute.call(this,c,a)});return this}};var g={_:e,extend:function(){return e.extendThis.apply(e.Module.prototype,arguments)},mixinEvents:function(a){a=a||{},e.addGuid(a);return e.extend(a,f)},on:function(){e.addEventHandler.apply(this,arguments)},subclass:function(a,b){b=b||!1,a=a||{},a.superclass=b?function(){}:e.Module;return e.createSubclass(a,!b)},version:a};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=g),exports.Stapes=g):typeof define=="function"&&define.amd?define(function(){return g}):window.Stapes=g})() |
@@ -37,2 +37,16 @@ var undef; | ||
test('extend', function() { | ||
var Module = Stapes.subclass(); | ||
var module = new Module(); | ||
module.extend({ | ||
'name' : 'foo', | ||
'say' : function() { | ||
ok(this.name === 'foo'); | ||
} | ||
}); | ||
module.say(); | ||
}); | ||
test("change events", function() { | ||
@@ -39,0 +53,0 @@ expect(12); |
@@ -7,5 +7,9 @@ window.App = (function() { | ||
this.createToc(); | ||
this.addAffix(); | ||
this.addSyntaxHighlighting(); | ||
this.addScrollspy(); | ||
if ($(window).width() > 960) { | ||
this.addAffix(); | ||
this.addScrollspy(); | ||
$("#toc").parent().addClass('pull-right'); | ||
} | ||
}, | ||
@@ -12,0 +16,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
770891
4229
3