Skip to content

Commit

Permalink
Upgraded to jQuery 1.6.2 which fixes an issue with FF 5
Browse files Browse the repository at this point in the history
  • Loading branch information
haacked committed Jul 17, 2011
1 parent ee255d3 commit d8a41d7
Show file tree
Hide file tree
Showing 16 changed files with 17,095 additions and 588 deletions.
79 changes: 79 additions & 0 deletions Lmbtfy.Web/Controllers/HomeController.cs.orig
@@ -0,0 +1,79 @@
using System;
using System.Globalization;
using System.IO;
using System.Net;
using System.Web.Mvc;
using Lmbtfy.Web.Models;
using System.Web;
using System.Web.Hosting;

namespace Lmbtfy.Web.Controllers {
public class HomeController : Controller {
public ImageMetadata _imageOfTheDay;

public HomeController(ImageMetadata imageOfTheDay) {
_imageOfTheDay = imageOfTheDay;
}

public ActionResult About() {
return View();
}

public ActionResult Index(string q) {
if (string.IsNullOrEmpty(q)) {
return View(_imageOfTheDay);
}
ViewBag.Question = q;
return View("BingThis", _imageOfTheDay);
}

public ActionResult GenerateUrl(string q) {
string virtualPath = Url.RouteUrl("Search", new { q, Controller = "Home", Action = "Index" });
string url = Url.ToPublicUrl(virtualPath);
string tinyUrl = GenerateTinyUrl(url);

return PartialView("_GenerateUrl", new GeneratedUrlModel { Url = url, TinyUrl = tinyUrl });
}

protected string GenerateTinyUrl(string realUrl) {
// prepare the web page we will be asking for
var request = (HttpWebRequest)WebRequest.Create("http://tinyurl.com/api-create.php?url=" + realUrl);

// execute the request
var response = (HttpWebResponse)request.GetResponse();

using (var sr = new StreamReader(response.GetResponseStream())) {
return sr.ReadToEnd();
}
}

public ActionResult BackgroundImageCss() {
var imageUrl = VirtualPathUtility.ToAbsolute(_imageOfTheDay.ImageUrl);

var imageMetadata = ImageMetadata.GetImageMetadata(Server, imageUrl);
string imageCss = @"#bgDiv {{ BACKGROUND-IMAGE: url({0}); BACKGROUND-REPEAT: no-repeat; }}
#bgDivFull {{ BACKGROUND-IMAGE: url({0}); BACKGROUND-REPEAT: no-repeat; }}";
imageCss = String.Format(CultureInfo.InvariantCulture, imageCss, imageMetadata.ImageUrl);
return Content(imageCss, "text/css");
}
}

public static class Helpers {
public static string ToPublicUrl(this UrlHelper urlHelper, string relativeUri) {
var httpContext = urlHelper.RequestContext.HttpContext;

var uriBuilder = new UriBuilder {
Host = httpContext.Request.Url.Host,
Path = "/",
Port = 80,
Scheme = "http",
};

if (httpContext.Request.IsLocal) {
uriBuilder.Port = httpContext.Request.Url.Port;
}

return new Uri(uriBuilder.Uri, relativeUri).AbsoluteUri;
}
}
}
6 changes: 3 additions & 3 deletions Lmbtfy.Web/Lmbtfy.Web.csproj
Expand Up @@ -114,9 +114,9 @@
<Content Include="Content\Site.css" />
<Content Include="Error.html" />
<Content Include="Global.asax" />
<Content Include="Scripts\jquery-1.6-vsdoc.js" />
<Content Include="Scripts\jquery-1.6.js" />
<Content Include="Scripts\jquery-1.6.min.js" />
<Content Include="Scripts\jquery-1.6.2-vsdoc.js" />
<Content Include="Scripts\jquery-1.6.2.js" />
<Content Include="Scripts\jquery-1.6.2.min.js" />
<Content Include="Scripts\jquery-ui-1.8.12.js" />
<Content Include="Scripts\jquery-ui-1.8.12.min.js" />
<Content Include="packages.config" />
Expand Down

0 comments on commit d8a41d7

Please sign in to comment.