Skip to content

Commit

Permalink
Merge branch 'feature/refactor' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk Lüth committed Aug 14, 2015
2 parents cfc2148 + 331c350 commit c0b955e
Show file tree
Hide file tree
Showing 86 changed files with 466 additions and 441 deletions.
9 changes: 5 additions & 4 deletions src/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
* @require ./promise/defer
* @require ./function/unique/uuid
*/
;(function(definition) {
window.qoopido.register('asset', definition, [ './emitter', './transport/xhr', './promise/defer', './function/unique/uuid' ]);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
;(function(definition, global) {
global.qoopido.register('asset', definition, [ './emitter', './transport/xhr', './promise/defer', './function/unique/uuid' ]);
}(function(modules, shared, global, undefined) {
'use strict';

var prototype,
document = global.document,
lookup = {},
xhrTransport = modules['transport/xhr'],
xhrOptions = { cache: true },
Expand Down Expand Up @@ -143,4 +144,4 @@
});

return prototype;
}, window, document));
}, this));
8 changes: 4 additions & 4 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/* global console, module, define */

;(function(definition, navigator, global, document, undefined) {
;(function(definition, global, undefined) {
'use strict';

function register(id, definition, dependencies, callback) {
Expand Down Expand Up @@ -57,7 +57,7 @@
}
}

modules[id] = definition(modules, shared, namespace, navigator, global, document, undefined);
modules[id] = definition(modules, shared, global, undefined);

if(callback) {
callback(modules[id]);
Expand Down Expand Up @@ -115,7 +115,7 @@
}

register('base', definition, dependencies);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
}(function(modules, shared, global, undefined) {
'use strict';

function getOwnPropertyDescriptors(object) {
Expand Down Expand Up @@ -163,5 +163,5 @@
}
};
},
navigator, this, document
this
));
8 changes: 4 additions & 4 deletions src/component/iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* @require ../function/merge
*/

