enki-engine 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +13 -0
- data/.rspec +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE +284 -0
- data/README.textile +112 -0
- data/Rakefile +13 -0
- data/TODO.textile +8 -0
- data/app/assets/images/admin/flash_bg.gif +0 -0
- data/app/assets/images/admin/future_bg.png +0 -0
- data/app/assets/images/admin/gray_bg.gif +0 -0
- data/app/assets/images/admin/new_button.png +0 -0
- data/app/assets/images/admin/silver_bg.gif +0 -0
- data/app/assets/images/admin/submit_bg.gif +0 -0
- data/app/assets/images/admin/subnav_bg.gif +0 -0
- data/app/assets/images/openid_icon.png +0 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/images/silk/arrow_undo.png +0 -0
- data/app/assets/images/silk/delete.png +0 -0
- data/app/assets/images/silk/pencil.png +0 -0
- data/app/assets/javascripts/admin/actions.js +18 -0
- data/app/assets/javascripts/admin/comments.js +3 -0
- data/app/assets/javascripts/admin/common.js +109 -0
- data/app/assets/javascripts/admin/dashboard.js +33 -0
- data/app/assets/javascripts/admin/edit-preview.js +40 -0
- data/app/assets/javascripts/admin/pages.js +1 -0
- data/app/assets/javascripts/admin/posts.js +1 -0
- data/app/assets/javascripts/admin/shortcut.js +223 -0
- data/app/assets/javascripts/admin.js +17 -0
- data/app/assets/javascripts/application.js +15 -0
- data/app/assets/javascripts/common.js +22 -0
- data/app/assets/javascripts/enki.js +13 -0
- data/app/assets/javascripts/live-comment-preview.js +36 -0
- data/app/assets/stylesheets/admin.css +304 -0
- data/app/assets/stylesheets/application.css.scss +486 -0
- data/app/assets/stylesheets/humanmsg.css +112 -0
- data/app/assets/stylesheets/login.css +65 -0
- data/app/controllers/enki/admin/base_controller.rb +15 -0
- data/app/controllers/enki/admin/comments_controller.rb +52 -0
- data/app/controllers/enki/admin/dashboard_controller.rb +12 -0
- data/app/controllers/enki/admin/health_controller.rb +20 -0
- data/app/controllers/enki/admin/pages_controller.rb +97 -0
- data/app/controllers/enki/admin/posts_controller.rb +104 -0
- data/app/controllers/enki/admin/undo_items_controller.rb +43 -0
- data/app/controllers/enki/application_controller.rb +21 -0
- data/app/controllers/enki/archives_controller.rb +7 -0
- data/app/controllers/enki/base_controller.rb +5 -0
- data/app/controllers/enki/comments_controller.rb +43 -0
- data/app/controllers/enki/pages_controller.rb +7 -0
- data/app/controllers/enki/posts_controller.rb +27 -0
- data/app/helpers/enki/admin/navigation_helper.rb +10 -0
- data/app/helpers/enki/application_helper.rb +35 -0
- data/app/helpers/enki/date_helper.rb +15 -0
- data/app/helpers/enki/form_helper.rb +7 -0
- data/app/helpers/enki/host_helper.rb +19 -0
- data/app/helpers/enki/navigation_helper.rb +23 -0
- data/app/helpers/enki/page_title_helper.rb +33 -0
- data/app/helpers/enki/posts_helper.rb +9 -0
- data/app/helpers/enki/tag_helper.rb +7 -0
- data/app/helpers/enki/url_helper.rb +25 -0
- data/app/models/enki/base/post.rb +153 -0
- data/app/models/enki/comment.rb +75 -0
- data/app/models/enki/comment_activity.rb +33 -0
- data/app/models/enki/delete_comment_undo.rb +33 -0
- data/app/models/enki/delete_page_undo.rb +32 -0
- data/app/models/enki/delete_post_undo.rb +36 -0
- data/app/models/enki/page.rb +42 -0
- data/app/models/enki/post.rb +4 -0
- data/app/models/enki/stats.rb +19 -0
- data/app/models/enki/tag.rb +19 -0
- data/app/models/enki/tagging.rb +7 -0
- data/app/models/enki/undo_item.rb +10 -0
- data/app/views/enki/admin/comments/_comment.html.erb +12 -0
- data/app/views/enki/admin/comments/index.html.erb +30 -0
- data/app/views/enki/admin/comments/show.html.erb +9 -0
- data/app/views/enki/admin/dashboard/show.html.erb +61 -0
- data/app/views/enki/admin/health/index.html.erb +3 -0
- data/app/views/enki/admin/pages/_form.html.erb +3 -0
- data/app/views/enki/admin/pages/_page.html.erb +12 -0
- data/app/views/enki/admin/pages/index.html.erb +25 -0
- data/app/views/enki/admin/pages/new.html.erb +8 -0
- data/app/views/enki/admin/pages/show.html.erb +8 -0
- data/app/views/enki/admin/posts/_form.html.erb +11 -0
- data/app/views/enki/admin/posts/_post.html.erb +12 -0
- data/app/views/enki/admin/posts/_taggings_form.html.erb +4 -0
- data/app/views/enki/admin/posts/_upload_form.html.erb +0 -0
- data/app/views/enki/admin/posts/index.html.erb +25 -0
- data/app/views/enki/admin/posts/new.html.erb +8 -0
- data/app/views/enki/admin/posts/show.html.erb +8 -0
- data/app/views/enki/admin/undo_items/index.html.erb +24 -0
- data/app/views/enki/archives/index.html.erb +17 -0
- data/app/views/enki/comments/_comment.html.erb +4 -0
- data/app/views/enki/pages/_page.html.erb +3 -0
- data/app/views/enki/pages/show.html.erb +5 -0
- data/app/views/enki/posts/_post.html.erb +13 -0
- data/app/views/enki/posts/index.atom.builder +27 -0
- data/app/views/enki/posts/index.html.erb +15 -0
- data/app/views/enki/posts/show.html.erb +37 -0
- data/autotest/discover.rb +2 -0
- data/config/cucumber.yml +8 -0
- data/config/enki.yml.sample +16 -0
- data/config/initializers/enki_ext.rb +3 -0
- data/config/initializers/set_chronic_timezone.rb +1 -0
- data/config/initializers/verification.rb +135 -0
- data/config/routes.rb +34 -0
- data/db/migrate/20110709024316_initialize_db.rb +97 -0
- data/db/seeds.rb +8 -0
- data/enki-engine.gemspec +47 -0
- data/features/admin_dashboard.feature +10 -0
- data/features/admin_health.feature +10 -0
- data/features/admin_undo.feature +20 -0
- data/features/browsing.feature +16 -0
- data/features/step_definitions/admin.rb +27 -0
- data/features/step_definitions/browsing.rb +3 -0
- data/features/step_definitions/posts.rb +11 -0
- data/features/step_definitions/web_steps.rb +1 -0
- data/features/support/env.rb +59 -0
- data/features/support/paths.rb +35 -0
- data/features/support/selectors.rb +39 -0
- data/lib/core_extensions/object.rb +9 -0
- data/lib/core_extensions/string.rb +22 -0
- data/lib/enki/config.rb +44 -0
- data/lib/enki/engine.rb +19 -0
- data/lib/enki/html5_tags.rb +8 -0
- data/lib/enki/pagination_shim.rb +25 -0
- data/lib/enki/version.rb +3 -0
- data/lib/enki.rb +14 -0
- data/lib/enki_formatter.rb +11 -0
- data/lib/tag_list.rb +2 -0
- data/lib/tags_helper.rb +13 -0
- data/lib/tasks/cucumber.rake +65 -0
- data/lib/tasks/enki.rake +29 -0
- data/lib/undo_failed.rb +2 -0
- data/script/cucumber +10 -0
- data/spec/controllers/admin/comments_controller_spec.rb +140 -0
- data/spec/controllers/admin/dashboard_controller_spec.rb +47 -0
- data/spec/controllers/admin/health_controller_spec.rb +49 -0
- data/spec/controllers/admin/pages_controller_spec.rb +136 -0
- data/spec/controllers/admin/posts_controller_spec.rb +183 -0
- data/spec/controllers/admin/undo_items_controller_spec.rb +93 -0
- data/spec/controllers/archives_controller_spec.rb +37 -0
- data/spec/controllers/comments_controller_spec.rb +126 -0
- data/spec/controllers/pages_controller_spec.rb +46 -0
- data/spec/controllers/posts_controller_spec.rb +168 -0
- data/spec/dummy/Gemfile +5 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/config/application.rb +34 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +6 -0
- data/spec/dummy/config/enki.yml +20 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +34 -0
- data/spec/dummy/config/environments/test.rb +32 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +14 -0
- data/spec/dummy/config.ru +6 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/factories.rb +36 -0
- data/spec/helpers/page_title_helper_spec.rb +54 -0
- data/spec/helpers/url_helper_spec.rb +23 -0
- data/spec/lib/slugorize_spec.rb +44 -0
- data/spec/models/comment_activity_spec.rb +60 -0
- data/spec/models/comment_spec.rb +125 -0
- data/spec/models/delete_comment_undo_spec.rb +52 -0
- data/spec/models/delete_post_undo_spec.rb +18 -0
- data/spec/models/page_spec.rb +75 -0
- data/spec/models/post_spec.rb +257 -0
- data/spec/models/stats_spec.rb +28 -0
- data/spec/models/tag_spec.rb +13 -0
- data/spec/models/tagging_spec.rb +30 -0
- data/spec/rcov.opts +2 -0
- data/spec/routing/admin/pages_routing_spec.rb +29 -0
- data/spec/routing/archives_routing_spec.rb +9 -0
- data/spec/routing/comments_routing_spec.rb +17 -0
- data/spec/routing/pages_routing_spec.rb +9 -0
- data/spec/routing/posts_routing_spec.rb +26 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +60 -0
- data/spec/support/be_valid_html5.rb +150 -0
- data/spec/support/be_valid_xhtml.rb +148 -0
- data/spec/support/routes_override_helper.rb +12 -0
- data/spec/views/admin/comments/index.html_spec.rb +26 -0
- data/spec/views/admin/comments/show.html_spec.rb +28 -0
- data/spec/views/admin/dashboard/show.html_spec.rb +37 -0
- data/spec/views/admin/pages/index.html_spec.rb +23 -0
- data/spec/views/admin/pages/new.html_spec.rb +16 -0
- data/spec/views/admin/pages/show.html_spec.rb +16 -0
- data/spec/views/admin/posts/index.html_spec.rb +24 -0
- data/spec/views/admin/posts/new.html_spec.rb +16 -0
- data/spec/views/admin/posts/show.html_spec.rb +16 -0
- data/spec/views/admin/undo_items/index.html_spec.rb +19 -0
- data/spec/views/archives/index.html_spec.rb +34 -0
- data/spec/views/pages/show.html_spec.rb +23 -0
- data/spec/views/posts/index.atom.builder_spec.rb +36 -0
- data/spec/views/posts/index.html_spec.rb +39 -0
- data/spec/views/posts/show.html_spec.rb +49 -0
- data/vendor/assets/javascripts/humanmsg.js +86 -0
- data/vendor/assets/javascripts/jquery.easing.1.3.js +205 -0
- data/vendor/assets/javascripts/jquery.form.js +869 -0
- data/vendor/assets/javascripts/jquery.jfeed.js +143 -0
- data/vendor/assets/javascripts/jquery.livequery.js +250 -0
- metadata +464 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Enki
|
4
|
+
|
5
|
+
describe "/pages/show.html" do
|
6
|
+
include UrlHelper
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
view.stub!(:enki_config).and_return(Enki::Config.default)
|
10
|
+
|
11
|
+
assign :page, create(:page)
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:each) do
|
15
|
+
rendered.should be_valid_html5_fragment
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should render a page" do
|
19
|
+
render :template => "/enki/pages/show", :formats => [:html]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Enki
|
4
|
+
|
5
|
+
describe "/posts/index.atom.builder" do
|
6
|
+
before(:each) do
|
7
|
+
view.stub!(:enki_config).and_return(Enki::Config.default)
|
8
|
+
|
9
|
+
mock_tag = mock_model(Tag,
|
10
|
+
:name => 'code'
|
11
|
+
)
|
12
|
+
|
13
|
+
mock_post = mock_model(Post,
|
14
|
+
:title => "A post",
|
15
|
+
:body_html => "Posts contents!",
|
16
|
+
:published_at => 1.year.ago,
|
17
|
+
:edited_at => 1.year.ago,
|
18
|
+
:slug => 'a-post',
|
19
|
+
:approved_comments => [mock_model(Comment)],
|
20
|
+
:tags => [mock_tag]
|
21
|
+
)
|
22
|
+
|
23
|
+
assign :posts, [mock_post, mock_post]
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should render list of posts" do
|
27
|
+
render :template => "/enki/posts/index", :formats => [:atom], :handler => [:builder]
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should render list of posts with a tag" do
|
31
|
+
assigns[:tag] = 'code'
|
32
|
+
render :template => "/enki/posts/index", :formats => [:atom], :handler => [:builder]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Enki
|
4
|
+
|
5
|
+
describe "/posts/index.html" do
|
6
|
+
before(:each) do
|
7
|
+
view.stub!(:enki_config).and_return(Enki::Config.default)
|
8
|
+
|
9
|
+
mock_tag = mock_model(Tag,
|
10
|
+
:name => 'code'
|
11
|
+
)
|
12
|
+
|
13
|
+
mock_post = mock_model(Post,
|
14
|
+
:title => "A post",
|
15
|
+
:body_html => "Posts contents!",
|
16
|
+
:published_at => 1.year.ago,
|
17
|
+
:slug => 'a-post',
|
18
|
+
:approved_comments => [mock_model(Comment)],
|
19
|
+
:tags => [mock_tag]
|
20
|
+
)
|
21
|
+
|
22
|
+
assign :posts, [mock_post, mock_post]
|
23
|
+
end
|
24
|
+
|
25
|
+
after(:each) do
|
26
|
+
rendered.should be_valid_html5_fragment
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should render list of posts" do
|
30
|
+
render :template => "/enki/posts/index", :formats => [:html]
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should render list of posts with a tag" do
|
34
|
+
assigns[:tag] = 'code'
|
35
|
+
render :template => "/enki/posts/index", :formats => [:html]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
module Enki
|
4
|
+
describe "/posts/show.html" do
|
5
|
+
include UrlHelper
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
view.stub!(:enki_config).and_return(Enki::Config.default)
|
9
|
+
|
10
|
+
mock_tag = mock_model(Tag,
|
11
|
+
:name => 'code'
|
12
|
+
)
|
13
|
+
|
14
|
+
mock_comment = mock_model(Comment,
|
15
|
+
:created_at => 1.month.ago,
|
16
|
+
:author => "Don Alias",
|
17
|
+
:author_url => "http://enkiblog.com",
|
18
|
+
:author_openid_authority => "http://enkiblog.com/server",
|
19
|
+
:body_html => "A comment"
|
20
|
+
)
|
21
|
+
|
22
|
+
mock_comment2 = mock_model(Comment,
|
23
|
+
:created_at => 1.month.ago,
|
24
|
+
:author => "Don Alias",
|
25
|
+
:author_url => '',
|
26
|
+
:body_html => "A comment"
|
27
|
+
)
|
28
|
+
|
29
|
+
@post = mock_model(Post,
|
30
|
+
:title => "A post",
|
31
|
+
:body_html => "Posts contents!",
|
32
|
+
:published_at => 1.year.ago,
|
33
|
+
:slug => 'a-post',
|
34
|
+
:approved_comments => [mock_comment, mock_comment2],
|
35
|
+
:tags => [mock_tag]
|
36
|
+
)
|
37
|
+
assign :post, @post
|
38
|
+
assign :comment, Comment.new
|
39
|
+
end
|
40
|
+
|
41
|
+
after(:each) do
|
42
|
+
rendered.should be_valid_html5_fragment
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should render a post" do
|
46
|
+
render :template => "/enki/posts/show", :formats => [:html]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/*
|
2
|
+
HUMANIZED MESSAGES 1.0
|
3
|
+
idea - http://www.humanized.com/weblog/2006/09/11/monolog_boxes_and_transparent_messages
|
4
|
+
home - http://humanmsg.googlecode.com
|
5
|
+
*/
|
6
|
+
|
7
|
+
var humanMsg = {
|
8
|
+
setup: function(appendTo, logName, msgOpacity) {
|
9
|
+
humanMsg.msgID = 'humanMsg';
|
10
|
+
humanMsg.logID = 'humanMsgLog';
|
11
|
+
|
12
|
+
// appendTo is the element the msg is appended to
|
13
|
+
if (appendTo == undefined)
|
14
|
+
appendTo = 'body';
|
15
|
+
|
16
|
+
// The text on the Log tab
|
17
|
+
if (logName == undefined)
|
18
|
+
logName = 'Message Log';
|
19
|
+
|
20
|
+
// Opacity of the message
|
21
|
+
humanMsg.msgOpacity = .8;
|
22
|
+
|
23
|
+
if (msgOpacity != undefined)
|
24
|
+
humanMsg.msgOpacity = parseFloat(msgOpacity);
|
25
|
+
|
26
|
+
// Inject the message structure
|
27
|
+
jQuery(appendTo).append('<div id="'+humanMsg.msgID+'" class="humanMsg"><div class="round"></div><p></p><div class="round"></div></div> <div id="'+humanMsg.logID+'"><p>'+logName+'</p><ul></ul></div>')
|
28
|
+
|
29
|
+
jQuery('#'+humanMsg.logID+' p').click(
|
30
|
+
function() { jQuery(this).siblings('ul').slideToggle() }
|
31
|
+
)
|
32
|
+
},
|
33
|
+
|
34
|
+
displayMsg: function(msg) {
|
35
|
+
if (msg == '')
|
36
|
+
return;
|
37
|
+
|
38
|
+
clearTimeout(humanMsg.t2);
|
39
|
+
|
40
|
+
// Inject message
|
41
|
+
jQuery('#'+humanMsg.msgID+' p').html(msg)
|
42
|
+
|
43
|
+
// Show message
|
44
|
+
jQuery('#'+humanMsg.msgID+'').show().animate({ opacity: humanMsg.msgOpacity}, 200, function() {
|
45
|
+
jQuery('#'+humanMsg.logID)
|
46
|
+
.show().children('ul').prepend('<li>'+msg+'</li>') // Prepend message to log
|
47
|
+
.children('li:first').slideDown(200) // Slide it down
|
48
|
+
|
49
|
+
if ( jQuery('#'+humanMsg.logID+' ul').css('display') == 'none') {
|
50
|
+
jQuery('#'+humanMsg.logID+' p').animate({ bottom: 40 }, 200, 'linear', function() {
|
51
|
+
jQuery(this).animate({ bottom: 0 }, 300, 'easeOutBounce', function() { jQuery(this).css({ bottom: 0 }) })
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
})
|
56
|
+
|
57
|
+
// Watch for mouse & keyboard in .5s
|
58
|
+
humanMsg.t1 = setTimeout("humanMsg.bindEvents()", 700)
|
59
|
+
// Remove message after 5s
|
60
|
+
humanMsg.t2 = setTimeout("humanMsg.removeMsg()", 5000)
|
61
|
+
},
|
62
|
+
|
63
|
+
bindEvents: function() {
|
64
|
+
// Remove message if mouse is moved or key is pressed
|
65
|
+
jQuery(window)
|
66
|
+
.mousemove(humanMsg.removeMsg)
|
67
|
+
.click(humanMsg.removeMsg)
|
68
|
+
.keypress(humanMsg.removeMsg)
|
69
|
+
},
|
70
|
+
|
71
|
+
removeMsg: function() {
|
72
|
+
// Unbind mouse & keyboard
|
73
|
+
jQuery(window)
|
74
|
+
.unbind('mousemove', humanMsg.removeMsg)
|
75
|
+
.unbind('click', humanMsg.removeMsg)
|
76
|
+
.unbind('keypress', humanMsg.removeMsg)
|
77
|
+
|
78
|
+
// If message is fully transparent, fade it out
|
79
|
+
if (jQuery('#'+humanMsg.msgID).css('opacity') == humanMsg.msgOpacity)
|
80
|
+
jQuery('#'+humanMsg.msgID).animate({ opacity: 0 }, 500, function() { jQuery(this).hide() })
|
81
|
+
}
|
82
|
+
};
|
83
|
+
|
84
|
+
jQuery(document).ready(function(){
|
85
|
+
humanMsg.setup();
|
86
|
+
})
|
@@ -0,0 +1,205 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
3
|
+
*
|
4
|
+
* Uses the built in easing capabilities added In jQuery 1.1
|
5
|
+
* to offer multiple easing options
|
6
|
+
*
|
7
|
+
* TERMS OF USE - jQuery Easing
|
8
|
+
*
|
9
|
+
* Open source under the BSD License.
|
10
|
+
*
|
11
|
+
* Copyright © 2008 George McGinley Smith
|
12
|
+
* All rights reserved.
|
13
|
+
*
|
14
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
15
|
+
* are permitted provided that the following conditions are met:
|
16
|
+
*
|
17
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
18
|
+
* conditions and the following disclaimer.
|
19
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
20
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
21
|
+
* provided with the distribution.
|
22
|
+
*
|
23
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
24
|
+
* or promote products derived from this software without specific prior written permission.
|
25
|
+
*
|
26
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
27
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
28
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
29
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
30
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
31
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
32
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
33
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
34
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
35
|
+
*
|
36
|
+
*/
|
37
|
+
|
38
|
+
// t: current time, b: begInnIng value, c: change In value, d: duration
|
39
|
+
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
40
|
+
|
41
|
+
jQuery.extend( jQuery.easing,
|
42
|
+
{
|
43
|
+
def: 'easeOutQuad',
|
44
|
+
swing: function (x, t, b, c, d) {
|
45
|
+
//alert(jQuery.easing.default);
|
46
|
+
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
47
|
+
},
|
48
|
+
easeInQuad: function (x, t, b, c, d) {
|
49
|
+
return c*(t/=d)*t + b;
|
50
|
+
},
|
51
|
+
easeOutQuad: function (x, t, b, c, d) {
|
52
|
+
return -c *(t/=d)*(t-2) + b;
|
53
|
+
},
|
54
|
+
easeInOutQuad: function (x, t, b, c, d) {
|
55
|
+
if ((t/=d/2) < 1) return c/2*t*t + b;
|
56
|
+
return -c/2 * ((--t)*(t-2) - 1) + b;
|
57
|
+
},
|
58
|
+
easeInCubic: function (x, t, b, c, d) {
|
59
|
+
return c*(t/=d)*t*t + b;
|
60
|
+
},
|
61
|
+
easeOutCubic: function (x, t, b, c, d) {
|
62
|
+
return c*((t=t/d-1)*t*t + 1) + b;
|
63
|
+
},
|
64
|
+
easeInOutCubic: function (x, t, b, c, d) {
|
65
|
+
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
66
|
+
return c/2*((t-=2)*t*t + 2) + b;
|
67
|
+
},
|
68
|
+
easeInQuart: function (x, t, b, c, d) {
|
69
|
+
return c*(t/=d)*t*t*t + b;
|
70
|
+
},
|
71
|
+
easeOutQuart: function (x, t, b, c, d) {
|
72
|
+
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
73
|
+
},
|
74
|
+
easeInOutQuart: function (x, t, b, c, d) {
|
75
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
76
|
+
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
77
|
+
},
|
78
|
+
easeInQuint: function (x, t, b, c, d) {
|
79
|
+
return c*(t/=d)*t*t*t*t + b;
|
80
|
+
},
|
81
|
+
easeOutQuint: function (x, t, b, c, d) {
|
82
|
+
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
83
|
+
},
|
84
|
+
easeInOutQuint: function (x, t, b, c, d) {
|
85
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
86
|
+
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
87
|
+
},
|
88
|
+
easeInSine: function (x, t, b, c, d) {
|
89
|
+
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
90
|
+
},
|
91
|
+
easeOutSine: function (x, t, b, c, d) {
|
92
|
+
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
93
|
+
},
|
94
|
+
easeInOutSine: function (x, t, b, c, d) {
|
95
|
+
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
96
|
+
},
|
97
|
+
easeInExpo: function (x, t, b, c, d) {
|
98
|
+
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
99
|
+
},
|
100
|
+
easeOutExpo: function (x, t, b, c, d) {
|
101
|
+
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
102
|
+
},
|
103
|
+
easeInOutExpo: function (x, t, b, c, d) {
|
104
|
+
if (t==0) return b;
|
105
|
+
if (t==d) return b+c;
|
106
|
+
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
107
|
+
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
108
|
+
},
|
109
|
+
easeInCirc: function (x, t, b, c, d) {
|
110
|
+
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
111
|
+
},
|
112
|
+
easeOutCirc: function (x, t, b, c, d) {
|
113
|
+
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
114
|
+
},
|
115
|
+
easeInOutCirc: function (x, t, b, c, d) {
|
116
|
+
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
117
|
+
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
118
|
+
},
|
119
|
+
easeInElastic: function (x, t, b, c, d) {
|
120
|
+
var s=1.70158;var p=0;var a=c;
|
121
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
122
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
123
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
124
|
+
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
125
|
+
},
|
126
|
+
easeOutElastic: function (x, t, b, c, d) {
|
127
|
+
var s=1.70158;var p=0;var a=c;
|
128
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
129
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
130
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
131
|
+
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
132
|
+
},
|
133
|
+
easeInOutElastic: function (x, t, b, c, d) {
|
134
|
+
var s=1.70158;var p=0;var a=c;
|
135
|
+
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
136
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
137
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
138
|
+
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
139
|
+
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
140
|
+
},
|
141
|
+
easeInBack: function (x, t, b, c, d, s) {
|
142
|
+
if (s == undefined) s = 1.70158;
|
143
|
+
return c*(t/=d)*t*((s+1)*t - s) + b;
|
144
|
+
},
|
145
|
+
easeOutBack: function (x, t, b, c, d, s) {
|
146
|
+
if (s == undefined) s = 1.70158;
|
147
|
+
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
148
|
+
},
|
149
|
+
easeInOutBack: function (x, t, b, c, d, s) {
|
150
|
+
if (s == undefined) s = 1.70158;
|
151
|
+
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
152
|
+
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
153
|
+
},
|
154
|
+
easeInBounce: function (x, t, b, c, d) {
|
155
|
+
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
156
|
+
},
|
157
|
+
easeOutBounce: function (x, t, b, c, d) {
|
158
|
+
if ((t/=d) < (1/2.75)) {
|
159
|
+
return c*(7.5625*t*t) + b;
|
160
|
+
} else if (t < (2/2.75)) {
|
161
|
+
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
162
|
+
} else if (t < (2.5/2.75)) {
|
163
|
+
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
164
|
+
} else {
|
165
|
+
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
166
|
+
}
|
167
|
+
},
|
168
|
+
easeInOutBounce: function (x, t, b, c, d) {
|
169
|
+
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
170
|
+
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
171
|
+
}
|
172
|
+
});
|
173
|
+
|
174
|
+
/*
|
175
|
+
*
|
176
|
+
* TERMS OF USE - EASING EQUATIONS
|
177
|
+
*
|
178
|
+
* Open source under the BSD License.
|
179
|
+
*
|
180
|
+
* Copyright © 2001 Robert Penner
|
181
|
+
* All rights reserved.
|
182
|
+
*
|
183
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
184
|
+
* are permitted provided that the following conditions are met:
|
185
|
+
*
|
186
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
187
|
+
* conditions and the following disclaimer.
|
188
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
189
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
190
|
+
* provided with the distribution.
|
191
|
+
*
|
192
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
193
|
+
* or promote products derived from this software without specific prior written permission.
|
194
|
+
*
|
195
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
196
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
197
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
198
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
199
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
200
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
201
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
202
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
203
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
204
|
+
*
|
205
|
+
*/
|