mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2025-01-11 13:48:37 -05:00
Merge branch 'master' into site
Conflicts: Rakefile
This commit is contained in:
commit
2afb62b297
@ -1,7 +1,8 @@
|
||||
{% if site.delicious_user %}
|
||||
<section>
|
||||
<h1>On Delicious</h1>
|
||||
<script type="text/javascript" src="http://feeds.delicious.com/v2/js/{{ site.delicious_user }}?title=&count={{ site.delicious_count }}&sort=date&extended"></script>
|
||||
<div id="delicious"></div>
|
||||
<script type="text/javascript" src="http://feeds.delicious.com/v1/json/{{ site.delicious_user }}?count={{ site.delicious_count }}&sort=date&callback=renderDeliciousLinks"></script>
|
||||
<p><a href="http://delicious.com/{{ site.delicious_user }}">My Delicious Bookmarks »</a></p>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endif %}
|
@ -104,6 +104,15 @@ function wrapFlashVideos() {
|
||||
});
|
||||
}
|
||||
|
||||
function renderDeliciousLinks(items) {
|
||||
var output = "<ul>";
|
||||
for (var i=0,l=items.length; i<l; i++) {
|
||||
output += '<li><a href="' + items[i].u + '" title="Tags: ' + items[i].t.join(', ') + '">' + items[i].d + '</a></li>';
|
||||
}
|
||||
output += "</ul>";
|
||||
$('#delicious').html(output);
|
||||
}
|
||||
|
||||
$.domReady(function() {
|
||||
testFeatures();
|
||||
wrapFlashVideos();
|
||||
|
@ -1,43 +1,5 @@
|
||||
// JSON-P Twitter fetcher for Octopress
|
||||
// (c) Brandon Mathis // MIT Lisence
|
||||
function getTwitterFeed(user, count, replies) {
|
||||
var feed = new jXHR();
|
||||
|
||||
feed.onerror = function (msg,url) {
|
||||
$('#tweets li.loading').addClass('error').text("Twitter's busted");
|
||||
}
|
||||
feed.onreadystatechange = function(data){
|
||||
if (feed.readyState === 4) {
|
||||
var tweets = new Array();
|
||||
var i = 0;
|
||||
for (i in data){
|
||||
if(tweets.length < count){
|
||||
if(replies || data[i].in_reply_to_user_id == null){
|
||||
tweets.push(data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
showTwitterFeed(tweets, user);
|
||||
}
|
||||
};
|
||||
feed.open("GET","http://twitter.com/statuses/user_timeline/"+user+".json?trim_user=true&count="+(parseInt(count)+60)+"&callback=?");
|
||||
feed.send();
|
||||
}
|
||||
|
||||
function showTwitterFeed(tweets, twitter_user){
|
||||
var timeline = document.getElementById('tweets');
|
||||
timeline.innerHTML='';
|
||||
for (t in tweets){
|
||||
timeline.innerHTML+='<li>'+'<p>'+'<a href="http://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'))+'</p>'+'</li>';
|
||||
}
|
||||
}
|
||||
function linkifyTweet(text){
|
||||
return text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
|
||||
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
|
||||
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// jXHR.js (JSON-P XHR) | v0.1 (c) Kyle Simpson | MIT License | http://mulletxhr.com/
|
||||
// uncompressed version available in source/javascripts/libs/jXHR.js
|
||||
@ -45,38 +7,71 @@ function linkifyTweet(text){
|
||||
|
||||
|
||||
/* Sky Slavin, Ludopoli. MIT license. * based on JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */
|
||||
|
||||
function prettyDate(time) {
|
||||
if (navigator.appName == 'Microsoft Internet Explorer') {
|
||||
if (navigator.appName === 'Microsoft Internet Explorer') {
|
||||
return "<span>∞</span>"; // because IE date parsing isn't fun.
|
||||
}
|
||||
|
||||
var say = {
|
||||
just_now: " now",
|
||||
minute_ago: "1m",
|
||||
minutes_ago: "m",
|
||||
hour_ago: "1h",
|
||||
hours_ago: "h",
|
||||
yesterday: "1d",
|
||||
days_ago: "d",
|
||||
weeks_ago: "w"
|
||||
};
|
||||
|
||||
var say = {};
|
||||
say.just_now = " now",
|
||||
say.minute_ago = "1m",
|
||||
say.minutes_ago = "m",
|
||||
say.hour_ago = "1h",
|
||||
say.hours_ago = "h",
|
||||
say.yesterday = "1d",
|
||||
say.days_ago = "d",
|
||||
say.weeks_ago = "w"
|
||||
var current_date = new Date(),
|
||||
current_date_time = current_date.getTime(),
|
||||
current_date_full = current_date_time + (1 * 60000),
|
||||
date = new Date(time),
|
||||
diff = ((current_date_full - date.getTime()) / 1000),
|
||||
day_diff = Math.floor(diff / 86400);
|
||||
|
||||
var current_date = new Date();
|
||||
current_date_time = current_date.getTime();
|
||||
current_date_full = current_date_time + (1 * 60000);
|
||||
var date = new Date(time);
|
||||
var diff = ((current_date_full - date.getTime()) / 1000);
|
||||
var day_diff = Math.floor(diff / 86400);
|
||||
if (isNaN(day_diff) || day_diff < 0) { return "<span>∞</span>"; }
|
||||
|
||||
if (isNaN(day_diff) || day_diff < 0) return "<span>∞</span>";
|
||||
|
||||
return day_diff == 0 && (
|
||||
return day_diff === 0 && (
|
||||
diff < 60 && say.just_now ||
|
||||
diff < 120 && say.minute_ago ||
|
||||
diff < 3600 && Math.floor(diff / 60) + say.minutes_ago ||
|
||||
diff < 7200 && say.hour_ago ||
|
||||
diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) ||
|
||||
day_diff == 1 && say.yesterday ||
|
||||
day_diff === 1 && say.yesterday ||
|
||||
day_diff < 7 && day_diff + say.days_ago ||
|
||||
day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago;
|
||||
}
|
||||
|
||||
function linkifyTweet(text, url) {
|
||||
for (var u in url) {
|
||||
var shortUrl = new RegExp(url[u].url, 'g');
|
||||
text = text.replace(shortUrl, '<a href="' + url[u].expanded_url + '">' + url[u].expanded_url.replace(/https?:\/\//, '') + '</a>');
|
||||
}
|
||||
return text.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
|
||||
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
|
||||
}
|
||||
|
||||
function showTwitterFeed(tweets, twitter_user) {
|
||||
var timeline = document.getElementById('tweets'),
|
||||
content = '';
|
||||
|
||||
for (var t in tweets) {
|
||||
content += '<li>'+'<p>'+'<a href="http://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
|
||||
}
|
||||
timeline.innerHTML = content;
|
||||
}
|
||||
|
||||
function getTwitterFeed(user, count, replies) {
|
||||
var feed = new jXHR();
|
||||
feed.onerror = function (msg,url) {
|
||||
$('#tweets li.loading').addClass('error').text("Twitter's busted");
|
||||
};
|
||||
feed.onreadystatechange = function(data){
|
||||
if (feed.readyState === 4) { showTwitterFeed(data, user); }
|
||||
};
|
||||
|
||||
// Documentation: https://dev.twitter.com/docs/api/1/get/statuses/user_timeline
|
||||
feed.open("GET","http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (parseInt(count, 10)) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?");
|
||||
feed.send();
|
||||
}
|
4
Rakefile
4
Rakefile
@ -6,6 +6,8 @@ require "stringex"
|
||||
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
|
||||
ssh_user = "mathisweb@octopress.org"
|
||||
document_root = "~/octopress.org/"
|
||||
ssh_port = "22"
|
||||
|
||||
deploy_default = "rsync"
|
||||
|
||||
# This will be configured for you when you run config_deploy
|
||||
@ -218,7 +220,7 @@ end
|
||||
desc "Deploy website via rsync"
|
||||
task :rsync do
|
||||
puts "## Deploying website via Rsync"
|
||||
ok_failed system("rsync -avz --delete #{public_dir}/ #{ssh_user}:#{document_root}")
|
||||
ok_failed system("rsync -avze 'ssh -p #{ssh_port}' --delete #{public_dir}/ #{ssh_user}:#{document_root}")
|
||||
end
|
||||
|
||||
desc "deploy public directory to github pages"
|
||||
|
@ -1,46 +1,47 @@
|
||||
# Title: Simple Image tag for Jekyll
|
||||
# Author: Brandon Mathis http://brandonmathis.com
|
||||
# Description: Easily output images with optional class names and title/alt attributes
|
||||
# Authors: Brandon Mathis http://brandonmathis.com
|
||||
# Felix Schäfer, Frederic Hemberger
|
||||
# Description: Easily output images with optional class names, width, height, title and alt attributes
|
||||
#
|
||||
# Syntax {% image [class name(s)] url [title text] %}
|
||||
# Syntax {% img [class name(s)] [http[s]:/]/path/to/image [width [height]] [title text | "title text" ["alt text"]] %}
|
||||
#
|
||||
# Example:
|
||||
# {% ima left half http://site.com/images/ninja.png Ninja Attack! %}
|
||||
# Examples:
|
||||
# {% img /images/ninja.png Ninja Attack! %}
|
||||
# {% img left half http://site.com/images/ninja.png Ninja Attack! %}
|
||||
# {% img left half http://site.com/images/ninja.png 150 150 "Ninja Attack!" "Ninja in attack posture" %}
|
||||
#
|
||||
# Output:
|
||||
# <image class='left' src="http://site.com/images/ninja.png" title="Ninja Attack!" alt="Ninja Attack!">
|
||||
# <img src="/images/ninja.png">
|
||||
# <img class="left half" src="http://site.com/images/ninja.png" title="Ninja Attack!" alt="Ninja Attack!">
|
||||
# <img class="left half" src="http://site.com/images/ninja.png" width="150" height="150" title="Ninja Attack!" alt="Ninja in attack posture">
|
||||
#
|
||||
|
||||
module Jekyll
|
||||
|
||||
class ImageTag < Liquid::Tag
|
||||
@img = nil
|
||||
@title = nil
|
||||
@class = ''
|
||||
@width = ''
|
||||
@height = ''
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
if markup =~ /(\S.*\s+)?(https?:\/\/|\/)(\S+)(\s+\d+\s+\d+)?(\s+.+)?/i
|
||||
@class = $1 || ''
|
||||
@img = $2 + $3
|
||||
if $5
|
||||
@title = $5.strip
|
||||
end
|
||||
if $4 =~ /\s*(\d+)\s+(\d+)/
|
||||
@width = $1
|
||||
@height = $2
|
||||
attributes = ['class', 'src', 'width', 'height', 'title']
|
||||
|
||||
if markup =~ /(?<class>\S.*\s+)?(?<src>(?:https?:\/\/|\/|\S+\/)\S+)(?:\s+(?<width>\d+))?(?:\s+(?<height>\d+))?(?<title>\s+.+)?/i
|
||||
@img = attributes.reduce({}) { |img, attr| img[attr] = $~[attr].strip if $~[attr]; img }
|
||||
if /(?:"|')(?<title>[^"']+)?(?:"|')\s+(?:"|')(?<alt>[^"']+)?(?:"|')/ =~ @img['title']
|
||||
@img['title'] = title
|
||||
@img['alt'] = alt
|
||||
else
|
||||
@img['alt'] = @img['title'].gsub!(/"/, '"')
|
||||
end
|
||||
@img['class'].gsub!(/"/, '')
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def render(context)
|
||||
output = super
|
||||
if @img
|
||||
"<img class='#{@class}' src='#{@img}' width='#{@width}' height='#{@height}' alt='#{@title}' title='#{@title}'>"
|
||||
"<img #{@img.collect {|k,v| "#{k}=\"#{v}\"" if v}.join(" ")}>"
|
||||
else
|
||||
"Error processing input, expected syntax: {% img [class name(s)] /url/to/image [width height] [title text] %}"
|
||||
"Error processing input, expected syntax: {% img [class name(s)] [http[s]:/]/path/to/image [width [height]] [title text | \"title text\" [\"alt text\"]] %}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
40
plugins/jsfiddle.rb
Normal file
40
plugins/jsfiddle.rb
Normal file
@ -0,0 +1,40 @@
|
||||
# Title: jsFiddle tag for Jekyll
|
||||
# Author: Brian Arnold (@brianarn)
|
||||
# Description:
|
||||
# Given a jsFiddle shortcode, outputs the jsFiddle iframe code.
|
||||
# Using 'default' will preserve defaults as specified by jsFiddle.
|
||||
#
|
||||
# Syntax: {% jsfiddle shorttag [tabs] [skin] [height] [width] %}
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# Input: {% jsfiddle ccWP7 %}
|
||||
# Output: <iframe style="width: 100%; height: 300px" src="http://jsfiddle.net/ccWP7/embedded/js,resources,html,css,result/light/"></iframe>
|
||||
#
|
||||
# Input: {% jsfiddle ccWP7 js,html,result %}
|
||||
# Output: <iframe style="width: 100%; height: 300px" src="http://jsfiddle.net/ccWP7/embedded/js,html,result/light/"></iframe>
|
||||
#
|
||||
|
||||
module Jekyll
|
||||
class JsFiddle < Liquid::Tag
|
||||
def initialize(tag_name, markup, tokens)
|
||||
if /(?<fiddle>\w+)(?:\s+(?<sequence>[\w,]+))?(?:\s+(?<skin>\w+))?(?:\s+(?<height>\w+))?(?:\s+(?<width>\w+))?/ =~ markup
|
||||
@fiddle = fiddle
|
||||
@sequence = (sequence unless sequence == 'default') || 'js,resources,html,css,result'
|
||||
@skin = (skin unless skin == 'default') || 'light'
|
||||
@width = width || '100%'
|
||||
@height = height || '300px'
|
||||
end
|
||||
end
|
||||
|
||||
def render(context)
|
||||
if @fiddle
|
||||
"<iframe style=\"width: #{@width}; height: #{@height}\" src=\"http://jsfiddle.net/#{@fiddle}/embedded/#{@sequence}/#{@skin}/\"></iframe>"
|
||||
else
|
||||
"Error processing input, expected syntax: {% jsfiddle shorttag [tabs] [skin] [height] [width] %}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('jsfiddle', Jekyll::JsFiddle)
|
Loading…
Reference in New Issue
Block a user