From 6eecbd7e302d846ef6f46efb439e888002016f60 Mon Sep 17 00:00:00 2001 From: jlukic Date: Sat, 14 Sep 2013 04:01:16 -0400 Subject: [PATCH] adds more examples of modules Former-commit-id: ce8621e0a841b1c8b49d6b846e35ad4706987778 Former-commit-id: 40c601f3dee31a05b3d5a824e4bd52d4f47f87a6 --- build/minified/modules/tab.js | 26 ++++++++--------- build/uncompressed/modules/tab.js | 26 ++++++++--------- .../introduction/getting-started.html | 28 ++++++++++++++++--- .../src/files/release/minified/modules/tab.js | 26 ++++++++--------- .../files/release/uncompressed/modules/tab.js | 26 ++++++++--------- src/modules/tab.js | 26 ++++++++--------- 6 files changed, 89 insertions(+), 69 deletions(-) diff --git a/build/minified/modules/tab.js b/build/minified/modules/tab.js index 0bf853386..f64f48a58 100644 --- a/build/minified/modules/tab.js +++ b/build/minified/modules/tab.js @@ -109,7 +109,7 @@ $.address.value(tabPath); } else { - module.change(tabPath); + module.changeTab(tabPath); } } else { @@ -125,7 +125,7 @@ module.debug('History change event', tabPath, event); historyEvent = event; if(tabPath !== undefined) { - module.change(tabPath); + module.changeTab(tabPath); } if(pageTitle) { $.address.title(pageTitle); @@ -137,7 +137,7 @@ refresh: function() { if(activeTabPath) { module.debug('Refreshing tab', activeTabPath); - module.change(activeTabPath); + module.changeTab(activeTabPath); } }, @@ -161,22 +161,22 @@ } }, - change: function(tabPath) { + changeTab: function(tabPath) { var pushStateAvailable = (window.history && window.history.pushState), shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad), remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ), // only get default path if not remote content pathArray = (remoteContent && !shouldIgnoreLoad) - ? module.utils.pathToArray(tabPath) + ? module.utilities.pathToArray(tabPath) : module.get.defaultPathArray(tabPath), - tabPath = module.utils.arrayToPath(pathArray) + tabPath = module.utilities.arrayToPath(pathArray) ; module.deactivate.all(); $.each(pathArray, function(index, tab) { var currentPathArray = pathArray.slice(0, index + 1), - currentPath = module.utils.arrayToPath(currentPathArray), + currentPath = module.utilities.arrayToPath(currentPathArray), isTab = module.is.tab(currentPath), isLastIndex = (index + 1 == pathArray.length), @@ -192,14 +192,14 @@ // scope up activeTabPath = currentPath; - parameterArray = module.utils.filterArray(pathArray, currentPathArray); + parameterArray = module.utilities.filterArray(pathArray, currentPathArray); if(isLastIndex) { isLastTab = true; } else { nextPathArray = pathArray.slice(0, index + 2); - nextPath = module.utils.arrayToPath(nextPathArray); + nextPath = module.utilities.arrayToPath(nextPathArray); isLastTab = ( !module.is.tab(nextPath) ); if(isLastTab) { module.verbose('Tab parameters found', nextPathArray); @@ -349,7 +349,7 @@ }, // adds default tabs to tab path defaultPathArray: function(tabPath) { - return module.utils.pathToArray( module.get.defaultPath(tabPath) ); + return module.utilities.pathToArray( module.get.defaultPath(tabPath) ); }, defaultPath: function(tabPath) { var @@ -382,8 +382,8 @@ lastTab ; tabPath = tabPath || activeTabPath; - tabPathArray = module.utils.pathToArray(tabPath); - lastTab = module.utils.last(tabPathArray); + tabPathArray = module.utilities.pathToArray(tabPath); + lastTab = module.utilities.last(tabPathArray); $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]'); $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]'); return ($fullPathTab.size() > 0) @@ -396,7 +396,7 @@ } }, - utils: { + utilities: { filterArray: function(keepArray, removeArray) { return $.grep(keepArray, function(keepValue) { return ( $.inArray(keepValue, removeArray) == -1); diff --git a/build/uncompressed/modules/tab.js b/build/uncompressed/modules/tab.js index 0bf853386..f64f48a58 100644 --- a/build/uncompressed/modules/tab.js +++ b/build/uncompressed/modules/tab.js @@ -109,7 +109,7 @@ $.address.value(tabPath); } else { - module.change(tabPath); + module.changeTab(tabPath); } } else { @@ -125,7 +125,7 @@ module.debug('History change event', tabPath, event); historyEvent = event; if(tabPath !== undefined) { - module.change(tabPath); + module.changeTab(tabPath); } if(pageTitle) { $.address.title(pageTitle); @@ -137,7 +137,7 @@ refresh: function() { if(activeTabPath) { module.debug('Refreshing tab', activeTabPath); - module.change(activeTabPath); + module.changeTab(activeTabPath); } }, @@ -161,22 +161,22 @@ } }, - change: function(tabPath) { + changeTab: function(tabPath) { var pushStateAvailable = (window.history && window.history.pushState), shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad), remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ), // only get default path if not remote content pathArray = (remoteContent && !shouldIgnoreLoad) - ? module.utils.pathToArray(tabPath) + ? module.utilities.pathToArray(tabPath) : module.get.defaultPathArray(tabPath), - tabPath = module.utils.arrayToPath(pathArray) + tabPath = module.utilities.arrayToPath(pathArray) ; module.deactivate.all(); $.each(pathArray, function(index, tab) { var currentPathArray = pathArray.slice(0, index + 1), - currentPath = module.utils.arrayToPath(currentPathArray), + currentPath = module.utilities.arrayToPath(currentPathArray), isTab = module.is.tab(currentPath), isLastIndex = (index + 1 == pathArray.length), @@ -192,14 +192,14 @@ // scope up activeTabPath = currentPath; - parameterArray = module.utils.filterArray(pathArray, currentPathArray); + parameterArray = module.utilities.filterArray(pathArray, currentPathArray); if(isLastIndex) { isLastTab = true; } else { nextPathArray = pathArray.slice(0, index + 2); - nextPath = module.utils.arrayToPath(nextPathArray); + nextPath = module.utilities.arrayToPath(nextPathArray); isLastTab = ( !module.is.tab(nextPath) ); if(isLastTab) { module.verbose('Tab parameters found', nextPathArray); @@ -349,7 +349,7 @@ }, // adds default tabs to tab path defaultPathArray: function(tabPath) { - return module.utils.pathToArray( module.get.defaultPath(tabPath) ); + return module.utilities.pathToArray( module.get.defaultPath(tabPath) ); }, defaultPath: function(tabPath) { var @@ -382,8 +382,8 @@ lastTab ; tabPath = tabPath || activeTabPath; - tabPathArray = module.utils.pathToArray(tabPath); - lastTab = module.utils.last(tabPathArray); + tabPathArray = module.utilities.pathToArray(tabPath); + lastTab = module.utilities.last(tabPathArray); $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]'); $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]'); return ($fullPathTab.size() > 0) @@ -396,7 +396,7 @@ } }, - utils: { + utilities: { filterArray: function(keepArray, removeArray) { return $.grep(keepArray, function(keepValue) { return ( $.inArray(keepValue, removeArray) == -1); diff --git a/node/src/documents/introduction/getting-started.html b/node/src/documents/introduction/getting-started.html index e688f3775..48ad704fa 100755 --- a/node/src/documents/introduction/getting-started.html +++ b/node/src/documents/introduction/getting-started.html @@ -17,18 +17,18 @@ $(document)
-

