Permalink
Browse files

Convert coffeescript to javascript

  • Loading branch information...
redhotvengeance committed Apr 10, 2014
1 parent 51d4a30 commit bb297ea6ece0df2462ecf7fbf0736ebf21667759
Showing with 80 additions and 98 deletions.
  1. +0 −1 Gemfile
  2. +0 −5 Gemfile.lock
  3. +0 −24 _plugins/coffeescript_converter.rb
  4. +0 −68 scripts/main.coffee
  5. +80 −0 scripts/main.js
View
@@ -7,4 +7,3 @@ gem 'rack'
gem 'thin'
gem 'sinatra'
gem 'jekyll'
gem 'coffee-script'
View
@@ -3,10 +3,6 @@ GEM
specs:
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
colorator (0.1)
commander (4.1.5)
highline (~> 1.6.11)
@@ -64,7 +60,6 @@ PLATFORMS
ruby
DEPENDENCIES
coffee-script
jekyll
rack
rake
@@ -1,24 +0,0 @@
module Jekyll
require 'coffee-script'
class CoffeeScriptConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /coffee/i
end
def output_ext(ext)
".js"
end
def convert(content)
begin
CoffeeScript.compile content
rescue StandardError => e
puts e.message
end
end
end
end
View
@@ -1,68 +0,0 @@
---
---
$(document).ready =>
## messages ##
if $('.message-bar').length > 0
messages = $('.message-bar > h1')
randomMessageIndex = Math.floor(Math.random() * messages.length)
messages.each (index) ->
$(@).hide()
if index is randomMessageIndex
$(@).show()
## about ##
if $('.about-content').length > 0
## i do ##
iWrite = $('#i-write > li')
iLike = $('#i-like > li')
iUse = $('#i-use > li')
iWrite.hide()
iLike.hide()
iUse.hide()
iWrite = _.shuffle(iWrite)
iLike = _.shuffle(iLike)
iUse = _.shuffle(iUse)
rotateItemList(iWrite, 0)
rotateItemList(iLike, 250)
rotateItemList(iUse, 500)
## i live ##
myWife = $('#my-wife > li')
myCorgi = $('#my-corgi > li')
myCat = $('#my-cat > li')
myWife.hide()
myCorgi.hide()
myCat.hide()
myWife = _.shuffle(myWife)
myCorgi = _.shuffle(myCorgi)
myCat = _.shuffle(myCat)
rotateItemList(myWife, 0, 0)
rotateItemList(myCorgi, 0, 0)
rotateItemList(myCat, 0, 0)
## my work ##
myWork = $('#my-work > li')
myWork.hide()
myWork = _.shuffle(myWork)
rotateItemList(myWork, 0, 0)
rotateItemList = (itemList, delay, duration = .65) =>
setTimeout =>
$(itemList[0]).css("top", -$(itemList[0]).height())
$(itemList[0]).show()
TweenLite.to $(itemList[itemList.length - 1]), duration, {css:{top:$(itemList[0]).height()}, ease:Back.easeInOut, onComplete:hideItem, onCompleteParams:[$(itemList[itemList.length - 1])]}
TweenLite.to $(itemList[0]), duration, {css:{top:0}, ease:Back.easeInOut}
itemList.push(itemList.splice(0, 1)[0])
rotateItemList(itemList, (Math.random() * 5000) + 2000)
, delay
hideItem = (item) =>
$(item).hide()
View
@@ -0,0 +1,80 @@
(function() {
function setMessage() {
var messages = $('.message-bar > h1');
if ($('.message-bar').length > 0) {
var randomMessageIndex = Math.floor(Math.random() * messages.length);
for (var i = 0; i < messages.length; i++) {
$(messages[i]).hide();
if (i === randomMessageIndex) {
$(messages[i]).show();
}
}
}
}
function setAbout() {
if ($('.about-content').length > 0) {
// i do
var iWrite = $('#i-write > li');
var iLike = $('#i-like > li');
var iUse = $('#i-use > li');
iWrite.hide();
iLike.hide();
iUse.hide();
iWrite = _.shuffle(iWrite);
iLike = _.shuffle(iLike);
iUse = _.shuffle(iUse);
rotateItemList(iWrite, 0, .65);
rotateItemList(iLike, 250, .65);
rotateItemList(iUse, 500, .65);
// i live
var myWife = $('#my-wife > li');
var myCorgi = $('#my-corgi > li');
var myCat = $('#my-cat > li');
myWife.hide();
myCorgi.hide();
myCat.hide();
myWife = _.shuffle(myWife);
myCorgi = _.shuffle(myCorgi);
myCat = _.shuffle(myCat);
rotateItemList(myWife, 0, 0);
rotateItemList(myCorgi, 0, 0);
rotateItemList(myCat, 0, 0);
// my work
var myWork = $('#my-work > li');
myWork.hide();
myWork = _.shuffle(myWork);
rotateItemList(myWork, 0, 0);
}
}
function rotateItemList(itemList, delay, duration) {
setTimeout(function() {
$(itemList[0]).css("top", -$(itemList[0]).height());
$(itemList[0]).show();
TweenLite.to($(itemList[itemList.length - 1]), duration, {css:{top:$(itemList[0]).height()}, ease:Back.easeInOut, onComplete:hideItem, onCompleteParams:[$(itemList[itemList.length - 1])]});
TweenLite.to($(itemList[0]), duration, {css:{top:0}, ease:Back.easeInOut});
itemList.push(itemList.splice(0, 1)[0]);
rotateItemList(itemList, (Math.random() * 5000) + 2000, .65);
}, delay);
}
function hideItem(item) {
$(item).hide();
}
$(document).ready(function() {
setMessage();
setAbout();
});
}).call(this);

0 comments on commit bb297ea

Please sign in to comment.