Skip to content

Commit

Permalink
cache only in release. added jquery.rollover.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl Seguin committed Mar 17, 2010
1 parent 4fb1ef2 commit ada1c05
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 11 deletions.
16 changes: 6 additions & 10 deletions Metsys.WebOp/Metsys.WebOp.Mvc/Metsys.WebOp.Mvc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>5ee56782-76a8-4cc9-ab03-9c63e5887f71</ProjectGuid>
<ProjectGuid>{856E9262-61C1-4B01-8874-107E1E8440F2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Metsys.WebOp.Mvc</RootNamespace>
Expand Down Expand Up @@ -35,18 +35,14 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebOpHttpModule.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="jquery.rollover.js" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
4 changes: 3 additions & 1 deletion Metsys.WebOp/Metsys.WebOp.Mvc/WebOpHttpModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ private void OnRequestEnd(object sender, EventArgs e)
var extension = Path.GetExtension(context.Request.Url.AbsolutePath);
if (_longCacheExtensions.Contains(extension))
{
#if !DEBUG
context.Response.CacheControl = "Public";
context.Response.Expires = 44000; //slightly over 1 month
#endif
}
}
}
}
}
40 changes: 40 additions & 0 deletions Metsys.WebOp/Metsys.WebOp.Mvc/jquery.rollover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(function($)
{
$.fn.rollover = function()
{
return this.each(function()
{
if (this.rollover) { return false; }
var $image = $(this);
var r =
{
initialize: function()
{
r.preload();
$image.hover(function() { $(this).attr('src', r.overImagePath()); }, function() { $(this).attr('src', r.normalImagePath()); });
$image.data('rolloverNormal', $image.attr('src'));
},
overImagePath: function()
{
var src = $image.attr('src').replace(/\./, '_o.');
var rel = $image.attr('rel');
if (rel)
{
src = src.replace(/(\?.*)?$/, '?' + rel);
}
return src;
},
normalImagePath: function()
{
return $image.data('rolloverNormal');
},
preload: function()
{
$('<img>').attr('src', r.overImagePath());
}
}
this.rollover = r;
r.initialize();
});
};
})(jQuery);
6 changes: 6 additions & 0 deletions Metsys.WebOp/Metsys.WebOp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Metsys.WebOp.Runner", "Metsys.WebOp.Runner\Metsys.WebOp.Runner.csproj", "{67C6730C-9A0A-472E-8E80-7DFC304CDE9D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Metsys.WebOp.Mvc", "Metsys.WebOp.Mvc\Metsys.WebOp.Mvc.csproj", "{856E9262-61C1-4B01-8874-107E1E8440F2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -13,6 +15,10 @@ Global
{67C6730C-9A0A-472E-8E80-7DFC304CDE9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67C6730C-9A0A-472E-8E80-7DFC304CDE9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67C6730C-9A0A-472E-8E80-7DFC304CDE9D}.Release|Any CPU.Build.0 = Release|Any CPU
{856E9262-61C1-4B01-8874-107E1E8440F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{856E9262-61C1-4B01-8874-107E1E8440F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{856E9262-61C1-4B01-8874-107E1E8440F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{856E9262-61C1-4B01-8874-107E1E8440F2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit ada1c05

Please sign in to comment.