GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — processing-docs/javascript/site.js at master · processing/processing-docs Expand file tree/ Copy pathsite.jsMore file actions 109 lines (92 loc) · 3.43 KB / Copy pathsite.jsFile metadata and controls109 lines (92 loc) · 3.43 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 $(function(){ // redirect download to support $('.download [href*="download.processing.org"]').on('click', function (e) { e.preventDefault() window.open($(this).attr('href')) window.location = '/download/support.html' window.focus() }) // sticky scroll if(!Modernizr.touch){ $(window).scroll(function(){ if($(this).scrollTop() < 114){ $('.navBar').removeClass('stuck') } else { $('.navBar').addClass('stuck') } }) } // if on the homepage, gather recent tweets/commits if($('body').attr('id')=='Cover'){ // recent tweets $.getJSON('/content/static/feeds/twitter.php', function(data) { $.each(data, function(i, tweet) { var time = parse_date(tweet.created_at); var timeText = format_relative_time(extract_relative_time(time)); var tweet_html = '<li><div>'+tweet.text.parseURL().parseUsername().parseHashtag(); tweet_html += ' about'; tweet_html += '<a href="https://www.twitter.com/processingOrg/status/' + tweet.id_str + '">' + timeText + '<\/a>'; tweet_html += '<\/div><\/li>'; $('.latest-tweets').append(tweet_html) }) }) // recent commits $.getJSON('/content/static/feeds/github.php', function(data) { $.each(data, function(i, commit) { if(i<=3){ var time = parse_date(commit.commit.committer.date); var timeText = format_relative_time(extract_relative_time(time)); var commit_html = '<li><img class="github-avatar" src="https://www.gravatar.com/avatar/' + commit.author.gravatar_id + '?s=20"/>'; commit_html += '<div><a href="' + commit.author.html_url + '">' + commit.author.login + '<\/a> committed'; commit_html += ' <a href="https://github.com/processing/processing/commit/' + commit.sha + '">"' + commit.commit.message + '"<\/a>'; commit_html += ' about ' + timeText + '<\/div>'; $('.latest-commits').append(commit_html) } }) }) } }); // Functions /* Twitter Parsing Functions */ String.prototype.parseUsername = function() { return this.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) { var username = u.replace("@","") return u.link("http://twitter.com/"+username); }); }; String.prototype.parseHashtag = function() { return this.replace(/[#]+[A-Za-z0-9-_]+/g, function(t) { var tag = t.replace("#","%23") return t.link("http://search.twitter.com/search?q="+tag); }); }; String.prototype.parseURL = function() { return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) { return url.link(url); }); }; /* Time Parsing */ function parse_date(date_str) { return Date.parse(date_str.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3')); } function extract_relative_time(date) { var toInt = function(val) { return parseInt(val, 10); }; var relative_to = new Date(); var delta = toInt((relative_to.getTime() - date) / 1000); if (delta < 1) delta = 0; return { days: toInt(delta / 86400), hours: toInt(delta / 3600), minutes: toInt(delta / 60), seconds: toInt(delta) }; } function format_relative_time(time_ago) { if ( time_ago.days > 2 ) return ' ' + time_ago.days + ' days ago'; if ( time_ago.hours > 24 ) return ' a day ago'; if ( time_ago.hours > 2 ) return ' ' + time_ago.hours + ' hours ago'; if ( time_ago.minutes > 45 ) return ' an hour ago'; if ( time_ago.minutes > 2 ) return ' ' + time_ago.minutes + ' minutes ago'; if ( time_ago.seconds > 1 ) return ' ' + time_ago.seconds + ' seconds ago'; return 'just now'; } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |