From 62ddb9498a401e1c7b6323632289a63513e90a46 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 11 Oct 2010 11:45:22 -0700 Subject: [PATCH] Adding html5shim to the core shapes (document template) --HG-- branch : dev --- CREDITS.txt | 5 +++++ lib/html5shim/html5.js | 3 +++ src/Orchard.Web/Core/Orchard.Core.csproj | 1 + src/Orchard.Web/Core/Shapes/Scripts/html5.js | 3 +++ .../Core/Shapes/Views/Document.cshtml | 17 +++++++---------- src/Orchard.Web/Orchard.Web.csproj | 2 +- .../Views/{Document.cshtml => _Document.cshtml} | 2 ++ 7 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 lib/html5shim/html5.js create mode 100644 src/Orchard.Web/Core/Shapes/Scripts/html5.js rename src/Orchard.Web/Themes/TheThemeMachine/Views/{Document.cshtml => _Document.cshtml} (78%) diff --git a/CREDITS.txt b/CREDITS.txt index 9940c0d8b..b956a0dcd 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -75,6 +75,11 @@ Website: http://htmlagilitypack.codeplex.com/ Copyright: Copyright (c) 2003-20010 Simon Mourier License: MS-PL +html5shim +----- +Website: http://code.google.com/p/html5shim/ +License: MIT + IESI Collections ----- Website: http://www.codeproject.com/KB/recipes/sets.aspx diff --git a/lib/html5shim/html5.js b/lib/html5shim/html5.js new file mode 100644 index 000000000..db402df67 --- /dev/null +++ b/lib/html5shim/html5.js @@ -0,0 +1,3 @@ +// html5shiv MIT @rem remysharp.com/html5-enabling-script +// iepp v1.5.1 MIT @jon_neal iecss.com/print-protector +/*@cc_on(function(p,e){var q=e.createElement("div");q.innerHTML="<z>i</z>";q.childNodes.length!==1&&function(){function r(a,b){if(g[a])g[a].styleSheet.cssText+=b;else{var c=s[l],d=e[j]("style");d.media=a;c.insertBefore(d,c[l]);g[a]=d;r(a,b)}}function t(a,b){for(var c=new RegExp("\\b("+m+")\\b(?!.*[;}])","gi"),d=function(k){return".iepp_"+k},h=-1;++h<a.length;){b=a[h].media||b;t(a[h].imports,b);r(b,a[h].cssText.replace(c,d))}}for(var s=e.documentElement,i=e.createDocumentFragment(),g={},m="abbr article aside audio canvas details figcaption figure footer header hgroup mark meter nav output progress section summary time video".replace(/ /g, '|'),n=m.split("|"),f=[],o=-1,l="firstChild",j="createElement";++o<n.length;){e[j](n[o]);i[j](n[o])}i=i.appendChild(e[j]("div"));p.attachEvent("onbeforeprint",function(){for(var a,b=e.getElementsByTagName("*"),c,d,h=new RegExp("^"+m+"$","i"),k=-1;++k<b.length;)if((a=b[k])&&(d=a.nodeName.match(h))){c=new RegExp("^\\s*<"+d+"(.*)\\/"+d+">\\s*$","i");i.innerHTML=a.outerHTML.replace(/\r|\n/g," ").replace(c,a.currentStyle.display=="block"?"<div$1/div>":"<span$1/span>");c=i.childNodes[0];c.className+=" iepp_"+d;c=f[f.length]=[a,c];a.parentNode.replaceChild(c[1],c[0])}t(e.styleSheets,"all")});p.attachEvent("onafterprint",function(){for(var a=-1,b;++a<f.length;)f[a][1].parentNode.replaceChild(f[a][0],f[a][1]);for(b in g)s[l].removeChild(g[b]);g={};f=[]})}()})(this,document);@*/ \ No newline at end of file diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index e853d889e..de3bb5af2 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -309,6 +309,7 @@ + diff --git a/src/Orchard.Web/Core/Shapes/Scripts/html5.js b/src/Orchard.Web/Core/Shapes/Scripts/html5.js new file mode 100644 index 000000000..db402df67 --- /dev/null +++ b/src/Orchard.Web/Core/Shapes/Scripts/html5.js @@ -0,0 +1,3 @@ +// html5shiv MIT @rem remysharp.com/html5-enabling-script +// iepp v1.5.1 MIT @jon_neal iecss.com/print-protector +/*@cc_on(function(p,e){var q=e.createElement("div");q.innerHTML="<z>i</z>";q.childNodes.length!==1&&function(){function r(a,b){if(g[a])g[a].styleSheet.cssText+=b;else{var c=s[l],d=e[j]("style");d.media=a;c.insertBefore(d,c[l]);g[a]=d;r(a,b)}}function t(a,b){for(var c=new RegExp("\\b("+m+")\\b(?!.*[;}])","gi"),d=function(k){return".iepp_"+k},h=-1;++h<a.length;){b=a[h].media||b;t(a[h].imports,b);r(b,a[h].cssText.replace(c,d))}}for(var s=e.documentElement,i=e.createDocumentFragment(),g={},m="abbr article aside audio canvas details figcaption figure footer header hgroup mark meter nav output progress section summary time video".replace(/ /g, '|'),n=m.split("|"),f=[],o=-1,l="firstChild",j="createElement";++o<n.length;){e[j](n[o]);i[j](n[o])}i=i.appendChild(e[j]("div"));p.attachEvent("onbeforeprint",function(){for(var a,b=e.getElementsByTagName("*"),c,d,h=new RegExp("^"+m+"$","i"),k=-1;++k<b.length;)if((a=b[k])&&(d=a.nodeName.match(h))){c=new RegExp("^\\s*<"+d+"(.*)\\/"+d+">\\s*$","i");i.innerHTML=a.outerHTML.replace(/\r|\n/g," ").replace(c,a.currentStyle.display=="block"?"<div$1/div>":"<span$1/span>");c=i.childNodes[0];c.className+=" iepp_"+d;c=f[f.length]=[a,c];a.parentNode.replaceChild(c[1],c[0])}t(e.styleSheets,"all")});p.attachEvent("onafterprint",function(){for(var a=-1,b;++a<f.length;)f[a][1].parentNode.replaceChild(f[a][0],f[a][1]);for(b in g)s[l].removeChild(g[b]);g={};f=[]})}()})(this,document);@*/ \ No newline at end of file diff --git a/src/Orchard.Web/Core/Shapes/Views/Document.cshtml b/src/Orchard.Web/Core/Shapes/Views/Document.cshtml index b899580be..bbef65ac1 100644 --- a/src/Orchard.Web/Core/Shapes/Views/Document.cshtml +++ b/src/Orchard.Web/Core/Shapes/Views/Document.cshtml @@ -2,22 +2,19 @@ @using Orchard.UI.Resources; @{ RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/modules/orchard.themes/Content/orchard.ico")}); + //todo: (heskew) get conditions (as in conditional comments) hooked up for script tags too + Script.Include("html5.js").AtLocation(ResourceLocation.Head); } - - @Html.Title(WorkContext.CurrentSite.SiteName) - @{ - //todo: (heskew) have resource modules that can be leaned on (like a jQuery module that knows about various CDNs and jQuery's version and min naming schemes) - //todo: (heskew) this is an interim solution to inlude jQuery in every page and still allow that to be overriden in some theme by it containing a headScripts partial - } - @* Model.Zones.AddRenderPartial("head:before", "HeadPreload", Model); *@ - @* Html.Zone("head", ":metas :styles :scripts"); %> *@ - @Display(Model.Head) + + @Model.Title + @Display(Model.Head) - + +@* Layout (template) is in the Body zone @ the default position (nothing, zero, zilch) *@ @Display(Model.Body) @Display(Model.Tail) diff --git a/src/Orchard.Web/Orchard.Web.csproj b/src/Orchard.Web/Orchard.Web.csproj index 4a1018f20..8062f4b86 100644 --- a/src/Orchard.Web/Orchard.Web.csproj +++ b/src/Orchard.Web/Orchard.Web.csproj @@ -147,7 +147,7 @@ Designer - + Designer diff --git a/src/Orchard.Web/Themes/TheThemeMachine/Views/Document.cshtml b/src/Orchard.Web/Themes/TheThemeMachine/Views/_Document.cshtml similarity index 78% rename from src/Orchard.Web/Themes/TheThemeMachine/Views/Document.cshtml rename to src/Orchard.Web/Themes/TheThemeMachine/Views/_Document.cshtml index fa0d04387..bbef65ac1 100644 --- a/src/Orchard.Web/Themes/TheThemeMachine/Views/Document.cshtml +++ b/src/Orchard.Web/Themes/TheThemeMachine/Views/_Document.cshtml @@ -2,6 +2,8 @@ @using Orchard.UI.Resources; @{ RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/modules/orchard.themes/Content/orchard.ico")}); + //todo: (heskew) get conditions (as in conditional comments) hooked up for script tags too + Script.Include("html5.js").AtLocation(ResourceLocation.Head); }