Skip to content

Commit

Permalink
updated hooks for project
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismatthieu committed Nov 21, 2010
1 parent 340a227 commit 15fc28d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
33 changes: 33 additions & 0 deletions Notes
@@ -0,0 +1,33 @@
Notes:

Determines the size of an image:
<script>
function onImageLoad(aEvent) {
alert("width:" + aEvent.target.width + "\nheight:" + aEvent.target.height);
}

var img = document.createElementNS("http://www.w3.org/1999/xhtml","html:img");
img.addEventListener("load", onImageLoad, false);
img.src = "http://upload.wikimedia.org/wikipedia/commons/0/06/Gigantactis.jpg";
</script>

OR largest image on the page:

<script>
var sHTML = getHTMLSomehow(sURL);
var nMaxDim = 0;
var $pageDOM = $(sHTML);
var $objMaxDimImage;

$pageDOM.("img").each(function(){
var $this = $(this);
var nDim = parseFloat($this.width()) * parseFloat($(this).height());
if (nDim > nMaxDim){
$objMaxDimImage = $this;
nMaxDim = nDim
}
});

alert("Max dim is:" nMaxDim);
alert("Image Source:" $objMaxDimImage.attr("src"));
</script>
2 changes: 0 additions & 2 deletions README
Expand Up @@ -5,6 +5,4 @@ This is a Rails 3 HTTP Proxy application. It allows users to surf the web throu
You can browse pages with the following URL structure:
http://localhost:3000/proxy?lnk=http://zappos.com



Copyright 2010 Chris Matthieu
14 changes: 9 additions & 5 deletions app/controllers/proxy_controller.rb
Expand Up @@ -6,11 +6,13 @@ def proxy
# site_url = request.env["REQUEST_URI"][0..request.env["REQUEST_URI"].index("/proxy")-1] # prefix i.e. "http://localhost:3000"

if request.env["REQUEST_URI"].index("http://localhost")
site_url = "http://localhost:3000"
site_url = "http://localhost:3000/proxy"
else
site_url = "http://webproxy.heroku.com"
site_url = "http://webproxy.heroku.com/proxy"
end

# INSERT START

if params[:lnk]
@url = params[:lnk]
else
Expand Down Expand Up @@ -165,7 +167,7 @@ def proxy
#not anchor
if a['href'] != nil and a['href'] != "#"

link = site_url + '/proxy' + '?lnk=' + URI.escape(link.strip)
link = site_url + '?lnk=' + URI.escape(link.strip)
a['href'] = link

end
Expand Down Expand Up @@ -224,7 +226,7 @@ def proxy
link.gsub!("http:///", @baseurl) #added to test localhost entries

link = link.strip
# link = site_url + '/proxy' + '?lnk=' + URI.escape(link.strip)
# link = site_url + '?lnk=' + URI.escape(link.strip)
a['href'] = link

end
Expand Down Expand Up @@ -260,7 +262,7 @@ def proxy
if a['action'] != nil and a['action'] != "#"

formaction = link.strip
link = site_url + '/proxy' + '?url=' + URI.escape(link.strip)
link = site_url + '?url=' + URI.escape(link.strip)

a['action'] = link

Expand Down Expand Up @@ -309,6 +311,8 @@ def proxy
@finaldoc.gsub(".location.replace", "")


# INSERT END

render :layout => false

end
Expand Down
4 changes: 2 additions & 2 deletions public/stylesheets/style.css
@@ -1,5 +1,5 @@
#generalform input:focus, textarea:focus {background: none repeat scroll 0 0 #FFFF99; line-height:30px; font-size: 30px;}
#generalform input, textarea {line-height:30px; font-size: 30px; }
#generalform input:focus, textarea:focus {background: none repeat scroll 0 0 #FFFF99; line-height:30px; font-size: 30px; width: 500px;}
#generalform input, textarea {line-height:30px; font-size: 30px; }

#generalform button, input{
padding:5px 10px;
Expand Down

0 comments on commit 15fc28d

Please sign in to comment.