This repository has been archived by the owner on Aug 7, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Fielding
authored and
Jonathan Fielding
committed
Feb 27, 2012
1 parent
7b7dfcd
commit 5564034
Showing
4 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,11 +1,21 @@ | |||
var app = {'url_path': ''}; | |||
|
|||
$(document.body).live('pagechange', function(event, eventData) { | $(document.body).live('pagechange', function(event, eventData) { | ||
var app = {'eventData': eventData}; | |||
var module_name = $(eventData.toPage).attr('data-module'); | var module_name = $(eventData.toPage).attr('data-module'); | ||
var javascript_required = module_name +'.js' | var javascript_required = module_name +'.js' | ||
|
|
||
if(window.location.pathname.match('modules')){ | |||
app.url_path = '../../'; | |||
} | |||
|
|||
//Load the plugins into the app | |||
require([app.url_path + 'plugins/add_plugins.js'],function(){ | |||
add_plugins.init(); | |||
}); | |||
|
|||
//Each module should have a javascript file, we pull this in here | //Each module should have a javascript file, we pull this in here | ||
require([javascript_required],function(){ | require([javascript_required],function(){ | ||
window[module_name].init(app); | window[module_name].init(eventData); | ||
}); | }); | ||
|
|
||
}); | }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,12 @@ | |||
var add_plugins = function(){ | |||
return { | |||
init: function(){ | |||
//add all plugins to the app | |||
|
|||
require([app.url_path + 'plugins/sample_plugin/sample_plugin.js'],function(){ | |||
app.sample_plugin.init(); | |||
}); | |||
} | |||
}; | |||
|
|||
}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,12 @@ | |||
app.sample_plugin = function(){ | |||
var privateProperties = { | |||
|
|||
}; | |||
|
|||
return { | |||
init: function(){ | |||
console.log('loaded first plugin'); | |||
} | |||
}; | |||
|
|||
}(); |