diff --git a/src/asset.js b/src/asset.js index 217a44b9..4b8e542a 100644 --- a/src/asset.js +++ b/src/asset.js @@ -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 }, @@ -143,4 +144,4 @@ }); return prototype; -}, window, document)); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/base.js b/src/base.js index 73f5de07..92b8c2e3 100644 --- a/src/base.js +++ b/src/base.js @@ -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) { @@ -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]); @@ -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) { @@ -163,5 +163,5 @@ } }; }, - navigator, this, document + this )); \ No newline at end of file diff --git a/src/component/iterator.js b/src/component/iterator.js index 43bed222..1c256940 100644 --- a/src/component/iterator.js +++ b/src/component/iterator.js @@ -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, @@ -122,4 +122,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/component/remux.js b/src/component/remux.js index 492424c9..943dac75 100644 --- a/src/component/remux.js +++ b/src/component/remux.js @@ -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, @@ -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; @@ -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() { @@ -130,4 +130,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/component/sense.js b/src/component/sense.js index e3640258..8507e1c4 100644 --- a/src/component/sense.js +++ b/src/component/sense.js @@ -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, @@ -43,7 +43,7 @@ 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); }; @@ -51,7 +51,7 @@ mql.addListener(listener); - window.setTimeout(listener, 0); + global.setTimeout(listener, 0); return self; }, @@ -61,4 +61,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/dom/collection.js b/src/dom/collection.js index f58bd1eb..2148beb3 100644 --- a/src/dom/collection.js +++ b/src/dom/collection.js @@ -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() { @@ -231,4 +232,4 @@ } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/dom/element.js b/src/dom/element.js index c38b4229..e692dfc1 100644 --- a/src/dom/element.js +++ b/src/dom/element.js @@ -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'); } @@ -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], @@ -703,4 +704,4 @@ return self; } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/dom/element/emerge.js b/src/dom/element/emerge.js index 650bbf4a..a810f7cf 100644 --- a/src/dom/element/emerge.js +++ b/src/dom/element/emerge.js @@ -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 = {}, @@ -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'); } @@ -53,7 +53,7 @@ } if(pointer.length === 0) { - window.element.clearInterval(intervals[interval]); + global.clearInterval(intervals[interval]); delete intervals[interval]; } @@ -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() { @@ -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'](); @@ -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; @@ -160,8 +160,8 @@ } }); - window.on(DOM_RESIZE, globalOnResize); + mGlobal.on(DOM_RESIZE, globalOnResize); globalOnResize(); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/dom/element/lazyimage.js b/src/dom/element/lazyimage.js index c5fd90b1..b1a993c3 100644 --- a/src/dom/element/lazyimage.js +++ b/src/dom/element/lazyimage.js @@ -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 @@ -79,4 +79,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/dom/element/shrinkimage.js b/src/dom/element/shrinkimage.js index 6fe0d9f4..fbd3c4c9 100644 --- a/src/dom/element/shrinkimage.js +++ b/src/dom/element/shrinkimage.js @@ -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'), @@ -266,4 +266,4 @@ }); return prototype; -}, window)); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/dom/event.js b/src/dom/event.js index 7b6baa3f..8acef544 100644 --- a/src/dom/event.js +++ b/src/dom/event.js @@ -14,9 +14,9 @@ * @require ../base * @require ../hook/event */ -;(function(definition) { - window.qoopido.register('dom/event', definition, [ '../base', '../hook/event' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('dom/event', definition, [ '../base', '../hook/event' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var hooks = modules['hook/event']; @@ -95,4 +95,4 @@ self.stopPropagation(); } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/emitter.js b/src/emitter.js index f72a21e6..57d605e6 100755 --- a/src/emitter.js +++ b/src/emitter.js @@ -13,9 +13,9 @@ * * @require ./base */ -;(function(definition) { - window.qoopido.register('emitter', definition, [ './base' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('emitter', definition, [ './base' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var excludeMethods = /^(_|extend$|create$|on$|one$|off$|emit$|get.+)/; @@ -129,4 +129,4 @@ return self; } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/function/load/css.js b/src/function/load/css.js index c7ba7f65..0fbb38b4 100644 --- a/src/function/load/css.js +++ b/src/function/load/css.js @@ -11,12 +11,13 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('function/load/css', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('function/load/css', definition); +}(function(modules, shared, global, undefined) { 'use strict'; - var storage = {}; + var document = global.document, + storage = {}; return function load(url, media) { media = media || 'all'; @@ -35,11 +36,11 @@ target.parentNode.insertBefore(link, target); - window.setTimeout(function() { + global.setTimeout(function() { link.media = media; }); } return link; }; -}, window, document)); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/function/merge.js b/src/function/merge.js index 1bd1a9e9..d088c906 100644 --- a/src/function/merge.js +++ b/src/function/merge.js @@ -11,9 +11,9 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('function/merge', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('function/merge', definition); +}(function(modules, shared, global, undefined) { 'use strict'; return function merge() { @@ -43,4 +43,4 @@ return target; }; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/function/proximity.js b/src/function/proximity.js index 908a2287..58253588 100644 --- a/src/function/proximity.js +++ b/src/function/proximity.js @@ -11,9 +11,9 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('function/proximity', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('function/proximity', definition); +}(function(modules, shared, global, undefined) { 'use strict'; return function proximity(source, target) { @@ -37,4 +37,4 @@ return distance; }; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/function/unique/string.js b/src/function/unique/string.js index 96e69047..6e720b18 100644 --- a/src/function/unique/string.js +++ b/src/function/unique/string.js @@ -11,9 +11,9 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('function/unique/string', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('function/unique/string', definition); +}(function(modules, shared, global, undefined) { 'use strict'; var lookup = {}, @@ -43,4 +43,4 @@ return result; }; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/function/unique/uuid.js b/src/function/unique/uuid.js index 8032524b..c72545d5 100644 --- a/src/function/unique/uuid.js +++ b/src/function/unique/uuid.js @@ -11,9 +11,9 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('function/unique/uuid', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('function/unique/uuid', definition); +}(function(modules, shared, global, undefined) { 'use strict'; var lookup = {}, @@ -39,4 +39,4 @@ return result; }; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/hook/css.js b/src/hook/css.js index 0fbb62b6..f09aed7b 100644 --- a/src/hook/css.js +++ b/src/hook/css.js @@ -14,19 +14,19 @@ * @require ../base * @require ../support */ -;(function(definition) { +;(function(definition, global) { var dependencies = [ '../base', '../support' ]; - if(!window.getComputedStyle) { + if(!global.getComputedStyle) { dependencies.push('../polyfill/window/getcomputedstyle'); } - window.qoopido.registerSingleton('hook/css', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.registerSingleton('hook/css', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; var mSupport = modules['support'], - getComputedStyle = window.getComputedStyle || modules['polyfill/window/getcomputedstyle'], + getComputedStyle = global.getComputedStyle || modules['polyfill/window/getcomputedstyle'], hooks = { general: { get: function(element, property) { @@ -86,4 +86,4 @@ } } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/hook/event.js b/src/hook/event.js index e2ad263e..4d2c9c01 100644 --- a/src/hook/event.js +++ b/src/hook/event.js @@ -13,11 +13,13 @@ * * @require ../base */ -;(function(definition) { - window.qoopido.registerSingleton('hook/event', definition, [ '../base' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.registerSingleton('hook/event', definition, [ '../base' ]); +}(function(modules, shared, global, undefined) { 'use strict'; + var document = global.document; + function transferProperties(event, originalEvent, properties) { var i = 0, property; @@ -55,7 +57,7 @@ event.path.push(pointer); } while(pointer = pointer.parentNode); - event.path.push(window); + event.path.push(global); } } }, @@ -134,4 +136,4 @@ } } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/jquery/extension/selector.js b/src/jquery/extension/selector.js index 96cb4621..b3a69e20 100644 --- a/src/jquery/extension/selector.js +++ b/src/jquery/extension/selector.js @@ -13,13 +13,13 @@ * * @external jQuery */ -;(function(definition) { - window.qoopido.register('jquery/extension/selector', definition, [ 'jquery' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('jquery/extension/selector', definition, [ 'jquery' ]); +}(function(modules, shared, global, undefined) { 'use strict'; - var jQuery = modules['jquery'] || window.jQuery, - $window = jQuery(window), + var jQuery = modules['jquery'] || global.jQuery, + $window = jQuery(global), $document = jQuery(document); jQuery.extend(jQuery.expr[':'], { @@ -68,7 +68,7 @@ return false; } - return el.hostname && el.hostname !== window.location.hostname; + return el.hostname && el.hostname !== global.location.hostname; }, inView: function(el) { el = jQuery(el); @@ -113,4 +113,4 @@ }); return jQuery; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/jquery/function/prefetch.js b/src/jquery/function/prefetch.js index da159b19..6824964d 100644 --- a/src/jquery/function/prefetch.js +++ b/src/jquery/function/prefetch.js @@ -13,12 +13,12 @@ * * @external jQuery */ -;(function(definition) { - window.qoopido.register('jquery/function/prefetch', definition, [ 'jquery' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('jquery/function/prefetch', definition, [ 'jquery' ]); +}(function(modules, shared, global, undefined) { 'use strict'; - var jQuery = modules['jquery'] || window.jQuery, + var jQuery = modules['jquery'] || global.jQuery, $head = jQuery('head'), lookup = []; @@ -34,4 +34,4 @@ }; return jQuery; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/jquery/plugin/emerge.js b/src/jquery/plugin/emerge.js index 9399a29f..db541931 100644 --- a/src/jquery/plugin/emerge.js +++ b/src/jquery/plugin/emerge.js @@ -14,15 +14,15 @@ * @require ../../dom/element/emerge * @external jQuery */ -;(function(definition) { - window.qoopido.register('jquery/plugins/emerge', definition, [ '../../dom/element/emerge', 'jquery' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('jquery/plugins/emerge', definition, [ '../../dom/element/emerge', 'jquery' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var // variables - jQuery = modules['jquery'] || window.jQuery, - name = namespace.pop(), + jQuery = modules['jquery'] || global.jQuery, + name = 'emerge', // classes prototype, @@ -52,4 +52,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/jquery/plugin/lazyimage.js b/src/jquery/plugin/lazyimage.js index c3bce98c..cbeff811 100644 --- a/src/jquery/plugin/lazyimage.js +++ b/src/jquery/plugin/lazyimage.js @@ -14,15 +14,15 @@ * @require ../../dom/element/lazyimage * @external jQuery */ -;(function(definition) { - window.qoopido.register('jquery/plugins/lazyimage', definition, [ '../../dom/element/lazyimage', 'jquery' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('jquery/plugins/lazyimage', definition, [ '../../dom/element/lazyimage', 'jquery' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var // variables - jQuery = modules['jquery'] || window.jQuery, - name = namespace.pop(), + jQuery = modules['jquery'] || global.jQuery, + name = 'lazyimage', // classes prototype, @@ -52,4 +52,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/jquery/plugin/shrinkimage.js b/src/jquery/plugin/shrinkimage.js index ace7f5f5..5f9faa09 100644 --- a/src/jquery/plugin/shrinkimage.js +++ b/src/jquery/plugin/shrinkimage.js @@ -14,15 +14,15 @@ * @require ../../dom/element/shrinkimage * @external jQuery */ -;(function(definition) { - window.qoopido.register('jquery/plugins/shrinkimage', definition, [ '../../dom/element/shrinkimage', 'jquery' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('jquery/plugins/shrinkimage', definition, [ '../../dom/element/shrinkimage', 'jquery' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var // variables - jQuery = modules['jquery'] || window.jQuery, - name = namespace.pop(), + jQuery = modules['jquery'] || global.jQuery, + name = 'shrinkimage', // classes prototype, @@ -58,4 +58,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/particle.js b/src/particle.js index ed21c5b1..9d44c2ef 100755 --- a/src/particle.js +++ b/src/particle.js @@ -15,9 +15,9 @@ * @require ./pool/module * @require ./vector/2d */ -;(function(definition) { - window.qoopido.register('particle', definition, [ './emitter', './pool/module', './vector/2d' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('particle', definition, [ './emitter', './pool/module', './vector/2d' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype, @@ -70,4 +70,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/array/indexof.js b/src/polyfill/array/indexof.js index 89d84b69..8ab74924 100644 --- a/src/polyfill/array/indexof.js +++ b/src/polyfill/array/indexof.js @@ -15,9 +15,9 @@ * @browsers Firefox < 1.5, Internet Explorer < 9 */ /* global Window, HTMLDocument, Element */ -;(function(definition) { - window.qoopido.register('polyfill/array/indexof', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/array/indexof', definition); +}(function(modules, shared, global, undefined) { 'use strict'; if(!Array.prototype.indexOf) { @@ -36,4 +36,4 @@ } return Array.prototype.indexOf; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/document/getelementsbyclassname.js b/src/polyfill/document/getelementsbyclassname.js index a7788b12..028db1cb 100644 --- a/src/polyfill/document/getelementsbyclassname.js +++ b/src/polyfill/document/getelementsbyclassname.js @@ -14,17 +14,19 @@ * * @polyfill ./queryselectorall */ -;(function(definition) { +;(function(definition, global) { var dependencies = []; if(!Object.defineProperty) { dependencies.push('./queryselectorall'); } - window.qoopido.register('polyfill/document/getelementsbyclassname', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('polyfill/document/getelementsbyclassname', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; + var document = window.document; + if(!document.getElementsByClassName) { var regex = new RegExp('^|\\s+', 'g'); @@ -36,4 +38,4 @@ } return document.getElementsByClassName; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/document/queryselector.js b/src/polyfill/document/queryselector.js index dc225b26..d3f1d022 100644 --- a/src/polyfill/document/queryselector.js +++ b/src/polyfill/document/queryselector.js @@ -14,17 +14,19 @@ * * @polyfill ./queryselectorall */ -;(function(definition) { +;(function(definition, global) { var dependencies = []; if(!document.querySelectorAll) { dependencies.push('./queryselectorall'); } - window.qoopido.register('polyfill/document/queryselector', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('polyfill/document/queryselector', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; + var document = global.document; + if(!document.querySelector) { document.querySelector = function(selector) { var elements = document.querySelectorAll(selector); @@ -34,4 +36,4 @@ } return document.querySelector; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/document/queryselectorall.js b/src/polyfill/document/queryselectorall.js index 71b48fca..f048fbf5 100644 --- a/src/polyfill/document/queryselectorall.js +++ b/src/polyfill/document/queryselectorall.js @@ -12,14 +12,16 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('polyfill/document/queryselectorall', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/document/queryselectorall', definition); +}(function(modules, shared, global, undefined) { 'use strict'; + var document = global.document; + if(!document.querySelectorAll) { document.querySelectorAll = function(selector) { - var target = window.document.getElementsByTagName('script')[0], + var target = document.getElementsByTagName('script')[0], style = document.createElement('style'), elements = [], element; @@ -29,7 +31,7 @@ style.styleSheet.cssText = selector + '{x-qsa:expression(document._qsa && document._qsa.push(this))}'; - window.scrollBy(0, 0); + global.scrollBy(0, 0); style.parentNode.removeChild(style); while(document._qsa.length) { @@ -50,4 +52,4 @@ } return document.querySelectorAll; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/element/matches.js b/src/polyfill/element/matches.js index 47909cc8..3d93ecf3 100644 --- a/src/polyfill/element/matches.js +++ b/src/polyfill/element/matches.js @@ -11,15 +11,15 @@ * * @polyfill ../document/queryselectorall */ -;(function(definition) { +;(function(definition, global) { var dependencies = []; if(!document.querySelectorAll) { dependencies.push('../document/queryselectorall'); } - window.qoopido.register('polyfill/element/matches', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('polyfill/element/matches', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; if(!Element.prototype.matches) { @@ -41,4 +41,4 @@ } return Element.prototype.matches; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/object/create.js b/src/polyfill/object/create.js index 76f1f648..e10c97ae 100644 --- a/src/polyfill/object/create.js +++ b/src/polyfill/object/create.js @@ -28,7 +28,7 @@ } else { (qoopido.modules = qoopido.modules || {})['polyfill/object/create'] = definition(); } -}(function(modules, shared, namespace, navigator, window, document, undefined) { +}(function(modules, shared, global, undefined) { 'use strict'; if(!Object.create) { @@ -60,5 +60,5 @@ return Object.create; }, - window.qoopido = window.qoopido || {} + this.qoopido = this.qoopido || {} )); \ No newline at end of file diff --git a/src/polyfill/object/defineproperties.js b/src/polyfill/object/defineproperties.js index 3387fcac..e9d9d0d7 100644 --- a/src/polyfill/object/defineproperties.js +++ b/src/polyfill/object/defineproperties.js @@ -28,7 +28,7 @@ } else { (qoopido.modules = qoopido.modules || {})['polyfill/object/defineproperties'] = definition(); } -}(function(modules, shared, namespace, navigator, window, document, undefined) { +}(function(modules, shared, global, undefined) { 'use strict'; if(!Object.defineProperties) { @@ -51,5 +51,5 @@ return Object.defineProperties; }, - window.qoopido = window.qoopido || {} + this.qoopido = this.qoopido || {} )); \ No newline at end of file diff --git a/src/polyfill/object/defineproperty.js b/src/polyfill/object/defineproperty.js index 1ac70d50..f692fd27 100644 --- a/src/polyfill/object/defineproperty.js +++ b/src/polyfill/object/defineproperty.js @@ -20,7 +20,7 @@ } else { (qoopido.modules = qoopido.modules || {})['polyfill/object/defineproperty'] = definition(); } -}(function(modules, shared, namespace, navigator, window, document, undefined) { +}(function(modules, shared, global, undefined) { 'use strict'; if(!Object.defineProperty || !(function () { try { Object.defineProperty({}, 'x', {}); return true; } catch (exception) { return false; } } ())) { @@ -54,5 +54,5 @@ return Object.defineProperty; }, - window.qoopido = window.qoopido || {} + this.qoopido = this.qoopido || {} )); \ No newline at end of file diff --git a/src/polyfill/object/getownpropertydescriptor.js b/src/polyfill/object/getownpropertydescriptor.js index 126a7437..e89ff63a 100644 --- a/src/polyfill/object/getownpropertydescriptor.js +++ b/src/polyfill/object/getownpropertydescriptor.js @@ -20,7 +20,7 @@ } else { (qoopido.modules = qoopido.modules || {})['polyfill/object/getownpropertydescriptor'] = definition(); } -}(function(modules, shared, namespace, navigator, window, document, undefined) { +}(function(modules, shared, global, undefined) { 'use strict'; if(!Object.getOwnPropertyDescriptor || !(function () { try { Object.getOwnPropertyDescriptor({ x: 0 }, 'x'); return true; } catch (exception) { return false; } } ())) { @@ -48,5 +48,5 @@ return Object.getOwnPropertyDescriptor; }, - window.qoopido = window.qoopido || {} + this.qoopido = this.qoopido || {} )); \ No newline at end of file diff --git a/src/polyfill/object/getownpropertynames.js b/src/polyfill/object/getownpropertynames.js index 4f1fd5cb..4a5873b7 100644 --- a/src/polyfill/object/getownpropertynames.js +++ b/src/polyfill/object/getownpropertynames.js @@ -20,7 +20,7 @@ } else { (qoopido.modules = qoopido.modules || {})['polyfill/object/getownpropertynames'] = definition(); } -}(function(modules, shared, namespace, navigator, window, document, undefined) { +}(function(modules, shared, global, undefined) { 'use strict'; if(!Object.getOwnPropertyNames) { @@ -44,5 +44,5 @@ return Object.getOwnPropertyNames; }, - window.qoopido = window.qoopido || {} + this.qoopido = this.qoopido || {} )); \ No newline at end of file diff --git a/src/polyfill/object/getprototypeof.js b/src/polyfill/object/getprototypeof.js index cf59e1d6..d315909f 100644 --- a/src/polyfill/object/getprototypeof.js +++ b/src/polyfill/object/getprototypeof.js @@ -15,7 +15,7 @@ } else { (qoopido.modules = qoopido.modules || {})['polyfill/object/getprototypeof'] = definition(); } -}(function(modules, shared, namespace, navigator, window, document, undefined) { +}(function(modules, shared, global, undefined) { 'use strict'; if(!Object.getPrototypeOf) { @@ -32,5 +32,5 @@ return Object.getPrototypeOf; }, - window.qoopido = window.qoopido || {} + this.qoopido = this.qoopido || {} )); \ No newline at end of file diff --git a/src/polyfill/object/keys.js b/src/polyfill/object/keys.js index e38c40e2..121ca0fb 100644 --- a/src/polyfill/object/keys.js +++ b/src/polyfill/object/keys.js @@ -12,9 +12,9 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('polyfill/object/keys', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/object/keys', definition); +}(function(modules, shared, global, undefined) { 'use strict'; if(!Object.keys) { @@ -37,4 +37,4 @@ } return Object.keys; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/string/lcfirst.js b/src/polyfill/string/lcfirst.js index 36efc886..67953904 100644 --- a/src/polyfill/string/lcfirst.js +++ b/src/polyfill/string/lcfirst.js @@ -9,9 +9,9 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('polyfill/string/lcfirst', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/string/lcfirst', definition); +}(function(modules, shared, global, undefined) { 'use strict'; if(!String.prototype.lcfirst) { @@ -23,4 +23,4 @@ } return String.prototype.lcfirst; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/string/trim.js b/src/polyfill/string/trim.js index 9bb44e6d..e9baa042 100644 --- a/src/polyfill/string/trim.js +++ b/src/polyfill/string/trim.js @@ -9,9 +9,9 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('polyfill/string/trim', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/string/trim', definition); +}(function(modules, shared, global, undefined) { 'use strict'; if(!String.prototype.trim) { @@ -23,4 +23,4 @@ } return String.prototype.trim; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/string/ucfirst.js b/src/polyfill/string/ucfirst.js index 4a46c109..401f4e0d 100644 --- a/src/polyfill/string/ucfirst.js +++ b/src/polyfill/string/ucfirst.js @@ -9,9 +9,9 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('polyfill/string/ucfirst', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/string/ucfirst', definition); +}(function(modules, shared, global, undefined) { 'use strict'; if(!String.prototype.ucfirst) { @@ -23,4 +23,4 @@ } return String.prototype.ucfirst; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/window/addeventlistener.js b/src/polyfill/window/addeventlistener.js index de661a99..6f9837c2 100644 --- a/src/polyfill/window/addeventlistener.js +++ b/src/polyfill/window/addeventlistener.js @@ -15,19 +15,21 @@ * @polyfill ../array/indexof */ /* global Window, HTMLDocument, Element */ -;(function(definition) { +;(function(definition, global) { var dependencies = [ ]; if(!Array.prototype.indexOf) { dependencies.push('../array/indexof'); } - window.qoopido.register('polyfill/window/addeventlistener', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('polyfill/window/addeventlistener', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; - if(!window.addEventListener) { - window.addEventListener = Window.prototype.addEventListener = HTMLDocument.prototype.addEventListener = Element.prototype.addEventListener = function addEventListener(type, listener) { + var documentElement = document.documentElement; + + if(!global.addEventListener) { + global.addEventListener = Window.prototype.addEventListener = HTMLDocument.prototype.addEventListener = Element.prototype.addEventListener = function addEventListener(type, listener) { var element = this; if(!element._events) { @@ -61,8 +63,8 @@ event.timeStamp = new Date().getTime(); if(event.clientX) { - event.pageX = event.clientX + document.documentElement.scrollLeft; - event.pageY = event.clientY + document.documentElement.scrollTop; + event.pageX = event.clientX + documentElement.scrollLeft; + event.pageY = event.clientY + documentElement.scrollTop; } for(; (pointer = events[index]) !== undefined && !event.cancelImmediate; ++index) { @@ -80,5 +82,5 @@ }; } - return window.addEventListener; -})); \ No newline at end of file + return global.addEventListener; +}, this)); \ No newline at end of file diff --git a/src/polyfill/window/customevent.js b/src/polyfill/window/customevent.js index 02ee5aaa..168cf0b2 100644 --- a/src/polyfill/window/customevent.js +++ b/src/polyfill/window/customevent.js @@ -13,12 +13,14 @@ * @author Dirk Lueth */ /* global Window */ -;(function(definition) { - window.qoopido.register('polyfill/window/customevent', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/window/customevent', definition); +}(function(modules, shared, global, undefined) { 'use strict'; - if(!window.CustomEvent) { + var document = global.document; + + if(!global.CustomEvent) { var createEvent = (document.createEvent) ? function(type, eventInitDict, detail) { var event = document.createEvent('Event'), @@ -42,7 +44,7 @@ return event; }; - window.CustomEvent = Window.prototype.CustomEvent = function CustomEvent(type, eventInitDict, detail) { + global.CustomEvent = Window.prototype.CustomEvent = function CustomEvent(type, eventInitDict, detail) { if(!type) { throw new Error('Not enough arguments'); } @@ -51,5 +53,5 @@ }; } - return window.CustomEvent; -})); \ No newline at end of file + return global.CustomEvent; +}, this)); \ No newline at end of file diff --git a/src/polyfill/window/dispatchevent.js b/src/polyfill/window/dispatchevent.js index 8eda8ace..468dbc89 100644 --- a/src/polyfill/window/dispatchevent.js +++ b/src/polyfill/window/dispatchevent.js @@ -13,13 +13,13 @@ * @author Dirk Lueth */ /* global Window, HTMLDocument */ -;(function(definition) { - window.qoopido.register('polyfill/window/dispatchevent', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/window/dispatchevent', definition); +}(function(modules, shared, global, undefined) { 'use strict'; - if(!window.dispatchEvent) { - window.dispatchEvent = Window.prototype.dispatchEvent = HTMLDocument.prototype.dispatchEvent = Element.prototype.dispatchEvent = function dispatchEvent(event) { + if(!global.dispatchEvent) { + global.dispatchEvent = Window.prototype.dispatchEvent = HTMLDocument.prototype.dispatchEvent = Element.prototype.dispatchEvent = function dispatchEvent(event) { if(!arguments.length) { throw new Error('Not enough arguments'); } @@ -38,7 +38,7 @@ var cancelBubbleEvent = function(event) { event.cancelBubble = true; - (element || window).detachEvent('on' + type, cancelBubbleEvent); + (element || global).detachEvent('on' + type, cancelBubbleEvent); }; this.attachEvent('on' + type, cancelBubbleEvent); @@ -67,5 +67,5 @@ }; } - return window.dispatchEvent; -})); \ No newline at end of file + return global.dispatchEvent; +}, this)); \ No newline at end of file diff --git a/src/polyfill/window/getcomputedstyle.js b/src/polyfill/window/getcomputedstyle.js index 7adde685..9bce1907 100644 --- a/src/polyfill/window/getcomputedstyle.js +++ b/src/polyfill/window/getcomputedstyle.js @@ -11,12 +11,12 @@ * * @browsers Internet Explorer < 9 */ -;(function(definition) { - window.qoopido.register('polyfill/window/getcomputedstyle', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/window/getcomputedstyle', definition); +}(function(modules, shared, global, undefined) { 'use strict'; - if(!window.getComputedStyle) { + if(!global.getComputedStyle) { var getComputedStyleRegex = new RegExp('(\\-([a-z]){1})', 'g'), getComputedStyleCallback = function() { return arguments[2].toUpperCase(); @@ -40,6 +40,6 @@ return self; }; } else { - return window.getComputedStyle; + return global.getComputedStyle; } -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/polyfill/window/matchmedia.js b/src/polyfill/window/matchmedia.js index 4cd3a79d..c1881255 100644 --- a/src/polyfill/window/matchmedia.js +++ b/src/polyfill/window/matchmedia.js @@ -17,10 +17,10 @@ * * @browsers Chrome < 9, Firefox < 6, Internet Explorer < 10, Opera < 12.1, Safari < 5.1 */ -;(function(definition) { +;(function(definition, global) { var dependencies = [ ]; - if(!window.getComputedStyle) { + if(!global.getComputedStyle) { dependencies.push('polyfill/window/getcomputedstyle'); } @@ -28,11 +28,12 @@ dependencies.push('../array/indexof'); } - window.qoopido.register('polyfill/window/matchmedia', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('polyfill/window/matchmedia', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; var identifier = 'qoopidoPolyfillWindowMatchmedia', + document = global.document, viewport = document.documentElement, queries = [], lookup = {}, @@ -44,12 +45,12 @@ timeout; function detectFeatures() { - var ww = window.innerWidth || viewport.clientWidth, - wh = window.innerHeight || viewport.clientHeight, - dw = window.screen.width, - dh = window.screen.height, - cd = window.screen.colorDepth, - pr = window.devicePixelRatio; + var ww = global.innerWidth || viewport.clientWidth, + wh = global.innerHeight || viewport.clientHeight, + dw = global.screen.width, + dh = global.screen.height, + cd = global.screen.colorDepth, + pr = global.devicePixelRatio; features['width'] = ww; features['height'] = wh; @@ -60,7 +61,7 @@ features['device-height'] = dh; features['device-width'] = dw; features['device-pixel-ratio'] = pr || 1; - features['resolution'] = (pr && pr * 96) || window.screen.deviceXDPI || 96; + features['resolution'] = (pr && pr * 96) || global.screen.deviceXDPI || 96; features['orientation'] = (wh >= ww ? 'portrait' : 'landscape'); } @@ -226,7 +227,7 @@ if(query.listeners) { for(; (listener = query.listeners[j]) !== undefined; j++) { - listener.call(window, query.mql); + listener.call(global, query.mql); } } } @@ -235,18 +236,18 @@ } function delayOnResize() { - window.clearTimeout(timeout); + global.clearTimeout(timeout); - timeout = window.setTimeout(delayedOnResize, 10); + timeout = global.setTimeout(delayedOnResize, 10); } function initialize() { - var target = window.document.getElementsByTagName('script')[0], + var target = document.getElementsByTagName('script')[0], style = document.createElement('style'), types = ['screen', 'print', 'speech', 'projection', 'handheld', 'tv', 'braille', 'embossed', 'tty'], cssText = '#' + identifier + ' { position: relative; z-index: 0; }', prefix = '', - addListener = window.addEventListener || (prefix = 'on') && window.attachEvent, + addListener = global.addEventListener || (prefix = 'on') && global.attachEvent, i = 0, pointer; @@ -265,7 +266,7 @@ style.textContent = cssText; } - features.type = types[((window.getComputedStyle || modules['polyfill/window/getcomputedstyle'])(style).zIndex * 1) || 0]; + features.type = types[((global.getComputedStyle || modules['polyfill/window/getcomputedstyle'])(style).zIndex * 1) || 0]; style.parentNode.removeChild(style); @@ -273,11 +274,11 @@ addListener(prefix + 'orientationchange', delayOnResize); } - if(!window.matchMedia) { + if(!global.matchMedia) { initialize(); detectFeatures(); - window.matchMedia = function(query) { + global.matchMedia = function(query) { var index = lookup[query] || false; if(index === false) { @@ -288,5 +289,5 @@ }; } - return window.matchMedia; -})); \ No newline at end of file + return global.matchMedia; +}, this)); \ No newline at end of file diff --git a/src/polyfill/window/promise.js b/src/polyfill/window/promise.js index eb12a4c0..ba1113b7 100644 --- a/src/polyfill/window/promise.js +++ b/src/polyfill/window/promise.js @@ -12,14 +12,14 @@ * * @author Dirk Lueth */ -;(function(definition) { - window.qoopido.register('polyfill/window/promise', definition); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('polyfill/window/promise', definition); +}(function(modules, shared, global, undefined) { 'use strict'; var isObject = function(value) { return typeof value === 'object'; }, isFunction = function(value) { return typeof value === 'function';}, - asap = (isFunction(window.setImmediate) && window.setImmediate) || function(fn) { setTimeout(fn, 1);}; + asap = (isFunction(global.setImmediate) && global.setImmediate) || function(fn) { setTimeout(fn, 1);}; function bind(fn, context) { return function() { @@ -195,9 +195,9 @@ }); }; - if(!window.Promise) { - window.Promise = Promise; + if(!global.Promise) { + global.Promise = Promise; } - return window.Promise; -})); \ No newline at end of file + return global.Promise; +}, this)); \ No newline at end of file diff --git a/src/polyfill/window/removeeventlistener.js b/src/polyfill/window/removeeventlistener.js index d7b05d22..8fb32a25 100644 --- a/src/polyfill/window/removeeventlistener.js +++ b/src/polyfill/window/removeeventlistener.js @@ -15,19 +15,19 @@ * @polyfill ../array/indexof */ /* global Window, HTMLDocument */ -;(function(definition) { +;(function(definition, global) { var dependencies = [ ]; if(!Array.prototype.indexOf) { dependencies.push('../array/indexof'); } - window.qoopido.register('polyfill/window/removeeventlistener', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('polyfill/window/removeeventlistener', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; - if(!window.removeEventListener) { - window.removeEventListener = Window.prototype.removeEventListener = HTMLDocument.prototype.removeEventListener = Element.prototype.removeEventListener = function removeEventListener(type, listener) { + if(!global.removeEventListener) { + global.removeEventListener = Window.prototype.removeEventListener = HTMLDocument.prototype.removeEventListener = Element.prototype.removeEventListener = function removeEventListener(type, listener) { var element = this; if(element._events && element._events[type] && element._events[type].list) { @@ -44,5 +44,5 @@ }; } - return window.removeEventListener; -})); \ No newline at end of file + return global.removeEventListener; +}, this)); \ No newline at end of file diff --git a/src/pool.js b/src/pool.js index 2389ffff..b2faa7ad 100644 --- a/src/pool.js +++ b/src/pool.js @@ -15,9 +15,9 @@ * @require ./function/merge * @require ./function/unique/uuid */ -;(function(definition) { - window.qoopido.register('pool', definition, [ './base', './function/merge', './function/unique/uuid' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('pool', definition, [ './base', './function/merge', './function/unique/uuid' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype, @@ -155,4 +155,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/pool/array.js b/src/pool/array.js index 1365f23b..3235fdaa 100644 --- a/src/pool/array.js +++ b/src/pool/array.js @@ -13,9 +13,9 @@ * * @require ../pool */ -;(function(definition) { - window.qoopido.register('pool/array', definition, [ '../pool' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('pool/array', definition, [ '../pool' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype = modules['pool'].extend({ @@ -33,4 +33,4 @@ shared.pool.array = prototype.create(); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/pool/dom.js b/src/pool/dom.js index 576fdc4a..62d164b9 100644 --- a/src/pool/dom.js +++ b/src/pool/dom.js @@ -13,9 +13,9 @@ * * @require ../pool */ -;(function(definition) { - window.qoopido.register('pool/dom', definition, [ '../pool' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('pool/dom', definition, [ '../pool' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype = modules['pool'].extend({ @@ -59,4 +59,4 @@ shared.pool.dom = prototype.create(); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/pool/module.js b/src/pool/module.js index 977a09bd..2ecc3de7 100644 --- a/src/pool/module.js +++ b/src/pool/module.js @@ -14,9 +14,9 @@ * @require ../pool * @require ../function/unique/uuid */ -;(function(definition) { - window.qoopido.register('pool/module', definition, [ '../pool', '../function/unique/uuid' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('pool/module', definition, [ '../pool', '../function/unique/uuid' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var generateUuid = modules['function/unique/uuid']; @@ -58,4 +58,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/pool/object.js b/src/pool/object.js index 92e8f327..4ef4a653 100644 --- a/src/pool/object.js +++ b/src/pool/object.js @@ -13,12 +13,13 @@ * * @require ../pool */ -;(function(definition) { - window.qoopido.register('pool/object', definition, [ '../pool' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('pool/object', definition, [ '../pool' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype, + document = global.document, supportsProto = (Object.prototype.__proto__ === null), objectPrototype = (supportsProto) ? '__proto__' : 'prototype', model = (supportsProto) ? null : (function() { @@ -67,4 +68,4 @@ shared.pool.object = prototype.create(); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/promise/all.js b/src/promise/all.js index 827aeb68..0ca358a7 100644 --- a/src/promise/all.js +++ b/src/promise/all.js @@ -14,15 +14,15 @@ * * @polyfill ../polyfill/window/promise */ -;(function(definition) { +;(function(definition, global) { var dependencies = []; - if(!window.Promise) { + if(!global.Promise) { dependencies.push('../polyfill/window/promise'); } - window.qoopido.register('promise/all', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('promise/all', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; return function all(promises) { @@ -30,7 +30,7 @@ throw new TypeError('You must pass an array to all.'); } - return new window.Promise(function(resolve, reject) { + return new global.Promise(function(resolve, reject) { var results = [], remaining = promises.length, i = 0, promise; @@ -62,4 +62,4 @@ } }); }; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/promise/defer.js b/src/promise/defer.js index 0297d6c7..0b345c1a 100644 --- a/src/promise/defer.js +++ b/src/promise/defer.js @@ -14,23 +14,23 @@ * * @polyfill ../polyfill/window/promise */ -;(function(definition) { +;(function(definition, global) { var dependencies = []; - if(!window.Promise) { + if(!global.Promise) { dependencies.push('../polyfill/window/promise'); } - window.qoopido.register('promise/defer', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('promise/defer', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; return function defer() { var self = this; - self.promise = new window.Promise(function(resolve, reject) { + self.promise = new global.Promise(function(resolve, reject) { self.resolve = resolve; self.reject = reject; }); }; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/promise/race.js b/src/promise/race.js index 2d4dc096..c6162417 100644 --- a/src/promise/race.js +++ b/src/promise/race.js @@ -14,15 +14,15 @@ * * @polyfill ../polyfill/window/promise */ -;(function(definition) { +;(function(definition, global) { var dependencies = []; - if(!window.Promise) { + if(!global.Promise) { dependencies.push('../polyfill/window/promise'); } - window.qoopido.register('promise/race', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.register('promise/race', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; return function race(promises) { @@ -30,7 +30,7 @@ throw new TypeError('You must pass an array to all.'); } - return new window.Promise(function(resolve, reject) { + return new global.Promise(function(resolve, reject) { var i = 0, promise; for(; (promise = promises[i]) !== undefined; i++) { @@ -42,4 +42,4 @@ } }); }; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/proxy.js b/src/proxy.js index 3b64d1e8..77ff2ddb 100644 --- a/src/proxy.js +++ b/src/proxy.js @@ -12,9 +12,9 @@ * @require ./base * @require ./function/unique/uuid */ -;(function(definition) { - window.qoopido.register('proxy', definition, [ './base', './function/unique/uuid' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('proxy', definition, [ './base', './function/unique/uuid' ]); +}(function(modules, shared, global, undefined) { 'use strict'; return modules['base'].extend({ @@ -29,4 +29,4 @@ return proxy; } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/renderer.js b/src/renderer.js index c5d49a2b..0c668f63 100755 --- a/src/renderer.js +++ b/src/renderer.js @@ -15,20 +15,21 @@ * @require ./support * @require ./dom/element */ -;(function(definition) { - window.qoopido.registerSingleton('renderer', definition, [ './emitter', './support', './dom/element' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.registerSingleton('renderer', definition, [ './emitter', './support', './dom/element' ]); +}(function(modules, shared, global, undefined) { 'use strict'; function requestAnimationFrameFallback(callback) { - return window.setTimeout(callback, targetInterval); + return global.setTimeout(callback, targetInterval); } var prototype, + document = global.document, mSupport = modules['support'], qDocument = modules['dom/element'].create(document), - requestAnimationFrame = window[mSupport.getMethod('requestAnimationFrame')] || requestAnimationFrameFallback, - cancelAnimationFrame = window[mSupport.getMethod('cancelAnimationFrame')] || clearTimeout, + requestAnimationFrame = global[mSupport.getMethod('requestAnimationFrame')] || requestAnimationFrameFallback, + cancelAnimationFrame = global[mSupport.getMethod('cancelAnimationFrame')] || clearTimeout, visibilityProperty = mSupport.getProperty('hidden', document), targetFramerate = 60, targetInterval = 1000 / targetFramerate, @@ -105,4 +106,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support.js b/src/support.js index f6720b03..c02ba792 100644 --- a/src/support.js +++ b/src/support.js @@ -18,7 +18,7 @@ * @polyfill ./polyfill/string/lcfirst * @optional ./pool/dom */ -;(function(definition) { +;(function(definition, global) { var dependencies = [ './base', './promise/all', './promise/defer' ]; if(!String.prototype.ucfirst) { @@ -29,11 +29,12 @@ dependencies.push('./polyfill/string/lcfirst'); } - window.qoopido.registerSingleton('support', definition, dependencies); -}(function(modules, shared, namespace, navigator, window, document, undefined) { + global.qoopido.registerSingleton('support', definition, dependencies); +}(function(modules, shared, global, undefined) { 'use strict'; - var CombinedPromise = modules['promise/all'], + var document = global.document, + CombinedPromise = modules['promise/all'], DeferredPromise = modules['promise/defer'], matchPrefix = new RegExp('^(Moz|WebKit|Khtml|ms|O|Icab)(?=[A-Z])'), removeJsPrefix = new RegExp('^(?:webkit|khtml|icab|moz|ms|o)([A-Z])'), @@ -125,7 +126,7 @@ }, getMethod: function(pMethod, pElement) { pMethod = normalize(pMethod); - pElement = pElement || window; + pElement = pElement || global; var type = pElement.tagName, pointer = lookup.method[type] = lookup.method[type] || { }, @@ -159,7 +160,7 @@ }, getProperty: function(pProperty, pElement) { pProperty = normalize(pProperty); - pElement = pElement || window; + pElement = pElement || global; var type = pElement.tagName, pointer = lookup.property[type] = lookup.property[type] || { }, @@ -254,7 +255,7 @@ return stored; }, testMethod: function(pMethod, pElement) { - pElement = pElement || window; + pElement = pElement || global; var type = pElement.tagName, pointer = lookup.promises.method[type] = lookup.promises.method[type] || { }, @@ -272,7 +273,7 @@ return stored; }, testProperty: function(pProperty, pElement) { - pElement = pElement || window; + pElement = pElement || global; var type = pElement.tagName, pointer = lookup.promises.property[type] = lookup.promises.property[type] || { }, @@ -322,4 +323,4 @@ }; } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/capability/datauri.js b/src/support/capability/datauri.js index 89b84c5e..08a1847c 100644 --- a/src/support/capability/datauri.js +++ b/src/support/capability/datauri.js @@ -13,9 +13,9 @@ * @require ../../dom/element */ -;(function(definition) { - window.qoopido.register('support/capability/datauri', definition, [ '../../support', '../../dom/element' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/capability/datauri', definition, [ '../../support', '../../dom/element' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -35,4 +35,4 @@ }, false) .setAttribute('src', 'data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/capability/touch.js b/src/support/capability/touch.js index 6c3fd673..ffb37791 100644 --- a/src/support/capability/touch.js +++ b/src/support/capability/touch.js @@ -14,12 +14,14 @@ /* global DocumentTouch */ -;(function(definition) { - window.qoopido.register('support/capability/touch', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/capability/touch', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; + var navigator = global.navigator; + return modules['support'].addTest('/capability/touch', function(deferred) { - (('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) ? deferred.resolve() : deferred.reject(); + (('ontouchstart' in global) || (global.DocumentTouch && document instanceof DocumentTouch) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)) ? deferred.resolve() : deferred.reject(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/borderradius.js b/src/support/css/borderradius.js index 499861d3..e721b19f 100644 --- a/src/support/css/borderradius.js +++ b/src/support/css/borderradius.js @@ -12,12 +12,12 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/css/borderradius', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/borderradius', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; return modules['support'].addTest('/css/borderradius', function(deferred) { (modules['support'].supportsCssProperty('border-radius')) ? deferred.resolve(modules['support'].getCssProperty('border-radius')) : deferred.reject(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/boxshadow.js b/src/support/css/boxshadow.js index 713469dd..ea2f5257 100644 --- a/src/support/css/boxshadow.js +++ b/src/support/css/boxshadow.js @@ -12,12 +12,12 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/css/boxshadow', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/boxshadow', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; return modules['support'].addTest('/css/boxshadow', function(deferred) { (modules['support'].supportsCssProperty('box-shadow')) ? deferred.resolve(modules['support'].getCssProperty('box-shadow')) : deferred.reject(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/rem.js b/src/support/css/rem.js index 30cc64cd..1e18b198 100644 --- a/src/support/css/rem.js +++ b/src/support/css/rem.js @@ -12,9 +12,9 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/css/rem', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/rem', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -31,4 +31,4 @@ sample.dispose && sample.dispose(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/rgba.js b/src/support/css/rgba.js index 8c989cc6..30784785 100644 --- a/src/support/css/rgba.js +++ b/src/support/css/rgba.js @@ -12,9 +12,9 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/css/rgba', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/rgba', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -30,4 +30,4 @@ sample.dispose && sample.dispose(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/textshadow.js b/src/support/css/textshadow.js index dc223862..393b46fc 100644 --- a/src/support/css/textshadow.js +++ b/src/support/css/textshadow.js @@ -12,12 +12,12 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/css/textshadow', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/textshadow', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; return modules['support'].addTest('/css/textshadow', function(deferred) { (modules['support'].supportsCssProperty('text-shadow')) ? deferred.resolve(modules['support'].getCssProperty('text-shadow')) : deferred.reject(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/transform.js b/src/support/css/transform.js index 0ea44474..4068d6c0 100644 --- a/src/support/css/transform.js +++ b/src/support/css/transform.js @@ -12,12 +12,12 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/css/transform', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/transform', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; return modules['support'].addTest('/css/transform', function(deferred) { (modules['support'].supportsCssProperty('transform')) ? deferred.resolve(modules['support'].getCssProperty('transform')) : deferred.reject(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/transform/2d.js b/src/support/css/transform/2d.js index 8132d897..d282222c 100644 --- a/src/support/css/transform/2d.js +++ b/src/support/css/transform/2d.js @@ -13,9 +13,9 @@ * @require ../transform */ -;(function(definition) { - window.qoopido.register('support/css/transform/2d', definition, [ '../../../support', '../transform' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/transform/2d', definition, [ '../../../support', '../transform' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -40,4 +40,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/transform/3d.js b/src/support/css/transform/3d.js index 593c9c50..34bec4b5 100644 --- a/src/support/css/transform/3d.js +++ b/src/support/css/transform/3d.js @@ -13,9 +13,9 @@ * @require ../transform */ -;(function(definition) { - window.qoopido.register('support/css/transform/3d', definition, [ '../../../support', '../transform' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/transform/3d', definition, [ '../../../support', '../transform' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -40,4 +40,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/css/transition.js b/src/support/css/transition.js index e98113d8..5bae8574 100644 --- a/src/support/css/transition.js +++ b/src/support/css/transition.js @@ -12,12 +12,12 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/css/transition', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/css/transition', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; return modules['support'].addTest('/css/transition', function(deferred) { (modules['support'].supportsCssProperty('transition')) ? deferred.resolve(modules['support'].getCssProperty('transition')) : deferred.reject(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/canvas.js b/src/support/element/canvas.js index fbb777c7..08d68030 100644 --- a/src/support/element/canvas.js +++ b/src/support/element/canvas.js @@ -12,9 +12,9 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/element/canvas', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/canvas', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -26,4 +26,4 @@ sample.dispose && sample.dispose(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/canvas/todataurl.js b/src/support/element/canvas/todataurl.js index e7987924..9c53f5c8 100644 --- a/src/support/element/canvas/todataurl.js +++ b/src/support/element/canvas/todataurl.js @@ -13,9 +13,9 @@ * @require ../canvas */ -;(function(definition) { - window.qoopido.register('support/element/canvas/todataurl', definition, [ '../../../support', '../canvas' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/canvas/todataurl', definition, [ '../../../support', '../canvas' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -35,4 +35,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/canvas/todataurl/jpeg.js b/src/support/element/canvas/todataurl/jpeg.js index 466d1ee5..eb0a98a3 100644 --- a/src/support/element/canvas/todataurl/jpeg.js +++ b/src/support/element/canvas/todataurl/jpeg.js @@ -13,9 +13,9 @@ * @require ../todataurl */ -;(function(definition) { - window.qoopido.register('support/element/canvas/todataurl/jpeg', definition, [ '../../../../support', '../todataurl' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/canvas/todataurl/jpeg', definition, [ '../../../../support', '../todataurl' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -35,4 +35,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/canvas/todataurl/png.js b/src/support/element/canvas/todataurl/png.js index 99f45e2f..78e2e856 100644 --- a/src/support/element/canvas/todataurl/png.js +++ b/src/support/element/canvas/todataurl/png.js @@ -13,9 +13,9 @@ * @require ../todataurl */ -;(function(definition) { - window.qoopido.register('support/element/canvas/todataurl/png', definition, [ '../../../../support', '../todataurl' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/canvas/todataurl/png', definition, [ '../../../../support', '../todataurl' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -35,4 +35,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/canvas/todataurl/webp.js b/src/support/element/canvas/todataurl/webp.js index f27da55b..d353298a 100644 --- a/src/support/element/canvas/todataurl/webp.js +++ b/src/support/element/canvas/todataurl/webp.js @@ -13,9 +13,9 @@ * @require ../todataurl */ -;(function(definition) { - window.qoopido.register('support/element/canvas/todataurl/webp', definition, [ '../../../../support', '../todataurl' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/canvas/todataurl/webp', definition, [ '../../../../support', '../todataurl' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -35,4 +35,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/svg.js b/src/support/element/svg.js index 480724a0..d306bb61 100644 --- a/src/support/element/svg.js +++ b/src/support/element/svg.js @@ -12,12 +12,14 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/element/svg', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/svg', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; + var document = global.document; + return modules['support'].addTest('/element/svg', function(deferred) { (document.createElementNS && document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect) ? deferred.resolve() : deferred.reject(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/video.js b/src/support/element/video.js index 13ef187c..0cd5edae 100644 --- a/src/support/element/video.js +++ b/src/support/element/video.js @@ -12,9 +12,9 @@ * @require ../../support */ -;(function(definition) { - window.qoopido.register('support/element/video', definition, [ '../../support' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/video', definition, [ '../../support' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -26,4 +26,4 @@ sample.dispose && sample.dispose(); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/video/mp4.js b/src/support/element/video/mp4.js index 237d705d..2a9d8ff7 100644 --- a/src/support/element/video/mp4.js +++ b/src/support/element/video/mp4.js @@ -13,9 +13,9 @@ * @require ../video */ -;(function(definition) { - window.qoopido.register('support/element/video/mp4', definition, [ '../../../support', '../video' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/video/mp4', definition, [ '../../../support', '../video' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -35,4 +35,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/video/ogg.js b/src/support/element/video/ogg.js index 1402fdb2..602bc79d 100644 --- a/src/support/element/video/ogg.js +++ b/src/support/element/video/ogg.js @@ -13,9 +13,9 @@ * @require ../video */ -;(function(definition) { - window.qoopido.register('support/element/video/ogg', definition, [ '../../../support', '../video' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/video/ogg', definition, [ '../../../support', '../video' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -35,4 +35,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/support/element/video/webm.js b/src/support/element/video/webm.js index 61ddd1c6..67394d27 100644 --- a/src/support/element/video/webm.js +++ b/src/support/element/video/webm.js @@ -13,9 +13,9 @@ * @require ../video */ -;(function(definition) { - window.qoopido.register('support/element/video/webm', definition, [ '../../../support', '../video' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('support/element/video/webm', definition, [ '../../../support', '../video' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var support = modules['support']; @@ -35,4 +35,4 @@ } ); }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/transport.js b/src/transport.js index 31e2af59..2a79e258 100644 --- a/src/transport.js +++ b/src/transport.js @@ -14,9 +14,9 @@ * @require ./base * @require ./function/merge */ -;(function(definition) { - window.qoopido.register('transport', definition, [ './base', './function/merge' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('transport', definition, [ './base', './function/merge' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype; @@ -44,4 +44,4 @@ }); return prototype; -}, window, document)); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/transport/jsonp.js b/src/transport/jsonp.js index 1a158153..7959da1d 100644 --- a/src/transport/jsonp.js +++ b/src/transport/jsonp.js @@ -19,12 +19,13 @@ * @require ../promise/defer * @optional ./pool/dom */ -;(function(definition) { - window.qoopido.registerSingleton('transport/jsonp', definition, [ '../transport', '../function/merge', '../function/unique/uuid', '../url', '../dom/element', '../promise/defer' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.registerSingleton('transport/jsonp', definition, [ '../transport', '../function/merge', '../function/unique/uuid', '../url', '../dom/element', '../promise/defer' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype, + document = global.document, DeferredPromise = modules['promise/defer'], pool = shared.pool && shared.pool.dom, head = document.getElementsByTagName('head')[0]; @@ -40,11 +41,11 @@ url = (settings.cache === false) ? ''.concat(url, (url.indexOf('?') > -1) ? '&' : '?', ''.concat('_=', new Date().getTime().toString())) : url; url = (content) ? ''.concat(url, (url.indexOf('?') > -1) ? '&' : '?', content) : url; - window[self.id] = function(data) { + global[self.id] = function(data) { try { - delete window[self.id]; + delete global[self.id]; } catch (exception) { - window[self.id] = null; + global[self.id] = null; } clear.call(self); @@ -132,4 +133,4 @@ }); return prototype; -}, window, document)); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/transport/xhr.js b/src/transport/xhr.js index 0562fbd9..c8ef413a 100644 --- a/src/transport/xhr.js +++ b/src/transport/xhr.js @@ -20,19 +20,19 @@ /* global ActiveXObject */ -;(function(definition) { - window.qoopido.registerSingleton('transport/xhr', definition, [ '../transport', '../function/merge', '../function/unique/string', '../url', '../promise/defer' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.registerSingleton('transport/xhr', definition, [ '../transport', '../function/merge', '../function/unique/string', '../url', '../promise/defer' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype, DeferredPromise = modules['promise/defer'], - getXhr = (typeof window.XMLHttpRequest !== 'undefined') ? + getXhr = (typeof global.XMLHttpRequest !== 'undefined') ? function(url) { if(modules['url'].isLocal(url)) { - return new window.XMLHttpRequest(); + return new global.XMLHttpRequest(); } else { - return window.XDomainRequest ? new window.XDomainRequest() : new window.XMLHttpRequest(); + return global.XDomainRequest ? new global.XDomainRequest() : new global.XMLHttpRequest(); } } : function() { @@ -175,4 +175,4 @@ }); return prototype; -}, window, document)); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/url.js b/src/url.js index 76c1abb9..d6282067 100644 --- a/src/url.js +++ b/src/url.js @@ -13,13 +13,13 @@ * * @require ./base */ -;(function(definition) { - window.qoopido.registerSingleton('url', definition, [ './base' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.registerSingleton('url', definition, [ './base' ]); +}(function(modules, shared, global, undefined) { 'use strict'; - var urlCurrent, regexLocal, - regexParameter = new RegExp('[?&]?([^=]+)=([^&]*)', 'g'); + var regexParameter = new RegExp('[?&]?([^=]+)=([^&]*)', 'g'), + urlCurrent, regexLocal; try { urlCurrent = location; @@ -42,7 +42,7 @@ return getResolver(url).href; }, redirect: function redirect(url, target) { - target = target || window; + target = target || global; target.location.href = this.resolve(url); }, @@ -61,4 +61,4 @@ return regexLocal.test(this.resolve(url)); } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/vector/2d.js b/src/vector/2d.js index b06c95f6..94127ecd 100644 --- a/src/vector/2d.js +++ b/src/vector/2d.js @@ -14,9 +14,9 @@ * @require ../base * @optional ./pool/object */ -;(function(definition) { - window.qoopido.register('vector/2d', definition, [ '../base' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('vector/2d', definition, [ '../base' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype, @@ -96,4 +96,4 @@ }); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/widget/image/adapt.js b/src/widget/image/adapt.js index 3a81472a..2b59d025 100644 --- a/src/widget/image/adapt.js +++ b/src/widget/image/adapt.js @@ -16,9 +16,9 @@ * @require ../../component/sense */ -;(function(definition) { - window.qoopido.register('widget/image/adapt', definition, [ '../../dom/element', '../../dom/element/emerge', '../../component/sense' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('widget/image/adapt', definition, [ '../../dom/element', '../../dom/element/emerge', '../../component/sense' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var prototype, @@ -59,7 +59,7 @@ boundingbox = image.element.getBoundingClientRect(); width = Math.round(boundingbox.width); height = Math.round(boundingbox.width * candidate.ratio); - url = candidate.url.replace(regex, '$1.' + width + 'x' + height + '@' + (window.devicePixelRatio || 1) + '.$2'); + url = candidate.url.replace(regex, '$1.' + width + 'x' + height + '@' + (global.devicePixelRatio || 1) + '.$2'); image.setAttribute('src', url); } @@ -78,9 +78,9 @@ } function delayOnResize() { - window.clearTimeout(timeout); + global.clearTimeout(timeout); - timeout = window.setTimeout(delayedOnResize, 200); + timeout = global.setTimeout(delayedOnResize, 200); } prototype = modules['dom/element/emerge'].extend({ @@ -131,8 +131,8 @@ }); mDomElement - .create(window) + .create(global) .on('resize orientationchange', delayOnResize); return prototype; -})); \ No newline at end of file +}, this)); \ No newline at end of file diff --git a/src/worker.js b/src/worker.js index ea220bb8..5e5a6b67 100644 --- a/src/worker.js +++ b/src/worker.js @@ -15,24 +15,24 @@ * @require ./support * @require ./promise/defer */ -;(function(definition) { - window.qoopido.register('worker', definition, [ './base', './support', './promise/defer' ]); -}(function(modules, shared, namespace, navigator, window, document, undefined) { +;(function(definition, global) { + global.qoopido.register('worker', definition, [ './base', './support', './promise/defer' ]); +}(function(modules, shared, global, undefined) { 'use strict'; var DeferredPromise = modules['promise/defer'], regex = new RegExp('Blob$', 'i'), supportsWorker = modules['support'].supportsMethod('Worker'), - urlMethod = modules['support'].supportsMethod('URL') ? window[modules['support'].getMethod('URL')] : null, + urlMethod = modules['support'].supportsMethod('URL') ? global[modules['support'].getMethod('URL')] : null, blobMethod = modules['support'].getMethod('Blob') || modules['support'].getMethod('BlobBuilder'), workerSource = "var self = this, regex = new RegExp(',\\s+', 'g'); self.addEventListener('message', function(pEvent) { self.postMessage({ type: 'result', result: self.process(pEvent.data.func).apply(null, pEvent.data.args)}); }, false); self.postProgress = function(pProgress) { self.postMessage({ type: 'progress', progress: pProgress}); }; self.process = function(pFunction) { var functionArguments = pFunction.substring(pFunction.indexOf('(') + 1, pFunction.indexOf(')')).replace(regex, ',').split(','); functionArguments.push(pFunction.substring(pFunction.indexOf('{') + 1, pFunction.lastIndexOf('}'))); return Function.apply(null, functionArguments); };", task = null; if(supportsWorker && urlMethod && blobMethod) { if(regex.test(blobMethod) === true) { - task = urlMethod.createObjectURL(new window[blobMethod]([ workerSource ], {type: 'text/javascript'})); + task = urlMethod.createObjectURL(new global[blobMethod]([ workerSource ], {type: 'text/javascript'})); } else { - task = urlMethod.createObjectURL(new window[blobMethod]().append(workerSource).getBlob('text/javascript')); + task = urlMethod.createObjectURL(new global[blobMethod]().append(workerSource).getBlob('text/javascript')); } } @@ -71,4 +71,4 @@ return deferred.promise; } }); -})); \ No newline at end of file +}, this)); \ No newline at end of file