Introduction +

Getting Started

-

Getting Started

+

Interfacing Carefully

UI definitions in Semantic are given the class name ui. This is to help tell the difference between ui elements and parts of the definition of an element. For example a menu may have menu items inside of it. These items are contained as part of the menu definition but do not receive the class name ui.

@@ -71,6 +71,16 @@ $(document)
Second
Third
+

Opening a new tab with a behavior

+

Modules have simple behaviors for triggering common actions

+
+ $('.demo.menu .item') + .tab('change tab', 'second') + ; +
+ +

Opening a new tab with multiple behaviors

+

Any internal behavior is accessible as well

$('.demo.menu .item') .tab('deactivate all') @@ -78,6 +88,16 @@ $(document) .tab('activate navigation', 'third') ;
+

Turning on HTML5 State

+

Modules can be re-initialized at any time with different settings

+
+ $('.demo.menu .item') + .tab({ + history : true, + path : '/introduction/getting-started.html' + }) + ; +
diff --git a/node/src/files/release/minified/modules/tab.js b/node/src/files/release/minified/modules/tab.js index 0bf853386..f64f48a58 100644 --- a/node/src/files/release/minified/modules/tab.js +++ b/node/src/files/release/minified/modules/tab.js @@ -109,7 +109,7 @@ $.address.value(tabPath); } else { - module.change(tabPath); + module.changeTab(tabPath); } } else { @@ -125,7 +125,7 @@ module.debug('History change event', tabPath, event); historyEvent = event; if(tabPath !== undefined) { - module.change(tabPath); + module.changeTab(tabPath); } if(pageTitle) { $.address.title(pageTitle); @@ -137,7 +137,7 @@ refresh: function() { if(activeTabPath) { module.debug('Refreshing tab', activeTabPath); - module.change(activeTabPath); + module.changeTab(activeTabPath); } }, @@ -161,22 +161,22 @@ } }, - change: function(tabPath) { + changeTab: function(tabPath) { var pushStateAvailable = (window.history && window.history.pushState), shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad), remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ), // only get default path if not remote content pathArray = (remoteContent && !shouldIgnoreLoad) - ? module.utils.pathToArray(tabPath) + ? module.utilities.pathToArray(tabPath) : module.get.defaultPathArray(tabPath), - tabPath = module.utils.arrayToPath(pathArray) + tabPath = module.utilities.arrayToPath(pathArray) ; module.deactivate.all(); $.each(pathArray, function(index, tab) { var currentPathArray = pathArray.slice(0, index + 1), - currentPath = module.utils.arrayToPath(currentPathArray), + currentPath = module.utilities.arrayToPath(currentPathArray), isTab = module.is.tab(currentPath), isLastIndex = (index + 1 == pathArray.length), @@ -192,14 +192,14 @@ // scope up activeTabPath = currentPath; - parameterArray = module.utils.filterArray(pathArray, currentPathArray); + parameterArray = module.utilities.filterArray(pathArray, currentPathArray); if(isLastIndex) { isLastTab = true; } else { nextPathArray = pathArray.slice(0, index + 2); - nextPath = module.utils.arrayToPath(nextPathArray); + nextPath = module.utilities.arrayToPath(nextPathArray); isLastTab = ( !module.is.tab(nextPath) ); if(isLastTab) { module.verbose('Tab parameters found', nextPathArray); @@ -349,7 +349,7 @@ }, // adds default tabs to tab path defaultPathArray: function(tabPath) { - return module.utils.pathToArray( module.get.defaultPath(tabPath) ); + return module.utilities.pathToArray( module.get.defaultPath(tabPath) ); }, defaultPath: function(tabPath) { var @@ -382,8 +382,8 @@ lastTab ; tabPath = tabPath || activeTabPath; - tabPathArray = module.utils.pathToArray(tabPath); - lastTab = module.utils.last(tabPathArray); + tabPathArray = module.utilities.pathToArray(tabPath); + lastTab = module.utilities.last(tabPathArray); $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]'); $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]'); return ($fullPathTab.size() > 0) @@ -396,7 +396,7 @@ } }, - utils: { + utilities: { filterArray: function(keepArray, removeArray) { return $.grep(keepArray, function(keepValue) { return ( $.inArray(keepValue, removeArray) == -1); diff --git a/node/src/files/release/uncompressed/modules/tab.js b/node/src/files/release/uncompressed/modules/tab.js index 0bf853386..f64f48a58 100644 --- a/node/src/files/release/uncompressed/modules/tab.js +++ b/node/src/files/release/uncompressed/modules/tab.js @@ -109,7 +109,7 @@ $.address.value(tabPath); } else { - module.change(tabPath); + module.changeTab(tabPath); } } else { @@ -125,7 +125,7 @@ module.debug('History change event', tabPath, event); historyEvent = event; if(tabPath !== undefined) { - module.change(tabPath); + module.changeTab(tabPath); } if(pageTitle) { $.address.title(pageTitle); @@ -137,7 +137,7 @@ refresh: function() { if(activeTabPath) { module.debug('Refreshing tab', activeTabPath); - module.change(activeTabPath); + module.changeTab(activeTabPath); } }, @@ -161,22 +161,22 @@ } }, - change: function(tabPath) { + changeTab: function(tabPath) { var pushStateAvailable = (window.history && window.history.pushState), shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad), remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ), // only get default path if not remote content pathArray = (remoteContent && !shouldIgnoreLoad) - ? module.utils.pathToArray(tabPath) + ? module.utilities.pathToArray(tabPath) : module.get.defaultPathArray(tabPath), - tabPath = module.utils.arrayToPath(pathArray) + tabPath = module.utilities.arrayToPath(pathArray) ; module.deactivate.all(); $.each(pathArray, function(index, tab) { var currentPathArray = pathArray.slice(0, index + 1), - currentPath = module.utils.arrayToPath(currentPathArray), + currentPath = module.utilities.arrayToPath(currentPathArray), isTab = module.is.tab(currentPath), isLastIndex = (index + 1 == pathArray.length), @@ -192,14 +192,14 @@ // scope up activeTabPath = currentPath; - parameterArray = module.utils.filterArray(pathArray, currentPathArray); + parameterArray = module.utilities.filterArray(pathArray, currentPathArray); if(isLastIndex) { isLastTab = true; } else { nextPathArray = pathArray.slice(0, index + 2); - nextPath = module.utils.arrayToPath(nextPathArray); + nextPath = module.utilities.arrayToPath(nextPathArray); isLastTab = ( !module.is.tab(nextPath) ); if(isLastTab) { module.verbose('Tab parameters found', nextPathArray); @@ -349,7 +349,7 @@ }, // adds default tabs to tab path defaultPathArray: function(tabPath) { - return module.utils.pathToArray( module.get.defaultPath(tabPath) ); + return module.utilities.pathToArray( module.get.defaultPath(tabPath) ); }, defaultPath: function(tabPath) { var @@ -382,8 +382,8 @@ lastTab ; tabPath = tabPath || activeTabPath; - tabPathArray = module.utils.pathToArray(tabPath); - lastTab = module.utils.last(tabPathArray); + tabPathArray = module.utilities.pathToArray(tabPath); + lastTab = module.utilities.last(tabPathArray); $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]'); $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]'); return ($fullPathTab.size() > 0) @@ -396,7 +396,7 @@ } }, - utils: { + utilities: { filterArray: function(keepArray, removeArray) { return $.grep(keepArray, function(keepValue) { return ( $.inArray(keepValue, removeArray) == -1); diff --git a/src/modules/tab.js b/src/modules/tab.js index 0bf853386..f64f48a58 100755 --- a/src/modules/tab.js +++ b/src/modules/tab.js @@ -109,7 +109,7 @@ $.address.value(tabPath); } else { - module.change(tabPath); + module.changeTab(tabPath); } } else { @@ -125,7 +125,7 @@ module.debug('History change event', tabPath, event); historyEvent = event; if(tabPath !== undefined) { - module.change(tabPath); + module.changeTab(tabPath); } if(pageTitle) { $.address.title(pageTitle); @@ -137,7 +137,7 @@ refresh: function() { if(activeTabPath) { module.debug('Refreshing tab', activeTabPath); - module.change(activeTabPath); + module.changeTab(activeTabPath); } }, @@ -161,22 +161,22 @@ } }, - change: function(tabPath) { + changeTab: function(tabPath) { var pushStateAvailable = (window.history && window.history.pushState), shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad), remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ), // only get default path if not remote content pathArray = (remoteContent && !shouldIgnoreLoad) - ? module.utils.pathToArray(tabPath) + ? module.utilities.pathToArray(tabPath) : module.get.defaultPathArray(tabPath), - tabPath = module.utils.arrayToPath(pathArray) + tabPath = module.utilities.arrayToPath(pathArray) ; module.deactivate.all(); $.each(pathArray, function(index, tab) { var currentPathArray = pathArray.slice(0, index + 1), - currentPath = module.utils.arrayToPath(currentPathArray), + currentPath = module.utilities.arrayToPath(currentPathArray), isTab = module.is.tab(currentPath), isLastIndex = (index + 1 == pathArray.length), @@ -192,14 +192,14 @@ // scope up activeTabPath = currentPath; - parameterArray = module.utils.filterArray(pathArray, currentPathArray); + parameterArray = module.utilities.filterArray(pathArray, currentPathArray); if(isLastIndex) { isLastTab = true; } else { nextPathArray = pathArray.slice(0, index + 2); - nextPath = module.utils.arrayToPath(nextPathArray); + nextPath = module.utilities.arrayToPath(nextPathArray); isLastTab = ( !module.is.tab(nextPath) ); if(isLastTab) { module.verbose('Tab parameters found', nextPathArray); @@ -349,7 +349,7 @@ }, // adds default tabs to tab path defaultPathArray: function(tabPath) { - return module.utils.pathToArray( module.get.defaultPath(tabPath) ); + return module.utilities.pathToArray( module.get.defaultPath(tabPath) ); }, defaultPath: function(tabPath) { var @@ -382,8 +382,8 @@ lastTab ; tabPath = tabPath || activeTabPath; - tabPathArray = module.utils.pathToArray(tabPath); - lastTab = module.utils.last(tabPathArray); + tabPathArray = module.utilities.pathToArray(tabPath); + lastTab = module.utilities.last(tabPathArray); $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]'); $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]'); return ($fullPathTab.size() > 0) @@ -396,7 +396,7 @@ } }, - utils: { + utilities: { filterArray: function(keepArray, removeArray) { return $.grep(keepArray, function(keepValue) { return ( $.inArray(keepValue, removeArray) == -1);