Customizing Theme File Processing (more than just .css, .jpg, etc)

G

grexican

Hello,

I'm working with some third-party JS code, such as mootools and
moo.fx, among a few others. They have some really nice "flashy"
features, such as fading from one color to another to bring
attention. I would like to use these settings, but I am currently
restricted to a single theme (more specifically, one color scheme),
because you must specify the start and stop color in JS.

If I could "theme" JS files, then I could create a JS file with a ton
of constants. By creating a .js file in a Theme's directory, it would
register a:
<script type="text/javascript" src="app_themes/theme_name/
file_name.js"></script>

Doing so would act like a .css file except for my .js file. Then in
my file_name.js file:

var FadeFromColor = "FFF";
var FadeToColor = "000";


-----------------------
The above is just an example, of course. Is there any way I can
extend PageTheme to do these types of things? Is there any kind of
PageTheme Provider that I can access?

I've searched all over the net, but I'm unable to find anything. Any
sort of information would be appreciated.

Thank you
-eli
 
G

grexican

For anyone that cares, I gave in and did it OnInit. I would ideally
like to do it through a provider of sorts, but for now this will work:

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

if(!string.IsNullOrEmpty(Page.Theme))
{
DirectoryInfo dir = new
DirectoryInfo(Page.Server.MapPath(Page.ResolveUrl("~/App_Themes/" +
Page.Theme)));

FileInfo[] files = dir.GetFiles("*.js",
SearchOption.TopDirectoryOnly);

foreach(FileInfo file in files)
{

Page.ClientScript.RegisterClientScriptInclude(this.GetType(),
file.Name, Page.ResolveUrl("~/App_Themes/" + Page.Theme + "/" +
file.Name));
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top