From 7e088a324e18a95c377b9a3193910aeb550c9d46 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sun, 6 Jun 2010 19:09:33 -0400 Subject: [PATCH] Move the download button into the download file. --- collects/meta/web/www/download.rkt | 36 ++++++++++++++++++++++++++++-- collects/meta/web/www/index.rkt | 31 +------------------------ 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/collects/meta/web/www/download.rkt b/collects/meta/web/www/download.rkt index 96c2750da3..54d155f512 100644 --- a/collects/meta/web/www/download.rkt +++ b/collects/meta/web/www/download.rkt @@ -1,9 +1,41 @@ #lang at-exp s-exp "shared.rkt" -(provide download) +(require "../download/data.rkt") + +(provide download-button) + (define download (page #:link-title "Download" #:window-title "Download Racket" #:file "download/" "Download page comes here.")) -(require "../download/data.rkt") +(define download-button + (let ([img1 (copyfile (in-here "download.png"))] + [img2 (copyfile (in-here "download-dark.png"))]) + @list{ + @script/inline[type: "text/javascript"]{ + @; Don't load all images here -- it causes a delay when loading the + @; page instead, do it only when needed, and also set a timer to do it + @; after loading the page. This makes it so that there's almost never + @; a delay when loading the page, and also no delay when switching the + @; image. + var rollovers = false, the_download_button = false; + function init_rollovers() { + if (!rollovers) { + rollovers = [ new Image(), new Image() ]; + rollovers[0].src = "@img1"; + rollovers[1].src = "@img2"; + the_download_button = document.getElementById("download_button"); + } + } + function set_download_image(n) { + if (!rollovers) init_rollovers(); + the_download_button.src = rollovers[n].src; + } + setTimeout(init_rollovers, 400); + } + @a[href: "download/" + onmouseover: "set_download_image(1);" + onmouseout: "set_download_image(0);"]{ + @img[id: "download_button" border: "0" src: img1 + alt: "Download PLT Scheme" title: "Download PLT Scheme"]}})) diff --git a/collects/meta/web/www/index.rkt b/collects/meta/web/www/index.rkt index 65144fa8a6..c03699fafa 100644 --- a/collects/meta/web/www/index.rkt +++ b/collects/meta/web/www/index.rkt @@ -21,7 +21,7 @@ @span{@span[class: 'whatb]{Racket} is a programming language.}) (div class: 'aboutpane (div class: 'panetitle "Start Quickly") - (div class: 'downloadbutton download-plt) + (div class: 'downloadbutton download-button) (alts-panel @; --- Each example here should be exactly 7 lines long --- @; Candidates for initial example: ------------------------ @@ -438,35 +438,6 @@ ;; width: (round (* 3/2 425)) height: (round (* 3/2 344))]{ ;; @param[name: "movie" value: url]}})) -(define download-plt - (let ([img1 (copyfile (in-here "download.png"))] - [img2 (copyfile (in-here "download-dark.png"))]) - (list - @script/inline[type: "text/javascript"]{ - @; Don't load all images here -- it causes a delay when loading the page - @; instead, do it only when needed, and also set a timer to do it after - @; loading the page. This makes it so that there's almost never a delay - @; when loading the page, and also no delay when switching the image. - var rollovers = false, the_download_button = false; - function init_rollovers() { - if (!rollovers) { - rollovers = [ new Image(), new Image() ]; - rollovers[0].src = "@img1"; - rollovers[1].src = "@img2"; - the_download_button = document.getElementById("download_button"); - } - } - function set_download_image(n) { - if (!rollovers) init_rollovers(); - the_download_button.src = rollovers[n].src; - } - setTimeout(init_rollovers, 400); - } - @a[href: "download/" - onmouseover: "set_download_image(1);" - onmouseout: "set_download_image(0);"]{ - @img[id: "download_button" border: "0" src: img1 - alt: "Download PLT Scheme" title: "Download PLT Scheme"]}))) ;; resources that are specific to the front page