From af4eb3a262c127eca6a45b0389d6a0b0346c7722 Mon Sep 17 00:00:00 2001 From: Quentin Brooks Date: Fri, 12 Jun 2015 12:48:24 -0700 Subject: [PATCH 1/3] Changed Uize.js so static function can be overriden before Uize.js is loaded, preventing the need to special case the loading of Uize.js --- site-source/js/Uize.js | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/site-source/js/Uize.js b/site-source/js/Uize.js index 1542c413..997bf6d0 100644 --- a/site-source/js/Uize.js +++ b/site-source/js/Uize.js @@ -26,6 +26,21 @@ Utility Belt Methods The =Uize= module provides a slew of utility belt methods that can be divided into the following categories... + Uize Overrides + =Uize= functions can be overriden by defining a =Uize= function before loading of the Uize module. For example... + + .................................................................................... + window.Uize = window.Uize || function(){}; + Uize.moduleUrlResolver = function (_moduleName) { + var _modulePath = Uize.modulePathResolver (_moduleName); + return ( + moduleName.indexOf ('MyDomain.') == 0 + ? '/js/' + _modulePath + '.js' + : 'http://www.some-cdn.com/uize-js/' + _modulePath + '.js' + ); + }; + .................................................................................... + Module Mechanism Methods The =Uize= module provides static methods for declaring your own JavaScript modules, requiring modules, and configuring the `module loader mechanism` to suit your application environment. @@ -299,12 +314,12 @@ This is just like immediate invokation of an anonymous function, except with the additional wrapper of the =Uize.quarantine= call. */ -Uize = (function () { +Uize = (function (_UizeOverrides) { 'use strict'; var /*** Variables for Scruncher Optimization ***/ - _package = function () {}, + _package = _UizeOverrides || function () { }, _undefined, _typeString = 'string', _typeObject = 'object', @@ -392,12 +407,21 @@ Uize = (function () { return _target; } - function _copySourceIntoTarget (_target,_source) { + function _copySourceIntoTarget(_target, _source) { for (var _property in _source) - _target [_property] = _source [_property] + _target[_property] = _source[_property] ; return _target; } + function _copyNewFromSourceIntoTarget (_target, _source) { + for (var _property in _source) { + //Only copy if it is a new property + if (!(_property in _target)) { + _target[_property] = _source[_property]; + } + } + return _target; + } function _mergeSourceIntoTarget (_target,_source) { var @@ -414,7 +438,7 @@ Uize = (function () { ; } - _copySourceIntoTarget ( + _copyNewFromSourceIntoTarget ( _package, { capFirstChar:function (_sourceStr) { @@ -5400,7 +5424,7 @@ Uize = (function () { ); } - _copySourceIntoTarget ( + _copyNewFromSourceIntoTarget( _package, { getModuleByName:_getModuleByName = function (_moduleName) { @@ -6049,5 +6073,5 @@ Uize = (function () { _package.addFolderOrgNamespaces ('Uize'); _package.module ({name:'Uize',builder:function () {return _package}}); - return _package; -}) (); + return _package; +}) ((function () {return this}) ().Uize); From 9ee2a70aa419b58b7a1649cc3f168042881679f1 Mon Sep 17 00:00:00 2001 From: Quentin Brooks Date: Fri, 12 Jun 2015 14:27:32 -0700 Subject: [PATCH 2/3] Spaces. --- site-source/js/Uize.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/site-source/js/Uize.js b/site-source/js/Uize.js index 997bf6d0..a0a88aaf 100644 --- a/site-source/js/Uize.js +++ b/site-source/js/Uize.js @@ -407,17 +407,17 @@ Uize = (function (_UizeOverrides) { return _target; } - function _copySourceIntoTarget(_target, _source) { + function _copySourceIntoTarget (_target,_source) { for (var _property in _source) - _target[_property] = _source[_property] + _target [_property] = _source [_property] ; return _target; } - function _copyNewFromSourceIntoTarget (_target, _source) { + function _copyNewFromSourceIntoTarget (_target,_source) { for (var _property in _source) { //Only copy if it is a new property if (!(_property in _target)) { - _target[_property] = _source[_property]; + _target [_property] = _source [_property]; } } return _target; From c45886a5d4891fd96ecd0f55f2243a938acefba2 Mon Sep 17 00:00:00 2001 From: Quentin Brooks Date: Fri, 12 Jun 2015 14:31:05 -0700 Subject: [PATCH 3/3] Spaces part 2 --- site-source/js/Uize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site-source/js/Uize.js b/site-source/js/Uize.js index a0a88aaf..f3f26028 100644 --- a/site-source/js/Uize.js +++ b/site-source/js/Uize.js @@ -6073,5 +6073,5 @@ Uize = (function (_UizeOverrides) { _package.addFolderOrgNamespaces ('Uize'); _package.module ({name:'Uize',builder:function () {return _package}}); - return _package; + return _package; }) ((function () {return this}) ().Uize);