;(function(definition) {
window.qoopido.register('component/iterator', definition, [ '../emitter', '../function/merge' ]);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
;(function(definition, global) {
global.qoopido.register('component/iterator', definition, [ '../emitter', '../function/merge' ]);
}(function(modules, shared, global, undefined) {
'use strict';

var prototype,
Expand Down Expand Up @@ -122,4 +122,4 @@
});

return prototype;
}));
}, this));
12 changes: 6 additions & 6 deletions src/component/remux.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* @require ../emitter
* @require ./sense
*/
;(function(definition) {
window.qoopido.registerSingleton('component/remux', definition, [ '../emitter', './sense' ]);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
;(function(definition, global) {
global.qoopido.registerSingleton('component/remux', definition, [ '../emitter', './sense' ]);
}(function(modules, shared, global, undefined) {
'use strict';

var prototype,
Expand All @@ -36,7 +36,7 @@
state.fontsize = fontsize;

if(current.fontsize !== state.fontsize || current.layout !== state.layout) {
state.ratio.device = (window.devicePixelRatio || 1);
state.ratio.device = (global.devicePixelRatio || 1);
state.ratio.fontsize = state.fontsize / base;
state.ratio.total = state.ratio.device * state.ratio.fontsize;

Expand All @@ -61,7 +61,7 @@
function addQuery(query, layout, fontsize) {
var self = this;

window.setTimeout(function() {
global.setTimeout(function() {
modules['component/sense']
.create(query)
.on('matched', function() {
Expand Down Expand Up @@ -130,4 +130,4 @@
});

return prototype;
}));
}, this));
14 changes: 7 additions & 7 deletions src/component/sense.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* @require ../emitter
* @polyfill ../polyfill/window/matchmedia
*/
;(function(definition) {
;(function(definition, global) {
var dependencies = [ '../emitter' ];

if(!window.matchMedia) {
if(!global.matchMedia) {
dependencies.push('../polyfill/window/matchmedia');
}

window.qoopido.register('component/sense', definition, dependencies);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
global.qoopido.register('component/sense', definition, dependencies);
}(function(modules, shared, global, undefined) {
'use strict';

var prototype,
Expand All @@ -43,15 +43,15 @@
mql: null,
_constructor: function(query) {
var self = prototype._parent._constructor.call(this),
mql = self.mql = queries[query] || (queries[query] = window.matchMedia(query)),
mql = self.mql = queries[query] || (queries[query] = global.matchMedia(query)),
listener = function() {
onQueryStateChange.call(self);
};



mql.addListener(listener);
window.setTimeout(listener, 0);
global.setTimeout(listener, 0);

return self;
},
Expand All @@ -61,4 +61,4 @@
});

return prototype;
}));
}, this));
11 changes: 6 additions & 5 deletions src/dom/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
* @require ./element
* @optional ../pool/module
*/
;(function(definition) {
window.qoopido.register('dom/collection', definition, [ '../base', './element' ]);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
;(function(definition, global) {
global.qoopido.register('dom/collection', definition, [ '../base', './element' ]);
}(function(modules, shared, global, undefined) {
'use strict';

var mDomElement = modules['dom/element'],
var document = global.document,
mDomElement = modules['dom/element'],
pool = modules['pool/module'] && modules['pool/module'].create(mDomElement, null, true) || null;

function buildFragment() {
Expand Down Expand Up @@ -231,4 +232,4 @@
}
});

}));
}, this));
19 changes: 10 additions & 9 deletions src/dom/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@
* @optional ../pool/module
*/
/* jshint loopfunc: true */
;(function(definition) {
;(function(definition, global) {
var dependencies = [ '../base', '../function/unique/uuid', '../hook/css', './event' ];

if(!window.CustomEvent) {
if(!global.CustomEvent) {
dependencies.push('../polyfill/window/customevent');
}

if(!window.addEventListener) {
if(!global.addEventListener) {
dependencies.push('../polyfill/window/addeventlistener');
}

if(!window.removeEventListener) {
if(!global.removeEventListener) {
dependencies.push('../polyfill/window/removeeventlistener');
}

if(!window.dispatchEvent) {
if(!global.dispatchEvent) {
dependencies.push('../polyfill/window/dispatchevent');
}

Expand All @@ -62,11 +62,12 @@
dependencies.push('../polyfill/string/trim');
}

window.qoopido.register('dom/element', definition, dependencies);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
global.qoopido.register('dom/element', definition, dependencies);
}(function(modules, shared, global, undefined) {
'use strict';

var stringObject = 'object',
var document = global.document,
stringObject = 'object',
stringString = 'string',
generateUuid = modules['function/unique/uuid'],
head = document.getElementsByTagName('head')[0],
Expand Down Expand Up @@ -703,4 +704,4 @@
return self;
}
});
}));
}, this));
26 changes: 13 additions & 13 deletions src/dom/element/emerge.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
* @require ../../function/merge
* @require ../../function/unique/uuid
*/
;(function(definition) {
window.qoopido.register('dom/element/emerge', definition, [ '../element', '../../function/merge', '../../function/unique/uuid' ]);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
;(function(definition, global) {
global.qoopido.register('dom/element/emerge', definition, [ '../element', '../../function/merge', '../../function/unique/uuid' ]);
}(function(modules, shared, global, undefined) {
'use strict';

var
// variables
defaults = { interval: 50, threshold: 'auto', recur: true, auto: 1, visibility: true },
documentElement = window.document.documentElement,
document = global.document,
documentElement = document.documentElement,
mGlobal = modules['dom/element'].create(global),
viewport = {},
intervals = {},
elements = {},
Expand All @@ -36,8 +38,6 @@
EVENT_DEMERGED = 'demerged',
DOM_RESIZE = 'resize orientationchange';

window = modules['dom/element'].create(window);

if(document.compatMode !== 'CSS1Compat') {
throw('[Qoopido.js] Not in standards mode');
}
Expand All @@ -53,7 +53,7 @@
}

if(pointer.length === 0) {
window.element.clearInterval(intervals[interval]);
global.clearInterval(intervals[interval]);

delete intervals[interval];
}
Expand All @@ -62,8 +62,8 @@
function globalOnResize() {
viewport.left = 0;
viewport.top = 0;
viewport.right = window.innerWidth || documentElement.clientWidth;
viewport.bottom = window.innerHeight || documentElement.clientHeight;
viewport.right = global.innerWidth || documentElement.clientWidth;
viewport.bottom = global.innerHeight || documentElement.clientHeight;
}

function instanceOnResize() {
Expand Down Expand Up @@ -135,7 +135,7 @@

if(intervals[settings.interval] === undefined) {
elements[settings.interval] = elements[settings.interval] || { length: 0 };
intervals[settings.interval] = window.element.setInterval(function() { tick(settings.interval); }, settings.interval);
intervals[settings.interval] = global.setInterval(function() { tick(settings.interval); }, settings.interval);
}

self._quid = modules['function/unique/uuid']();
Expand All @@ -147,7 +147,7 @@
elements[settings.interval][self._quid] = self;
elements[settings.interval].length++;

window.on(DOM_RESIZE, function() { instanceOnResize.call(self); });
mGlobal.on(DOM_RESIZE, function() { instanceOnResize.call(self); });
instanceOnResize.call(self);

return self;
Expand All @@ -160,8 +160,8 @@
}
});

window.on(DOM_RESIZE, globalOnResize);
mGlobal.on(DOM_RESIZE, globalOnResize);
globalOnResize();

return prototype;
}));
}, this));
8 changes: 4 additions & 4 deletions src/dom/element/lazyimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
* @require ./emerge
* @require ../../function/merge
*/
;(function(definition) {
window.qoopido.register('dom/element/lazyimage', definition, [ './emerge', '../../function/merge' ]);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
;(function(definition, global) {
global.qoopido.register('dom/element/lazyimage', definition, [ './emerge', '../../function/merge' ]);
}(function(modules, shared, global, undefined) {
'use strict';

var
Expand Down Expand Up @@ -79,4 +79,4 @@
});

return prototype;
}));
}, this));
14 changes: 7 additions & 7 deletions src/dom/element/shrinkimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
* @require ../../transport/xhr
* @optional ./pool/dom
*/
;(function(definition) {
;(function(definition, global) {
var dependencies = [ '../element', '../../proxy', '../../function/merge', '../../url', '../../support', '../../support/capability/datauri', '../../support/element/canvas/todataurl/png', '../../transport/xhr' ];

window.qoopido.register('dom/element/shrinkimage', definition, dependencies);
}(function(modules, shared, namespace, navigator, window, document, undefined) {
global.qoopido.register('dom/element/shrinkimage', definition, dependencies);
}(function(modules, shared, global, undefined) {
'use strict';

var
// properties
JSON = window.JSON,
name = namespace.pop(),
defaults = { attribute: 'data-' + name, quality: 80, debug: false },
document = global.document,
JSON = global.JSON,
defaults = { attribute: 'data-shrinkimage', quality: 80, debug: false },
pool = shared.pool && shared.pool.dom || null,
lookup = {},
regexBackground = new RegExp('^url\\x28"{0,1}data:image/shrink,(.+?)"{0,1}\\x29$', 'i'),
Expand Down Expand Up @@ -266,4 +266,4 @@
});

return prototype;
}, window));
}, this));
Loading

0 comments on commit c0b955e

Please sign in to comment.