7 new revisions:
Revision: adffc5811706
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Wed Aug 15 15:37:41 2012
Log: Use event bubbling to simplify extensions. Update event-log,
google-a...
http://code.google.com/p/iui/source/detail?r=adffc5811706
Revision: 7db2cf8cc565
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Thu Aug 16 00:42:14 2012
Log: Merge branch 'master' of
https://github.com/iui/iUI into
msgilligan-ev...
http://code.google.com/p/iui/source/detail?r=7db2cf8cc565
Revision: 7b3194eeb4dc
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Thu Aug 16 01:00:58 2012
Log: Use bubbling to simplify iui-canvg and iui-video plugins, too.
http://code.google.com/p/iui/source/detail?r=7b3194eeb4dc
Revision: d7b24d62dece
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Tue Aug 28 00:33:00 2012
Log: Namespace all events to iui.eventname, simplify TbBMod.js with
bubblin...
http://code.google.com/p/iui/source/detail?r=d7b24d62dece
Revision: fb75de33a03e
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Tue Aug 28 00:33:13 2012
Log: Fix typos
http://code.google.com/p/iui/source/detail?r=fb75de33a03e
Revision: d9752d581503
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Tue Aug 28 00:45:19 2012
Log: Merge branch 'master' of
https://github.com/iui/iUI into
msgilligan-ev...
http://code.google.com/p/iui/source/detail?r=d9752d581503
Revision: d04bbee2b910
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Wed Aug 29 09:19:47 2012
Log: Merge pull request #6 from msgilligan/msgilligan-event-bubbling...
http://code.google.com/p/iui/source/detail?r=d04bbee2b910
==============================================================================
Revision: adffc5811706
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Wed Aug 15 15:37:41 2012
Log: Use event bubbling to simplify extensions. Update event-log,
google-analytics, and unloader extensions to use it.
http://code.google.com/p/iui/source/detail?r=adffc5811706
Modified:
/web-app/iui/ext-sandbox/google-analytics/iui-google-analytics.js
/web-app/iui/ext-sandbox/unloader/iui-unloader.js
/web-app/iui/iui.js
/web-app/iui/js/iui-event-log.js
=======================================
--- /web-app/iui/ext-sandbox/google-analytics/iui-google-analytics.js Tue
Aug 14 18:07:04 2012
+++ /web-app/iui/ext-sandbox/google-analytics/iui-google-analytics.js Wed
Aug 15 15:37:41 2012
@@ -4,7 +4,7 @@
*/
//
-// For an example see web-app/index.html
+// For an example see web-app/mobile/demos.html
//
// Assumes that Google Analytics has been installed in the page in
asynchronous mode
// Typically this is done by inserting the recommended script tag and
contents at the bottom
@@ -22,32 +22,13 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('afterinsert', afterInsert, false);
-// This will register event handlers on all initial nodes
-// We'll also need to register handlers on inserted (via ajax) nodes
-// To do that we'll need to use the afterInsert event
- var nodes = iui.getAllViews();
- for (var i = 0; i < nodes.length ; i++)
- {
- registerEvents(nodes[i]);
- }
+ document.body.addEventListener('focus', trackEvent, false);
}, false);
-
-function registerEvents(node)
-{
- node.addEventListener('focus', trackEvent, false);
-}
-
-function afterInsert(e)
-{
- registerEvents(e.insertedNode); // Set event handlers on newly added node
-}
function trackEvent(e)
{
// console.log("trackEvent type: " + e.type + " target " +
e.target.tagName + "#" +
e.target.id);
_gaq.push(['_trackEvent', 'iUI', 'focus', e.target.tagName + "#" +
e.target.id]);
}
-
})();
=======================================
--- /web-app/iui/ext-sandbox/unloader/iui-unloader.js Tue Aug 14 18:07:04
2012
+++ /web-app/iui/ext-sandbox/unloader/iui-unloader.js Wed Aug 15 15:37:41
2012
@@ -9,8 +9,8 @@
// An iUI extension that will remove any iUI fragment or view (aka "page")
when it receives
// an 'unload' event from iUI core.
//
-// This will prevent your DOM from getting overloaded. It can also be
used as a template
-// for a more advanced unloading scheme.
+// This will prevent your DOM from getting overloaded and using up memory.
+// It could also be used as a template for a more advanced
caching/unloading scheme.
//
(function() {
@@ -25,24 +25,11 @@
addEventListener("DOMContentLoaded", function(event)
{
document.body.addEventListener('afterinsert', afterInsert, false);
-// This will register event handlers on all initial nodes
-// We'll also need to register handlers on inserted (via ajax) nodes
-// To do that we'll need to use the afterInsert event
- var nodes = iui.getAllViews();
- for (var i = 0; i < nodes.length ; i++)
- {
- registerEvents(nodes[i]);
- }
+ document.body.addEventListener('unload', unloader, false);
}, false);
-
-function registerEvents(node)
-{
- node.addEventListener('unload', unloader, false);
-}
function afterInsert(e)
{
- registerEvents(e.insertedNode); // Set event handlers on newly added node
console.log("Marking " + e.insertedNode + " for removal from DOM on
unload");
e.insertedNode.unloadMe = true; // Mark everything inserted by Ajax for
removal
}
@@ -55,6 +42,5 @@
e.target.parentNode.removeChild(e.target); // remove the node after
unloaded
}
}
-
})();
=======================================
--- /web-app/iui/iui.js Tue Aug 14 17:56:33 2012
+++ /web-app/iui/iui.js Wed Aug 15 15:37:41 2012
@@ -693,7 +693,7 @@
if (node)
{
var event = document.createEvent("UIEvent");
- event.initEvent(type, false, false); // no bubble, no cancel
+ event.initEvent(type, true, false); // bubble, no cancel
if (props)
{
for (i in props)
=======================================
--- /web-app/iui/js/iui-event-log.js Wed Aug 15 09:49:38 2012
+++ /web-app/iui/js/iui-event-log.js Wed Aug 15 15:37:41 2012
@@ -5,10 +5,10 @@
(function() {
-var eventNames =
['blur', 'focus', 'load', 'unload', 'beforetransition', 'aftertransition' ];
+var eventNames =
['beforeinsert', 'afterinsert', 'afterinsertend', 'blur', 'focus', 'load', 'unload', 'beforetransition', 'aftertransition'
];
// Using DOMContentLoaded so this loads before the onload in iui.js --
need a better method (Issue #204?)
-// We need to register before iui's main onload handler so we can get
the 'load' and 'focus' events
+// We need to register before iUI's main onload handler so we can get
the 'load' and 'focus' events
// for the default 'page' (view).
//
// The "better method" may be related to
http://code.google.com/p/iui/issues/detail?id=204
@@ -16,33 +16,11 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('beforeinsert', logEvent, false);
- document.body.addEventListener('afterinsert', afterInsert, false);
- document.body.addEventListener('afterinsertend', logEvent, false);
-// This will register event handlers on all initial nodes
-// We'll also need to register handlers on inserted (via ajax) nodes
-// To do that we'll need to use the afterInsert event
- var nodes = iui.getAllViews();
- for (var i = 0; i < nodes.length ; i++)
- {
- registerAllEvents(nodes[i]);
- }
+ for (var i = 0; i < eventNames.length ; i++)
+ {
+ document.body.addEventListener(eventNames[i], logEvent, false);
+ }
}, false);
-
-function registerAllEvents(node)
-{
- for (var i = 0; i < eventNames.length ; i++)
- {
- console.log("addlistener: " + eventNames[i] + " on #" +
node.id + " = "
+ node);
- node.addEventListener(eventNames[i], logEvent, false);
- }
-}
-
-function afterInsert(e)
-{
- logEvent(e);
- registerAllEvents(e.insertedNode); // Set event handlers on newly added
node
-}
function logEvent(e)
{
@@ -61,6 +39,5 @@
console.log(" fragment = " + e.fragment);
}
}
-
})();
==============================================================================
Revision: 7db2cf8cc565
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Thu Aug 16 00:42:14 2012
Log: Merge branch 'master' of
https://github.com/iui/iUI into
msgilligan-event-bubbling
http://code.google.com/p/iui/source/detail?r=7db2cf8cc565
==============================================================================
Revision: 7b3194eeb4dc
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Thu Aug 16 01:00:58 2012
Log: Use bubbling to simplify iui-canvg and iui-video plugins, too.
http://code.google.com/p/iui/source/detail?r=7b3194eeb4dc
Modified:
/web-app/iui/ext-sandbox/canvg/iui-canvg.js
/web-app/iui/ext-sandbox/video/iui-video.js
=======================================
--- /web-app/iui/ext-sandbox/canvg/iui-canvg.js Tue Aug 14 18:07:04 2012
+++ /web-app/iui/ext-sandbox/canvg/iui-canvg.js Thu Aug 16 01:00:58 2012
@@ -21,26 +21,8 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('afterinsert', afterInsert, false);
-// This will register event handlers on all initial nodes
-// We'll also need to register handlers on inserted (via ajax) nodes
-// To do that we'll need to use the beforeInsert event
- var nodes = iui.getAllViews();
- for (var i = 0; i < nodes.length ; i++)
- {
- registerAllEvents(nodes[i]);
- }
+ document.body.addEventListener('load', onLoad, false);
}, false);
-
-function registerAllEvents(node)
-{
- node.addEventListener('load', onLoad, false);
-}
-
-function afterInsert(e)
-{
- registerAllEvents(e.insertedNode); // Set event handlers on newly added
node
-}
function onLoad(e)
{
@@ -59,6 +41,5 @@
}
}
}
-
})();
=======================================
--- /web-app/iui/ext-sandbox/video/iui-video.js Tue Aug 14 18:07:04 2012
+++ /web-app/iui/ext-sandbox/video/iui-video.js Thu Aug 16 01:00:58 2012
@@ -20,15 +20,8 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('afterinsert', afterInsert, false);
-// This will register event handlers on all initial nodes
-// We'll also need to register handlers on inserted (via ajax) nodes
-// To do that we'll need to use the beforeInsert event
- var nodes = iui.getAllViews();
- for (var i = 0; i < nodes.length ; i++)
- {
- registerAllEvents(nodes[i]);
- }
+ document.body.addEventListener('aftertransition', afterTrans, false);
+ document.body.addEventListener('blur', onBlur, false);
if (false)
{
@@ -50,18 +43,6 @@
}
}, false);
-
-function registerAllEvents(node)
-{
- node.addEventListener('aftertransition', afterTrans, false);
- node.addEventListener('blur', onBlur, false);
-// node.addEventListener('beforetransition', beforeTrans, false);
-}
-
-function afterInsert(e)
-{
- registerAllEvents(e.insertedNode); // Set event handlers on newly added
node
-}
function afterTrans(e)
{
@@ -123,27 +104,6 @@
}
}
}
-
-function beforeTrans(e)
-{
- if (e.out)
- {
- var vid = e.target.querySelector("video");
- if (vid)
- {
- console.log("beforeTrans of video div");
- vid.pause();
- iui.addClass(vid, 'video-out');
- var aNode = e.target.querySelector("a[rel='iuiposter']");
- if (aNode)
- {
- //aNode.style.visibility = 'visible';
- //vid.style.visibility = 'hidden';
- iui.removeClass(aNode, 'poster-out');
- }
- }
- }
-}
function startLoad(vid)
{
@@ -208,6 +168,5 @@
addVideoLoggers(vid);
}
}
-
})();
==============================================================================
Revision: d7b24d62dece
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Tue Aug 28 00:33:00 2012
Log: Namespace all events to iui.eventname, simplify TbBMod.js with
bubbling
http://code.google.com/p/iui/source/detail?r=d7b24d62dece
Modified:
/web-app/iui/ext-sandbox/TbBMod/TbBMod.js
/web-app/iui/ext-sandbox/cache-manager/iui-cache-manager.js
/web-app/iui/ext-sandbox/canvg/iui-canvg.js
/web-app/iui/ext-sandbox/google-analytics/iui-google-analytics.js
/web-app/iui/ext-sandbox/jit-loader/jit-loader.js
/web-app/iui/ext-sandbox/jit-loader/jit-test-gmaps.js
/web-app/iui/ext-sandbox/jit-loader/jstest2.js
/web-app/iui/ext-sandbox/masabi/iui_ext.js
/web-app/iui/ext-sandbox/unloader/iui-unloader.js
/web-app/iui/ext-sandbox/video/iui-video.js
/web-app/iui/ext-sandbox/view/iui-views.js
/web-app/iui/ext-sandbox/view/view-test.js
/web-app/iui/iui.js
/web-app/iui/js/iui-event-log.js
=======================================
--- /web-app/iui/ext-sandbox/TbBMod/TbBMod.js Tue Aug 14 18:07:04 2012
+++ /web-app/iui/ext-sandbox/TbBMod/TbBMod.js Tue Aug 28 00:33:00 2012
@@ -10,8 +10,6 @@
(function() {
-var eventNames =
['blur', 'focus'/*, 'load', 'unload', 'beforetransition', 'aftertransition'
*/];
-
// Using DOMContentLoaded so this loads before the onload in iui.js --
need a better method
// We need to register before iui's main onload handler so we can get
the 'load' and 'focus' events
// for the default 'page' (view).
@@ -19,28 +17,10 @@
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('beforeinsert', registerTbBModEvents,
false);
- document.body.addEventListener('afterinsert', afterInsert, false);
-// This will register event handlers on all initial nodes
-// We'll also need to register handlers on inserted (via ajax) nodes
-// To do that we'll need to use the beforeInsert event
- nodes = document.querySelectorAll("ul, div, form"); // select all of the
usual page containers
- for (var i = 0; i < nodes.length ; i++){ // loop through them
- registerTbBModEvents(nodes[i]); // adding event listener
-
- }
+ document.body.addEventListener('iui.blur', TbBModHandler, false);
+ document.body.addEventListener('iui.focus', TbBModHandler, false);
}, false);
-function registerTbBModEvents(node){ // add TbBMod event listener to
page containers
- for (var i = 0; i < eventNames.length ; i++){
- node.addEventListener(eventNames[i], TbBModHandler, false);
- }
-}
-
-function afterInsert(e){
- //TbBModHandler(e);
- registerTbBModEvents(e.insertedNode); // Set event handlers on newly
added node
-}
////////////////////////////////////////////////////////////// Variables
used for mustiple functions
var TbBModForm; // The form with TbBMods in it
@@ -50,13 +30,13 @@
//////////////////////////////////////////////////////////////
TbBModHandler(e)
function TbBModHandler(e){ // function called on page focus and
blur to mod buttons
- if (e.type == "focus"){ // focus event - look in page for TbBMods
+ if (e.type == "iui.focus"){ // focus event - look in page for
TbBMods
var page = e.target; // assign event target page to variable
if (page.tagName == "FORM" && hasTbBMod(page)){ // page is a form and
has TbBMods
doTbBMods(); // take care of TbBMods in form
} else if (hasForm(page) && checkForms(page)) // page has a form and
has TbBMods
doTbBMods(); // take care of TbBMods in form
- } else if (e.type == "blur"){ // blur event - reset TbBMods before
leaving
+ } else if (e.type == "iui.blur"){ // blur event - reset TbBMods
before leaving
undoTbBMods(); // undo buttons modded before leaving page
}
}
=======================================
--- /web-app/iui/ext-sandbox/cache-manager/iui-cache-manager.js Mon Mar 15
11:30:35 2010
+++ /web-app/iui/ext-sandbox/cache-manager/iui-cache-manager.js Tue Aug 28
00:33:00 2012
@@ -27,7 +27,7 @@
cache.addEventListener('obsolete', cacheEventListener, false);
}
var cacheView = document.getElementById('iui-cache-panel');
- cacheView.addEventListener('focus', infoPanelFocus, false);
+ cacheView.addEventListener('iui.focus', infoPanelFocus, false);
updateButton = document.querySelector('.iui-cache-update-button');
updateButton.addEventListener('click', updateClicked, false);
=======================================
--- /web-app/iui/ext-sandbox/canvg/iui-canvg.js Thu Aug 16 01:00:58 2012
+++ /web-app/iui/ext-sandbox/canvg/iui-canvg.js Tue Aug 28 00:33:00 2012
@@ -21,7 +21,7 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('load', onLoad, false);
+ document.body.addEventListener('iui.load', onLoad, false);
}, false);
function onLoad(e)
=======================================
--- /web-app/iui/ext-sandbox/google-analytics/iui-google-analytics.js Wed
Aug 15 15:37:41 2012
+++ /web-app/iui/ext-sandbox/google-analytics/iui-google-analytics.js Tue
Aug 28 00:33:00 2012
@@ -22,7 +22,7 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('focus', trackEvent, false);
+ document.body.addEventListener('iui.focus', trackEvent, false);
}, false);
function trackEvent(e)
=======================================
--- /web-app/iui/ext-sandbox/jit-loader/jit-loader.js Tue Aug 14 18:07:04
2012
+++ /web-app/iui/ext-sandbox/jit-loader/jit-loader.js Tue Aug 28 00:33:00
2012
@@ -31,8 +31,8 @@
addEventListener("load", function(event)
{
- document.body.addEventListener('beforeinsert', beforeInsert, false);
- document.body.addEventListener('afterinsertend', afterInsertEnd, false);
+ document.body.addEventListener('iui.beforeinsert', beforeInsert, false);
+ document.body.addEventListener('iui.afterinsertend', afterInsertEnd,
false);
}, false);
var loading = false;
=======================================
--- /web-app/iui/ext-sandbox/jit-loader/jit-test-gmaps.js Wed Feb 10
00:36:29 2010
+++ /web-app/iui/ext-sandbox/jit-loader/jit-test-gmaps.js Tue Aug 28
00:33:00 2012
@@ -35,5 +35,5 @@
//var def12 = document.getElementById('default_map');
//var geo12 = document.getElementById('geo_map');
-//def12.addEventListener("focus", function(){ loadGMAP('dmap') }, false);
-//geo12.addEventListener("focus", function(){ loadGeoMAP('geomap') },
false);
+//def12.addEventListener("iui.focus", function(){ loadGMAP('dmap') },
false);
+//geo12.addEventListener("iui.focus", function(){ loadGeoMAP('geomap') },
false);
=======================================
--- /web-app/iui/ext-sandbox/jit-loader/jstest2.js Wed Feb 10 14:05:27 2010
+++ /web-app/iui/ext-sandbox/jit-loader/jstest2.js Tue Aug 28 00:33:00 2012
@@ -4,11 +4,11 @@
var elsub2 = document.getElementById('sub2');
var els1 = document.getElementById('s1');
var els2 = document.getElementById('s2');
- elsub1.addEventListener("focus", function()
+ elsub1.addEventListener("iui.focus", function()
{
els1.innerText = sub1()
}, false);
- elsub2.addEventListener("focus", function()
+ elsub2.addEventListener("iui.focus", function()
{
els2.innerText = sub2()
}, false);
=======================================
--- /web-app/iui/ext-sandbox/masabi/iui_ext.js Tue Aug 14 18:07:04 2012
+++ /web-app/iui/ext-sandbox/masabi/iui_ext.js Tue Aug 28 00:33:00 2012
@@ -37,7 +37,7 @@
addEventListener("DOMContentLoaded", function(event)
{
// Use afterinsert to injectEventMethods on inserted (via ajax) nodes
- document.body.addEventListener('afterinsert', afterInsert, false);
+ document.body.addEventListener('iui.afterinsert', afterInsert, false);
// This will register event handlers on all initial form nodes
nodes = document.querySelectorAll("body > form");
for (var i = 0; i < nodes.length ; i++)
@@ -179,8 +179,8 @@
var generated=addChild(document.body,"ul","az",name),n,c,o;
generated.title=caption;
generated.name=
select.name;
- generated.addEventListener('focus',azFocus,true);
- generated.addEventListener('blur',azBlur,true);
+ generated.addEventListener('iui.focus',azFocus,true);
+ generated.addEventListener('iui.blur',azBlur,true);
var nav=addChild(generated,"nav");
// build name/value map of children, adding radios to the new form
=======================================
--- /web-app/iui/ext-sandbox/unloader/iui-unloader.js Wed Aug 15 15:37:41
2012
+++ /web-app/iui/ext-sandbox/unloader/iui-unloader.js Tue Aug 28 00:33:00
2012
@@ -24,8 +24,8 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('afterinsert', afterInsert, false);
- document.body.addEventListener('unload', unloader, false);
+ document.body.addEventListener('iui.afterinsert', afterInsert, false);
+ document.body.addEventListener('iui.unload', unloader, false);
}, false);
function afterInsert(e)
=======================================
--- /web-app/iui/ext-sandbox/video/iui-video.js Thu Aug 16 01:00:58 2012
+++ /web-app/iui/ext-sandbox/video/iui-video.js Tue Aug 28 00:33:00 2012
@@ -20,8 +20,8 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('aftertransition', afterTrans, false);
- document.body.addEventListener('blur', onBlur, false);
+ document.body.addEventListener('iui.aftertransition', afterTrans, false);
+ document.body.addEventListener('iui.blur', onBlur, false);
if (false)
{
=======================================
--- /web-app/iui/ext-sandbox/view/iui-views.js Tue Aug 14 18:07:04 2012
+++ /web-app/iui/ext-sandbox/view/iui-views.js Tue Aug 28 00:33:00 2012
@@ -17,7 +17,7 @@
byID: []
}
-var eventNames =
['load', 'unload', 'focus', 'blur', 'beforetransition', 'aftertransition' ];
+var eventNames =
['iui.load', 'iui.unload', 'iui.focus', 'iui.blur', 'iui.beforetransition', 'iui.aftertransition'
];
// Using DOMContentLoaded so this loads before the onload in iui.js --
need a better method
// We need to register before iui's main onload handler so we can get
the 'load' and 'focus' events
@@ -25,7 +25,7 @@
//
addEventListener("DOMContentLoaded", function(event)
{
- document.body.addEventListener('afterinsert', afterInsert, false);
+ document.body.addEventListener('iui.afterinsert', afterInsert, false);
// This will register event handlers on all initial nodes
// We'll also need to register handlers on inserted (via ajax) nodes
// To do that we'll need to use the beforeInsert event
@@ -86,14 +86,14 @@
function logEvent(e)
{
console.log("logEvent type: " + e.type + " target " + e.target.tagName
+ "#" +
e.target.id);
- if (e.type == "beforetransition" || e.type == "aftertransition")
+ if (e.type == "iui.beforetransition" || e.type == "iui.aftertransition")
{
console.log(" out trans = " + e.out);
}
- else if (e.type == "beforeinsert") {
+ else if (e.type == "iui.beforeinsert") {
console.log(" fragment = " + e.fragment);
}
- else if (e.type == "afterinsert") {
+ else if (e.type == "iui.afterinsert") {
console.log(" node = " + e.insertedNode);
}
}
=======================================
--- /web-app/iui/ext-sandbox/view/view-test.js Tue Oct 6 09:53:15 2009
+++ /web-app/iui/ext-sandbox/view/view-test.js Tue Aug 28 00:33:00 2012
@@ -37,14 +37,14 @@
function logEvent(e)
{
console.log("logEvent type: " + e.type + " target " + e.target.tagName
+ "#" +
e.target.id);
- if (e.type == "beforetransition" || e.type == "aftertransition")
+ if (e.type == "iui.beforetransition" || e.type == "iui.aftertransition")
{
console.log(" out trans = " + e.out);
}
- else if (e.type == "beforeinsert") {
+ else if (e.type == "iui.beforeinsert") {
console.log(" fragment = " + e.fragment);
}
- else if (e.type == "afterinsert") {
+ else if (e.type == "iui.afterinsert") {
console.log(" node = " + e.insertedNode);
}
}
=======================================
--- /web-app/iui/iui.js Wed Aug 15 15:37:41 2012
+++ /web-app/iui/iui.js Tue Aug 28 00:33:00 2012
@@ -106,7 +106,7 @@
if (currentDialog)
{
currentDialog.removeAttribute("selected");
- sendEvent("blur", currentDialog); // EVENT: BLUR
+ sendEvent("iui.blur", currentDialog); // EVENT: BLUR
currentDialog = null;
}
@@ -120,7 +120,7 @@
iui.busy = false; // There's no slide transition, so clear busy flag
// There's no LOAD/UNLOAD events for dialogs -- is that the way it
should be??
// Should the view the dialog is going over get a BLUR??
- sendEvent("focus", page); // EVENT: FOCUS
+ sendEvent("iui.focus", page); // EVENT: FOCUS
showDialog(page);
}
/*
@@ -130,13 +130,13 @@
*/
else
{
- sendEvent("load", page); // EVENT: LOAD
+ sendEvent("iui.load", page); // EVENT: LOAD
// 127(stylesheet), 128(script), 129(onload)
// 130(onFocus), 133(loadActionButton)
var fromPage = currentPage;
- sendEvent("blur", currentPage); // EVENT: BLUR
+ sendEvent("iui.blur", currentPage); // EVENT: BLUR
currentPage = page;
- sendEvent("focus", page); // EVENT: FOCUS
+ sendEvent("iui.focus", page); // EVENT: FOCUS
if (fromPage)
{
@@ -257,7 +257,7 @@
element receives a `beforeinsert` event with `{ fragment: frag }`
parameters
and afterwards receives an `afterinsert` event with `{insertedNode:
docNode}` parameters.
*/
- sendEvent("beforeinsert", document.body, {fragment:frag})
+ sendEvent("iui.beforeinsert", document.body, {fragment:frag})
if (replace)
{
replaceElementWithFrag(replace, frag);
@@ -397,7 +397,7 @@
else
docNode = document.body.appendChild(child);
- sendEvent("afterinsert", document.body, {insertedNode:docNode});
+ sendEvent("iui.afterinsert", document.body, {insertedNode:docNode});
// First child becomes selected page/view by default unless
// selected="true" is set
@@ -408,7 +408,7 @@
--i;
}
}
- sendEvent("afterinsertend", document.body, {fragment:frag})
+ sendEvent("iui.afterinsertend", document.body, {fragment:frag})
if (targetPage)
iui.showPage(targetPage);
@@ -854,8 +854,8 @@
clearInterval(checkTimer);
- sendEvent("beforetransition", fromPage, {out:true});
- sendEvent("beforetransition", toPage, {out:false});
+ sendEvent("iui.beforetransition", fromPage, {out:true});
+ sendEvent("iui.beforetransition", toPage, {out:false});
if (canDoSlideAnim() && axis != 'y')
{
slide2(fromPage, toPage, backwards, slideDone);
@@ -872,9 +872,9 @@
checkTimer = setInterval(checkOrientAndLocation, 300);
setTimeout(updatePage, 0, toPage, fromPage);
fromPage.removeEventListener('webkitTransitionEnd', slideDone, false);
- sendEvent("aftertransition", fromPage, {out:true});
- sendEvent("aftertransition", toPage, {out:false});
- if (backwards) sendEvent("unload", fromPage); // EVENT: UNLOAD
+ sendEvent("iui.aftertransition", fromPage, {out:true});
+ sendEvent("iui.aftertransition", toPage, {out:false});
+ if (backwards) sendEvent("iui.unload", fromPage); // EVENT: UNLOAD
}
}
@@ -1031,9 +1031,9 @@
var docNode;
while (frag.firstChild) {
docNode = page.appendChild(frag.firstChild);
- sendEvent("afterinsert", document.body, {insertedNode:docNode});
+ sendEvent("iui.afterinsert", document.body, {insertedNode:docNode});
}
- sendEvent("afterinsertend", document.body, {fragment:frag})
+ sendEvent("iui.afterinsertend", document.body, {fragment:frag})
}
function $(id) { return document.getElementById(id); }
=======================================
--- /web-app/iui/js/iui-event-log.js Wed Aug 15 15:37:41 2012
+++ /web-app/iui/js/iui-event-log.js Tue Aug 28 00:33:00 2012
@@ -5,7 +5,7 @@
(function() {
-var eventNames =
['beforeinsert', 'afterinsert', 'afterinsertend', 'blur', 'focus', 'load', 'unload', 'beforetransition', 'aftertransition'
];
+var eventNames =
['iui.beforeinsert', 'iui.afterinsert', 'iui.afterinsertend', 'iui.blur', 'iui.focus', 'iui.load', 'iui.unload', 'iui.beforetransition', 'iui.aftertransition'];
// Using DOMContentLoaded so this loads before the onload in iui.js --
need a better method (Issue #204?)
// We need to register before iUI's main onload handler so we can get
the 'load' and 'focus' events
@@ -25,17 +25,17 @@
function logEvent(e)
{
console.log("logEvent type: " + e.type + " target " + e.target.tagName
+ "#" +
e.target.id);
- if (e.type == "beforetransition" || e.type == "aftertransition")
+ if (e.type == "iui.beforetransition" || e.type == "iui.aftertransition")
{
console.log(" out trans = " + e.out);
}
- else if (e.type == "beforeinsert") {
+ else if (e.type == "iui.beforeinsert") {
console.log(" fragment = " + e.fragment);
}
- else if (e.type == "afterinsert") {
+ else if (e.type == "iui.afterinsert") {
console.log(" node = " + e.insertedNode);
}
- else if (e.type == "afterinsertend") {
+ else if (e.type == "iui.afterinsertend") {
console.log(" fragment = " + e.fragment);
}
}
==============================================================================
Revision: fb75de33a03e
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Tue Aug 28 00:33:13 2012
Log: Fix typos
http://code.google.com/p/iui/source/detail?r=fb75de33a03e
Modified:
/web-app/iui/ext-sandbox/unloader/index.html
=======================================
--- /web-app/iui/ext-sandbox/unloader/index.html Sun Sep 25 14:19:04 2011
+++ /web-app/iui/ext-sandbox/unloader/index.html Tue Aug 28 00:33:13 2012
@@ -9,7 +9,7 @@
<link rel="stylesheet" title="Default"
href="../../t/default/default-theme.css" type="text/css"/>
<link rel="stylesheet" href="../../../css/iui-panel-list.css"
type="text/css" />
- <script type="application/x-javascript" src="../../iui.js"></script>
+ <script type="application/x-javascript" src="../../iui.js"></script>
<script type="application/x-javascript" src="iui-unloader.js"></script>
<link href="../TbBMod/xtra.css" rel="stylesheet" type="text/css">
</head>
@@ -19,7 +19,7 @@
<a id="backButton" class="button" href="#"></a>
</div>
-<ul id="home" title="Video Ext" selected="true">
+<ul id="home" title="Unloader Ext" selected="true">
<li><a href="#about">About Unloader Ext</a></li>
<li><a href="#instructions">Instructions</a></li>
<li class="group">Tests</li>
@@ -34,7 +34,7 @@
<div id="about" class="panel" title="About">
<h2>About Video Extension</h2>
<fieldset>
- <p class="normalText">iui-unlaoder.js is an extension for the iUI
framework. It is currently EXPERIMENTAL</p>
+ <p class="normalText">iui-unloader.js is an extension for the iUI
framework. It is currently EXPERIMENTAL</p>
<p class="normalText">For info on how to use this extension see
Instructions.</p>
<p class="normalText">Sean Gilligan</p>
</fieldset>
@@ -52,7 +52,7 @@
<div id="int" title="Internal Frag">
<h2>Internal Fragment</h2>
<p>This should not be unloaded when you hit the back button</p>
-</div>
+</div>
</body>
</html>
==============================================================================
Revision: d9752d581503
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Tue Aug 28 00:45:19 2012
Log: Merge branch 'master' of
https://github.com/iui/iUI into
msgilligan-event-bubbling
http://code.google.com/p/iui/source/detail?r=d9752d581503
==============================================================================
Revision: d04bbee2b910
Author: Sean Gilligan <
se...@msgilligan.com>
Date: Wed Aug 29 09:19:47 2012
Log: Merge pull request #6 from msgilligan/msgilligan-event-bubbling
Use event bubbling and "iui." namespace to simplify extensions. Update all
extensions to use it.
http://code.google.com/p/iui/source/detail?r=d04bbee2b910