# HG changeset patch # User Eugen Sawin # Date 1324231069 -3600 # Node ID 7b3fc980d9d780aafd3fc26f6cf626f165167f5c # Parent c0e6fb6cf6ef849008159b600242c7910fd60758 Pretty lines. diff -r c0e6fb6cf6ef -r 7b3fc980d9d7 factory/v2012/links.html --- a/factory/v2012/links.html Sun Dec 18 15:57:15 2011 +0100 +++ b/factory/v2012/links.html Sun Dec 18 18:57:49 2011 +0100 @@ -21,25 +21,18 @@ -

Professional

+

The People and their Sites

- -

Friends (with websites)

-

Recursive

diff -r c0e6fb6cf6ef -r 7b3fc980d9d7 factory/v2012/linksend.html --- a/factory/v2012/linksend.html Sun Dec 18 15:57:15 2011 +0100 +++ b/factory/v2012/linksend.html Sun Dec 18 18:57:49 2011 +0100 @@ -21,25 +21,18 @@ -

Professional

+

The People and their Sites

- -

Friends (with websites)

-

Recursive

diff -r c0e6fb6cf6ef -r 7b3fc980d9d7 factory/v2012/script.js --- a/factory/v2012/script.js Sun Dec 18 15:57:15 2011 +0100 +++ b/factory/v2012/script.js Sun Dec 18 18:57:49 2011 +0100 @@ -8,10 +8,10 @@ image.src = "images/logobase.png"; $("#logo").click(handle_click); $("#logo").hover(function() { - $(this).css("cursor", "pointer"); + $(this).css("cursor", "pointer"); }, function() { $(this).css("cursor", "auto"); - }); + }); }); $(document).keypress( function(event) { @@ -23,32 +23,33 @@ var menu_width = 670; var menu_height = 120; +var menu_splits = new Array(150, 350, 545); var click_events = new Array(); click_events["logo"] = new Array(); click_events["logo"][0] = new Object(); click_events["logo"][0]["min_x"] = 0; -click_events["logo"][0]["max_x"] = Math.round(menu_width/4); +click_events["logo"][0]["max_x"] = menu_splits[0]; click_events["logo"][0]["min_y"] = 0; click_events["logo"][0]["max_y"] = menu_height; click_events["logo"][0]["func"] = switch_page; click_events["logo"][0]["args"] = new Array("personalwork.html"); click_events["logo"][1] = new Object(); -click_events["logo"][1]["min_x"] = Math.round(menu_width/4) + 1; -click_events["logo"][1]["max_x"] = Math.round(menu_width/2); +click_events["logo"][1]["min_x"] = menu_splits[0] + 1; +click_events["logo"][1]["max_x"] = menu_splits[1]; click_events["logo"][1]["min_y"] = 0; click_events["logo"][1]["max_y"] = menu_height; click_events["logo"][1]["func"] = switch_page; click_events["logo"][1]["args"] = new Array("howiwork.html"); click_events["logo"][2] = new Object(); -click_events["logo"][2]["min_x"] = Math.round(menu_width/2) + 1; -click_events["logo"][2]["max_x"] = Math.round(menu_width/4*3); +click_events["logo"][2]["min_x"] = menu_splits[1] + 1; +click_events["logo"][2]["max_x"] = menu_splits[2]; click_events["logo"][2]["min_y"] = 0; click_events["logo"][2]["max_y"] = menu_height; click_events["logo"][2]["func"] = switch_page; click_events["logo"][2]["args"] = new Array("books.html"); click_events["logo"][3] = new Object(); -click_events["logo"][3]["min_x"] = Math.round(menu_width/4*3) + 1; +click_events["logo"][3]["min_x"] = menu_splits[2] + 1; click_events["logo"][3]["max_x"] = menu_width - 1; click_events["logo"][3]["min_y"] = 0; click_events["logo"][3]["max_y"] = menu_height; @@ -116,6 +117,71 @@ color_area("logo", p["min_x"], p["max_x"], 0, 70, white); } } + drawMenuLines(); +} + +function drawMenuLines() { + var canvas = document.getElementById("logo"); + var context = canvas.getContext("2d"); + var image = context.getImageData(0, 0, menu_width, menu_height); + var pixels = image.data; + context.lineCap = "round"; + context.lineWidth = 1; + var colour1a = new Colour(0, 0, 0, 0.1); + context.beginPath(); + context.moveTo(0, menu_height - 1); + context.lineTo(menu_width - 1, menu_height - 1); + context.closePath(); + context.strokeStyle = colour1a.str(); + context.stroke(); +var colour1b = new Colour(0, 0, 0, 0.1); + context.beginPath(); + context.moveTo(50, menu_height - 1); + context.lineTo(menu_width - 51, menu_height - 1); + context.closePath(); + context.strokeStyle = colour1b.str(); + context.stroke(); + var colour1c = new Colour(0, 0, 0, 0.05); + context.beginPath(); + context.moveTo(25, menu_height - 1); + context.lineTo(menu_width - 26, menu_height - 1); + context.closePath(); + context.strokeStyle = colour1c.str(); + context.stroke(); + var colour1d = new Colour(0, 0, 0, 0.05); + context.beginPath(); + context.moveTo(10, menu_height - 1); + context.lineTo(menu_width - 11, menu_height - 1); + context.closePath(); + context.strokeStyle = colour1d.str(); + context.stroke(); + + var colour2 = new Colour(0, 0, 0, 0.2); + context.beginPath(); + context.moveTo(menu_splits[0], 0); + context.lineTo(menu_splits[0], menu_height - 1); + context.moveTo(menu_splits[1], 0); + context.lineTo(menu_splits[1], menu_height - 1); + context.moveTo(menu_splits[2], 0); + context.lineTo(menu_splits[2], menu_height - 1); + context.closePath(); + context.strokeStyle = colour2.str(); + context.stroke(); + + context.clearRect(menu_splits[0] - 1, menu_height - 1, 2, 2); + context.clearRect(menu_splits[1] - 1, menu_height - 1, 2, 2); + context.clearRect(menu_splits[2] - 1, menu_height - 1, 2, 2); +} + +function clearMenuLines() { + var canvas = document.getElementById("logo"); + var context = canvas.getContext("2d"); + var image = context.getImageData(0, 0, menu_width, menu_height); + var pixels = image.data; + context.clearRect(0, menu_height - 2, menu_width - 1, 2); + context.clearRect(menu_splits[0] - 1, 0, 2, menu_height - 1); + context.clearRect(menu_splits[1] - 1, 0, 2, menu_height - 1); + context.clearRect(menu_splits[2] - 1, 0, 2, menu_height - 1); } function update_logo() { @@ -139,7 +205,7 @@ this.r = r; this.g = g; this.b = b; - this.a = a == undefined ? 255 : a; + this.a = a == undefined ? 1 : a; } Colour.prototype.equals = function(rhs) { for (p in this) { @@ -150,6 +216,9 @@ } return true; } +Colour.prototype.str = function() { + return "rgba(" + this.r + "," + this.g + "," + this.b + "," + this.a + ")"; +} function setPixel(image, x, y, color) { var index = 4 * (x + y * image.width); diff -r c0e6fb6cf6ef -r 7b3fc980d9d7 links.html --- a/links.html Sun Dec 18 15:57:15 2011 +0100 +++ b/links.html Sun Dec 18 18:57:49 2011 +0100 @@ -56,25 +56,18 @@ -

Professional

+

The People and their Sites

- -

Friends (with websites)

-

Recursive

diff -r c0e6fb6cf6ef -r 7b3fc980d9d7 linksend.html --- a/linksend.html Sun Dec 18 15:57:15 2011 +0100 +++ b/linksend.html Sun Dec 18 18:57:49 2011 +0100 @@ -56,25 +56,18 @@ -

Professional

+

The People and their Sites

- -

Friends (with websites)

-

Recursive

diff -r c0e6fb6cf6ef -r 7b3fc980d9d7 script.js --- a/script.js Sun Dec 18 15:57:15 2011 +0100 +++ b/script.js Sun Dec 18 18:57:49 2011 +0100 @@ -8,10 +8,10 @@ image.src = "images/logobase.png"; $("#logo").click(handle_click); $("#logo").hover(function() { - $(this).css("cursor", "pointer"); + $(this).css("cursor", "pointer"); }, function() { $(this).css("cursor", "auto"); - }); + }); }); $(document).keypress( function(event) { @@ -23,32 +23,33 @@ var menu_width = 670; var menu_height = 120; +var menu_splits = new Array(150, 350, 545); var click_events = new Array(); click_events["logo"] = new Array(); click_events["logo"][0] = new Object(); click_events["logo"][0]["min_x"] = 0; -click_events["logo"][0]["max_x"] = Math.round(menu_width/4); +click_events["logo"][0]["max_x"] = menu_splits[0]; click_events["logo"][0]["min_y"] = 0; click_events["logo"][0]["max_y"] = menu_height; click_events["logo"][0]["func"] = switch_page; click_events["logo"][0]["args"] = new Array("personalwork.html"); click_events["logo"][1] = new Object(); -click_events["logo"][1]["min_x"] = Math.round(menu_width/4) + 1; -click_events["logo"][1]["max_x"] = Math.round(menu_width/2); +click_events["logo"][1]["min_x"] = menu_splits[0] + 1; +click_events["logo"][1]["max_x"] = menu_splits[1]; click_events["logo"][1]["min_y"] = 0; click_events["logo"][1]["max_y"] = menu_height; click_events["logo"][1]["func"] = switch_page; click_events["logo"][1]["args"] = new Array("howiwork.html"); click_events["logo"][2] = new Object(); -click_events["logo"][2]["min_x"] = Math.round(menu_width/2) + 1; -click_events["logo"][2]["max_x"] = Math.round(menu_width/4*3); +click_events["logo"][2]["min_x"] = menu_splits[1] + 1; +click_events["logo"][2]["max_x"] = menu_splits[2]; click_events["logo"][2]["min_y"] = 0; click_events["logo"][2]["max_y"] = menu_height; click_events["logo"][2]["func"] = switch_page; click_events["logo"][2]["args"] = new Array("books.html"); click_events["logo"][3] = new Object(); -click_events["logo"][3]["min_x"] = Math.round(menu_width/4*3) + 1; +click_events["logo"][3]["min_x"] = menu_splits[2] + 1; click_events["logo"][3]["max_x"] = menu_width - 1; click_events["logo"][3]["min_y"] = 0; click_events["logo"][3]["max_y"] = menu_height; @@ -116,6 +117,71 @@ color_area("logo", p["min_x"], p["max_x"], 0, 70, white); } } + drawMenuLines(); +} + +function drawMenuLines() { + var canvas = document.getElementById("logo"); + var context = canvas.getContext("2d"); + var image = context.getImageData(0, 0, menu_width, menu_height); + var pixels = image.data; + context.lineCap = "round"; + context.lineWidth = 1; + var colour1a = new Colour(0, 0, 0, 0.1); + context.beginPath(); + context.moveTo(0, menu_height - 1); + context.lineTo(menu_width - 1, menu_height - 1); + context.closePath(); + context.strokeStyle = colour1a.str(); + context.stroke(); +var colour1b = new Colour(0, 0, 0, 0.1); + context.beginPath(); + context.moveTo(50, menu_height - 1); + context.lineTo(menu_width - 51, menu_height - 1); + context.closePath(); + context.strokeStyle = colour1b.str(); + context.stroke(); + var colour1c = new Colour(0, 0, 0, 0.05); + context.beginPath(); + context.moveTo(25, menu_height - 1); + context.lineTo(menu_width - 26, menu_height - 1); + context.closePath(); + context.strokeStyle = colour1c.str(); + context.stroke(); + var colour1d = new Colour(0, 0, 0, 0.05); + context.beginPath(); + context.moveTo(10, menu_height - 1); + context.lineTo(menu_width - 11, menu_height - 1); + context.closePath(); + context.strokeStyle = colour1d.str(); + context.stroke(); + + var colour2 = new Colour(0, 0, 0, 0.2); + context.beginPath(); + context.moveTo(menu_splits[0], 0); + context.lineTo(menu_splits[0], menu_height - 1); + context.moveTo(menu_splits[1], 0); + context.lineTo(menu_splits[1], menu_height - 1); + context.moveTo(menu_splits[2], 0); + context.lineTo(menu_splits[2], menu_height - 1); + context.closePath(); + context.strokeStyle = colour2.str(); + context.stroke(); + + context.clearRect(menu_splits[0] - 1, menu_height - 1, 2, 2); + context.clearRect(menu_splits[1] - 1, menu_height - 1, 2, 2); + context.clearRect(menu_splits[2] - 1, menu_height - 1, 2, 2); +} + +function clearMenuLines() { + var canvas = document.getElementById("logo"); + var context = canvas.getContext("2d"); + var image = context.getImageData(0, 0, menu_width, menu_height); + var pixels = image.data; + context.clearRect(0, menu_height - 2, menu_width - 1, 2); + context.clearRect(menu_splits[0] - 1, 0, 2, menu_height - 1); + context.clearRect(menu_splits[1] - 1, 0, 2, menu_height - 1); + context.clearRect(menu_splits[2] - 1, 0, 2, menu_height - 1); } function update_logo() { @@ -139,7 +205,7 @@ this.r = r; this.g = g; this.b = b; - this.a = a == undefined ? 255 : a; + this.a = a == undefined ? 1 : a; } Colour.prototype.equals = function(rhs) { for (p in this) { @@ -150,6 +216,9 @@ } return true; } +Colour.prototype.str = function() { + return "rgba(" + this.r + "," + this.g + "," + this.b + "," + this.a + ")"; +} function setPixel(image, x, y, color) { var index = 4 * (x + y * image.width);