Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "gridle", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Olivier Bossel <olivier.bossel@gmail.com>" |
@@ -26,9 +26,9 @@ | ||
obj.emit = function(eventName) { | ||
var handler, _i, _len, _ref; | ||
var handler, i, len, ref; | ||
if (!handlers[eventName]) { | ||
return; | ||
} | ||
_ref = handlers[eventName]; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
handler = _ref[_i]; | ||
ref = handlers[eventName]; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
handler = ref[i]; | ||
handler.apply(obj, Array.prototype.slice.call(arguments, 1)); | ||
@@ -71,3 +71,3 @@ continue; | ||
init: function(settings) { | ||
var index, link, _cssLinks, _ref, _ref1; | ||
var _cssLinks, index, link, ref, ref1; | ||
this._inited = true; | ||
@@ -78,4 +78,4 @@ if (settings != null) { | ||
if (settings && (settings.debug != null)) { | ||
if ((_ref = this._settings.debug) != null) { | ||
_ref; | ||
if ((ref = this._settings.debug) != null) { | ||
ref; | ||
} else { | ||
@@ -86,4 +86,4 @@ settings.debug; | ||
if (settings && (settings.onStatesChange != null)) { | ||
if ((_ref1 = this._settings.onStatesChange) != null) { | ||
_ref1; | ||
if ((ref1 = this._settings.onStatesChange) != null) { | ||
ref1; | ||
} else { | ||
@@ -115,6 +115,6 @@ settings.onStatesChange; | ||
_loadAndParseCss: function() { | ||
var index, link, _ref; | ||
_ref = this._cssLinks; | ||
for (index in _ref) { | ||
link = _ref[index]; | ||
var index, link, ref; | ||
ref = this._cssLinks; | ||
for (index in ref) { | ||
link = ref[index]; | ||
if (this._statesFindedInCss) { | ||
@@ -186,7 +186,7 @@ return false; | ||
_processFindedStates: function() { | ||
var name, query, _ref; | ||
var name, query, ref; | ||
this._debug('begin process finded states in css'); | ||
_ref = this._statesInCss; | ||
for (name in _ref) { | ||
query = _ref[name]; | ||
ref = this._statesInCss; | ||
for (name in ref) { | ||
query = ref[name]; | ||
this._registerState(name, query); | ||
@@ -254,3 +254,3 @@ } | ||
_updateStatesStatus: function() { | ||
var defaultState, defaultStateIdx, key, state, wasDefault, _ref; | ||
var defaultState, defaultStateIdx, key, ref, state, wasDefault; | ||
defaultState = this.getDefaultState(); | ||
@@ -265,5 +265,5 @@ defaultStateIdx = this._states.indexOf(defaultState); | ||
this._updatedStatesNames = []; | ||
_ref = this._states; | ||
for (key in _ref) { | ||
state = _ref[key]; | ||
ref = this._states; | ||
for (key in ref) { | ||
state = ref[key]; | ||
if (!state.updateOnResize) { | ||
@@ -394,6 +394,6 @@ continue; | ||
getDefaultState: function() { | ||
var state, _i, _len, _ref; | ||
_ref = this.getRegisteredStates(); | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
state = _ref[_i]; | ||
var i, len, ref, state; | ||
ref = this.getRegisteredStates(); | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
state = ref[i]; | ||
if (state.name === 'default') { | ||
@@ -458,7 +458,7 @@ return state; | ||
isActive: function(stateName) { | ||
var index, isActive, name, _ref; | ||
var index, isActive, name, ref; | ||
isActive = false; | ||
_ref = this._activeStatesNames; | ||
for (index in _ref) { | ||
name = _ref[index]; | ||
ref = this._activeStatesNames; | ||
for (index in ref) { | ||
name = ref[index]; | ||
if (stateName === name) { | ||
@@ -465,0 +465,0 @@ isActive = true; |
@@ -1,1 +0,1 @@ | ||
!function(){var a;return a={convert:function(a,b){return b={},a.on=function(c,d){return(b[c]=b[c]||[]).push(d),a},a.emit=function(c){var d,e,f,g;if(b[c]){for(g=b[c],e=0,f=g.length;f>e;e++)d=g[e],d.apply(a,Array.prototype.slice.call(arguments,1));return a}},a}},window.Gridle={_inited:!1,_isReady:!1,_statesInCss:null,_statesFindedInCss:!1,_cssLinks:[],_cssSettings:[],_states:[],_activeStates:[],_activeStatesNames:[],_inactiveStates:[],_inactiveStatesNames:[],_updatedStates:[],_updatedStatesNames:[],resizeTimeout:null,_settings:{cssPath:null,onUpdate:null,debug:null},init:function(a){var b,c,d,e,f;if(this._inited=!0,null!=a&&(this._settings=a),a&&null!=a.debug&&(null!=(e=this._settings.debug)||a.debug),a&&null!=a.onStatesChange&&(null!=(f=this._settings.onStatesChange)||a.onStatesChange),this._debug("ajax request on stylesheets to find gridle states"),this._settings.cssPath)this._cssLinks.push({href:this._settings.cssPath});else{d=document.getElementsByTagName("link");for(b in d){if(c=d[b],!c)return!1;this._cssLinks.push(c)}}return this._loadAndParseCss(this._cssLinks.length?void 0:this._launch)},_loadAndParseCss:function(){var a,b,c;c=this._cssLinks;for(a in c){if(b=c[a],this._statesFindedInCss)return!1;b&&b.href&&(this._debug("|--- ajax request on ",b.href),this._ajax({async:!0,url:b.href,success:function(a){return function(c){var d;return a._statesFindedInCss?!1:c&&(d=c.match(/#gridle-settings(?:\s*)\{(?:\s*)content(?:\s*):(?:\s*)\'(.+)\'(;\s*|\s*)\}/)&&RegExp.$1)?(d=d.toString().replace(/\\/g,""),d=JSON.parse(d),a._cssSettings=d,d.states?(a._debug("|--- states finded in",b.href),a._statesFindedInCss=!0,a._statesInCss=d.states,a._processFindedStates()):(a._debug("no queries finded in css"),a._noSettingsFindedInThisCss(b),!1)):(a._noSettingsFindedInThisCss(b),!1)}}(this),error:function(a){return function(){return a._statesFindedInCss?!1:a._noSettingsFindedInThisCss(b)}}(this),dataType:"text"}))}},_noSettingsFindedInThisCss:function(){return this._cssLinks.shift,this._cssLinks.length?void 0:this._debug("no settings finded in css")},_processFindedStates:function(){var a,b,c;this._debug("begin process finded states in css"),c=this._statesInCss;for(a in c)b=c[a],this._registerState(a,b);return this._launch()},_launch:function(){return this._debug("launch"),this._isReady=!0,this._crossEmit("ready"),this._addEvent(window,"resize",function(a){return function(){return clearTimeout(a.resizeTimeout),a.resizeTimeout=setTimeout(function(){return a._onResize()},100)}}(this)),this._onResize()},_onResize:function(){var a;return a=[],this._updateStatesStatus(),this.getActiveStatesNames().length&&this._debug("active states",this.getActiveStatesNames().join(",")),this.getInactiveStatesNames().length&&this._debug("inactive states",this.getInactiveStatesNames().join(",")),this.getUpdatedStatesNames().length?this._debug("updated states",this.getUpdatedStatesNames().join(",")):void 0},_registerState:function(a,b,c){var d;return d={name:a,query:b.query,settings:b,status:null,previous_status:null,updateOnResize:null!=c?c:!0},this._states.push(d),this._debug("|--- register state",a,d)},_updateStatesStatus:function(){var a,b,c,d,e,f;a=this.getDefaultState(),b=this._states.indexOf(a),e=a.status,this._activeStates=[],this._activeStatesNames=[],this._inactiveStates=[],this._inactiveStatesNames=[],this._updatedStates=[],this._updatedStatesNames=[],f=this._states;for(c in f)d=f[c],d.updateOnResize&&(this._states[c].previous_status=d.status,this._validateState(d)?(this._states[c].status||(this._updatedStates.push(d),this._updatedStatesNames.push(d.name)),this._states[c].status=!0,this._activeStates.push(d),this._activeStatesNames.push(d.name)):"default"!==d.name&&(this._states[c].status&&(this._updatedStates.push(d),this._updatedStatesNames.push(d.name)),this._states[c].status=!1,this._inactiveStates.push(d),this._inactiveStatesNames.push(d.name)));return this._activeStates.length?(this._states[b].status=!1,this._inactiveStates.push(a),this._inactiveStatesNames.push("default"),e&&(this._updatedStates.push(a),this._updatedStatesNames.push("default"))):(this._states[b].status=!0,this._activeStates.push(a),this._activeStatesNames.push("default"),e||(this._updatedStates.push(a),this._updatedStatesNames.push("default"))),this._updatedStates.length&&this._crossEmit("update",this._updatedStates,this._activeStates,this._inactiveStates),this._updatedStates.length&&this._settings.onUpdate?this._settings.onUpdate(this._updatedStates,this._activeStates,this._inactiveStates):void 0},_validateState:function(a){return matchMedia(a.query).matches},_addEvent:function(a,b,c){return a?a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c:!1},_crossEmit:function(a){return"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery(this).trigger(a,Array.prototype.slice.call(arguments,1)),jQuery("body").trigger("gridle."+a,Array.prototype.slice.call(arguments,1))),this.emit.apply(this,arguments)},_ajax:function(a){var b,c;return b={type:a.type||"GET",url:a.url,success:a.success,error:a.error,dataType:a.dataType||"text",context:a.context},c=new XMLHttpRequest,b.context&&(c.context=b.context),c.open(b.type,b.url,!0),c.onreadystatechange=function(){var a;if(4!==c.readyState)return!1;switch(c.status){case 200:switch(b.dataType){case"json":a=JSON.parse(c.responseText);break;default:a=c.responseText}if(b.success)return b.success(a,c.status,c)}},c.send()},getDefaultState:function(){var a,b,c,d;for(d=this.getRegisteredStates(),b=0,c=d.length;c>b;b++)if(a=d[b],"default"===a.name)return a},getRegisteredStates:function(){return this._states},getUpdatedStates:function(){return this._updatedStates},getUpdatedStatesNames:function(){return this._updatedStatesNames},getActiveStates:function(){return this._activeStates},getActiveStatesNames:function(){return this._activeStatesNames},getInactiveStates:function(){return this._inactiveStates},getInactiveStatesNames:function(){return this._inactiveStatesNames},isActive:function(a){var b,c,d,e;c=!1,e=this._activeStatesNames;for(b in e)d=e[b],a===d&&(c=!0);return c},isReady:function(){return this._isReady},_debug:function(){return this._settings.debug?console.log("GRIDLE",arguments):void 0}},a.convert(window.Gridle),setTimeout(function(){return Gridle._inited?void 0:Gridle.init()},500),"function"==typeof window.define&&window.define.amd?window.define([],function(){return window.Gridle}):void 0}(); | ||
!function(){var a;return a={convert:function(a,b){return b={},a.on=function(c,d){return(b[c]=b[c]||[]).push(d),a},a.emit=function(c){var d,e,f,g;if(b[c]){for(g=b[c],e=0,f=g.length;f>e;e++)d=g[e],d.apply(a,Array.prototype.slice.call(arguments,1));return a}},a}},window.Gridle={_inited:!1,_isReady:!1,_statesInCss:null,_statesFindedInCss:!1,_cssLinks:[],_cssSettings:[],_states:[],_activeStates:[],_activeStatesNames:[],_inactiveStates:[],_inactiveStatesNames:[],_updatedStates:[],_updatedStatesNames:[],resizeTimeout:null,_settings:{cssPath:null,onUpdate:null,debug:null},init:function(a){var b,c,d,e,f;if(this._inited=!0,null!=a&&(this._settings=a),a&&null!=a.debug&&(null!=(e=this._settings.debug)||a.debug),a&&null!=a.onStatesChange&&(null!=(f=this._settings.onStatesChange)||a.onStatesChange),this._debug("ajax request on stylesheets to find gridle states"),this._settings.cssPath)this._cssLinks.push({href:this._settings.cssPath});else{b=document.getElementsByTagName("link");for(c in b){if(d=b[c],!d)return!1;this._cssLinks.push(d)}}return this._loadAndParseCss(this._cssLinks.length?void 0:this._launch)},_loadAndParseCss:function(){var a,b,c;c=this._cssLinks;for(a in c){if(b=c[a],this._statesFindedInCss)return!1;b&&b.href&&(this._debug("|--- ajax request on ",b.href),this._ajax({async:!0,url:b.href,success:function(a){return function(c){var d;return a._statesFindedInCss?!1:c&&(d=c.match(/#gridle-settings(?:\s*)\{(?:\s*)content(?:\s*):(?:\s*)\'(.+)\'(;\s*|\s*)\}/)&&RegExp.$1)?(d=d.toString().replace(/\\/g,""),d=JSON.parse(d),a._cssSettings=d,d.states?(a._debug("|--- states finded in",b.href),a._statesFindedInCss=!0,a._statesInCss=d.states,a._processFindedStates()):(a._debug("no queries finded in css"),a._noSettingsFindedInThisCss(b),!1)):(a._noSettingsFindedInThisCss(b),!1)}}(this),error:function(a){return function(c){return a._statesFindedInCss?!1:a._noSettingsFindedInThisCss(b)}}(this),dataType:"text"}))}},_noSettingsFindedInThisCss:function(a){return this._cssLinks.shift,this._cssLinks.length?void 0:this._debug("no settings finded in css")},_processFindedStates:function(){var a,b,c;this._debug("begin process finded states in css"),c=this._statesInCss;for(a in c)b=c[a],this._registerState(a,b);return this._launch()},_launch:function(){return this._debug("launch"),this._isReady=!0,this._crossEmit("ready"),this._addEvent(window,"resize",function(a){return function(b){return clearTimeout(a.resizeTimeout),a.resizeTimeout=setTimeout(function(){return a._onResize()},100)}}(this)),this._onResize()},_onResize:function(){var a;return a=[],this._updateStatesStatus(),this.getActiveStatesNames().length&&this._debug("active states",this.getActiveStatesNames().join(",")),this.getInactiveStatesNames().length&&this._debug("inactive states",this.getInactiveStatesNames().join(",")),this.getUpdatedStatesNames().length?this._debug("updated states",this.getUpdatedStatesNames().join(",")):void 0},_registerState:function(a,b,c){var d;return d={name:a,query:b.query,settings:b,status:null,previous_status:null,updateOnResize:null!=c?c:!0},this._states.push(d),this._debug("|--- register state",a,d)},_updateStatesStatus:function(){var a,b,c,d,e,f;a=this.getDefaultState(),b=this._states.indexOf(a),f=a.status,this._activeStates=[],this._activeStatesNames=[],this._inactiveStates=[],this._inactiveStatesNames=[],this._updatedStates=[],this._updatedStatesNames=[],d=this._states;for(c in d)e=d[c],e.updateOnResize&&(this._states[c].previous_status=e.status,this._validateState(e)?(this._states[c].status||(this._updatedStates.push(e),this._updatedStatesNames.push(e.name)),this._states[c].status=!0,this._activeStates.push(e),this._activeStatesNames.push(e.name)):"default"!==e.name&&(this._states[c].status&&(this._updatedStates.push(e),this._updatedStatesNames.push(e.name)),this._states[c].status=!1,this._inactiveStates.push(e),this._inactiveStatesNames.push(e.name)));return this._activeStates.length?(this._states[b].status=!1,this._inactiveStates.push(a),this._inactiveStatesNames.push("default"),f&&(this._updatedStates.push(a),this._updatedStatesNames.push("default"))):(this._states[b].status=!0,this._activeStates.push(a),this._activeStatesNames.push("default"),f||(this._updatedStates.push(a),this._updatedStatesNames.push("default"))),this._updatedStates.length&&this._crossEmit("update",this._updatedStates,this._activeStates,this._inactiveStates),this._updatedStates.length&&this._settings.onUpdate?this._settings.onUpdate(this._updatedStates,this._activeStates,this._inactiveStates):void 0},_validateState:function(a){return matchMedia(a.query).matches},_addEvent:function(a,b,c){return a?a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c:!1},_crossEmit:function(a){return"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery(this).trigger(a,Array.prototype.slice.call(arguments,1)),jQuery("body").trigger("gridle."+a,Array.prototype.slice.call(arguments,1))),this.emit.apply(this,arguments)},_ajax:function(a){var b,c;return b={type:a.type||"GET",url:a.url,success:a.success,error:a.error,dataType:a.dataType||"text",context:a.context},c=new XMLHttpRequest,b.context&&(c.context=b.context),c.open(b.type,b.url,!0),c.onreadystatechange=function(){var a;if(4!==c.readyState)return!1;switch(c.status){case 200:switch(b.dataType){case"json":a=JSON.parse(c.responseText);break;default:a=c.responseText}if(b.success)return b.success(a,c.status,c)}},c.send()},getDefaultState:function(){var a,b,c,d;for(c=this.getRegisteredStates(),a=0,b=c.length;b>a;a++)if(d=c[a],"default"===d.name)return d},getRegisteredStates:function(){return this._states},getUpdatedStates:function(){return this._updatedStates},getUpdatedStatesNames:function(){return this._updatedStatesNames},getActiveStates:function(){return this._activeStates},getActiveStatesNames:function(){return this._activeStatesNames},getInactiveStates:function(){return this._inactiveStates},getInactiveStatesNames:function(){return this._inactiveStatesNames},isActive:function(a){var b,c,d,e;c=!1,e=this._activeStatesNames;for(b in e)d=e[b],a===d&&(c=!0);return c},isReady:function(){return this._isReady},_debug:function(){return this._settings.debug?console.log("GRIDLE",arguments):void 0}},a.convert(window.Gridle),setTimeout(function(){return Gridle._inited?void 0:Gridle.init()},500),"function"==typeof window.define&&window.define.amd?window.define([],function(){return window.Gridle}):void 0}(); |
{ | ||
"name": "gridle", | ||
"description": "Gridle grid system", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "sass/gridle/_gridle.scss", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -1,2 +0,2 @@ | ||
# gridle (v2.0.0) | ||
# gridle (v2.0.1) | ||
@@ -3,0 +3,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
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13900
0
1522604
59