Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorSteven Hancock <stevenh512@gmail.com>2012-03-22 16:44:35 +0400
committerMaxwell Salzberg <maxwell@joindiaspora.com>2012-03-28 05:07:44 +0400
commit1aa0b15c8ccd51a7f5b53b5da91a02495bb9d6e6 (patch)
treedc9b0e443eefb09fd72804e97321f63489f63d62 /public
parent9dffb426d4d0ad342530b142dd19f66abd678218 (diff)
Move Javascript to the asset pipeline
* Move all Diaspora-specific javascripts to app/assets/javascripts * Move all vendored javascripts to vendor/assets/javascripts * Add the appropriate Sprockets require directives to make sure everything gets included in the right order * Remove Jammit dependencies * Fix all templates that were using Jammit's include_javascripts helper * Add handlebars_assets gem for compiling Handlebars templates * Move all Handlebars templates to app/assets/templates and rename from .handlebars to .jst.hbs (this is to keep them in the same global JST namespace that they were in under Jammit) * Add public/assets to .gitignore since these files can and should be re-generated by Heroku or Capistrano during each deploy * Fix a few Handlebars templates that were looking for images in the wrong location (I'm sure there are others, but it's late) * Configure application.rb to precompile all javascript and css assets that were compiled by Jammit in the Rails 3.0 code
Diffstat (limited to 'public')
-rw-r--r--public/javascripts/app/app.js46
-rw-r--r--public/javascripts/app/collections/comments.js7
-rw-r--r--public/javascripts/app/collections/likes.js7
-rw-r--r--public/javascripts/app/collections/participations.js7
-rw-r--r--public/javascripts/app/collections/photos.js12
-rw-r--r--public/javascripts/app/collections/posts.js12
-rw-r--r--public/javascripts/app/helpers/date_formatter.js35
-rw-r--r--public/javascripts/app/helpers/handlebars-helpers.js26
-rw-r--r--public/javascripts/app/helpers/handlebars-partials.js4
-rw-r--r--public/javascripts/app/helpers/text_formatter.js69
-rw-r--r--public/javascripts/app/models/block.js3
-rw-r--r--public/javascripts/app/models/comment.js3
-rw-r--r--public/javascripts/app/models/like.js1
-rw-r--r--public/javascripts/app/models/participation.js1
-rw-r--r--public/javascripts/app/models/photo.js14
-rw-r--r--public/javascripts/app/models/photos.js69
-rw-r--r--public/javascripts/app/models/post.js108
-rw-r--r--public/javascripts/app/models/reshare.js14
-rw-r--r--public/javascripts/app/models/status_message.js24
-rw-r--r--public/javascripts/app/models/stream.js67
-rw-r--r--public/javascripts/app/models/user.js11
-rw-r--r--public/javascripts/app/pages/post-viewer.js97
-rw-r--r--public/javascripts/app/router.js57
-rw-r--r--public/javascripts/app/templates/activity-streams-photo.handlebars3
-rw-r--r--public/javascripts/app/templates/comment-stream.handlebars30
-rw-r--r--public/javascripts/app/templates/comment.handlebars27
-rw-r--r--public/javascripts/app/templates/feedback.handlebars43
-rw-r--r--public/javascripts/app/templates/header.handlebars117
-rw-r--r--public/javascripts/app/templates/likes-info.handlebars28
-rw-r--r--public/javascripts/app/templates/photo.handlebars3
-rw-r--r--public/javascripts/app/templates/post-viewer.handlebars10
-rw-r--r--public/javascripts/app/templates/post-viewer/author.handlebars25
-rw-r--r--public/javascripts/app/templates/post-viewer/comment.handlebars15
-rw-r--r--public/javascripts/app/templates/post-viewer/content/activity-streams-photo.handlebars7
-rw-r--r--public/javascripts/app/templates/post-viewer/content/multi-photo.handlebars9
-rw-r--r--public/javascripts/app/templates/post-viewer/content/note.handlebars3
-rw-r--r--public/javascripts/app/templates/post-viewer/content/photo-backdrop.handlebars4
-rw-r--r--public/javascripts/app/templates/post-viewer/content/rich-media.handlebars11
-rw-r--r--public/javascripts/app/templates/post-viewer/content/status-with-photo-backdrop.handlebars9
-rw-r--r--public/javascripts/app/templates/post-viewer/content/status.handlebars1
-rw-r--r--public/javascripts/app/templates/post-viewer/feedback.handlebars66
-rw-r--r--public/javascripts/app/templates/post-viewer/interactions.handlebars11
-rw-r--r--public/javascripts/app/templates/post-viewer/nav.handlebars11
-rw-r--r--public/javascripts/app/templates/post-viewer/new-comment.handlebars8
-rw-r--r--public/javascripts/app/templates/post-viewer/reactions.handlebars53
-rw-r--r--public/javascripts/app/templates/reshare.handlebars46
-rw-r--r--public/javascripts/app/templates/static-text.handlebars1
-rw-r--r--public/javascripts/app/templates/status-message.handlebars31
-rw-r--r--public/javascripts/app/templates/stream-element.handlebars80
-rw-r--r--public/javascripts/app/templates/stream-faces.handlebars5
-rw-r--r--public/javascripts/app/views.js70
-rw-r--r--public/javascripts/app/views/comment_stream_view.js79
-rw-r--r--public/javascripts/app/views/comment_view.js31
-rw-r--r--public/javascripts/app/views/content_view.js69
-rw-r--r--public/javascripts/app/views/feedback_view.js58
-rw-r--r--public/javascripts/app/views/header_view.js35
-rw-r--r--public/javascripts/app/views/likes_info_view.js31
-rw-r--r--public/javascripts/app/views/photo_view.js13
-rw-r--r--public/javascripts/app/views/photos_view.js60
-rw-r--r--public/javascripts/app/views/post-viewer/author.js8
-rw-r--r--public/javascripts/app/views/post-viewer/feedback.js40
-rw-r--r--public/javascripts/app/views/post-viewer/interactions.js56
-rw-r--r--public/javascripts/app/views/post-viewer/nav.js30
-rw-r--r--public/javascripts/app/views/post-viewer/new_comment.js45
-rw-r--r--public/javascripts/app/views/post-viewer/reactions.js34
-rw-r--r--public/javascripts/app/views/post_view.js44
-rw-r--r--public/javascripts/app/views/publisher_view.js100
-rw-r--r--public/javascripts/app/views/stream_faces_view.js29
-rw-r--r--public/javascripts/app/views/stream_object_view.js19
-rw-r--r--public/javascripts/app/views/stream_view.js119
-rw-r--r--public/javascripts/aspect-edit-pane.js29
-rw-r--r--public/javascripts/aspect-sorting.js18
-rw-r--r--public/javascripts/aspects-dropdown.js61
-rw-r--r--public/javascripts/contact-edit.js98
-rw-r--r--public/javascripts/contact-list.js82
-rw-r--r--public/javascripts/diaspora.js95
-rw-r--r--public/javascripts/fileuploader-custom.js1264
-rw-r--r--public/javascripts/friend-finder.js25
-rw-r--r--public/javascripts/helpers/alert.js30
-rw-r--r--public/javascripts/helpers/i18n.js39
-rw-r--r--public/javascripts/ie.js3
-rw-r--r--public/javascripts/inbox.js93
-rw-r--r--public/javascripts/jquery.autocomplete-custom.js763
-rw-r--r--public/javascripts/jquery.infinitescroll-custom.js621
-rw-r--r--public/javascripts/keycodes.js116
-rw-r--r--public/javascripts/login.js26
-rw-r--r--public/javascripts/mentions.js26
-rw-r--r--public/javascripts/mobile.js265
-rw-r--r--public/javascripts/pages/aspects-index.js7
-rw-r--r--public/javascripts/pages/contacts-index.js9
-rw-r--r--public/javascripts/pages/featured-users-index.js7
-rw-r--r--public/javascripts/pages/invitations-edit.js8
-rw-r--r--public/javascripts/pages/invitations-new.js12
-rw-r--r--public/javascripts/pages/notifications-index.js8
-rw-r--r--public/javascripts/pages/services-finder.js7
-rw-r--r--public/javascripts/pages/users-getting-started.js81
-rw-r--r--public/javascripts/photo-show.js72
-rw-r--r--public/javascripts/publisher.js221
-rw-r--r--public/javascripts/rails.validations.js404
-rw-r--r--public/javascripts/vendor/backbone.js1158
-rw-r--r--public/javascripts/vendor/bootstrap/bootstrap-modal.js209
-rw-r--r--public/javascripts/vendor/bootstrap/bootstrap-popover.js77
-rw-r--r--public/javascripts/vendor/bootstrap/bootstrap-transition.js51
-rw-r--r--public/javascripts/vendor/bootstrap/bootstrap-twipsy.js303
-rw-r--r--public/javascripts/vendor/facebox.js309
-rw-r--r--public/javascripts/vendor/handlebars-1.0.0.beta.6.js1550
-rwxr-xr-xpublic/javascripts/vendor/jquery-ui-1.8.9.custom.min.js442
-rw-r--r--public/javascripts/vendor/jquery.autoSuggest.custom.js372
-rw-r--r--public/javascripts/vendor/jquery.autoresize.js274
-rw-r--r--public/javascripts/vendor/jquery.charcount.js58
-rw-r--r--public/javascripts/vendor/jquery.elastic.js162
-rw-r--r--public/javascripts/vendor/jquery.events.input.js132
-rw-r--r--public/javascripts/vendor/jquery.hotkeys.js99
-rw-r--r--public/javascripts/vendor/jquery.idle-timer.js246
-rw-r--r--public/javascripts/vendor/jquery.mentionsInput.js387
-rw-r--r--public/javascripts/vendor/jquery.placeholder.js104
-rw-r--r--public/javascripts/vendor/jquery.textchange.min.js10
-rw-r--r--public/javascripts/vendor/mailchimp/jquery.form.js872
-rw-r--r--public/javascripts/vendor/mailchimp/jquery.validate.js1118
-rw-r--r--public/javascripts/vendor/mailchimp/jquery126.min.js32
-rw-r--r--public/javascripts/vendor/markdown/Markdown.Converter.js1332
-rw-r--r--public/javascripts/vendor/markdown/Markdown.Sanitizer.js108
-rw-r--r--public/javascripts/vendor/mbp-helper.js171
-rw-r--r--public/javascripts/vendor/timeago.js143
-rw-r--r--public/javascripts/vendor/underscore.js999
-rw-r--r--public/javascripts/view.js129
-rw-r--r--public/javascripts/widgets/aspect-navigation.js92
-rw-r--r--public/javascripts/widgets/back-to-top.js33
-rw-r--r--public/javascripts/widgets/direction-detector.js86
-rw-r--r--public/javascripts/widgets/flash-messages.js35
-rw-r--r--public/javascripts/widgets/header.js21
-rw-r--r--public/javascripts/widgets/hovercard.js138
-rw-r--r--public/javascripts/widgets/infinite-scroll.js58
-rw-r--r--public/javascripts/widgets/lightbox.js162
-rw-r--r--public/javascripts/widgets/notifications-badge.js87
-rw-r--r--public/javascripts/widgets/notifications.js165
-rw-r--r--public/javascripts/widgets/search.js70
-rw-r--r--public/javascripts/widgets/stream.js32
-rw-r--r--public/javascripts/widgets/timeago.js17
139 files changed, 0 insertions, 18654 deletions
diff --git a/public/javascripts/app/app.js b/public/javascripts/app/app.js
deleted file mode 100644
index bf1320cc3..000000000
--- a/public/javascripts/app/app.js
+++ /dev/null
@@ -1,46 +0,0 @@
-var app = {
- collections: {},
- models: {},
- helpers: {},
- views: {},
- pages: {},
- forms: {},
-
- user: function(userAttrs) {
- if(userAttrs) { return this._user = new app.models.User(userAttrs) }
- return this._user || false
- },
-
- baseImageUrl: function(baseUrl){
- if(baseUrl) { return this._baseImageUrl = baseUrl }
- return this._baseImageUrl || ""
- },
-
- initialize: function() {
- app.router = new app.Router();
-
- app.currentUser = app.user(window.current_user_attributes) || new app.models.User()
-
- if(app.currentUser.authenticated()){
- app.header = new app.views.Header;
- $("header").prepend(app.header.el);
- app.header.render();
- }
-
-
- Backbone.history.start({pushState: true});
-
- // there's probably a better way to do this...
- $("a[rel=backbone]").bind("click", function(evt){
- evt.preventDefault();
- var link = $(this);
-
- $(".stream_title").text(link.text())
- app.router.navigate(link.attr("href").substring(1) ,true)
- })
- }
-};
-
-$(function() {
- app.initialize();
-});
diff --git a/public/javascripts/app/collections/comments.js b/public/javascripts/app/collections/comments.js
deleted file mode 100644
index d564f8682..000000000
--- a/public/javascripts/app/collections/comments.js
+++ /dev/null
@@ -1,7 +0,0 @@
-app.collections.Comments = Backbone.Collection.extend({
- model: app.models.Comment,
-
- initialize : function(models, options) {
- this.url = "/posts/" + options.post.id + "/comments" //not delegating to post.url() because when it is in a stream collection it delegates to that url
- }
-});
diff --git a/public/javascripts/app/collections/likes.js b/public/javascripts/app/collections/likes.js
deleted file mode 100644
index 01831d4f9..000000000
--- a/public/javascripts/app/collections/likes.js
+++ /dev/null
@@ -1,7 +0,0 @@
-app.collections.Likes = Backbone.Collection.extend({
- model: app.models.Like,
-
- initialize : function(models, options) {
- this.url = "/posts/" + options.post.id + "/likes" //not delegating to post.url() because when it is in a stream collection it delegates to that url
- }
-});
diff --git a/public/javascripts/app/collections/participations.js b/public/javascripts/app/collections/participations.js
deleted file mode 100644
index bc861d784..000000000
--- a/public/javascripts/app/collections/participations.js
+++ /dev/null
@@ -1,7 +0,0 @@
-app.collections.Participations = Backbone.Collection.extend({
- model: app.models.Participation,
-
- initialize : function(models, options) {
- this.url = "/posts/" + options.post.id + "/participations" //not delegating to post.url() because when it is in a stream collection it delegates to that url
- }
-});
diff --git a/public/javascripts/app/collections/photos.js b/public/javascripts/app/collections/photos.js
deleted file mode 100644
index 40c960b23..000000000
--- a/public/javascripts/app/collections/photos.js
+++ /dev/null
@@ -1,12 +0,0 @@
-app.collections.Photos = Backbone.Collection.extend({
- url : "/photos",
-
- model: function(attrs, options) {
- var modelClass = app.models.Photo
- return new modelClass(attrs, options);
- },
-
- parse: function(resp){
- return resp.photos;
- }
-});
diff --git a/public/javascripts/app/collections/posts.js b/public/javascripts/app/collections/posts.js
deleted file mode 100644
index 37fb1a206..000000000
--- a/public/javascripts/app/collections/posts.js
+++ /dev/null
@@ -1,12 +0,0 @@
-app.collections.Posts = Backbone.Collection.extend({
- url : "/posts",
-
- model: function(attrs, options) {
- var modelClass = app.models[attrs.post_type] || app.models.Post
- return new modelClass(attrs, options);
- },
-
- parse: function(resp){
- return resp.posts;
- }
-});
diff --git a/public/javascripts/app/helpers/date_formatter.js b/public/javascripts/app/helpers/date_formatter.js
deleted file mode 100644
index dbcb005b6..000000000
--- a/public/javascripts/app/helpers/date_formatter.js
+++ /dev/null
@@ -1,35 +0,0 @@
-(function(){
- var dateFormatter = function dateFormatter() {
-
- };
-
- dateFormatter.parse = function(date_string) {
- var timestamp = new Date(date_string).getTime();
-
- if (isNaN(timestamp)) {
- timestamp = dateFormatter.parseISO8601UTC(date_string);
- }
-
- return timestamp;
- },
-
- dateFormatter.parseISO8601UTC = function(date_string) {
- var iso8601_utc_pattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(.(\d{3}))?Z$/;
- var time_components = date_string.match(iso8601_utc_pattern);
- var timestamp = 0;
-
- if (time_components != null) {
- if (time_components[8] == undefined) {
- time_components[8] = 0;
- }
-
- timestamp = Date.UTC(time_components[1], time_components[2] - 1, time_components[3],
- time_components[4], time_components[5], time_components[6],
- time_components[8]);
- }
-
- return timestamp;
- },
-
- app.helpers.dateFormatter = dateFormatter;
-})();
diff --git a/public/javascripts/app/helpers/handlebars-helpers.js b/public/javascripts/app/helpers/handlebars-helpers.js
deleted file mode 100644
index da747a669..000000000
--- a/public/javascripts/app/helpers/handlebars-helpers.js
+++ /dev/null
@@ -1,26 +0,0 @@
-Handlebars.registerHelper('t', function(scope, values) {
- return Diaspora.I18n.t(scope, values.hash)
-})
-
-Handlebars.registerHelper('imageUrl', function(path){
- return app.baseImageUrl() + path;
-})
-
-Handlebars.registerHelper('linkToPerson', function(context, block) {
- var html = "<a href=\"/people/" + context.guid + "\" class=\"author-name\">";
- html+= block.fn(context);
- html+= "</a>";
-
- return html
-})
-
-Handlebars.registerHelper('personImage', function(person, size, imageClass) {
- /* we return here if person.avatar is blank, because this happens when a
- * user is unauthenticated. we don't know why this happens... */
- if(typeof(person.avatar) == "undefined") { return }
-
- size = (typeof(size) != "string" ? "small" : size);
- imageClass = (typeof(imageClass) != "string" ? size : imageClass);
-
- return "<img src=\"" + person.avatar[size] +"\" class=\"avatar " + imageClass + "\" title=\"" + person.name +"\" />";
-})
diff --git a/public/javascripts/app/helpers/handlebars-partials.js b/public/javascripts/app/helpers/handlebars-partials.js
deleted file mode 100644
index eb4e1b5e9..000000000
--- a/public/javascripts/app/helpers/handlebars-partials.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* we need to wrap this in a document ready to ensure JST is accessible */
-$(function(){
- Handlebars.registerPartial('status-message', JST['status-message'])
-});
diff --git a/public/javascripts/app/helpers/text_formatter.js b/public/javascripts/app/helpers/text_formatter.js
deleted file mode 100644
index 84f4ba7e6..000000000
--- a/public/javascripts/app/helpers/text_formatter.js
+++ /dev/null
@@ -1,69 +0,0 @@
-(function(){
- var textFormatter = function textFormatter(model) {
- var text = model.get("text");
- var mentions = model.get("mentioned_people");
-
- return textFormatter.mentionify(
- textFormatter.hashtagify(
- textFormatter.markdownify(text)
- ), mentions
- )
- };
-
- textFormatter.markdownify = function markdownify(text){
- var converter = Markdown.getSanitizingConverter();
-
- // punycode non-ascii chars in urls
- converter.hooks.chain("preConversion", function(text) {
-
- // add < > around plain urls, effectively making them "autolinks"
- var urlRegex = /(^|\s)\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi;
- text = text.replace(urlRegex, function(wholematch, space, url) {
- return space+"<"+url+">";
- });
-
- // process links
- var linkRegex = /(\[.*\]:\s)?(<|\()(((https?|ftp):\/{1,3})([^'">\s]+))(>|\))/gi;
- text = text.replace(linkRegex, function() {
- var protocol = arguments[4];
- var unicodeUrl = arguments[6];
- var asciiUrl = protocol+punycode.toASCII(unicodeUrl);
- if( !arguments[1] || arguments[1] == "") { // inline link
- if(arguments[2] == "<") return "["+protocol+unicodeUrl+"]("+asciiUrl+")"; // without link text
- else return arguments[2]+asciiUrl+arguments[7]; // with link text
- } else { // reference style link
- return arguments[1]+asciiUrl;
- }
- });
-
- return text;
- });
-
- converter.hooks.chain("postConversion", function (text) {
- return text.replace(/(\"(?:(?:http|https):\/\/)?[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(?:\/\S*)?\")(\>)/g, '$1 target="_blank">')
- });
-
- return converter.makeHtml(text)
- };
-
- textFormatter.hashtagify = function hashtagify(text){
- var utf8WordCharcters =/(\s|^|>)#([\u0080-\uFFFF|\w|-]+|&lt;3)/g
- return text.replace(utf8WordCharcters, function(hashtag, preceeder, tagText) {
- return preceeder + "<a href='/tags/" + tagText + "' class='tag'>#" + tagText + "</a>"
- })
- };
-
- textFormatter.mentionify = function mentionify(text, mentions) {
- var mentionRegex = /@\{([^;]+); ([^\}]+)\}/g
- return text.replace(mentionRegex, function(mentionText, fullName, diasporaId) {
- var person = _.find(mentions, function(person){
- return person.diaspora_id == diasporaId
- })
-
- return person ? "<a href='/people/" + person.guid + "' class='mention'>" + fullName + "</a>" : fullName;
- })
- }
-
- app.helpers.textFormatter = textFormatter;
-})();
-
diff --git a/public/javascripts/app/models/block.js b/public/javascripts/app/models/block.js
deleted file mode 100644
index ef7e8f1ef..000000000
--- a/public/javascripts/app/models/block.js
+++ /dev/null
@@ -1,3 +0,0 @@
-app.models.Block = Backbone.Model.extend({
- urlRoot : "/blocks"
-});
diff --git a/public/javascripts/app/models/comment.js b/public/javascripts/app/models/comment.js
deleted file mode 100644
index c4c35ce71..000000000
--- a/public/javascripts/app/models/comment.js
+++ /dev/null
@@ -1,3 +0,0 @@
-app.models.Comment = Backbone.Model.extend({
- urlRoot: "/comments"
-});
diff --git a/public/javascripts/app/models/like.js b/public/javascripts/app/models/like.js
deleted file mode 100644
index 81e71a61e..000000000
--- a/public/javascripts/app/models/like.js
+++ /dev/null
@@ -1 +0,0 @@
-app.models.Like = Backbone.Model.extend({ });
diff --git a/public/javascripts/app/models/participation.js b/public/javascripts/app/models/participation.js
deleted file mode 100644
index 01c53d9e2..000000000
--- a/public/javascripts/app/models/participation.js
+++ /dev/null
@@ -1 +0,0 @@
-app.models.Participation = Backbone.Model.extend({ });
diff --git a/public/javascripts/app/models/photo.js b/public/javascripts/app/models/photo.js
deleted file mode 100644
index cefbb0e1d..000000000
--- a/public/javascripts/app/models/photo.js
+++ /dev/null
@@ -1,14 +0,0 @@
-app.models.Photo = Backbone.Model.extend({
- urlRoot : "/photos",
-
- initialize : function() {},
-
- createdAt : function() {
- return this.timeOf("created_at");
- },
-
- timeOf: function(field) {
- return app.helpers.dateFormatter.parse(this.get(field)) / 1000;
- },
-
-});
diff --git a/public/javascripts/app/models/photos.js b/public/javascripts/app/models/photos.js
deleted file mode 100644
index cbffb3de2..000000000
--- a/public/javascripts/app/models/photos.js
+++ /dev/null
@@ -1,69 +0,0 @@
-app.models.Photos = Backbone.Model.extend({
- initialize : function(){
- this.photos = new app.collections.Photos([], this.photoOptions());
- },
-
- photoOptions :function(){
- var order = this.sortOrder();
- return {
- comparator : function(photo) { return -photo[order](); }
- }
- },
-
- url : function() {
- return _.any(this.photos.models) ? this.timeFilteredPath() : this.basePath()
- },
-
- _fetching : false,
-
- fetch : function(){
- if(this._fetching) { return false; }
- var self = this;
-
- // we're fetching the collection... there is probably a better way to do this
- self._fetching = true;
-
- this.photos
- .fetch({
- add : true,
- url : self.url()
- })
- .done(
- function(resp){
- // we're done fetching... there is probably a better way to handle this
- self._fetching = false;
-
- self.trigger("fetched", self);
-
- // all loaded?
- if(resp.photos && resp.photos.length == 0) {
- self.trigger("allPostsLoaded", self);
- }
- }
- );
-
- return this;
- },
-
- basePath : function(){
- return document.location.pathname;
- },
-
- timeFilteredPath : function(){
- return this.basePath() + "?max_time=" + this.maxTime();
- },
-
- maxTime: function(){
- var lastPost = _.last(this.photos.models);
- return lastPost[this.sortOrder()]()
- },
-
- sortOrder : function() {
- return "createdAt";
- },
-
- add : function(models){
- this.photos.add(models)
- }
-
-}); \ No newline at end of file
diff --git a/public/javascripts/app/models/post.js b/public/javascripts/app/models/post.js
deleted file mode 100644
index efe9c9a8c..000000000
--- a/public/javascripts/app/models/post.js
+++ /dev/null
@@ -1,108 +0,0 @@
-app.models.Post = Backbone.Model.extend({
- urlRoot : "/posts",
-
- initialize : function() {
- this.setupCollections();
- this.bind("change", this.setupCollections, this)
- },
-
- setupCollections: function() {
- this.comments = new app.collections.Comments(this.get("comments") || this.get("last_three_comments"), {post : this});
- this.likes = this.likes || new app.collections.Likes([], {post : this}); // load in the user like initially
- this.participations = this.participations || new app.collections.Participations([], {post : this}); // load in the user like initially
- },
-
- createdAt : function() {
- return this.timeOf("created_at");
- },
-
- interactedAt : function() {
- return this.timeOf("interacted_at");
- },
-
- timeOf: function(field) {
- return app.helpers.dateFormatter.parse(this.get(field)) / 1000;
- },
-
- createReshareUrl : "/reshares",
-
- reshare : function(){
- return this._reshare = this._reshare || new app.models.Reshare({root_guid : this.get("guid")});
- },
-
- reshareAuthor : function(){
- return this.get("author")
- },
-
- toggleFollow : function() {
- var userParticipation = this.get("user_participation");
- if(userParticipation) {
- this.unfollow();
- } else {
- this.follow();
- }
- },
-
- follow : function() {
- var self = this;
- this.participations.create({}, {success : function(resp){
- self.set(resp)
- self.trigger('interacted', self)
- }});
- },
-
- unfollow : function() {
- var self = this;
- var participationModel = new app.models.Participation(this.get("user_participation"));
- participationModel.url = this.participations.url + "/" + participationModel.id;
-
- participationModel.destroy({success : function(model, resp){
- self.set(resp);
- self.trigger('interacted', this)
- }});
- },
-
- toggleLike : function() {
- var userLike = this.get("user_like")
- if(userLike) {
- this.unlike()
- } else {
- this.like()
- }
- },
-
- like : function() {
- var self = this;
- this.likes.create({}, {success : function(resp){
- self.set(resp)
- self.trigger('interacted', self)
- }});
-
- },
-
- unlike : function() {
- var self = this;
- var likeModel = new app.models.Like(this.get("user_like"));
- likeModel.url = this.likes.url + "/" + likeModel.id;
-
- likeModel.destroy({success : function(model, resp) {
- self.set(resp);
- self.trigger('interacted', this)
- }});
- }
-}, {
-
- frameMoods : [
- "Day"
- ],
-
- legacyTemplateNames : [
- "status-with-photo-backdrop",
- "note",
- "rich-media",
- "multi-photo",
- "photo-backdrop",
- "activity-streams-photo",
- "status"
- ]
-});
diff --git a/public/javascripts/app/models/reshare.js b/public/javascripts/app/models/reshare.js
deleted file mode 100644
index 68320eb80..000000000
--- a/public/javascripts/app/models/reshare.js
+++ /dev/null
@@ -1,14 +0,0 @@
-app.models.Reshare = app.models.Post.extend({
- rootPost : function(){
- this._rootPost = this._rootPost || new app.models.Post(this.get("root"));
- return this._rootPost
- },
-
- reshare : function(){
- return this.rootPost().reshare()
- },
-
- reshareAuthor : function(){
- return this.rootPost().reshareAuthor()
- }
-});
diff --git a/public/javascripts/app/models/status_message.js b/public/javascripts/app/models/status_message.js
deleted file mode 100644
index d1af3f03e..000000000
--- a/public/javascripts/app/models/status_message.js
+++ /dev/null
@@ -1,24 +0,0 @@
-app.models.StatusMessage = app.models.Post.extend({
- url : function(){
- return this.isNew() ? '/status_messages' : '/posts/' + this.get("id");
- },
-
- defaults : {
- 'post_type' : 'StatusMessage',
- 'author' : app.currentUser ? app.currentUser.attributes : {}
- },
-
- toJSON : function(){
- return {
- status_message : _.clone(this.attributes),
- aspect_ids : this.get("aspect_ids") && this.get("aspect_ids").split(","),
- photos : this.photos && this.photos.pluck("id"),
- services : mungeServices(this.get("services"))
- }
-
- function mungeServices (values) {
- if(!values) { return; }
- return values.length > 1 ? values : [values]
- }
- }
-});
diff --git a/public/javascripts/app/models/stream.js b/public/javascripts/app/models/stream.js
deleted file mode 100644
index a164b04d9..000000000
--- a/public/javascripts/app/models/stream.js
+++ /dev/null
@@ -1,67 +0,0 @@
-app.models.Stream = Backbone.Collection.extend({
- initialize : function(){
- this.posts = new app.collections.Posts([], this.postOptions());
- },
-
- postOptions :function(){
- var order = this.sortOrder();
- return {
- comparator : function(post) { return -post[order](); }
- }
- },
-
- url : function(){
- return _.any(this.posts.models) ? this.timeFilteredPath() : this.basePath()
- },
-
- _fetching : false,
-
- fetch: function() {
- if(this._fetching) { return false; }
- var self = this
-
- // we're fetching the collection... there is probably a better way to do this
- self._fetching = true;
-
- this.posts
- .fetch({
- add : true,
- url : self.url()
- })
- .done(
- function(resp){
- // we're done fetching... there is probably a better way to handle this
- self._fetching = false;
-
- self.trigger("fetched", self);
-
- // all loaded?
- if(resp.posts && (resp.posts.author || resp.posts.length == 0)) {
- self.trigger("allPostsLoaded", self);
- }
- }
- )
- return this;
- },
-
- basePath : function(){
- return document.location.pathname;
- },
-
- timeFilteredPath : function(){
- return this.basePath() + "?max_time=" + this.maxTime();
- },
-
- maxTime: function(){
- var lastPost = _.last(this.posts.models);
- return lastPost[this.sortOrder()]()
- },
-
- sortOrder : function() {
- return this.basePath().match(/activity/) ? "interactedAt" : "createdAt"
- },
-
- add : function(models){
- this.posts.add(models)
- }
-});
diff --git a/public/javascripts/app/models/user.js b/public/javascripts/app/models/user.js
deleted file mode 100644
index dd2ddd434..000000000
--- a/public/javascripts/app/models/user.js
+++ /dev/null
@@ -1,11 +0,0 @@
-app.models.User = Backbone.Model.extend({
- toggleNsfwState : function() {
- if(!app.currentUser.authenticated()){ return false }
- this.set({showNsfw : !this.get("showNsfw")});
- this.trigger("nsfwChanged");
- },
-
- authenticated : function() {
- return !!this.id;
- }
-});
diff --git a/public/javascripts/app/pages/post-viewer.js b/public/javascripts/app/pages/post-viewer.js
deleted file mode 100644
index 803dbe384..000000000
--- a/public/javascripts/app/pages/post-viewer.js
+++ /dev/null
@@ -1,97 +0,0 @@
-app.pages.PostViewer = app.views.Base.extend({
-
- templateName: "post-viewer",
-
- subviews : {
- "#post-content" : "postView",
- "#post-nav" : "navView",
- "#post-interactions" : "interactionsView",
- "#header-container" : "authorView"
- },
-
- initialize : function(options) {
- this.model = new app.models.Post({ id : options.id });
- this.model.fetch().success(_.bind(this.initViews, this));
-
- this.prepIdleHooks();
-
- $(document).bind("keypress", _.bind(this.commentAnywhere, this))
- $(document).bind("keypress", _.bind(this.invokePane, this))
- $(document).bind("keyup", _.bind(this.closePane, this))
- },
-
- initViews : function() {
- /* init view */
- this.authorView = new app.views.PostViewerAuthor({ model : this.model });
- this.interactionsView = new app.views.PostViewerInteractions({ model : this.model });
- this.navView = new app.views.PostViewerNav({ model : this.model });
- this.postView = app.views.Post.showFactory(this.model)
-
- this.render();
- },
-
- prepIdleHooks : function () {
- $.idleTimer(3000);
-
- $(document).bind("idle.idleTimer", function(){
- $("body").addClass('idle');
- });
-
- $(document).bind("active.idleTimer", function(){
- $("body").removeClass('idle');
- });
- },
-
- postRenderTemplate : function() {
- /* set the document title */
- console.log(this.model)
- document.title = this.model.get("title");
-
- this.bindNavHooks();
- },
-
- bindNavHooks : function() {
- /* navagation hooks */
- var nextPostLocation = this.model.get("next_post");
- var previousPostLocation = this.model.get("previous_post");
-
-
- $(document).keydown(function(evt){
- /* prevent nav from happening if the user is using the arrow
- * keys to navigate through their comment text */
- if($(evt.target).is("textarea")) { return }
-
- switch(evt.keyCode) {
- case 37:
- navigate(nextPostLocation); break;
- case 39:
- navigate(previousPostLocation); break;
- default:
- break;
- }
- })
-
- function navigate(loc) {
- loc ? window.location = loc : null
- }
- },
-
- commentAnywhere : function(evt) {
- /* ignore enter, space bar, arrow keys */
- if(_.include([13, 32, 37, 38, 39, 40], evt.keyCode)) { return }
-
- this.interactionsView.invokePane();
- $('#new-post-comment textarea').focus();
- },
-
- invokePane : function(evt) {
- if(evt.keyCode != 32) { return }
- this.interactionsView.invokePane();
- },
-
- closePane : function(evt) {
- if(evt.keyCode != 27) { return }
- this.interactionsView.hidePane();
- }
-
-});
diff --git a/public/javascripts/app/router.js b/public/javascripts/app/router.js
deleted file mode 100644
index f45d158e4..000000000
--- a/public/javascripts/app/router.js
+++ /dev/null
@@ -1,57 +0,0 @@
-app.Router = Backbone.Router.extend({
- routes: {
- "activity": "stream",
- "stream": "stream",
-
- "participate": "stream",
- "explore": "stream",
-
- "aspects:query": "stream",
- "commented": "stream",
- "liked": "stream",
- "mentions": "stream",
- "people/:id": "stream",
- "people/:id/photos": "photos",
- "u/:name": "stream",
- "followed_tags": "stream",
- "tags/:name": "stream",
-
- "posts/new" : "newPost",
- "posts/:id": "singlePost",
- "p/:id": "singlePost",
- "framer": "framer"
- },
-
- stream : function() {
- app.stream = new app.models.Stream();
- app.page = new app.views.Stream({model : app.stream});
- app.publisher = app.publisher || new app.views.Publisher({collection : app.stream.posts});
-
- var streamFacesView = new app.views.StreamFaces({collection : app.stream.posts});
-
- $("#main_stream").html(app.page.render().el);
- $('#selected_aspect_contacts .content').html(streamFacesView.render().el);
- },
-
- photos : function() {
- app.photos = new app.models.Photos();
- app.page = new app.views.Photos({model : app.photos});
- $("#main_stream").html(app.page.render().el);
- },
-
- newPost : function(){
- var page = new app.pages.PostNew();
- $("#container").html(page.render().el)
- },
-
- framer : function(){
- var page = new app.pages.Framer();
- $("#container").html(page.render().el)
- },
-
- singlePost : function(id) {
- var page = new app.pages.PostViewer({ id: id });
- $("#container").html(page.el);
- }
-});
-
diff --git a/public/javascripts/app/templates/activity-streams-photo.handlebars b/public/javascripts/app/templates/activity-streams-photo.handlebars
deleted file mode 100644
index 6908cb400..000000000
--- a/public/javascripts/app/templates/activity-streams-photo.handlebars
+++ /dev/null
@@ -1,3 +0,0 @@
-<a href="{{object_url}}" class="stream-photo-link">
- <img src="{{image_url}}" data-small-photo="{{image_url}}" data-full-photo="{{image_url}}" class="stream-photo" />
-</a>
diff --git a/public/javascripts/app/templates/comment-stream.handlebars b/public/javascripts/app/templates/comment-stream.handlebars
deleted file mode 100644
index 200235fda..000000000
--- a/public/javascripts/app/templates/comment-stream.handlebars
+++ /dev/null
@@ -1,30 +0,0 @@
-{{#unless all_comments_loaded}}
- <div class="show_comments comment {{#unless showExpandCommentsLink}} hidden {{/unless}}">
- <div class="media">
- <a href="/posts/{{id}}/comments" class="toggle_post_comments">
- {{t "stream.more_comments" count=moreCommentsCount}}
- </a>
- </div>
- </div>
-{{/unless}}
-
-<div class="comments"> </div>
-
-{{#if loggedIn}}
- <div class="comment no-border media new_comment_form_wrapper {{#unless comments_count}} hidden {{/unless}}">
- {{#with current_user}}
- <a href="/people/{{guid}}" class="img">
- {{{personImage this}}}
- </a>
- {{/with}}
-
- <div class="bd">
- <form accept-charset="UTF-8" action="/posts/{{id}}/comments" class="new_comment" id="new_comment_on_{{id}}" method="post">
- <textarea class="comment_box" id="comment_text_on_{{id}}" name="text" rows="2" placeholder="{{t "stream.comment"}}" />
- <div class="submit_button">
- <input class="button creation" id="comment_submit_{{id}}" name="commit" type="submit" value="{{t "stream.comment"}}" />
- </div>
- </form>
- </div>
- </div>
-{{/if}}
diff --git a/public/javascripts/app/templates/comment.handlebars b/public/javascripts/app/templates/comment.handlebars
deleted file mode 100644
index 376f2047f..000000000
--- a/public/javascripts/app/templates/comment.handlebars
+++ /dev/null
@@ -1,27 +0,0 @@
-{{#if canRemove}}
- <div class="controls">
- <a href="#" class="delete comment_delete" title="{{t "delete"}}">
- <img alt="Deletelabel" src="{{imageUrl "deletelabel.png"}}" />
- <a/>
- </div>
-{{/if}}
-
-<div class="img">
- {{#linkToPerson author}}
- {{{personImage this "small" "small"}}}
- {{/linkToPerson}}
-</div>
-
-<div class="bd">
- <a href="/people/{{author.guid}}" class="author author-name">
- {{author.name}}
- </a>
-
- <div class="collapsible comment-content">
- {{{text}}}
- </div>
-
- <div class="info">
- <time class="timeago" datetime="{{created_at}}"/>
- </div>
-</div>
diff --git a/public/javascripts/app/templates/feedback.handlebars b/public/javascripts/app/templates/feedback.handlebars
deleted file mode 100644
index 472cf0b0c..000000000
--- a/public/javascripts/app/templates/feedback.handlebars
+++ /dev/null
@@ -1,43 +0,0 @@
-<span class="post_scope grey">
- {{#if public}}
- {{t "stream.public"}}
- {{else}}
- {{t "stream.limited"}}
- {{/if}}
-
- {{#if provider_display_name}}
- <strong>
- via {{provider_display_name}}
- </strong>
- {{/if}}
- –
-</span>
-
-<a href="#" class="participate_action" rel='nofollow'>
- {{#if user_participation}}
- {{t "stream.unfollow"}}
- {{else}}
- {{t "stream.follow"}}
- {{/if}}
-</a>
-
-<a href="#" class="like_action" rel='nofollow'>
- {{#if user_like}}
- {{t "stream.unlike"}}
- {{else}}
- {{t "stream.like"}}
- {{/if}}
-</a>
-
-{{#if userCanReshare}}
- <a href="#" class="reshare_action" rel='nofollow'>
- {{t "stream.reshare"}}
- </a>
- ·
-{{/if}}
-
-<a href="#" class="focus_comment_textarea" rel="nofollow">
- {{t "stream.comment"}}
-</a>
diff --git a/public/javascripts/app/templates/header.handlebars b/public/javascripts/app/templates/header.handlebars
deleted file mode 100644
index f28015fa9..000000000
--- a/public/javascripts/app/templates/header.handlebars
+++ /dev/null
@@ -1,117 +0,0 @@
-<div class="container" style="position:relative;">
-
- <a href="/stream">
- <img alt="Logo_small" class="diaspora_header_logo" height="38px" width="65px" src="{{imageUrl "header-logo.png"}}" />
- </a>
-
- <span class="header-nav">
- <span>
- <a href="/stream">
- {{t "my_stream"}}
- </a>
- </span>
-
- <span>
- <a href="/activity">
- {{t "my_activity"}}
- </a>
- </span>
- </span>
-
- <div id="nav_badges">
- <div class="badge" id="notification_badge">
- <a href="/notifications" title="{{t "header.notifications"}}">
- <img alt="{{t "header.notifications"}}" id="notification-flag" src="{{imageUrl "icons/notifications_grey.png"}}" />
- <div class="badge_count {{#unless current_user.notifications_count}} hidden {{/unless}}">
- {{current_user.notifications_count}}
- </div>
- </a>
- </div>
-
- <div class="badge" id="message_inbox_badge">
- <a href="/conversations" title="{{t "header.messages"}}">
- <img alt="{{t "header.messages"}}" src="{{imageUrl "icons/mail_grey.png"}}" />
- <div class="badge_count {{#unless current_user.unread_messages_count}} hidden {{/unless}}">
- {{current_user.unread_messages_count}}
- </div>
- </a>
- </div>
-
-
- <div id="notification_dropdown">
- <div class="header">
- <div class="right">
- <a href="#" id="mark_all_read_link">
- {{t "header.mark_all_as_read"}}
- </a>
- |
- <a href="/notifications" id="view_all_notifications">
- {{t "header.view_all"}}
- </a>
- </div>
-
- <h4>
- {{t "header.recent_notifications"}}
- </h4>
- </div>
-
- <div class="notifications">
- <div class="ajax_loader">
- <img alt="Ajax-loader" src="{{imageUrl "ajax-loader.gif"}}">
- </div>
- </div>
- </div>
- </div>
-
-
- <div id="hovercard_container">
- <div id="hovercard">
- <img class="avatar">
- <h4>
- <a class="person"></a>
- </h4>
- <p class="handle"></p>
- <div id="hovercard_dropdown_container"></div>
- <div class="hovercard_footer">
- <div class="footer_container">
- <div class="hashtags"></div>
- </div>
- </div>
- </div>
- </div>
-
- <ul class="dropdown" id="user_menu">
- <li>
- <div class="right">
- ▼
- </div>
- <img alt="{{current_user.name}}" class="avatar" src="{{current_user.avatar.small}}" title="{{current_user.name}}" />
- <a href="#">{{current_user.name}}</a>
- </li>
- <li><a href="/people/{{current_user.guid}}">{{t "header.profile"}}</a></li>
- <li><a href="/contacts">{{t "header.contacts"}}</a></li>
- <li><a href="/user/edit">{{t "header.settings"}}</a></li>
- {{#if current_user.admin}}
- <li><a href="/admins/user_search">{{t "header.admin"}}</a></li>
- {{/if}}
- <li><a href="/users/sign_out">{{t "header.log_out"}}</a></li>
- </ul>
-
-
- <div id="global_search">
- <form accept-charset="UTF-8" action="/people" class="search_form" method="get">
- <input name="utf8" type="hidden" value="✓">
- <input id="q" name="q" placeholder="{{t "header.search"}}" results="5" type="search" autocomplete="off" class="ac_input">
- </form>
- </div>
-
- <div id="lightbox">
- <div id="lightbox-content">
- <a href="#" id="lightbox-close-link">[x] close</a>
- <img id="lightbox-image">
- <div id="lightbox-imageset"></div>
- </div>
- </div>
- <div id="lightbox-backdrop"></div>
-
-</div>
diff --git a/public/javascripts/app/templates/likes-info.handlebars b/public/javascripts/app/templates/likes-info.handlebars
deleted file mode 100644
index b059bdd92..000000000
--- a/public/javascripts/app/templates/likes-info.handlebars
+++ /dev/null
@@ -1,28 +0,0 @@
-{{#if likes_count}}
- <div class="comment">
- <div class="media">
- <span class="img">
- <img alt="Heart" src="{{imageUrl "heart.png"}}" />
- </span>
-
- <div class="bd">
- {{#unless likes.length}}
- <a href="#" class="expand_likes grey">
- {{t "stream.likes" count=likes_count}}
- </a>
-
- {{else}}
-
- {{#each likes}}
- {{#with attributes.author}}
- <a href="/people/{{guid}}">
- <img src="{{avatar.small}}" class="avatar micro" title="{{name}}"/>
- </a>
- {{/with}}
- {{/each}}
-
- {{/unless}}
- </div>
- </div>
- </div>
-{{/if}}
diff --git a/public/javascripts/app/templates/photo.handlebars b/public/javascripts/app/templates/photo.handlebars
deleted file mode 100644
index 375d6869e..000000000
--- a/public/javascripts/app/templates/photo.handlebars
+++ /dev/null
@@ -1,3 +0,0 @@
-<a href="#" class="photo-link">
- <img src="{{sizes.large}}" class="photo big_photo" data-small-photo="{{sizes.small}}" data-full-photo="{{sizes.large}}" rel="lightbox">
-</a> \ No newline at end of file
diff --git a/public/javascripts/app/templates/post-viewer.handlebars b/public/javascripts/app/templates/post-viewer.handlebars
deleted file mode 100644
index dbde01a53..000000000
--- a/public/javascripts/app/templates/post-viewer.handlebars
+++ /dev/null
@@ -1,10 +0,0 @@
-<!-- header to be extracted -->
-
-<div class="header">
- <div id="header-container"> </div>
-</div>
-
-<div id="post-content"> </div>
-<div id="post-nav"> </div>
-<div id="post-interactions"> </div>
-
diff --git a/public/javascripts/app/templates/post-viewer/author.handlebars b/public/javascripts/app/templates/post-viewer/author.handlebars
deleted file mode 100644
index 14418b1d2..000000000
--- a/public/javascripts/app/templates/post-viewer/author.handlebars
+++ /dev/null
@@ -1,25 +0,0 @@
-<div class="img">
- {{#linkToPerson author}}
- {{{personImage this "small"}}}
- {{/linkToPerson}}
-</div>
-
-<div class="bd">
- {{#linkToPerson author}}
- {{name}}
- {{/linkToPerson}}
-
- {{#if root}}
- <i class="icon-retweet"></i>
- {{#linkToPerson root.author}}
- {{name}}
- {{/linkToPerson}}
- {{/if}}
-
- <div class="post-time">
- <time datetime="{{created_at}}" />
- {{#unless public}}
- <i class="icon-lock"> </i>
- {{/unless}}
- </div>
-</div>
diff --git a/public/javascripts/app/templates/post-viewer/comment.handlebars b/public/javascripts/app/templates/post-viewer/comment.handlebars
deleted file mode 100644
index fb5da3920..000000000
--- a/public/javascripts/app/templates/post-viewer/comment.handlebars
+++ /dev/null
@@ -1,15 +0,0 @@
-<div class="img">
- {{#linkToPerson author}}
- {{{personImage this "small" "small"}}}
- {{/linkToPerson}}
-</div>
-
-<div class="bd">
- {{#linkToPerson author}}
- {{name}}
- {{/linkToPerson}}
-
- <div class="comment-content">
- {{{text}}}
- </div>
-</div>
diff --git a/public/javascripts/app/templates/post-viewer/content/activity-streams-photo.handlebars b/public/javascripts/app/templates/post-viewer/content/activity-streams-photo.handlebars
deleted file mode 100644
index 30e543995..000000000
--- a/public/javascripts/app/templates/post-viewer/content/activity-streams-photo.handlebars
+++ /dev/null
@@ -1,7 +0,0 @@
-<div class="photoset">
- <div class="img-bounding-box">
- <a href="{{object_url}}" class="stream-photo-link">
- <img src="{{image_url}}" data-small-photo="{{image_url}}" data-full-photo="{{image_url}}" class="stream-photo" />
- </a>
- </div>
-</div>
diff --git a/public/javascripts/app/templates/post-viewer/content/multi-photo.handlebars b/public/javascripts/app/templates/post-viewer/content/multi-photo.handlebars
deleted file mode 100644
index 25a681ef9..000000000
--- a/public/javascripts/app/templates/post-viewer/content/multi-photo.handlebars
+++ /dev/null
@@ -1,9 +0,0 @@
-{{{text}}}
-
-<div class="photoset">
- {{#each photos}}
- <div class="img-bounding-box">
- <img src="{{sizes.large}}" />
- </div>
- {{/each}}
-</div>
diff --git a/public/javascripts/app/templates/post-viewer/content/note.handlebars b/public/javascripts/app/templates/post-viewer/content/note.handlebars
deleted file mode 100644
index bb45a09d9..000000000
--- a/public/javascripts/app/templates/post-viewer/content/note.handlebars
+++ /dev/null
@@ -1,3 +0,0 @@
-<div class="note-content">
- {{{text}}}
-</div>
diff --git a/public/javascripts/app/templates/post-viewer/content/photo-backdrop.handlebars b/public/javascripts/app/templates/post-viewer/content/photo-backdrop.handlebars
deleted file mode 100644
index 6afb41df1..000000000
--- a/public/javascripts/app/templates/post-viewer/content/photo-backdrop.handlebars
+++ /dev/null
@@ -1,4 +0,0 @@
-{{#each photos}}
- <div class="photo-fill" style="background-image: url({{sizes.large}})"> </div>
- <img src="{{sizes.large}}" />
-{{/each}}
diff --git a/public/javascripts/app/templates/post-viewer/content/rich-media.handlebars b/public/javascripts/app/templates/post-viewer/content/rich-media.handlebars
deleted file mode 100644
index 02aaa7c8e..000000000
--- a/public/javascripts/app/templates/post-viewer/content/rich-media.handlebars
+++ /dev/null
@@ -1,11 +0,0 @@
-<div class="rich-media-container">
- <div class="rich-media-container2">
-
- {{{o_embed_cache.data.html}}}
-
- <br>
- <br>
-
- {{{text}}}
- </div>
-</div>
diff --git a/public/javascripts/app/templates/post-viewer/content/status-with-photo-backdrop.handlebars b/public/javascripts/app/templates/post-viewer/content/status-with-photo-backdrop.handlebars
deleted file mode 100644
index cc15b92a9..000000000
--- a/public/javascripts/app/templates/post-viewer/content/status-with-photo-backdrop.handlebars
+++ /dev/null
@@ -1,9 +0,0 @@
-{{#each photos}}
- <div class="photo-fill" style="background-image: url({{sizes.large}})">
- <div class="darken">
- <div class="darken-content">
- {{{../text}}}
- </div>
- </div>
- </div>
-{{/each}}
diff --git a/public/javascripts/app/templates/post-viewer/content/status.handlebars b/public/javascripts/app/templates/post-viewer/content/status.handlebars
deleted file mode 100644
index 05a443902..000000000
--- a/public/javascripts/app/templates/post-viewer/content/status.handlebars
+++ /dev/null
@@ -1 +0,0 @@
-{{{text}}}
diff --git a/public/javascripts/app/templates/post-viewer/feedback.handlebars b/public/javascripts/app/templates/post-viewer/feedback.handlebars
deleted file mode 100644
index 18bf51ab9..000000000
--- a/public/javascripts/app/templates/post-viewer/feedback.handlebars
+++ /dev/null
@@ -1,66 +0,0 @@
-<a href="#" rel="auth-required" class="label like" title="{{#if user_like}} {{t "viewer.unlike"}} {{else}} {{t "viewer.like"}} {{/if}}">
- {{#if user_like}}
- <i class="icon-heart icon-red"></i>
- {{else}}
- <i class="icon-heart icon-white"></i>
- {{/if}}
- {{likes_count}}
-</a>
-
-<a href="#" rel="auth-required" class="label follow" title="{{#if user_participation}} {{t "viewer.stop_following_post"}} {{else}} {{t "viewer.follow_post"}} {{/if}}">
- {{#if user_participation}}
- <i class="icon-plus icon-green"></i>
- {{else}}
- <i class="icon-plus icon-white"></i>
- {{/if}}
- {{participations_count}}
-</a>
-
-{{#if userCanReshare}}
- <a href="#" rel="auth-required" class="label reshare" title="{{#if user_reshare}} {{t "viewer.reshared"}} {{else}} {{t "viewer.reshare"}} {{/if}}">
- {{#if user_reshare}}
- <i class="icon-retweet icon-blue"></i>
- {{else}}
- <i class="icon-retweet icon-white"></i>
- {{/if}}
- {{reshares_count}}
- </a>
-{{else}}
- <a class="label reshare-viewonly" title="{{#if user_reshare}} {{t "viewer.reshared"}} {{else}} {{t "viewer.reshare"}} {{/if}}">
- {{#if user_reshare}}
- <i class="icon-retweet icon-blue"></i>
- {{else}}
- <i class="icon-retweet icon-white"></i>
- {{/if}}
- {{reshares_count}}
- </a>
-{{/if}}
-
-<a href="#" class="label comment" rel="invoke-interaction-pane" title="{{t "viewer.comment"}}">
- <i class="icon-comment icon-white"></i>
- {{comments_count}}
-</a>
-
-<!-- this acts as a dock underlay -->
-<div id="post-info-sneaky" class="passive">
- <div id="post-info-container-sneaky">
- <a href="#" rel="invoke-interaction-pane" class="invoker">
- <img src="/images/up-tick-inset.png" class="info-tick"/>
- <a href="/" title="{{t "header.home"}}" class="home-button">
- <i class="icon-home icon-white"></i>
- </a>
- </a>
- </div>
-</div>
-
-<!-- this closes an open interaction pane -->
-<div id="close-reactions-pane">
- <div id="close-reactions-pane-container">
- <a href="#" rel="hide-interaction-pane" class="invoker">
- <a href="/" title="{{t "header.home"}}" class="home-button">
- <i class="icon-home icon-white"></i>
- </a>
- </a>
- </div>
-</div>
-
diff --git a/public/javascripts/app/templates/post-viewer/interactions.handlebars b/public/javascripts/app/templates/post-viewer/interactions.handlebars
deleted file mode 100644
index 239f549d8..000000000
--- a/public/javascripts/app/templates/post-viewer/interactions.handlebars
+++ /dev/null
@@ -1,11 +0,0 @@
-<div id="post-feedback"> </div>
-
-<div id="post-info" style="display:none;">
- <div id="post-info-container">
- <img src="/images/down-tick-inset.png" class="info-tick"/>
-
- <div id="post-reactions"> </div>
- <div id="new-post-comment"> </div>
- </div>
-</div>
-
diff --git a/public/javascripts/app/templates/post-viewer/nav.handlebars b/public/javascripts/app/templates/post-viewer/nav.handlebars
deleted file mode 100644
index 68b3b9fe0..000000000
--- a/public/javascripts/app/templates/post-viewer/nav.handlebars
+++ /dev/null
@@ -1,11 +0,0 @@
-<a href="#" class="nav-arrow left" id="forward">
- <div class="nav-arrow-inner">
- <img src="/images/arrow-left.png" />
- </div>
-</a>
-
-<a href="#" class="nav-arrow right" id="back">
- <div class="nav-arrow-inner">
- <img src="/images/arrow-right.png" />
- </div>
-</a>
diff --git a/public/javascripts/app/templates/post-viewer/new-comment.handlebars b/public/javascripts/app/templates/post-viewer/new-comment.handlebars
deleted file mode 100644
index a1eab8349..000000000
--- a/public/javascripts/app/templates/post-viewer/new-comment.handlebars
+++ /dev/null
@@ -1,8 +0,0 @@
-<div id="new-post-comment-container">
- <form class="form-inline">
- <textarea class="new-comment-text" id="new-comment-text" placeholder="{{t "stream.comment"}}"></textarea>
- <button type="submit" class="btn btn-small">
- {{t "stream.comment"}}
- </button>
- </form>
-</div>
diff --git a/public/javascripts/app/templates/post-viewer/reactions.handlebars b/public/javascripts/app/templates/post-viewer/reactions.handlebars
deleted file mode 100644
index c4217b591..000000000
--- a/public/javascripts/app/templates/post-viewer/reactions.handlebars
+++ /dev/null
@@ -1,53 +0,0 @@
-{{# if likes}}
- <div id="post-likes">
- <div class="well media">
- <div class="img">
- <i class="icon-heart icon-red"></i>
- </div>
- <div class="bd">
- {{#each likes}}
- {{#linkToPerson author}}
- {{{personImage this "small" "micro"}}}
- {{/linkToPerson}}
- {{/each}}
- </div>
- </div>
- </div>
-{{/if}}
-
-{{# if participations}}
- <div id="post-follows">
- <div class="well media">
- <div class="img">
- <i class="icon-plus icon-green"></i>
- </div>
- <div class="bd">
- {{#each participations}}
- {{#linkToPerson author}}
- {{{personImage this "small" "micro"}}}
- {{/linkToPerson}}
- {{/each}}
- </div>
- </div>
- </div>
-{{/if}}
-
-{{# if reshares}}
- <div id="post-reshares">
- <div class="well media">
- <div class="img">
- <i class="icon-retweet icon-blue"></i>
- </div>
- <div class="bd">
- {{#each reshares}}
- {{#linkToPerson author}}
- {{{personImage this "small" "micro"}}}
- {{/linkToPerson}}
- {{/each}}
- </div>
- </div>
- </div>
-{{/if}}
-
-<div id="post-comments"> </div>
-
diff --git a/public/javascripts/app/templates/reshare.handlebars b/public/javascripts/app/templates/reshare.handlebars
deleted file mode 100644
index 08e399050..000000000
--- a/public/javascripts/app/templates/reshare.handlebars
+++ /dev/null
@@ -1,46 +0,0 @@
-<div class="reshare">
-
- {{#if root}}
-
- <div class="media">
-
- {{#with root}}
- <a href="/people/{{author.guid}}" class="img">
- <img src="{{author.avatar.small}}" class="avatar" />
- </a>
- {{/with}}
-
- {{#with root}}
- <div class="bd">
- <div>
- <a href="/people/{{author.guid}}" class="author">
- {{author.name}}
- </a>
-
- <span class="details grey">
- -
- <a href="/posts/{{id}}">
- <time class="timeago" datetime="{{created_at}}"/>
- </a>
-
- {{#if reshares_count}}
- -
- {{t "stream.reshares" count=reshares_count}}
- {{/if}}
- </span>
- </div>
- {{/with}}
-
- {{> status-message}}
- </div>
-
- </div>
-
- {{else}}
-
- <p>
- {{t "stream.original_post_deleted"}}
- </p>
- {{/if}}
-
-</div>
diff --git a/public/javascripts/app/templates/static-text.handlebars b/public/javascripts/app/templates/static-text.handlebars
deleted file mode 100644
index 1c37e4a9c..000000000
--- a/public/javascripts/app/templates/static-text.handlebars
+++ /dev/null
@@ -1 +0,0 @@
-<span class=text>{{ text }}</span>
diff --git a/public/javascripts/app/templates/status-message.handlebars b/public/javascripts/app/templates/status-message.handlebars
deleted file mode 100644
index a20dfac00..000000000
--- a/public/javascripts/app/templates/status-message.handlebars
+++ /dev/null
@@ -1,31 +0,0 @@
-{{#if largePhoto}}
- <div class="photo_attachments">
-
- <a href="#" class="stream-photo-link">
- {{#with largePhoto}}
- <img src="{{sizes.large}}" class="stream-photo big_stream_photo" data-small-photo="{{sizes.small}}" data-full-photo="{{sizes.large}}" rel="lightbox">
- {{/with}}
- </a>
-
- {{#each smallPhotos}}
- <a href="#" class="stream-photo-link">
- <img src="{{sizes.small}}" class="stream-photo thumb_small" data-small-photo="{{sizes.small}}" data-full-photo="{{sizes.large}}" rel="lightbox">
- </a>
- {{/each}}
-{{/if}}
-
-<div class="collapsible">
- {{{text}}}
- {{#if o_embed_cache}}
- <div class="oembed">
- {{#if o_embed_cache.data.thumbnail_url}}
- <div class="thumb">
- <img src="{{o_embed_cache.data.thumbnail_url}}" />
- <div class="video-overlay"></div>
- </div>
- {{else}}
- {{{o_embed_html}}}
- {{/if}}
- </div>
- {{/if}}
-</div>
diff --git a/public/javascripts/app/templates/stream-element.handlebars b/public/javascripts/app/templates/stream-element.handlebars
deleted file mode 100644
index 89503daf7..000000000
--- a/public/javascripts/app/templates/stream-element.handlebars
+++ /dev/null
@@ -1,80 +0,0 @@
-<div class="media">
-
- {{#if current_user}}
- <div class="controls">
- {{#unless authorIsCurrentUser}}
- <a href="#" rel=nofollow>
- <img src="{{imageUrl "ignoreuser.png"}}"" alt="Ignoreuser" class="block_user control_icon" title="{{t "ignore"}}" />
- </a>
- <a href="#" rel=nofollow>
- <img src="{{imageUrl "deletelabel.png"}}" class="delete control_icon hide_post" title="{{t "stream.hide"}}" />
- </a>
- {{else}}
- <a href="#" rel=nofollow>
- <img src="{{imageUrl "deletelabel.png"}}" class="delete control_icon remove_post" title="{{t "delete"}}" />
- </a>
- {{/unless}}
- </div>
- {{/if}}
-
- {{#with author}}
- <a href="/people/{{guid}}" class="img">
- {{{personImage this}}}
- </a>
- {{/with}}
-
- <div class="bd">
- <div>
- {{#with author}}
- <a href="/people/{{guid}}" class="author">
- {{name}}
- </a>
- {{/with}}
-
- <span class="details grey">
- -
- <a href="/posts/{{id}}">
- <time class="timeago" datetime="{{created_at}}" />
- </a>
-
- {{#if reshares_count}}
- -
- {{t "stream.reshares" count=reshares_count}}
- {{/if}}
- </span>
- </div>
-
- {{#if showPost}}
- {{#if nsfw}}
- <div class="nsfw_off">
- <strong>
- #NSFW
- </strong>
- |
- <a href="#" class="toggle_nsfw_state">
- {{t "stream.hide_nsfw_posts"}}
- </a>
- </div>
- {{/if}}
- <div class="post-content"> </div>
-
- <div class="feedback"> </div>
- <div class="likes"> </div>
- <div class="comments"> </div>
- {{else}}
- <div class="nsfw-shield">
- <strong>
- #NSFW
- </strong>
- |
- <a href="#" class="show_nsfw_post">
- {{t "stream.show_nsfw_post"}}
- </a>
- |
- <a href="#" class="toggle_nsfw_state">
- {{t "stream.show_nsfw_posts"}}
- </a>
- </div>
- {{/if}}
-
- </div>
diff --git a/public/javascripts/app/templates/stream-faces.handlebars b/public/javascripts/app/templates/stream-faces.handlebars
deleted file mode 100644
index 6db001f19..000000000
--- a/public/javascripts/app/templates/stream-faces.handlebars
+++ /dev/null
@@ -1,5 +0,0 @@
-{{#people}}
- {{#linkToPerson this}}
- {{{personImage this "small"}}}
- {{/linkToPerson}}
-{{/people}}
diff --git a/public/javascripts/app/views.js b/public/javascripts/app/views.js
deleted file mode 100644
index faadd32ce..000000000
--- a/public/javascripts/app/views.js
+++ /dev/null
@@ -1,70 +0,0 @@
-app.views.Base = Backbone.View.extend({
-
- initialize : function(options) {
- this.setupRenderEvents();
- },
-
- presenter : function(){
- return this.defaultPresenter()
- },
-
- setupRenderEvents : function(){
- if(this.model) {
- //this should be in streamobjects view
- this.model.bind('remove', this.remove, this);
- }
-
- // this line is too generic. we usually only want to re-render on
- // feedback changes as the post content, author, and time do not change.
- //
- // this.model.bind('change', this.render, this);
- },
-
- defaultPresenter : function(){
- var modelJson = this.model ? _.clone(this.model.attributes) : {}
- return _.extend(modelJson, {
- current_user : app.currentUser.attributes,
- loggedIn : app.currentUser.authenticated()
- });
- },
-
- render : function() {
- this.renderTemplate()
- this.renderSubviews()
- this.renderPluginWidgets()
- this.removeTooltips()
-
- return this
- },
-
- renderTemplate : function(){
- var presenter = _.isFunction(this.presenter) ? this.presenter() : this.presenter
- this.template = JST[this.templateName]
- $(this.el)
- .html(this.template(presenter))
- .attr("data-template", _.last(this.templateName.split("/")));
- this.postRenderTemplate();
- },
-
- postRenderTemplate : $.noop, //hella callbax yo
-
- renderSubviews : function(){
- var self = this;
- _.each(this.subviews, function(property, selector){
- var view = _.isFunction(self[property]) ? self[property]() : self[property]
- if(view) {
- self.$(selector).html(view.render().el)
- view.delegateEvents();
- }
- })
- },
-
- renderPluginWidgets : function() {
- this.$(this.tooltipSelector).twipsy();
- this.$("time").timeago();
- },
-
- removeTooltips : function() {
- $(".twipsy").remove();
- }
-});
diff --git a/public/javascripts/app/views/comment_stream_view.js b/public/javascripts/app/views/comment_stream_view.js
deleted file mode 100644
index 5c756753b..000000000
--- a/public/javascripts/app/views/comment_stream_view.js
+++ /dev/null
@@ -1,79 +0,0 @@
-app.views.CommentStream = app.views.Base.extend({
-
- templateName: "comment-stream",
-
- className : "comment_stream",
-
- events: {
- "submit form": "createComment",
- "focus .comment_box": "commentTextareaFocused",
- "click .toggle_post_comments": "expandComments"
- },
-
- initialize: function(options) {
- this.commentTemplate = options.commentTemplate;
-
- this.setupBindings();
- },
-
- setupBindings: function() {
- this.model.comments.bind('add', this.appendComment, this);
- this.model.bind("commentsExpanded", this.render, this);
- },
-
- postRenderTemplate : function() {
- this.$("textarea").placeholder();
- this.model.comments.each(this.appendComment, this);
-
- // add autoexpanders to new comment textarea
- this.$("textarea").autoResize({'extraSpace' : 10});
- },
-
- presenter: function(){
- return _.extend(this.defaultPresenter(), {
- moreCommentsCount : (this.model.get("comments_count") - 3),
- showExpandCommentsLink : (this.model.get("comments_count") > 3)
- })
- },
-
- createComment: function(evt) {
- if(evt){ evt.preventDefault(); }
-
- this.model.comments.create({
- "text" : this.$(".comment_box").val()
- });
-
- this.$(".comment_box").val("")
- return this;
- },
-
- appendComment: function(comment) {
- // Set the post as the comment's parent, so we can check
- // on post ownership in the Comment view.
- comment.set({parent : this.model.toJSON()})
-
- this.$(".comments").append(new app.views.Comment({
- model: comment
- }).render().el);
- },
-
- commentTextareaFocused: function(evt){
- this.$("form").removeClass('hidden').addClass("open");
- },
-
- expandComments: function(evt){
- if(evt){ evt.preventDefault(); }
-
- var self = this;
- this.model.comments.fetch({
- success : function(resp){
- self.model.set({
- comments : resp.models,
- all_comments_loaded : true
- })
- self.model.trigger("commentsExpanded", self)
- }
- });
- }
-
-});
diff --git a/public/javascripts/app/views/comment_view.js b/public/javascripts/app/views/comment_view.js
deleted file mode 100644
index c85faf7a2..000000000
--- a/public/javascripts/app/views/comment_view.js
+++ /dev/null
@@ -1,31 +0,0 @@
-app.views.Comment = app.views.Content.extend({
-
- templateName: "comment",
-
- className : "comment media",
-
- events : function() {
- return _.extend(app.views.Content.prototype.events, {
- "click .comment_delete": "destroyModel"
- });
- },
-
- presenter : function() {
- return _.extend(this.defaultPresenter(), {
- canRemove: this.canRemove(),
- text : app.helpers.textFormatter(this.model)
- })
- },
-
- ownComment : function() {
- return app.currentUser.authenticated() && this.model.get("author").diaspora_id == app.currentUser.get("diaspora_id")
- },
-
- postOwner : function() {
- return app.currentUser.authenticated() && this.model.get("parent").author.diaspora_id == app.currentUser.get("diaspora_id")
- },
-
- canRemove : function() {
- return app.currentUser.authenticated() && (this.ownComment() || this.postOwner())
- }
-});
diff --git a/public/javascripts/app/views/content_view.js b/public/javascripts/app/views/content_view.js
deleted file mode 100644
index bb66c08f1..000000000
--- a/public/javascripts/app/views/content_view.js
+++ /dev/null
@@ -1,69 +0,0 @@
-app.views.Content = app.views.StreamObject.extend({
-
- events: {
- "click .oembed .thumb": "showOembedContent",
- "click .expander": "expandPost"
- },
-
- presenter : function(){
- return _.extend(this.defaultPresenter(), {
- text : app.helpers.textFormatter(this.model),
- o_embed_html : this.embedHTML(),
- largePhoto : this.largePhoto(),
- smallPhotos : this.smallPhotos()
- });
- },
-
- embedHTML: function(){
- if(!this.model.get("o_embed_cache")) { return ""; }
- var data = this.model.get("o_embed_cache").data;
- if(data.type == "photo") {
- return '<img src="'+data.url+'" width="'+data.width+'" height="'+data.height+'" />';
- } else {
- return data.html || ""
- }
- },
-
- largePhoto : function() {
- var photos = this.model.get("photos")
- if(!photos || photos.length == 0) { return }
- return photos[0]
- },
-
- smallPhotos : function() {
- var photos = this.model.get("photos")
- if(!photos || photos.length < 2) { return }
- return photos.slice(1,8)
- },
-
- showOembedContent: function() {
- var oembed = $(this.el).find(".oembed");
- var insertHTML = $( this.embedHTML() );
- var paramSeparator = ( /\?/.test(insertHTML.attr("src")) ) ? "&" : "?";
- insertHTML.attr("src", insertHTML.attr("src") + paramSeparator + "autoplay=1");
- oembed.html( insertHTML );
- },
-
- expandPost: function(evt) {
- var el = $(this.el).find('.collapsible');
- el.removeClass('collapsed').addClass('opened');
- el.animate({'height':el.data('orig-height')}, 550, function() {
- el.css('height','auto');
- });
- $(evt.currentTarget).hide();
- }
-
-});
-
-app.views.StatusMessage = app.views.Content.extend({
- templateName : "status-message"
-});
-
-app.views.Reshare = app.views.Content.extend({
- templateName : "reshare"
-});
-
-app.views.ActivityStreams__Photo = app.views.Content.extend({
- templateName : "activity-streams-photo"
-});
-
diff --git a/public/javascripts/app/views/feedback_view.js b/public/javascripts/app/views/feedback_view.js
deleted file mode 100644
index 9046356b3..000000000
--- a/public/javascripts/app/views/feedback_view.js
+++ /dev/null
@@ -1,58 +0,0 @@
-app.views.Feedback = app.views.Base.extend({
-
- templateName: "feedback",
-
- className : "info",
-
- events: {
- "click .like_action" : "toggleLike",
- "click .participate_action" : "toggleFollow",
- "click .reshare_action" : "resharePost"
- },
-
- initialize : function() {
- this.model.bind('interacted', this.render, this);
- },
-
- presenter : function() {
- return _.extend(this.defaultPresenter(), {
- userCanReshare : this.userCanReshare()
- })
- },
-
- toggleFollow : function(evt) {
- if(evt) { evt.preventDefault(); }
- this.model.toggleFollow();
- },
-
- toggleLike: function(evt) {
- if(evt) { evt.preventDefault(); }
- this.model.toggleLike();
- },
-
- resharePost : function(evt) {
- if(evt) { evt.preventDefault(); }
- if(!window.confirm("Reshare " + this.model.reshareAuthor().name + "'s post?")) { return }
- var reshare = this.model.reshare()
- var model = this.model
-
- reshare.save({}, {
- url: this.model.createReshareUrl,
- success : function(resp){
- app.stream && app.stream.add(reshare);
- model.trigger("interacted")
- }
- });
- },
-
- userCanReshare : function() {
- var isReshare = this.model.get("post_type") == "Reshare"
- var rootExists = (isReshare ? this.model.get("root") : true)
-
- var publicPost = this.model.get("public");
- var userIsNotAuthor = this.model.get("author").diaspora_id != app.currentUser.get("diaspora_id");
- var userIsNotRootAuthor = rootExists && (isReshare ? this.model.get("root").author.diaspora_id != app.currentUser.get("diaspora_id") : true)
-
- return publicPost && app.currentUser.authenticated() && userIsNotAuthor && userIsNotRootAuthor;
- }
-});
diff --git a/public/javascripts/app/views/header_view.js b/public/javascripts/app/views/header_view.js
deleted file mode 100644
index b1ed5151f..000000000
--- a/public/javascripts/app/views/header_view.js
+++ /dev/null
@@ -1,35 +0,0 @@
-app.views.Header = app.views.Base.extend({
-
- templateName : "header",
-
- className : "dark-header",
-
- events : {
- "click ul.dropdown li:first-child" : "toggleDropdown"
- },
-
- initialize : function(options) {
- $(document.body).click($.proxy(this.hideDropdown, this));
- return this;
- },
-
- menuElement : function() {
- return this.$("ul.dropdown");
- },
-
- toggleDropdown : function(evt) {
- if(evt){ evt.preventDefault(); }
-
- this.menuElement().toggleClass("active");
-
- if($.browser.msie) {
- this.$("header").toggleClass('ie-user-menu-active');
- }
- },
-
- hideDropdown : function(evt) {
- if(this.menuElement().hasClass("active") && !$(evt.target).parents("#user_menu").length) {
- this.menuElement().removeClass("active");
- }
- }
-});
diff --git a/public/javascripts/app/views/likes_info_view.js b/public/javascripts/app/views/likes_info_view.js
deleted file mode 100644
index 146f859a2..000000000
--- a/public/javascripts/app/views/likes_info_view.js
+++ /dev/null
@@ -1,31 +0,0 @@
-app.views.LikesInfo = app.views.StreamObject.extend({
-
- templateName : "likes-info",
-
- events : {
- "click .expand_likes" : "showAvatars"
- },
-
- tooltipSelector : ".avatar",
-
- initialize : function() {
- this.model.bind('expandedLikes', this.render, this)
- },
-
- presenter : function() {
- return _.extend(this.defaultPresenter(), {
- likes : this.model.likes.models
- })
- },
-
- showAvatars : function(evt){
- if(evt) { evt.preventDefault() }
- var self = this;
- this.model.likes.fetch()
- .done(function(resp){
- // set like attribute and like collection
- self.model.set({likes : self.model.likes.reset(resp)})
- self.model.trigger("expandedLikes")
- })
- }
-});
diff --git a/public/javascripts/app/views/photo_view.js b/public/javascripts/app/views/photo_view.js
deleted file mode 100644
index c672863d4..000000000
--- a/public/javascripts/app/views/photo_view.js
+++ /dev/null
@@ -1,13 +0,0 @@
-app.views.Photo = app.views.StreamObject.extend({
-
- templateName: "photo",
-
- className : "photo loaded",
-
- initialize : function() {
- $(this.el).attr("id", this.model.get("guid"));
- this.model.bind('remove', this.remove, this);
- return this;
- }
-
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/photos_view.js b/public/javascripts/app/views/photos_view.js
deleted file mode 100644
index 2f930f018..000000000
--- a/public/javascripts/app/views/photos_view.js
+++ /dev/null
@@ -1,60 +0,0 @@
-app.views.Photos = Backbone.View.extend({
-
- events : {},
-
- initialize : function(options) {
- this.photos = this.model;
- this.collection = this.model.photos;
-
- this.setupEvents();
- this.setupLightbox();
- },
-
- setupEvents : function(){
- this.photos.bind("fetched", this.removeLoader, this)
- this.collection.bind("add", this.addPhoto, this);
- },
-
- addPhoto : function(photo) {
- var photoView = new app.views.Photo({ model: photo });
-
- $(this.el)[
- (this.collection.at(0).id == photo.id)
- ? "prepend"
- : "append"
- ](photoView.render().el);
-
- return this;
- },
-
- render : function(evt) {
- if(evt) {evt.preventDefault(); }
-
- if(this.model.fetch()) {
- this.appendLoader();
- };
-
- return this;
- },
-
- appendLoader: function(){
- $("#paginate").html($("<img>", {
- src : "/images/static-loader.png",
- "class" : "loader"
- }));
- },
-
- removeLoader: function() {
- $("#paginate").empty();
- },
-
- setupLightbox : function(){
- this.lightbox = Diaspora.BaseWidget.instantiate("Lightbox");
- this.lightbox.set({
- imageParent: '#main_stream',
- imageSelector: 'img.photo'
- });
- $(this.el).delegate("a.photo-link", "click", this.lightbox.lightboxImageClicked);
- },
-
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/post-viewer/author.js b/public/javascripts/app/views/post-viewer/author.js
deleted file mode 100644
index 0de915c93..000000000
--- a/public/javascripts/app/views/post-viewer/author.js
+++ /dev/null
@@ -1,8 +0,0 @@
-app.views.PostViewerAuthor = app.views.Base.extend({
-
- id : "post-author",
- className : "media",
-
- templateName: "post-viewer/author"
-
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/post-viewer/feedback.js b/public/javascripts/app/views/post-viewer/feedback.js
deleted file mode 100644
index 0b38c0588..000000000
--- a/public/javascripts/app/views/post-viewer/feedback.js
+++ /dev/null
@@ -1,40 +0,0 @@
-app.views.PostViewerFeedback = app.views.Feedback.extend({
-
- id : "user-controls",
- className : "",
-
- templateName: "post-viewer/feedback",
-
- events : {
- "click *[rel='auth-required']" : "requireAuth",
-
- "click .like" : "toggleLike",
- "click .follow" : "toggleFollow",
- "click .reshare" : "resharePost",
-
- "click *[rel='invoke-interaction-pane']" : "invokePane",
- "click *[rel='hide-interaction-pane']" : "hidePane"
- },
-
- tooltipSelector : ".label, .home-button",
-
- postRenderTemplate : function() {
- this.sneakyVisiblity()
- },
-
- sneakyVisiblity : function() {
- if(!$("#post-info").is(":visible")) {
- this.$("#post-info-sneaky").removeClass('passive')
- }
- },
-
- invokePane : function(evt){ this.trigger("invokePane") },
- hidePane : function(evt){ this.trigger("hidePane") },
-
- requireAuth : function(evt) {
- if( app.currentUser.authenticated() ) { return }
- alert("you must be logged in to do that!")
- return false;
- }
-
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/post-viewer/interactions.js b/public/javascripts/app/views/post-viewer/interactions.js
deleted file mode 100644
index a0b17600b..000000000
--- a/public/javascripts/app/views/post-viewer/interactions.js
+++ /dev/null
@@ -1,56 +0,0 @@
-app.views.PostViewerInteractions = app.views.Base.extend({
-
- className : "",
-
- subviews : {
- "#post-feedback" : "feedbackView",
- "#post-reactions" : "reactionsView",
- "#new-post-comment" : "newCommentView"
- },
-
- templateName: "post-viewer/interactions",
-
- initialize : function() {
- this.initViews();
-
- this.feedbackView && this.feedbackView.bind("invokePane", this.invokePane, this)
- this.feedbackView && this.feedbackView.bind("hidePane", this.hidePane, this)
- },
-
- initViews : function() {
- this.reactionsView = new app.views.PostViewerReactions({ model : this.model })
-
- /* subviews that require user */
- this.feedbackView = new app.views.PostViewerFeedback({ model : this.model })
- if(app.currentUser.authenticated()) {
- this.newCommentView = new app.views.PostViewerNewComment({ model : this.model })
- }
- },
-
- togglePane : function(evt) {
- if(evt) { evt.preventDefault() }
- $("#post-interactions").toggleClass("active")
- this.$("#post-info").slideToggle(300)
- this.removeTooltips()
- },
-
- invokePane : function() {
- if(!this.$("#post-info").is(":visible")) {
- this.$("#post-info-sneaky").addClass("passive")
- this.togglePane()
- }
- },
-
- hidePane : function() {
- if(this.$("#post-info").is(":visible")) {
-
- /* it takes about 400ms for the pane to hide. we need to keep
- * the sneaky hidden until the slide is complete */
- setTimeout(function(){
- this.$("#post-info-sneaky").removeClass("passive")
- }, 400)
-
- this.togglePane()
- }
- }
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/post-viewer/nav.js b/public/javascripts/app/views/post-viewer/nav.js
deleted file mode 100644
index 736535d76..000000000
--- a/public/javascripts/app/views/post-viewer/nav.js
+++ /dev/null
@@ -1,30 +0,0 @@
-app.views.PostViewerNav = app.views.Base.extend({
-
- templateName: "post-viewer/nav",
-
- events : {
- "click a" : "pjax"
- },
-
- postRenderTemplate : function() {
- var mappings = {"#forward" : "next_post",
- "#back" : "previous_post"};
-
- _.each(mappings, function(attribute, selector){
- this.setArrow(this.$(selector), this.model.get(attribute))
- }, this);
- },
-
- setArrow : function(arrow, loc) {
- loc ? arrow.attr('href', loc) : arrow.remove()
- },
-
- pjax : function(evt) {
- if(evt) { evt.preventDefault(); }
- var link;
-
- evt.target.tagName != "A" ? link = $(evt.target).closest("a") : link = $(evt.target)
- app.router.navigate(link.attr("href").substring(1), true)
- }
-
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/post-viewer/new_comment.js b/public/javascripts/app/views/post-viewer/new_comment.js
deleted file mode 100644
index 2ab3b45e7..000000000
--- a/public/javascripts/app/views/post-viewer/new_comment.js
+++ /dev/null
@@ -1,45 +0,0 @@
-app.views.PostViewerNewComment = app.views.Base.extend({
-
- templateName: "post-viewer/new-comment",
-
- events : {
- "click button" : "createComment",
- "focus textarea" : "scrollToBottom"
- },
-
- scrollableArea : "#post-reactions",
-
- postRenderTemplate : function() {
- this.$("textarea").placeholder();
- this.$("textarea").autoResize({'extraSpace' : 0});
- },
-
- createComment: function(evt) {
- if(evt){ evt.preventDefault(); }
-
- var self = this;
-
- this.toggleFormState()
- this.model.comments.create({
- "text" : this.$("textarea").val()
- }, {success : _.bind(self.clearAndReactivateForm, self)});
-
- },
-
- clearAndReactivateForm : function() {
- this.model.trigger("interacted")
- this.toggleFormState()
- this.$("textarea").val("")
- .css('height', '18px')
- .focus()
- },
-
- toggleFormState : function() {
- this.$("form").children().toggleClass('disabled')
- },
-
- scrollToBottom : function() {
- $(this.scrollableArea).scrollTop($(this.scrollableArea).prop("scrollHeight"))
- }
-
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/post-viewer/reactions.js b/public/javascripts/app/views/post-viewer/reactions.js
deleted file mode 100644
index 145ed1b02..000000000
--- a/public/javascripts/app/views/post-viewer/reactions.js
+++ /dev/null
@@ -1,34 +0,0 @@
-app.views.PostViewerReactions = app.views.Base.extend({
-
- className : "",
-
- templateName: "post-viewer/reactions",
-
- tooltipSelector : ".avatar",
-
- initialize : function() {
- this.model.bind('interacted', this.render, this);
- },
-
- postRenderTemplate : function() {
- this.populateComments()
- },
-
- /* copy pasta from commentStream */
- populateComments : function() {
- this.model.comments.each(this.appendComment, this)
- },
-
- /* copy pasta from commentStream */
- appendComment: function(comment) {
- // Set the post as the comment's parent, so we can check
- // on post ownership in the Comment view.
- comment.set({parent : this.model.toJSON()})
-
- this.$("#post-comments").append(new app.views.Comment({
- model: comment,
- className : "post-comment media"
- }).render().el);
- }
-
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/post_view.js b/public/javascripts/app/views/post_view.js
deleted file mode 100644
index 4f167fd3a..000000000
--- a/public/javascripts/app/views/post_view.js
+++ /dev/null
@@ -1,44 +0,0 @@
-app.views.Post = app.views.StreamObject.extend({
- presenter : function() {
- return _.extend(this.defaultPresenter(), {
- authorIsCurrentUser : this.authorIsCurrentUser(),
- showPost : this.showPost(),
- text : app.helpers.textFormatter(this.model)
- })
- },
-
- authorIsCurrentUser : function() {
- return app.currentUser.authenticated() && this.model.get("author").id == app.user().id
- },
-
- showPost : function() {
- return (app.currentUser.get("showNsfw")) || !this.model.get("nsfw")
- }
-}, { //static methods below
-
- showFactory : function(model) {
- var frameName = model.get("frame_name");
-
- if(_.include(app.models.Post.legacyTemplateNames, frameName)){
- return legacyShow(model)
- } else {
- return new app.views.Post[frameName]({
- model : model
- })
- }
-
- function legacyShow(model) {
- return new app.views.Post.Legacy({
- model : model,
- className : frameName + " post loaded",
- templateName : "post-viewer/content/" + frameName
- });
- }
- }
-});
-
-app.views.Post.Legacy = app.views.Post.extend({
- initialize : function(options) {
- this.templateName = options.templateName || this.templateName
- }
-}) \ No newline at end of file
diff --git a/public/javascripts/app/views/publisher_view.js b/public/javascripts/app/views/publisher_view.js
deleted file mode 100644
index 2274aeb74..000000000
--- a/public/javascripts/app/views/publisher_view.js
+++ /dev/null
@@ -1,100 +0,0 @@
-//this file is the scary no-no-zone bad-touch of our backbone code.
-//after re-writing/eliminating the existing Publisher let's re-write
-//this with PANACHE! <333 Dennis
-
-app.views.Publisher = Backbone.View.extend({
-
- el : "#publisher",
-
- events : {
- "focus textarea" : "open",
- "click #hide_publisher" : "clear",
- "submit form" : "createStatusMessage"
- },
-
- initialize : function(){
- this.collection = this.collection //takes a Posts collection
- return this;
- },
-
- createStatusMessage : function(evt) {
- if(evt){ evt.preventDefault(); }
-
- var serializedForm = $(evt.target).closest("form").serializeObject();
-
- // lulz this code should be killed.
- var statusMessage = new app.models.Post();
-
- statusMessage.save({
- "status_message" : {
- "text" : serializedForm["status_message[text]"]
- },
- "aspect_ids" : serializedForm["aspect_ids[]"],
- "photos" : serializedForm["photos[]"],
- "services" : serializedForm["services[]"]
- }, {
- url : "/status_messages",
- success : function() {
- if(app.publisher) {
- $(app.publisher.el).trigger('ajax:success');
- }
- if(app.stream) {
- app.stream.posts.add(statusMessage.toJSON());
- }
- }
- });
-
- // clear state
- this.clear();
- },
-
- clear : function() {
- this.$('textarea').val("");
- this.$('#publisher_textarea_wrapper').removeClass("with_attachments");
-
- // remove photos
- this.$("#photodropzone").find('li').remove();
- this.$("input[name='photos[]']").remove();
-
- // close publishing area (CSS)
- this.close();
-
- Publisher.clear()
-
- return this;
- },
-
- open : function() {
- $(this.el).removeClass('closed');
- this.$("#publisher_textarea_wrapper").addClass('active');
- this.$("textarea.ac_input").css('min-height', '42px');
-
- return this;
- },
-
- close : function() {
- $(this.el).addClass("closed");
- this.$("#publisher_textarea_wrapper").removeClass("active");
- this.$("textarea.ac_input").css('min-height', '');
-
- return this;
- }
-});
-
-// jQuery helper for serializing a <form> into JSON
-$.fn.serializeObject = function()
-{
- var o = {};
- var a = this.serializeArray();
- $.each(a, function() {
- if (o[this.name] !== undefined) {
- if (!o[this.name].push) {
- o[this.name] = [o[this.name]];
- }
- o[this.name].push(this.value || '');
- } else {
- o[this.name] = this.value || '';
- }
- });
- return o;
-};
diff --git a/public/javascripts/app/views/stream_faces_view.js b/public/javascripts/app/views/stream_faces_view.js
deleted file mode 100644
index 70fa6055b..000000000
--- a/public/javascripts/app/views/stream_faces_view.js
+++ /dev/null
@@ -1,29 +0,0 @@
-app.views.StreamFaces = app.views.Base.extend({
-
- templateName : "stream-faces",
-
- className : "stream-faces",
-
- tooltipSelector : ".avatar",
-
- initialize : function(){
- this.updatePeople()
- app.stream.posts.bind("add", this.updatePeople, this)
- },
-
- presenter : function() {
- return {people : this.people}
- },
-
- updatePeople : function(){
- if(this.people && this.people.length >= 15) { return }
- this.people = _(this.collection.models).chain()
- .map(function(post){ return post.get("author") })
- .compact()
- .uniq(false, function(person){ return person.id })
- .value()
- .slice(0,15);
-
- this.render();
- }
-}); \ No newline at end of file
diff --git a/public/javascripts/app/views/stream_object_view.js b/public/javascripts/app/views/stream_object_view.js
deleted file mode 100644
index 42d7bc6d4..000000000
--- a/public/javascripts/app/views/stream_object_view.js
+++ /dev/null
@@ -1,19 +0,0 @@
-app.views.StreamObject = app.views.Base.extend({
- destroyModel: function(evt) {
- if (evt) {
- evt.preventDefault();
- }
- if (!confirm(Diaspora.I18n.t("confirm_dialog"))) {
- return
- }
-
- this.model.destroy();
- this.slideAndRemove();
- },
-
- slideAndRemove : function() {
- $(this.el).slideUp(400, function() {
- $(this).remove();
- });
- }
-});
diff --git a/public/javascripts/app/views/stream_view.js b/public/javascripts/app/views/stream_view.js
deleted file mode 100644
index b17ae4c60..000000000
--- a/public/javascripts/app/views/stream_view.js
+++ /dev/null
@@ -1,119 +0,0 @@
-app.views.Stream = Backbone.View.extend({
-
- events: {
- "click #paginate": "render"
- },
-
- initialize: function(options) {
- this.stream = this.model
- this.collection = this.model.posts
-
- this.setupEvents()
- this.setupInfiniteScroll()
- this.setupLightbox()
- this.postViews = []
- },
-
- setupEvents : function(){
- this.stream.bind("fetched", this.removeLoader, this)
- this.stream.bind("fetched", this.postRender, this)
- this.stream.bind("allPostsLoaded", this.unbindInfScroll, this)
- this.collection.bind("add", this.addPost, this);
- if(window.app.user()) {
- app.user().bind("nsfwChanged", function() {
- _.map(this.postViews, function(view){ view.render() })
- }, this)
- }
- },
-
- addPost : function(post) {
- var postView = new app.views.StreamPost({ model: post });
-
- $(this.el)[
- (this.collection.at(0).id == post.id)
- ? "prepend"
- : "append"
- ](postView.render().el);
-
- this.postViews.push(postView)
- return this;
- },
-
- unbindInfScroll : function() {
- $(window).unbind("scroll");
- },
-
- render : function(evt) {
- if(evt) { evt.preventDefault(); }
-
- // fetch more posts from the stream model
- if(this.stream.fetch()) {
- this.appendLoader()
- };
-
- return this;
- },
-
- postRender : function() {
- // collapse long posts
- var collHeight = 420,
- collElem = $(this.el).find(".collapsible");
-
- _.each(collElem, function(elem) {
- var elem = $(elem),
- oembed = elem.find(".oembed"),
- addHeight = 0;
-
- if( $.trim(oembed.html()) != "" ) {
- addHeight = oembed.height();
- }
-
- // only collapse if height exceeds collHeight+20%
- if( elem.height() > ((collHeight*1.2)+addHeight) && !elem.is(".opened") ) {
- elem.data("orig-height", elem.height() );
- elem
- .height( Math.max(collHeight, addHeight) )
- .addClass("collapsed")
- .append(
- $('<div />')
- .addClass('expander')
- .text( Diaspora.I18n.t("show_more") )
- );
- }
- });
- },
-
- appendLoader: function(){
- $("#paginate").html($("<img>", {
- src : "/images/static-loader.png",
- "class" : "loader"
- }));
- },
-
- removeLoader: function() {
- $("#paginate").empty();
- },
-
- setupLightbox : function(){
- this.lightbox = Diaspora.BaseWidget.instantiate("Lightbox");
- $(this.el).delegate("a.stream-photo-link", "click", this.lightbox.lightboxImageClicked);
- },
-
- setupInfiniteScroll : function() {
- var throttledScroll = _.throttle($.proxy(this.infScroll, this), 200);
- $(window).scroll(throttledScroll);
- },
-
- infScroll : function() {
- var $window = $(window);
- var distFromTop = $window.height() + $window.scrollTop();
- var distFromBottom = $(document).height() - distFromTop;
- var bufferPx = 500;
-
- if(distFromBottom < bufferPx) {
- this.render();
- }
-
- return this;
- },
-});
diff --git a/public/javascripts/aspect-edit-pane.js b/public/javascripts/aspect-edit-pane.js
deleted file mode 100644
index c2b44f513..000000000
--- a/public/javascripts/aspect-edit-pane.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
-* licensed under the Affero General Public License version 3 or later. See
-* the COPYRIGHT file.
-*/
-
-function toggleAspectTitle(){
- $("#aspect_name_title").toggleClass('hidden');
- $("#aspect_name_edit").toggleClass('hidden');
-}
-
-function updateAspectName(new_name) {
- $('#aspect_name_title .name').html(new_name);
- $('input#aspect_name').val(new_name);
-}
-function updatePageAspectName( an_id, new_name) {
- $('ul#aspect_nav [data-guid="'+an_id+'"]').html(new_name);
-}
-
-$(document).ready(function() {
- $('#rename_aspect_link').live('click', function(){
- toggleAspectTitle();
- });
-
- $('form.edit_aspect').live('ajax:success', function(evt, data, status, xhr) {
- updateAspectName(data['name']);
- updatePageAspectName( data['id'], data['name'] );
- toggleAspectTitle();
- });
-});
diff --git a/public/javascripts/aspect-sorting.js b/public/javascripts/aspect-sorting.js
deleted file mode 100644
index 695050f8c..000000000
--- a/public/javascripts/aspect-sorting.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
-* licensed under the Affero General Public License version 3 or later. See
-* the COPYRIGHT file.
-*/
-
-$(document).ready(function() {
- $('#aspect_nav.left_nav .all_aspects .sub_nav').sortable({
- items: "li[data-aspect_id]",
- update: function(event, ui) {
- var order = $(this).sortable("toArray", {attribute: "data-aspect_id"}),
- obj = { 'reorder_aspects': order, '_method': 'put' };
- $.ajax('/user', { type: 'post', dataType: 'script', data: obj });
- },
- revert: true,
- helper: 'clone'
- });
-});
-
diff --git a/public/javascripts/aspects-dropdown.js b/public/javascripts/aspects-dropdown.js
deleted file mode 100644
index 61f035d17..000000000
--- a/public/javascripts/aspects-dropdown.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2010-2011, Diaspora Inc. This file is
-// licensed under the Affero General Public License version 3 or later. See
-// the COPYRIGHT file.
-
-var AspectsDropdown = {
- updateNumber: function(dropdown, personId, number, inAspectClass){
- var button = dropdown.parents(".dropdown").children('.button.toggle'),
- selectedAspects = dropdown.children(".selected").length,
- allAspects = dropdown.children().length,
- replacement;
-
- if (number == 0) {
- button.removeClass(inAspectClass);
- if( dropdown.closest('#publisher').length ) {
- replacement = Diaspora.I18n.t("aspect_dropdown.select_aspects");
- } else {
- replacement = Diaspora.I18n.t("aspect_dropdown.add_to_aspect");
- /* flash message prompt */
- var message = Diaspora.I18n.t("aspect_dropdown.stopped_sharing_with", {name: dropdown.data('person-short-name')});
- Diaspora.page.flashMessages.render({success: true, notice: message});
- }
- }else if (selectedAspects == allAspects) {
- replacement = Diaspora.I18n.t('aspect_dropdown.all_aspects');
- }else if (number == 1) {
- button.addClass(inAspectClass);
- replacement = dropdown.find(".selected").first().text();
- /* flash message prompt */
- if( dropdown.closest('#publisher').length == 0 ) {
- var message = Diaspora.I18n.t("aspect_dropdown.started_sharing_with", {name: dropdown.data('person-short-name')});
- Diaspora.page.flashMessages.render({success: true, notice: message});
- }
- }else {
- replacement = Diaspora.I18n.t('aspect_dropdown.toggle', { count: number.toString()})
- }
-
- button.text(replacement + ' ▼');
- },
-
- toggleCheckbox: function(check) {
- if(!check.hasClass('radio')){
- var selectedAspects = check.closest(".dropdown").find("li.radio");
- AspectsDropdown.uncheckGroup(selectedAspects);
- }
-
- check.toggleClass('selected');
- },
-
- toggleRadio: function(check) {
- var selectedAspects = check.closest(".dropdown").find("li");
-
- AspectsDropdown.uncheckGroup(selectedAspects);
- AspectsDropdown.toggleCheckbox(check);
- },
-
- uncheckGroup: function(elements){
- $.each(elements, function(index, value) {
- $(value).removeClass('selected');
- });
- }
-};
-
diff --git a/public/javascripts/contact-edit.js b/public/javascripts/contact-edit.js
deleted file mode 100644
index 0e00c1c08..000000000
--- a/public/javascripts/contact-edit.js
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2010-2011, Diaspora Inc. This file is
-// licensed under the Affero General Public License version 3 or later. See
-// the COPYRIGHT file.
-
-var ContactEdit = {
- init: function(){
- $.extend(ContactEdit, AspectsDropdown);
- $('.dropdown.aspect_membership .dropdown_list > li, .dropdown.inviter .dropdown_list > li').live('click', function(evt){
- ContactEdit.processClick($(this), evt);
- });
- },
-
- updateNumber: function(dropdown, personId, number){
- var button = dropdown.parents(".dropdown").children('.button.toggle'),
- replacement;
-
- if (number == 0) {
- button.removeClass("in_aspects");
- replacement = Diaspora.I18n.t("aspect_dropdown.toggle.zero");
- }else if (number == 1) {
- button.addClass("in_aspects");
- replacement = dropdown.find(".selected").first().text();
- }else if (number < 3) {
- replacement = Diaspora.I18n.t('aspect_dropdown.toggle.few', { count: number.toString()})
- }else if (number > 3) {
- replacement = Diaspora.I18n.t('aspect_dropdown.toggle.many', { count: number.toString()})
- }else {
- //the above one are a tautology, but I want to have them here once for once we figure out a neat way i18n them
- replacement = Diaspora.I18n.t('aspect_dropdown.toggle.other', { count: number.toString()})
- ContactEdit.toggleAspectMembership(li, evt);
- }
- },
-
- inviteFriend: function(li, evt) {
- $.post('/services/inviter/facebook.json', {
- "aspect_id" : li.data("aspect_id"),
- "uid" : li.parent().data("service_uid")
- }, function(data){
- ContactEdit.processSuccess(li, evt, data);
- });
- },
-
- processSuccess: function(element, evt, data) {
- element.removeClass('loading')
- if (data.url != undefined) {
- window.location = data.url;
- } else {
- element.toggleClass("selected");
- Diaspora.widgets.flashes.render({'success':true, 'notice':data.message});
- }
- },
-
- processClick: function(li, evt){
- var dropdown = li.closest('.dropdown');
- li.addClass('loading');
- if (dropdown.hasClass('inviter')) {
- ContactEdit.inviteFriend(li, evt);
- dropdown.html('sending, please wait...');
- }
- else {
- ContactEdit.toggleAspectMembership(li, evt);
- }
- },
-
- toggleAspectMembership: function(li, evt) {
- var button = li.find('.button'),
- dropdown = li.closest('.dropdown'),
- dropdownList = li.parent('.dropdown_list');
-
- if(button.hasClass('disabled') || li.hasClass('newItem')){ return; }
-
- var selected = li.hasClass("selected"),
- routedId = selected ? "/42" : "";
-
- $.post("/aspect_memberships" + routedId + ".json", {
- "aspect_id": li.data("aspect_id"),
- "person_id": li.parent().data("person_id"),
- "_method": (selected) ? "DELETE" : "POST"
- }, function(aspectMembership) {
- ContactEdit.toggleCheckbox(li);
- ContactEdit.updateNumber(li.closest(".dropdown_list"), li.parent().data("person_id"), aspectMembership.aspect_ids.length, 'in_aspects');
-
- Diaspora.page.publish("aspectDropdown/updated", [li.parent().data("person_id"), li.parents(".dropdown").parent(".right").html()]);
- })
- .error(function() {
- var message = Diaspora.I18n.t("aspect_dropdown.error", {name: dropdownList.data('person-short-name')});
- Diaspora.page.flashMessages.render({success: false, notice: message});
- dropdown.removeClass('active');
- })
- .complete(function() {
- li.removeClass("loading");
- });
- }
-};
-
-$(document).ready(function(){
- ContactEdit.init();
-});
diff --git a/public/javascripts/contact-list.js b/public/javascripts/contact-list.js
deleted file mode 100644
index 2a5e0d684..000000000
--- a/public/javascripts/contact-list.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
-* licensed under the Affero General Public License version 3 or later. See
-* the COPYRIGHT file.
-*/
-
-var List = {
- initialize: function() {
- $(".contact_list_search").live("keyup", function(e) {
- var search = $(this);
- var list = $(".contacts", ".searchable");
- var query = new RegExp(search.val(),'i');
-
- $("> .contact", list).each( function(idx, element) {
- element = $(element);
- if( !element.find(".name").text().match(query) ) {
- element.addClass('hidden');
- } else {
- element.removeClass('hidden');
- }
- });
- });
- },
-
- disconnectUser: function(contact_id){
- $.ajax({
- url: "/contacts/" + contact_id,
- type: "DELETE",
- success: function(){
- if( $('.searchable').length == 1){
- $('.searchable .contact[data-contact_id='+contact_id+']').fadeOut(200);
- } else if($('#aspects_list').length == 1) {
- $.facebox.close();
- };
- }
- });
- },
-
- runDelayedSearch: function( searchTerm ) {
- $.getJSON('/people/refresh_search',
- { q: searchTerm },
- List.handleSearchRefresh
- );
- },
-
- handleSearchRefresh: function( data ) {
- var streamEl = $("#people_stream.stream");
- var string = data.search_html || $("<p>", {
- text : Diaspora.I18n.t("people.not_found")
- });
-
- streamEl.html(string);
- },
-
- startSearchDelay: function (theSearch) {
- setTimeout( "List.runDelayedSearch('" + theSearch + "')", 10000);
- }
-
-};
-
-$(document).ready(function() {
- $('.added').bind('ajax:loading', function() {
- var $this = $(this);
-
- $this.addClass('disabled');
- $this.fadeTo(200,0.4);
- });
-
- $('.added').bind('hover',
- function() {
- var $this = $(this)
- $this.addClass("remove");
- $this.children("img").attr("src","/images/icons/monotone_close_exit_delete.png");
- },
-
- function() {
- var $this = $(this)
- $this.removeClass("remove");
- $this.children("img").attr("src","/images/icons/monotone_check_yes.png");
- });
-
- List.initialize();
-});
diff --git a/public/javascripts/diaspora.js b/public/javascripts/diaspora.js
deleted file mode 100644
index e6270bf13..000000000
--- a/public/javascripts/diaspora.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
-* licensed under the Affero General Public License version 3 or later. See
-* the COPYRIGHT file.
-*/
-
-(function() {
- var Diaspora = {
- Pages: {},
- Widgets: {}
- };
-
- Diaspora.EventBroker = {
- extend: function(Klass) {
- var whatToExtend = (typeof Klass === "function") ? Klass.prototype : Klass;
-
- $.extend(whatToExtend, {
- eventsContainer: $({}),
- publish: function(eventName, args) {
- var eventNames = eventName.split(" ");
-
- for(eventName in eventNames) {
- this.eventsContainer.trigger(eventNames[eventName], args);
- }
- },
- subscribe: function(eventName, callback, context) {
- var eventNames = eventName.split(" ");
-
- for(eventName in eventNames) {
- this.eventsContainer.bind(eventNames[eventName], $.proxy(callback, context));
- }
- }
- });
-
- return whatToExtend;
- }
- };
-
- Diaspora.BaseWidget = {
- instantiate: function(Widget, element) {
- $.extend(Diaspora.Widgets[Widget].prototype, Diaspora.EventBroker.extend(Diaspora.BaseWidget));
-
- var widget = new Diaspora.Widgets[Widget](),
- args = Array.prototype.slice.call(arguments, 1);
-
- widget.publish("widget/ready", args);
-
- return widget;
- },
-
- globalSubscribe: function(eventName, callback, context) {
- Diaspora.page.subscribe(eventName, callback, context);
- },
-
- globalPublish: function(eventName, args) {
- Diaspora.page.publish(eventName, args);
- }
- };
-
- Diaspora.BasePage = function(body) {
- $.extend(this, Diaspora.BaseWidget);
- $.extend(this, {
- directionDetector: this.instantiate("DirectionDetector"),
- events: function() { return Diaspora.page.eventsContainer.data("events"); },
- flashMessages: this.instantiate("FlashMessages"),
- header: this.instantiate("Header", body.find("header")),
- hoverCard: this.instantiate("HoverCard", body.find("#hovercard")),
- timeAgo: this.instantiate("TimeAgo")
- });
- };
-
- Diaspora.instantiatePage = function() {
- if (typeof Diaspora.Pages[Diaspora.Page] === "undefined") {
- Diaspora.page = Diaspora.EventBroker.extend(Diaspora.BaseWidget);
- } else {
- var Page = Diaspora.Pages[Diaspora.Page];
- $.extend(Page.prototype, Diaspora.EventBroker.extend(Diaspora.BaseWidget));
-
- Diaspora.page = new Page();
- }
-
- if(!$.mobile)//why does this need this?
- $.extend(Diaspora.page, new Diaspora.BasePage($(document.body)));
- Diaspora.page.publish("page/ready", [$(document.body)])
- };
-
- // temp hack to check if backbone is enabled for the page
- Diaspora.backboneEnabled = function(){
- return window.app && window.app.stream !== undefined;
- }
-
- window.Diaspora = Diaspora;
-})();
-
-
-$(Diaspora.instantiatePage);
diff --git a/public/javascripts/fileuploader-custom.js b/public/javascripts/fileuploader-custom.js
deleted file mode 100644
index 1840b14fa..000000000
--- a/public/javascripts/fileuploader-custom.js
+++ /dev/null
@@ -1,1264 +0,0 @@
-/**
- * http://github.com/valums/file-uploader
- *
- * Multiple file upload component with progress-bar, drag-and-drop.
- * © 2010 Andrew Valums ( andrew(at)valums.com )
- *
- * Licensed under GNU GPL 2 or later, see license.txt.
- * Modified by Diaspora
- */
-
-//
-// Helper functions
-//
-
-var qq = qq || {};
-
-/**
- * Adds all missing properties from second obj to first obj
- */
-qq.extend = function(first, second){
- for (var prop in second){
- first[prop] = second[prop];
- }
-};
-
-/**
- * Searches for a given element in the array, returns -1 if it is not present.
- * @param {Number} [from] The index at which to begin the search
- */
-qq.indexOf = function(arr, elt, from){
- if (arr.indexOf) { return arr.indexOf(elt, from); }
-
- from = from || 0;
- var len = arr.length;
-
- if (from < 0) { from += len; }
-
- for (; from < len; from++){
- if (from in arr && arr[from] === elt){
- return from;
- }
- }
- return -1;
-};
-
-qq.getUniqueId = (function(){
- var id = 0;
- return function(){ return id++; };
-})();
-
-//
-// Events
-
-qq.attach = function(element, type, fn){
- if (element.addEventListener){
- element.addEventListener(type, fn, false);
- } else if (element.attachEvent){
- element.attachEvent('on' + type, fn);
- }
-};
-qq.detach = function(element, type, fn){
- if (element.removeEventListener){
- element.removeEventListener(type, fn, false);
- } else if (element.attachEvent){
- element.detachEvent('on' + type, fn);
- }
-};
-
-qq.preventDefault = function(e){
- if (e.preventDefault){
- e.preventDefault();
- } else{
- e.returnValue = false;
- }
-};
-
-//
-// Node manipulations
-
-/**
- * Insert node a before node b.
- */
-qq.insertBefore = function(a, b){
- b.parentNode.insertBefore(a, b);
-};
-qq.remove = function(element){
- element.parentNode.removeChild(element);
-};
-
-qq.contains = function(parent, descendant){
- // compareposition returns false in this case
- if (parent == descendant) { return true; }
-
- if (parent.contains){
- return parent.contains(descendant);
- } else {
- return !!(descendant.compareDocumentPosition(parent) & 8);
- }
-};
-
-/**
- * Creates and returns element from html string
- * Uses innerHTML to create an element
- */
-qq.toElement = (function(){
- var div = document.createElement('div');
- return function(html){
- div.innerHTML = html;
- var element = div.firstChild;
- div.removeChild(element);
- return element;
- };
-})();
-
-//
-// Node properties and attributes
-
-/**
- * Sets styles for an element.
- * Fixes opacity in IE6-8.
- */
-qq.css = function(element, styles){
- if (styles.opacity !== null){
- if (typeof element.style.opacity != 'string' && typeof(element.filters) != 'undefined'){
- styles.filter = 'alpha(opacity=' + Math.round(100 * styles.opacity) + ')';
- }
- }
- qq.extend(element.style, styles);
-};
-qq.hasClass = function(element, name){
- var re = new RegExp('(^| )' + name + '( |$)');
- return re.test(element.className);
-};
-qq.addClass = function(element, name){
- if (!qq.hasClass(element, name)){
- element.className += ' ' + name;
- }
-};
-qq.removeClass = function(element, name){
- var re = new RegExp('(^| )' + name + '( |$)');
- element.className = element.className.replace(re, ' ').replace(/^\s+|\s+$/g, "");
-};
-qq.setText = function(element, text){
- element.innerText = text;
- element.textContent = text;
-};
-
-//
-// Selecting elements
-
-qq.children = function(element){
- var children = [],
- child = element.firstChild;
-
- while (child){
- if (child.nodeType == 1){
- children.push(child);
- }
- child = child.nextSibling;
- }
-
- return children;
-};
-
-qq.getByClass = function(element, className){
- if (element.querySelectorAll){
- return element.querySelectorAll('.' + className);
- }
-
- var result = [];
- var candidates = element.getElementsByTagName("*");
- var len = candidates.length;
-
- for (var i = 0; i < len; i++){
- if (qq.hasClass(candidates[i], className)){
- result.push(candidates[i]);
- }
- }
- return result;
-};
-
-/**
- * obj2url() takes a json-object as argument and generates
- * a querystring. pretty much like jQuery.param()
- *
- * how to use:
- *
- * `qq.obj2url({a:'b',c:'d'},'http://any.url/upload?otherParam=value');`
- *
- * will result in:
- *
- * `http://any.url/upload?otherParam=value&a=b&c=d`
- *
- * @param Object JSON-Object
- * @param String current querystring-part
- * @return String encoded querystring
- */
-qq.obj2url = function(obj, temp, prefixDone){
- var uristrings = [],
- prefix = '&',
- add = function(nextObj, i){
- var nextTemp = temp
- ? (/\[\]$/.test(temp)) // prevent double-encoding
- ? temp
- : temp+'['+i+']'
- : i;
- if ((nextTemp != 'undefined') && (i != 'undefined')) {
- uristrings.push(
- (typeof nextObj === 'object')
- ? qq.obj2url(nextObj, nextTemp, true)
- : (Object.prototype.toString.call(nextObj) === '[object Function]')
- ? encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj())
- : encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)
- );
- }
- };
-
- if (!prefixDone && temp) {
- prefix = (/\?/.test(temp)) ? (/\?$/.test(temp)) ? '' : '&' : '?';
- uristrings.push(temp);
- uristrings.push(qq.obj2url(obj));
- } else if ((Object.prototype.toString.call(obj) === '[object Array]') && (typeof obj != 'undefined') ) {
- // we wont use a for-in-loop on an array (performance)
- for (var i = 0, len = obj.length; i < len; ++i){
- add(obj[i], i);
- }
- } else if ((typeof obj != 'undefined') && (obj !== null) && (typeof obj === "object")){
- // for anything else but a scalar, we will use for-in-loop
- for (var i in obj){
- add(obj[i], i);
- }
- } else {
- uristrings.push(encodeURIComponent(temp) + '=' + encodeURIComponent(obj));
- }
-
- return uristrings.join(prefix)
- .replace(/^&/, '')
- .replace(/%20/g, '+');
-};
-
-//
-//
-// Uploader Classes
-//
-//
-
-var qq = qq || {};
-
-/**
- * Creates upload button, validates upload, but doesn't create file list or dd.
- */
-qq.FileUploaderBasic = function(o){
- this._options = {
- // set to true to see the server response
- debug: false,
- action: '/server/upload',
- params: {},
- button: null,
- multiple: true,
- maxConnections: 3,
- // validation
- allowedExtensions: [],
- sizeLimit: 0,
- minSizeLimit: 0,
- // events
- // return false to cancel submit
- onSubmit: function(id, fileName){},
- onProgress: function(id, fileName, loaded, total){},
- onComplete: function(id, fileName, responseJSON){},
- onAllComplete: function(completed_files){},
- onCancel: function(id, fileName){},
- // messages
- messages: {
- typeError: "{file} has invalid extension. Only {extensions} are allowed.",
- sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
- minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
- emptyError: "{file} is empty, please select files again without it.",
- onLeave: "The files are being uploaded, if you leave now the upload will be cancelled."
- },
- showMessage: function(message){
- alert(message);
- }
- };
- qq.extend(this._options, o);
-
- // number of files being uploaded
- this._filesInProgress = 0;
- this._handler = this._createUploadHandler();
-
- if (this._options.button){
- this._button = this._createUploadButton(this._options.button);
- }
-
- this._preventLeaveInProgress();
-};
-
-qq.FileUploaderBasic.prototype = {
- setParams: function(params){
- this._options.params = params;
- },
- getInProgress: function(){
- return this._filesInProgress;
- },
- _createUploadButton: function(element){
- var self = this;
-
- return new qq.UploadButton({
- element: element,
- multiple: this._options.multiple && qq.UploadHandlerXhr.isSupported(),
- onChange: function(input){
- self._onInputChange(input);
- }
- });
- },
- _createUploadHandler: function(){
- var self = this,
- handlerClass;
-
- if(qq.UploadHandlerXhr.isSupported()){
- handlerClass = 'UploadHandlerXhr';
- } else {
- handlerClass = 'UploadHandlerForm';
- }
-
- var handler = new qq[handlerClass]({
- debug: this._options.debug,
- action: this._options.action,
- maxConnections: this._options.maxConnections,
- onProgress: function(id, fileName, loaded, total){
- self._onProgress(id, fileName, loaded, total);
- self._options.onProgress(id, fileName, loaded, total);
- },
- onComplete: function(id, fileName, result){
- self._onComplete(id, fileName, result);
- self._options.onComplete(id, fileName, result);
- },
- onAllComplete: function(completed_files){
- self._options.onAllComplete(completed_files);
- },
- onCancel: function(id, fileName){
- self._onCancel(id, fileName);
- self._options.onCancel(id, fileName);
- }
- });
-
- return handler;
- },
- _preventLeaveInProgress: function(){
- var self = this;
-
- qq.attach(window, 'beforeunload', function(e){
- if (!self._filesInProgress){return;}
-
- var e = e || window.event;
- // for ie, ff
- e.returnValue = self._options.messages.onLeave;
- // for webkit
- return self._options.messages.onLeave;
- });
- },
- _onSubmit: function(id, fileName){
- this._filesInProgress++;
- },
- _onProgress: function(id, fileName, loaded, total){
- },
- _onComplete: function(id, fileName, result){
- this._filesInProgress--;
- if (result.error){
- this._options.showMessage(result.error);
- }
- },
- _onCancel: function(id, fileName){
- this._filesInProgress--;
- },
- _onInputChange: function(input){
- if (this._handler instanceof qq.UploadHandlerXhr){
- this._uploadFileList(input.files);
- } else {
- if (this._validateFile(input)){
- this._uploadFile(input);
- }
- }
- this._button.reset();
- },
- _uploadFileList: function(files){
- for (var i=0; i<files.length; i++){
- if ( !this._validateFile(files[i])){
- return;
- }
- }
-
- for (var i=0; i<files.length; i++){
- this._uploadFile(files[i]);
- }
- },
- _uploadFile: function(fileContainer){
- var id = this._handler.add(fileContainer);
- var fileName = this._handler.getName(id);
-
- if (this._options.onSubmit(id, fileName) !== false){
- this._onSubmit(id, fileName);
- this._handler.upload(id, this._options.params);
- }
- },
- _validateFile: function(file){
- var name, size;
-
- if (file.value){
- // it is a file input
- // get input value and remove path to normalize
- name = file.value.replace(/.*(\/|\\)/, "");
- } else {
- // fix missing properties in Safari
- name = file.fileName != null ? file.fileName : file.name;
- size = file.fileSize != null ? file.fileSize : file.size;
- }
-
- if (! this._isAllowedExtension(name)){
- this._error('typeError', name);
- return false;
-
- } else if (size === 0){
- this._error('emptyError', name);
- return false;
-
- } else if (size && this._options.sizeLimit && size > this._options.sizeLimit){
- this._error('sizeError', name);
- return false;
-
- } else if (size && size < this._options.minSizeLimit){
- this._error('minSizeError', name);
- return false;
- }
-
- return true;
- },
- _error: function(code, fileName){
- var message = this._options.messages[code];
- function r(name, replacement){ message = message.replace(name, replacement); }
-
- r('{file}', this._formatFileName(fileName));
- r('{extensions}', this._options.allowedExtensions.join(', '));
- r('{sizeLimit}', this._formatSize(this._options.sizeLimit));
- r('{minSizeLimit}', this._formatSize(this._options.minSizeLimit));
-
- this._options.showMessage(message);
- },
- _formatFileName: function(name){
- if (name.length > 33){
- name = name.slice(0, 19) + '...' + name.slice(-13);
- }
- return name;
- },
- _isAllowedExtension: function(fileName){
- var ext = (-1 !== fileName.indexOf('.')) ? fileName.replace(/.*[.]/, '').toLowerCase() : '';
- var allowed = this._options.allowedExtensions;
-
- if (!allowed.length){return true;}
-
- for (var i=0; i<allowed.length; i++){
- if (allowed[i].toLowerCase() == ext){ return true;}
- }
-
- return false;
- },
- _formatSize: function(bytes){
- var i = -1;
- do {
- bytes = bytes / 1024;
- i++;
- } while (bytes > 99);
-
- return Math.max(bytes, 0.1).toFixed(1) + ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'][i];
- }
-};
-
-
-/**
- * Class that creates upload widget with drag-and-drop and file list
- * @inherits qq.FileUploaderBasic
- */
-qq.FileUploader = function(o){
- // call parent constructor
- qq.FileUploaderBasic.apply(this, arguments);
-
- // additional options
- qq.extend(this._options, {
- element: null,
- // if set, will be used instead of qq-upload-list in template
- listElement: null,
-
- template: '<div class="qq-uploader">' +
- '<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
- '<div class="qq-upload-button">Upload a file</div>' +
- '<ul class="qq-upload-list"></ul>' +
- '</div>',
-
- // template for one item in file list
- fileTemplate: '<li>' +
- '<span class="qq-upload-file"></span>' +
- '<span class="qq-upload-spinner"></span>' +
- '<span class="qq-upload-size"></span>' +
- '<a class="qq-upload-cancel" href="#">Cancel</a>' +
- '<span class="qq-upload-failed-text">Failed</span>' +
- '</li>',
-
- classes: {
- // used to get elements from templates
- button: 'qq-upload-button',
- drop: 'qq-upload-drop-area',
- dropActive: 'qq-upload-drop-area-active',
- list: 'qq-upload-list',
-
- file: 'qq-upload-file',
- spinner: 'qq-upload-spinner',
- size: 'qq-upload-size',
- cancel: 'qq-upload-cancel',
-
- // added to list item when upload completes
- // used in css to hide progress spinner
- success: 'qq-upload-success',
- fail: 'qq-upload-fail'
- }
- });
- // overwrite options with user supplied
- qq.extend(this._options, o);
-
- this._element = this._options.element;
- this._element.innerHTML = this._options.template;
- this._listElement = this._options.listElement || this._find(this._element, 'list');
-
- this._classes = this._options.classes;
-
- this._button = this._createUploadButton(this._find(this._element, 'button'));
-
- this._bindCancelEvent();
- this._setupDragDrop();
-};
-
-// inherit from Basic Uploader
-qq.extend(qq.FileUploader.prototype, qq.FileUploaderBasic.prototype);
-
-qq.extend(qq.FileUploader.prototype, {
- /**
- * Gets one of the elements listed in this._options.classes
- **/
- _find: function(parent, type){
- var element = qq.getByClass(parent, this._options.classes[type])[0];
- if (!element){
- throw new Error('element not found ' + type);
- }
-
- return element;
- },
- _setupDragDrop: function(){
- var self = this,
- dropArea = this._find(this._element, 'drop');
-
- var dz = new qq.UploadDropZone({
- element: dropArea,
- onEnter: function(e){
- qq.addClass(dropArea, self._classes.dropActive);
- e.stopPropagation();
- },
- onLeave: function(e){
- e.stopPropagation();
- },
- onLeaveNotDescendants: function(e){
- qq.removeClass(dropArea, self._classes.dropActive);
- },
- onDrop: function(e){
- dropArea.style.display = 'none';
- qq.removeClass(dropArea, self._classes.dropActive);
- self._uploadFileList(e.dataTransfer.files);
- }
- });
-
- dropArea.style.display = 'none';
-
- qq.attach(document, 'dragenter', function(e){
- if (!dz._isValidFileDrag(e)) return;
-
- dropArea.style.display = 'block';
- });
- qq.attach(document, 'dragleave', function(e){
- if (!dz._isValidFileDrag(e)) return;
-
- var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
- // only fire when leaving document out
- if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){
- dropArea.style.display = 'none';
- }
- });
- },
- _onSubmit: function(id, fileName){
- qq.FileUploaderBasic.prototype._onSubmit.apply(this, arguments);
- this._addToList(id, fileName);
- },
- _onProgress: function(id, fileName, loaded, total){
- qq.FileUploaderBasic.prototype._onProgress.apply(this, arguments);
-
- var item = this._getItemByFileId(id);
- var size = this._find(item, 'size');
- size.style.display = 'inline';
-
- var text;
- if (loaded != total){
- text = Math.round(loaded / total * 100) + '% from ' + this._formatSize(total);
- } else {
- text = this._formatSize(total);
- }
-
- qq.setText(size, text);
- },
- _onComplete: function(id, fileName, result){
- qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);
-
- // mark completed
- var item = this._getItemByFileId(id);
- qq.remove(this._find(item, 'cancel'));
- qq.remove(this._find(item, 'spinner'));
-
- if (result.success){
- qq.addClass(item, this._classes.success);
- } else {
- qq.addClass(item, this._classes.fail);
- }
- },
- _addToList: function(id, fileName){
- var item = qq.toElement(this._options.fileTemplate);
- item.qqFileId = id;
-
- var fileElement = this._find(item, 'file');
- qq.setText(fileElement, this._formatFileName(fileName));
- this._find(item, 'size').style.display = 'none';
-
- this._listElement.appendChild(item);
- },
- _getItemByFileId: function(id){
- var item = this._listElement.firstChild;
-
- // there can't be txt nodes in dynamically created list
- // and we can use nextSibling
- while (item){
- if (item.qqFileId == id) return item;
- item = item.nextSibling;
- }
- },
- /**
- * delegate click event for cancel link
- **/
- _bindCancelEvent: function(){
- var self = this,
- list = this._listElement;
-
- qq.attach(list, 'click', function(e){
- e = e || window.event;
- var target = e.target || e.srcElement;
-
- if (qq.hasClass(target, self._classes.cancel)){
- qq.preventDefault(e);
-
- var item = target.parentNode;
- self._handler.cancel(item.qqFileId);
- qq.remove(item);
- }
- });
- }
-});
-
-qq.UploadDropZone = function(o){
- this._options = {
- element: null,
- onEnter: function(e){},
- onLeave: function(e){},
- // is not fired when leaving element by hovering descendants
- onLeaveNotDescendants: function(e){},
- onDrop: function(e){}
- };
- qq.extend(this._options, o);
-
- this._element = this._options.element;
-
- this._disableDropOutside();
- this._attachEvents();
-};
-
-qq.UploadDropZone.prototype = {
- _disableDropOutside: function(e){
- // run only once for all instances
- if (!qq.UploadDropZone.dropOutsideDisabled ){
-
- qq.attach(document, 'dragover', function(e){
- if (e.dataTransfer){
- e.dataTransfer.dropEffect = 'none';
- e.preventDefault();
- }
- });
-
- qq.UploadDropZone.dropOutsideDisabled = true;
- }
- },
- _attachEvents: function(){
- var self = this;
-
- qq.attach(self._element, 'dragover', function(e){
- if (!self._isValidFileDrag(e)) return;
-
- var effect = e.dataTransfer.effectAllowed;
- if (effect == 'move' || effect == 'linkMove'){
- e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed)
- } else {
- e.dataTransfer.dropEffect = 'copy'; // for Chrome
- }
-
- e.stopPropagation();
- e.preventDefault();
- });
-
- qq.attach(self._element, 'dragenter', function(e){
- if (!self._isValidFileDrag(e)) return;
-
- self._options.onEnter(e);
- });
-
- qq.attach(self._element, 'dragleave', function(e){
- if (!self._isValidFileDrag(e)) return;
-
- self._options.onLeave(e);
-
- var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
- // do not fire when moving a mouse over a descendant
- if (qq.contains(this, relatedTarget)) return;
-
- self._options.onLeaveNotDescendants(e);
- });
-
- qq.attach(self._element, 'drop', function(e){
- if (!self._isValidFileDrag(e)) return;
-
- e.preventDefault();
- self._options.onDrop(e);
- });
- },
- _isValidFileDrag: function(e){
- var dt = e.dataTransfer,
- // do not check dt.types.contains in webkit, because it crashes safari 4
- isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1;
-
- // dt.effectAllowed is none in Safari 5
- // dt.types.contains check is for firefox
- return dt && dt.effectAllowed != 'none' &&
- (dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files')));
-
- }
-};
-
-qq.UploadButton = function(o){
- this._options = {
- element: null,
- // if set to true adds multiple attribute to file input
- multiple: false,
- // name attribute of file input
- name: 'file',
- onChange: function(input){},
- hoverClass: 'qq-upload-button-hover',
- focusClass: 'qq-upload-button-focus'
- };
-
- qq.extend(this._options, o);
-
- this._element = this._options.element;
-
- // make button suitable container for input
- qq.css(this._element, {
- position: 'relative',
- overflow: 'hidden',
- // Make sure browse button is in the right side
- // in Internet Explorer
- direction: 'ltr'
- });
-
- this._input = this._createInput();
-};
-
-qq.UploadButton.prototype = {
- /* returns file input element */
- getInput: function(){
- return this._input;
- },
- /* cleans/recreates the file input */
- reset: function(){
- if (this._input.parentNode){
- qq.remove(this._input);
- }
-
- qq.removeClass(this._element, this._options.focusClass);
- this._input = this._createInput();
- },
- _createInput: function(){
- var input = document.createElement("input");
-
- if (this._options.multiple){
- input.setAttribute("multiple", "multiple");
- }
-
- input.setAttribute("type", "file");
- input.setAttribute("name", this._options.name);
-
- qq.css(input, {
- position: 'absolute',
- // in Opera only 'browse' button
- // is clickable and it is located at
- // the right side of the input
- right: 0,
- top: 0,
- //fontFamily: 'Arial',
- // 4 persons reported this, the max values that worked for them were 243, 236, 236, 118
- //fontSize: '118px',
- margin: 0,
- padding: 0,
- opacity: 0
- });
-
- this._element.appendChild(input);
-
- var self = this;
- qq.attach(input, 'change', function(){
- self._options.onChange(input);
- });
-
- qq.attach(input, 'mouseover', function(){
- qq.addClass(self._element, self._options.hoverClass);
- });
- qq.attach(input, 'mouseout', function(){
- qq.removeClass(self._element, self._options.hoverClass);
- });
- qq.attach(input, 'focus', function(){
- qq.addClass(self._element, self._options.focusClass);
- });
- qq.attach(input, 'blur', function(){
- qq.removeClass(self._element, self._options.focusClass);
- });
-
- // IE and Opera, unfortunately have 2 tab stops on file input
- // which is unacceptable in our case, disable keyboard access
- if (window.attachEvent){
- // it is IE or Opera
- input.setAttribute('tabIndex', "-1");
- }
-
- return input;
- }
-};
-
-/**
- * Class for uploading files, uploading itself is handled by child classes
- */
-qq.UploadHandlerAbstract = function(o){
- this._options = {
- debug: false,
- action: '/upload.php',
- // maximum number of concurrent uploads
- maxConnections: 999,
- onProgress: function(id, fileName, loaded, total){},
- onComplete: function(id, fileName, response){},
- onAllComplete: function(completed_files){},
- onCancel: function(id, fileName){}
- };
- qq.extend(this._options, o);
-
- this._queue = [];
- // params for files in queue
- this._params = [];
- this._completed_files = [];
-};
-qq.UploadHandlerAbstract.prototype = {
- log: function(str){
- if (this._options.debug && window.console) console.log('[uploader] ' + str);
- },
- /**
- * Adds file or file input to the queue
- * @returns id
- **/
- add: function(file){},
- /**
- * Sends the file identified by id and additional query params to the server
- */
- upload: function(id, params){
- var len = this._queue.push(id);
-
- var copy = {};
- qq.extend(copy, params);
- this._params[id] = copy;
-
- // if too many active uploads, wait...
- if (len <= this._options.maxConnections){
- this._upload(id, this._params[id]);
- }
- },
- /**
- * Cancels file upload by id
- */
- cancel: function(id){
- this._cancel(id);
- this._dequeue(id);
- },
- /**
- * Cancells all uploads
- */
- cancelAll: function(){
- for (var i=0; i<this._queue.length; i++){
- this._cancel(this._queue[i]);
- }
- this._queue = [];
- },
- /**
- * Returns name of the file identified by id
- */
- getName: function(id){},
- /**
- * Returns size of the file identified by id
- */
- getSize: function(id){},
- /**
- * Returns id of files being uploaded or
- * waiting for their turn
- */
- getQueue: function(){
- return this._queue;
- },
- /**
- * Actual upload method
- */
- _upload: function(id){},
- /**
- * Actual cancel method
- */
- _cancel: function(id){},
- /**
- * Removes element from queue, starts upload of next
- */
- _dequeue: function(id){
- var i = qq.indexOf(this._queue, id);
- this._queue.splice(i, 1);
-
- var max = this._options.maxConnections;
-
- if (this._queue.length >= max){
- var nextId = this._queue[max-1];
- this._upload(nextId, this._params[nextId]);
- }
-
- if (this._queue.length == 0){
- this._onAllComplete();
- }
- },
- _onAllComplete: function(){
- this._options.onAllComplete(this._completed_files);
- }
-};
-
-/**
- * Class for uploading files using form and iframe
- * @inherits qq.UploadHandlerAbstract
- */
-qq.UploadHandlerForm = function(o){
- qq.UploadHandlerAbstract.apply(this, arguments);
-
- this._inputs = {};
-};
-// @inherits qq.UploadHandlerAbstract
-qq.extend(qq.UploadHandlerForm.prototype, qq.UploadHandlerAbstract.prototype);
-
-qq.extend(qq.UploadHandlerForm.prototype, {
- add: function(fileInput){
- fileInput.setAttribute('name', 'qqfile');
- var id = 'qq-upload-handler-iframe' + qq.getUniqueId();
-
- this._inputs[id] = fileInput;
-
- // remove file input from DOM
- if (fileInput.parentNode){
- qq.remove(fileInput);
- }
-
- return id;
- },
- getName: function(id){
- // get input value and remove path to normalize
- return this._inputs[id].value.replace(/.*(\/|\\)/, "");
- },
- _cancel: function(id){
- this._options.onCancel(id, this.getName(id));
-
- delete this._inputs[id];
-
- var iframe = document.getElementById(id);
- if (iframe){
- // to cancel request set src to something else
- // we use src="javascript:false;" because it doesn't
- // trigger ie6 prompt on https
- iframe.setAttribute('src', 'javascript:false;');
-
- qq.remove(iframe);
- }
- },
- _upload: function(id, params){
- var input = this._inputs[id];
-
- if (!input){
- throw new Error('file with passed id was not added, or already uploaded or cancelled');
- }
-
- var fileName = this.getName(id);
-
- var iframe = this._createIframe(id);
- var form = this._createForm(iframe, params);
- form.appendChild(input);
- $(form).append($('<input type="hidden" name="authenticity_token" value="'+$("meta[name='csrf-token']").attr("content")+'"/>'));
-
- var self = this;
- this._attachLoadEvent(iframe, function(){
- self.log('iframe loaded');
-
- var response = self._getIframeContentJSON(iframe);
-
- self._options.onComplete(id, fileName, response);
- self._dequeue(id);
-
- delete self._inputs[id];
- // timeout added to fix busy state in FF3.6
- setTimeout(function(){
- qq.remove(iframe);
- }, 1);
- });
-
- form.submit();
- qq.remove(form);
-
- return id;
- },
- _attachLoadEvent: function(iframe, callback){
- qq.attach(iframe, 'load', function(){
- // when we remove iframe from dom
- // the request stops, but in IE load
- // event fires
- if (!iframe.parentNode){
- return;
- }
-
- // fixing Opera 10.53
- if (iframe.contentDocument &&
- iframe.contentDocument.body &&
- iframe.contentDocument.body.innerHTML == "false"){
- // In Opera event is fired second time
- // when body.innerHTML changed from false
- // to server response approx. after 1 sec
- // when we upload file with iframe
- return;
- }
-
- callback();
- });
- },
- /**
- * Returns json object received by iframe from server.
- */
- _getIframeContentJSON: function(iframe){
- // iframe.contentWindow.document - for IE<7
- var doc = iframe.contentDocument ? iframe.contentDocument: iframe.contentWindow.document,
- response;
-
- this.log("converting iframe's innerHTML to JSON");
- this.log("innerHTML = " + doc.body.innerHTML);
-
- try {
- response = eval("(" + doc.body.innerHTML + ")");
- } catch(err){
- response = {};
- }
-
- return response;
- },
- /**
- * Creates iframe with unique name
- */
- _createIframe: function(id){
- // We can't use following code as the name attribute
- // won't be properly registered in IE6, and new window
- // on form submit will open
- // var iframe = document.createElement('iframe');
- // iframe.setAttribute('name', id);
-
- var iframe = qq.toElement('<iframe src="javascript:false;" name="' + id + '" />');
- // src="javascript:false;" removes ie6 prompt on https
-
- iframe.setAttribute('id', id);
-
- iframe.style.display = 'none';
- document.body.appendChild(iframe);
-
- return iframe;
- },
- /**
- * Creates form, that will be submitted to iframe
- */
- _createForm: function(iframe, params){
- // We can't use the following code in IE6
- // var form = document.createElement('form');
- // form.setAttribute('method', 'post');
- // form.setAttribute('enctype', 'multipart/form-data');
- // Because in this case file won't be attached to request
- var form = qq.toElement('<form method="post" enctype="multipart/form-data"></form>');
-
- var queryString = qq.obj2url(params, this._options.action);
-
- form.setAttribute('action', queryString);
- form.setAttribute('target', iframe.name);
- form.style.display = 'none';
- document.body.appendChild(form);
-
- return form;
- }
-});
-
-/**
- * Class for uploading files using xhr
- * @inherits qq.UploadHandlerAbstract
- */
-qq.UploadHandlerXhr = function(o){
- qq.UploadHandlerAbstract.apply(this, arguments);
-
- this._files = [];
- this._xhrs = [];
-
- // current loaded size in bytes for each file
- this._loaded = [];
-};
-
-// static method
-qq.UploadHandlerXhr.isSupported = function(){
- var input = document.createElement('input');
- input.type = 'file';
-
- return (
- 'multiple' in input &&
- typeof File != "undefined" &&
- typeof (new XMLHttpRequest()).upload != "undefined" );
-};
-
-// @inherits qq.UploadHandlerAbstract
-qq.extend(qq.UploadHandlerXhr.prototype, qq.UploadHandlerAbstract.prototype)
-
-qq.extend(qq.UploadHandlerXhr.prototype, {
- /**
- * Adds file to the queue
- * Returns id to use with upload, cancel
- **/
- add: function(file){
- if (!(file instanceof File)){
- throw new Error('Passed obj in not a File (in qq.UploadHandlerXhr)');
- }
-
- return this._files.push(file) - 1;
- },
- getName: function(id){
- var file = this._files[id];
- // fix missing name in Safari 4
- return file.fileName != null ? file.fileName : file.name;
- },
- getSize: function(id){
- var file = this._files[id];
- return file.fileSize != null ? file.fileSize : file.size;
- },
- /**
- * Returns uploaded bytes for file identified by id
- */
- getLoaded: function(id){
- return this._loaded[id] || 0;
- },
- /**
- * Sends the file identified by id and additional query params to the server
- * @param {Object} params name-value string pairs
- */
- _upload: function(id, params){
- var file = this._files[id],
- name = this.getName(id),
- size = this.getSize(id);
-
- this._loaded[id] = 0;
-
- var xhr = this._xhrs[id] = new XMLHttpRequest();
- var self = this;
-
- xhr.upload.onprogress = function(e){
- if (e.lengthComputable){
- self._loaded[id] = e.loaded;
- self._options.onProgress(id, name, e.loaded, e.total);
- }
- };
-
- xhr.onreadystatechange = function(){
- if (xhr.readyState == 4){
- self._onComplete(id, xhr);
- }
- };
-
- // build query string
- params = params || {};
- params['qqfile'] = name;
- var queryString = qq.obj2url(params, this._options.action);
-
- xhr.open("POST", queryString, true);
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
- xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
- xhr.setRequestHeader("Content-Type", "application/octet-stream");
- xhr.setRequestHeader("X-CSRF-Token", $("meta[name='csrf-token']").attr("content"));
- xhr.send(file);
- },
- _onComplete: function(id, xhr){
- // the request was aborted/cancelled
- if (!this._files[id]) return;
-
- var name = this.getName(id);
- var size = this.getSize(id);
-
- this._options.onProgress(id, name, size, size);
-
- if (xhr.status == 200){
- this.log("xhr - server response received");
- this.log("responseText = " + xhr.responseText);
-
- var response;
-
- try {
- response = eval("(" + xhr.responseText + ")");
- } catch(err){
- response = {};
- }
-
- this._completed_files.push({file: this._files[id], response: response});
- this._options.onComplete(id, name, response);
-
- } else {
- this._completed_files.push({file: this._files[id], response: {}});
- this._options.onComplete(id, name, {});
- }
-
- this._files[id] = null;
- this._xhrs[id] = null;
- this._dequeue(id);
- },
- _cancel: function(id){
- this._options.onCancel(id, this.getName(id));
-
- this._files[id] = null;
-
- if (this._xhrs[id]){
- this._xhrs[id].abort();
- this._xhrs[id] = null;
- }
- }
-});
diff --git a/public/javascripts/friend-finder.js b/public/javascripts/friend-finder.js
deleted file mode 100644
index b628e8faf..000000000
--- a/public/javascripts/friend-finder.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-var FriendFinder = {
-
- initialize: function() {
- $('.contact_list .button').click(function(){
- $this = $(this);
- var uid = $this.parents('li').attr("uid");
- $this.parents('ul').children("#options_"+uid).slideToggle(function(){
- if($this.text() == 'Done'){
- $this.text($this.attr('old-text'));
- } else {
- $this.attr('old-text', $this.text());
- $this.text('Done');
- }
- $(this).toggleClass('hidden');
- });
- });
- }
-};
-
-$(document).ready(FriendFinder.initialize);
diff --git a/public/javascripts/helpers/alert.js b/public/javascripts/helpers/alert.js
deleted file mode 100644
index 08dd06dea..000000000
--- a/public/javascripts/helpers/alert.js
+++ /dev/null
@@ -1,30 +0,0 @@
-Diaspora.Alert = {
- faceboxTemplate:
- '<div id="diaspora_alert">' +
- '<div class="span-12 last">' +
- '<div id="facebox_header">' +
- '<h4>' +
- '<%= title %>' +
- '</h4>' +
- '</div>' +
- '<%= content %>' +
- '</div>' +
- '</div>',
-
- show: function(title, content) {
- $(_.template(this.faceboxTemplate, {
- title: title,
- content: content
- })).appendTo(document.body);
-
- $.facebox({
- div: "#diaspora_alert"
- }, "diaspora_alert");
- }
-};
-
-$(function() {
- $(document).bind("close.facebox", function() {
- $("#diaspora_alert").remove();
- });
-});
diff --git a/public/javascripts/helpers/i18n.js b/public/javascripts/helpers/i18n.js
deleted file mode 100644
index 8a16e2ecf..000000000
--- a/public/javascripts/helpers/i18n.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
- Diaspora.I18n = {
- language: "en",
- locale: {},
-
- loadLocale: function(locale, language) {
- this.locale = locale;
- this.language = language;
- rule = this.t('pluralization_rule');
- if (rule === "")
- rule = 'function (n) { return n == 1 ? "one" : "other" }';
- eval("this.pluralizationKey = "+rule);
- },
-
- t: function(item, views) {
- var items = item.split("."),
- translatedMessage,
- nextNamespace;
-
- while(nextNamespace = items.shift()) {
- translatedMessage = (translatedMessage)
- ? translatedMessage[nextNamespace]
- : this.locale[nextNamespace];
-
- if(typeof translatedMessage === "undefined") {
- return "";
- }
- }
-
- if(views && typeof views.count !== "undefined") {
- translatedMessage = translatedMessage[this.pluralizationKey(views.count)];
- }
-
- return _.template(translatedMessage, views || {});
- }
- };
diff --git a/public/javascripts/ie.js b/public/javascripts/ie.js
deleted file mode 100644
index 3cdb19683..000000000
--- a/public/javascripts/ie.js
+++ /dev/null
@@ -1,3 +0,0 @@
-document.createElement('header');
-document.createElement('footer');
-
diff --git a/public/javascripts/inbox.js b/public/javascripts/inbox.js
deleted file mode 100644
index 1e4515aa1..000000000
--- a/public/javascripts/inbox.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-$(document).ready(function(){
-
- $('a.conversation').live('click', function(){
- $.getScript(this.href, function() {
- Diaspora.page.directionDetector.updateBinds();
- });
- history.pushState(null, "", this.href);
-
- var conv = $(this).children('.stream_element'),
- cBadge = $("#message_inbox_badge").children(".badge_count");
- if(conv.hasClass('unread') ){
- conv.removeClass('unread');
- }
- if(cBadge.html() !== null) {
- cBadge.html().replace(/\d+/, function(num){
- num = parseInt(num);
- cBadge.html(parseInt(num)-1);
- if(num == 1) {
- cBadge.addClass("hidden");
- }
- });
- }
-
- jQuery("abbr.timeago").timeago();
- return false;
- });
-
- $(window).bind("popstate", function(){
- if (location.href.match(/conversations\/\d+/) !== null) {
- $.getScript(location.href, function() {
- Diaspora.page.directionDetector.updateBinds();
- });
- return false;
- }
- });
-
- resize();
- $(window).resize(function(){
- resize();
- });
-
- $('#conversation_inbox .stream').infinitescroll({
- navSelector : ".pagination",
- // selector for the paged navigation (it will be hidden)
- nextSelector : ".pagination a.next_page",
- // selector for the NEXT link (to page 2)
- itemSelector : "#conversation_inbox .conversation",
- // selector for all items you'll retrieve
- localMode: true,
- debug: false,
- donetext: "no more.",
- loadingText: "",
- loadingImg: '/images/ajax-loader.gif'
- }, function(){
- $('.conversation', '.stream').bind('mousedown', function(){
- bindIt($(this));
- });
- });
-
- // kill scroll binding
- $(window).unbind('.infscr');
-
- // hook up the manual click guy.
- $('a.next_page').click(function(){
- $(document).trigger('retrieve.infscr');
- return false;
- });
-
- // remove the paginator when we're done.
- $(document).ajaxError(function(e,xhr,opt){
- if (xhr.status == 404) { $('a.next_page').remove(); }
- });
-
- $('#reply_to_conversation').live('click', function(evt) {
- evt.preventDefault();
- $('html, body').animate({scrollTop:$(window).height()}, 'medium', function(){
- $('#message_text').focus();
- });
- });
-});
-
-var resize = function(){
- var inboxSidebar = $('#conversation_inbox'),
- inboxSidebarOffset = inboxSidebar.offset().top,
- windowHeight = $(window).height();
-
- inboxSidebar.css('height', windowHeight - inboxSidebarOffset);
-};
diff --git a/public/javascripts/jquery.autocomplete-custom.js b/public/javascripts/jquery.autocomplete-custom.js
deleted file mode 100644
index e10b9de6d..000000000
--- a/public/javascripts/jquery.autocomplete-custom.js
+++ /dev/null
@@ -1,763 +0,0 @@
-/*
- * Autocomplete - jQuery plugin 1.1pre
- *
- * Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id: jquery.autocomplete.js 5785 2008-07-12 10:37:33Z joern.zaefferer $
- * Modified by Diaspora
- */
-
-;(function($) {
-
-$.fn.extend({
- autocomplete: function(urlOrData, options) {
- var isUrl = typeof urlOrData == "string";
- options = $.extend({}, $.Autocompleter.defaults, {
- url: isUrl ? urlOrData : null,
- data: isUrl ? null : urlOrData,
- delay: isUrl ? $.Autocompleter.defaults.delay : 10,
- max: options && !options.scroll ? 10 : 150
- }, options);
-
- // if highlight is set to false, replace it with a do-nothing function
- options.highlight = options.highlight || function(value) { return value; };
-
- // if the formatMatch option is not specified, then use formatItem for backwards compatibility
- options.formatMatch = options.formatMatch || options.formatItem;
-
- return this.each(function() {
- new $.Autocompleter(this, options);
- });
- },
- result: function(handler) {
- return this.bind("result", handler);
- },
- search: function(handler) {
- return this.trigger("search", [handler]);
- },
- flushCache: function() {
- return this.trigger("flushCache");
- },
- setOptions: function(options){
- return this.trigger("setOptions", [options]);
- },
- unautocomplete: function() {
- return this.trigger("unautocomplete");
- }
-});
-
-$.Autocompleter = function(input, options) {
-
- var KEY = KEYCODES;
-
- // Create $ object for input element
- var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
-
- var timeout;
- var previousValue = "";
- var cache = $.Autocompleter.Cache(options);
- var hasFocus = 0;
- var lastKeyPressCode;
- var config = {
- mouseDownOnSelect: false
- };
- var select = $.Autocompleter.Select(options, input, selectCurrent, config);
-
- var blockSubmit;
-
- // prevent form submit in opera when selecting with return key
- $.browser.opera && $(input.form).bind("submit.autocomplete", function() {
- if (blockSubmit) {
- blockSubmit = false;
- return false;
- }
- });
-
- // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
- $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
- // track last key pressed
- lastKeyPressCode = event.keyCode;
- switch(event.keyCode) {
-
- case KEY.LEFT:
- case KEY.RIGHT:
- if( options.disableRightAndLeft && select.visible()){
- event.preventDefault();
- }
- break;
- case KEY.UP:
- if ( select.visible() ) {
- event.preventDefault();
- select.prev();
- } else {
- onChange(0, true);
- }
- break;
-
- case KEY.DOWN:
- if ( select.visible() ) {
- event.preventDefault();
- select.next();
- } else {
- onChange(0, true);
- }
- break;
-
- case KEY.PAGEUP:
- if ( select.visible() ) {
- event.preventDefault();
- select.pageUp();
- } else {
- onChange(0, true);
- }
- break;
-
- case KEY.PAGEDOWN:
- if ( select.visible() ) {
- event.preventDefault();
- select.pageDown();
- } else {
- onChange(0, true);
- }
- break;
-
- // matches also semicolon
- case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
- case KEY.TAB:
- case KEY.RETURN:
- if( selectCurrent() ) {
- // stop default to prevent a form submit, Opera needs special handling
- event.preventDefault();
- blockSubmit = true;
- return false;
- }
- break;
-
- case KEY.ESC:
- select.hide();
- break;
-
- default:
- options.onLetterTyped(event, $input);
- clearTimeout(timeout);
- timeout = setTimeout(onChange, options.delay);
- break;
- }
- }).focus(function(){
- // track whether the field has focus, we shouldn't process any
- // results if the field no longer has focus
- hasFocus++;
- }).blur(function() {
- hasFocus = 0;
- if (!config.mouseDownOnSelect) {
- hideResults();
- }
- }).click(function() {
- // show select when clicking in a focused field
- if ( hasFocus++ > 1 && !select.visible() ) {
- onChange(0, true);
- }
- }).bind("search", function() {
- // TODO why not just specifying both arguments?
- var fn = (arguments.length > 1) ? arguments[1] : null;
- function findValueCallback(q, data) {
- var result;
- if( data && data.length ) {
- for (var i=0; i < data.length; i++) {
- if( data[i].result.toLowerCase() == q.toLowerCase() ) {
- result = data[i];
- break;
- }
- }
- }
- if( typeof fn == "function" ) fn(result);
- else $input.trigger("result", result && [result.data, result.value]);
- }
- $.each(trimWords($input.val()), function(i, value) {
- request(value, findValueCallback, findValueCallback);
- });
- }).bind("flushCache", function() {
- cache.flush();
- }).bind("setOptions", function() {
- $.extend(options, arguments[1]);
- // if we've updated the data, repopulate
- if ( "data" in arguments[1] )
- cache.populate();
- }).bind("unautocomplete", function() {
- select.unbind();
- $input.unbind();
- $(input.form).unbind(".autocomplete");
- });
-
-
- function selectCurrent() {
- var selected = select.selected();
- if( !selected )
- return false;
-
- var v = selected.result;
- previousValue = v;
-
- if ( options.multiple ) {
- var words = trimWords($input.val());
- if ( words.length > 1 ) {
- v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
- }
- v += options.multipleSeparator;
- }
-
- hideResultsNow();
- options.onSelect($input, selected.data, selected.value);
- return true;
- }
-
- function onChange(crap, skipPrevCheck) {
- if( lastKeyPressCode == KEY.DEL ) {
- select.hide();
- return;
- }
-
- var currentValue = $input.val();
-
- if ( !skipPrevCheck && currentValue == previousValue )
- return;
-
- previousValue = currentValue;
-
- currentValue = options.searchTermFromValue(currentValue, $input[0].selectionStart);
- if ( currentValue.length >= options.minChars) {
- $input.addClass(options.loadingClass);
- if (!options.matchCase)
- currentValue = currentValue.toLowerCase();
- request(currentValue, receiveData, hideResultsNow);
- } else {
- stopLoading();
- select.hide();
- }
- };
-
- function trimWords(value) {
- if ( !value ) {
- return [""];
- }
- var words = value.split( options.multipleSeparator );
- var result = [];
- $.each(words, function(i, value) {
- if ( $.trim(value) )
- result[i] = $.trim(value);
- });
- return result;
- }
-
- // fills in the input box w/the first match (assumed to be the best match)
- // q: the term entered
- // sValue: the first matching result
- function autoFill(q, sValue){
- // autofill in the complete box w/the first match as long as the user hasn't entered in more data
- // if the last user key pressed was backspace, don't autofill
- if( options.autoFill && (options.lastWord($input.val(), null, options.multiple).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
- // fill in the value (keep the case the user has typed)
- $input.val($input.val() + sValue.substring(options.lastWord(previousValue, null, options.multiple).length));
- // select the portion of the value not typed by the user (so the next character will erase)
- $.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
- }
- };
-
- function hideResults() {
- clearTimeout(timeout);
- timeout = setTimeout(hideResultsNow, 200);
- };
-
- function hideResultsNow() {
- select.hide();
- clearTimeout(timeout);
- stopLoading();
- if (options.mustMatch) {
- // call search and run callback
- $input.search(
- function (result){
- // if no value found, clear the input box
- if( !result ) {
- if (options.multiple) {
- var words = trimWords($input.val()).slice(0, -1);
- $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
- }
- else
- $input.val( "" );
- }
- }
- );
- }
- };
-
- function receiveData(q, data) {
- if ( data && data.length && hasFocus ) {
- stopLoading();
- select.display(data, q);
- autoFill(q, data[0].value);
- select.show();
- } else {
- hideResultsNow();
- }
- };
-
- function request(term, success, failure) {
- if (!options.matchCase)
- term = term.toLowerCase();
- var data = cache.load(term);
- // recieve the cached data
- if (data && data.length) {
- success(term, data);
- // if an AJAX url has been supplied, try loading the data now
- } else if( (typeof options.url == "string") && (options.url.length > 0) ){
-
- var extraParams = {
- timestamp: +new Date()
- };
- $.each(options.extraParams, function(key, param) {
- extraParams[key] = typeof param == "function" ? param() : param;
- });
-
- $.ajax({
- // try to leverage ajaxQueue plugin to abort previous requests
- mode: "abort",
- // limit abortion to this input
- port: "autocomplete" + input.name,
- dataType: options.dataType,
- url: options.url,
- data: $.extend({
- q: options.lastWord(term, null, options.multiple),
- limit: options.max
- }, extraParams),
- success: function(data) {
- var parsed = options.parse && options.parse(data) || parse(data);
- cache.add(term, parsed);
- success(term, parsed);
- }
- });
- } else {
- // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
- select.emptyList();
- failure(term);
- }
- };
-
- function parse(data) {
- var parsed = [];
- var rows = data.split("\n");
- for (var i=0; i < rows.length; i++) {
- var row = $.trim(rows[i]);
- if (row) {
- row = row.split("|");
- parsed[parsed.length] = {
- data: row,
- value: row[0],
- result: options.formatResult && options.formatResult(row, row[0]) || row[0]
- };
- }
- }
- return parsed;
- };
-
- function stopLoading() {
- $input.removeClass(options.loadingClass);
- };
-
-};
-
-$.Autocompleter.defaults = {
- onLetterTyped : function(event){},
- lastWord : function(value, crap, multiple) {
- if ( !multiple )
- return value;
- var words = trimWords(value);
- return words[words.length - 1];
- },
- inputClass: "ac_input",
- resultsClass: "ac_results",
- loadingClass: "ac_loading",
- onSelect: function(input, data, formatted){
- if (select.visible())
- // position cursor at end of input field
- $.Autocompleter.Selection(input, input.value.length, input.value.length);
- input.val(formatted);
- },
- minChars: 1,
- delay: 400,
- matchCase: false,
- matchSubset: true,
- matchContains: false,
- cacheLength: 10,
- max: 100,
- mustMatch: false,
- extraParams: {},
- selectFirst: true,
- formatItem: function(row) { return row[0]; },
- selectionChanged : function(newItem) {},
- formatMatch: null,
- autoFill: false,
- width: 0,
- multiple: false,
- multipleSeparator: ", ",
- disableRightAndLeft: false,
- highlight: function(value, term) {
- return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
- },
- scroll: true,
- scrollHeight: 180
-};
-$.Autocompleter.defaults.searchTermFromValue = $.Autocompleter.defaults.lastWord;
-
-$.Autocompleter.Cache = function(options) {
-
- var data = {};
- var length = 0;
-
- function matchSubset(s, sub) {
- if (!options.matchCase)
- s = s.toLowerCase();
- var i = s.indexOf(sub);
- if (options.matchContains == "word"){
- i = s.toLowerCase().search("\\b" + sub.toLowerCase());
- }
- if (i == -1) return false;
- return i == 0 || options.matchContains;
- };
-
- function add(q, value) {
- if (length > options.cacheLength){
- flush();
- }
- if (!data[q]){
- length++;
- }
- data[q] = value;
- }
-
- function populate(){
- if( !options.data ) return false;
- // track the matches
- var stMatchSets = {},
- nullData = 0;
-
- // no url was specified, we need to adjust the cache length to make sure it fits the local data store
- if( !options.url ) options.cacheLength = 1;
-
- // track all options for minChars = 0
- stMatchSets[""] = [];
-
- // loop through the array and create a lookup structure
- for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
- var rawValue = options.data[i];
- // if rawValue is a string, make an array otherwise just reference the array
- rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
-
- var value = options.formatMatch(rawValue, i+1, options.data.length);
- if ( value === false )
- continue;
-
- var firstChar = value.charAt(0).toLowerCase();
- // if no lookup array for this character exists, look it up now
- if( !stMatchSets[firstChar] )
- stMatchSets[firstChar] = [];
-
- // if the match is a string
- var row = {
- value: value,
- data: rawValue,
- result: options.formatResult && options.formatResult(rawValue) || value
- };
-
- // push the current match into the set list
- stMatchSets[firstChar].push(row);
-
- // keep track of minChars zero items
- if ( nullData++ < options.max ) {
- stMatchSets[""].push(row);
- }
- };
-
- // add the data items to the cache
- $.each(stMatchSets, function(i, value) {
- // increase the cache size
- options.cacheLength++;
- // add to the cache
- add(i, value);
- });
- }
-
- // populate any existing data
- setTimeout(populate, 25);
-
- function flush(){
- data = {};
- length = 0;
- }
-
- return {
- flush: flush,
- add: add,
- populate: populate,
- load: function(q) {
- if (!options.cacheLength || !length)
- return null;
- /*
- * if dealing w/local data and matchContains than we must make sure
- * to loop through all the data collections looking for matches
- */
- if( !options.url && options.matchContains ){
- // track all matches
- var csub = [];
- // loop through all the data grids for matches
- for( var k in data ){
- // don't search through the stMatchSets[""] (minChars: 0) cache
- // this prevents duplicates
- if( k.length > 0 ){
- var c = data[k];
- $.each(c, function(i, x) {
- // if we've got a match, add it to the array
- if (matchSubset(x.value, q)) {
- csub.push(x);
- }
- });
- }
- }
- return csub;
- } else
- // if the exact item exists, use it
- if (data[q]){
- return data[q];
- } else
- if (options.matchSubset) {
- for (var i = q.length - 1; i >= options.minChars; i--) {
- var c = data[q.substr(0, i)];
- if (c) {
- var csub = [];
- $.each(c, function(i, x) {
- if (matchSubset(x.value, q)) {
- csub[csub.length] = x;
- }
- });
- return csub;
- }
- }
- }
- return null;
- }
- };
-};
-
-$.Autocompleter.Select = function (options, input, select, config) {
- var CLASSES = {
- ACTIVE: "ac_over"
- };
-
- var listItems,
- active = -1,
- data,
- term = "",
- needsInit = true,
- element,
- list;
-
- // Create results
- function init() {
- if (!needsInit)
- return;
- element = $("<div/>")
- .hide()
- .addClass(options.resultsClass)
- .css("position", "absolute")
- .appendTo(document.body);
-
- list = $("<ul/>").appendTo(element).mouseover( function(event) {
- if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
- active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
- $(target(event)).addClass(CLASSES.ACTIVE);
- }
- }).click(function(event) {
- $(target(event)).addClass(CLASSES.ACTIVE);
- select();
- // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
- input.focus();
- return false;
- }).mousedown(function() {
- config.mouseDownOnSelect = true;
- }).mouseup(function() {
- config.mouseDownOnSelect = false;
- });
-
- if( options.width > 0 )
- element.css("width", options.width);
-
- needsInit = false;
- }
-
- function target(event) {
- var element = event.target;
- while(element && element.tagName != "LI")
- element = element.parentNode;
- // more fun with IE, sometimes event.target is empty, just ignore it then
- if(!element)
- return [];
- return element;
- }
-
- function moveSelect(step) {
- listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
- movePosition(step);
- var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
- if(options.scroll) {
- var offset = 0;
- listItems.slice(0, active).each(function() {
- offset += this.offsetHeight;
- });
- if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
- list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
- } else if(offset < list.scrollTop()) {
- list.scrollTop(offset);
- }
- }
- options.selectionChanged(activeItem);
- };
-
- function movePosition(step) {
- active += step;
- if (active < 0) {
- active = listItems.size() - 1;
- } else if (active >= listItems.size()) {
- active = 0;
- }
- }
-
- function limitNumberOfItems(available) {
- return options.max && options.max < available
- ? options.max
- : available;
- }
-
- function fillList() {
- list.empty();
- var max = limitNumberOfItems(data.length);
- for (var i=0; i < max; i++) {
- if (!data[i])
- continue;
- var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
- if ( formatted === false )
- continue;
- var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
- $.data(li, "ac_data", data[i]);
- }
- listItems = list.find("li");
- if ( options.selectFirst ) {
- listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
- active = 0;
- }
- // apply bgiframe if available
- if ( $.fn.bgiframe )
- list.bgiframe();
- }
-
- return {
- display: function(d, q) {
- init();
- data = d;
- term = q;
- fillList();
- },
- next: function() {
- moveSelect(1);
- },
- prev: function() {
- moveSelect(-1);
- },
- pageUp: function() {
- if (active != 0 && active - 8 < 0) {
- moveSelect( -active );
- } else {
- moveSelect(-8);
- }
- },
- pageDown: function() {
- if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
- moveSelect( listItems.size() - 1 - active );
- } else {
- moveSelect(8);
- }
- },
- hide: function() {
- element && element.hide();
- listItems && listItems.removeClass(CLASSES.ACTIVE);
- active = -1;
- },
- visible : function() {
- return element && element.is(":visible");
- },
- current: function() {
- return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
- },
- show: function() {
- var offset = $(input).offset();
- element.css({
- width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
- top: offset.top + input.offsetHeight,
- left: offset.left
- }).show();
- if(options.scroll) {
- list.scrollTop(0);
- list.css({
- maxHeight: options.scrollHeight,
- overflow: 'auto'
- });
-
- if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
- var listHeight = 0;
- listItems.each(function() {
- listHeight += this.offsetHeight;
- });
- var scrollbarsVisible = listHeight > options.scrollHeight;
- list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
- if (!scrollbarsVisible) {
- // IE doesn't recalculate width when scrollbar disappears
- listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
- }
- }
-
- }
- },
- selected: function() {
- var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
- return selected && selected.length && $.data(selected[0], "ac_data");
- },
- emptyList: function (){
- list && list.empty();
- },
- unbind: function() {
- element && element.remove();
- }
- };
-};
-
-$.Autocompleter.Selection = function(field, start, end) {
- if( field.createTextRange ){
- var selRange = field.createTextRange();
- selRange.collapse(true);
- selRange.moveStart("character", start);
- selRange.moveEnd("character", end);
- selRange.select();
- } else if( field.setSelectionRange ){
- field.setSelectionRange(start, end);
- } else {
- if( field.selectionStart ){
- field.selectionStart = start;
- field.selectionEnd = end;
- }
- }
- field.focus();
-};
-
-})(jQuery);
diff --git a/public/javascripts/jquery.infinitescroll-custom.js b/public/javascripts/jquery.infinitescroll-custom.js
deleted file mode 100644
index 7e5c70fc0..000000000
--- a/public/javascripts/jquery.infinitescroll-custom.js
+++ /dev/null
@@ -1,621 +0,0 @@
-/*!
-// Infinite Scroll jQuery plugin
-// copyright Paul Irish, licensed GPL & MIT
-// version 2.0b1.110420
-
-// home and docs: http://www.infinite-scroll.com
-// Modified by Diaspora:
-// A few callbacks were made options and generateInstanceID was make jquery 162 compatible
-*/
-
-; (function ($) {
-
- /* Define 'infinitescroll' function
- ---------------------------------------------------*/
-
- $.fn.infinitescroll = function infscr(options, callback) {
-
- // grab each selector option and see if any fail.
- function areSelectorsValid(opts) {
- var debug = $.fn.infinitescroll._debug;
- for (var key in opts) {
- if (key.indexOf && key.indexOf('Selector') > -1 && $(opts[key]).length === 0) {
- debug('Your ' + key + ' found no elements.');
- return false;
- }
- return true;
- }
- }
-
-
- // find the number to increment in the path.
- function determinePath(path) {
-
- if ($.isFunction(opts.pathParse)) {
-
- debug('pathParse');
- return [path];
-
- } else if (path.match(/^(.*?)\b2\b(.*?$)/)) {
- path = path.match(/^(.*?)\b2\b(.*?$)/).slice(1);
-
- // if there is any 2 in the url at all.
- } else if (path.match(/^(.*?)2(.*?$)/)) {
-
- // page= is used in django:
- // http://www.infinite-scroll.com/changelog/comment-page-1/#comment-127
- if (path.match(/^(.*?page=)2(\/.*|$)/)) {
- path = path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
- return path;
- }
-
- path = path.match(/^(.*?)2(.*?$)/).slice(1);
-
- } else {
-
- // page= is used in drupal too but second page is page=1 not page=2:
- // thx Jerod Fritz, vladikoff
- if (path.match(/^(.*?page=)1(\/.*|$)/)) {
- path = path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
- return path;
- } else {
- debug('Sorry, we couldn\'t parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.');
- props.isInvalidPage = true; //prevent it from running on this page.
- }
- }
- debug('determinePath',path);
- return path;
- }
-
-
- // Calculate internal height (used for local scroll)
- function hiddenHeight(element) {
- var height = 0;
- $(element).children().each(function () {
- height = height + $(this).outerHeight(false);
- });
- return height;
- }
-
-
- //Generate InstanceID based on random data (to give consistent but different ID's)
- function generateInstanceID(element) {
- var $element = $(element)
- var number = $element.length + $element.html().length
- if($element.attr("class") !== undefined){
- number += $element.attr("class").length
- }
- if($element.attr("id") !== undefined){
- number += $element.attr("id").length
- }
- opts.infid = number;
- }
-
-
- // if options is a string, use as a command
- if (typeof options=='string') {
-
- var command = options,
- argument = callback,
- validCommand = (command == 'pause' || command == 'destroy' || command == 'retrieve' || command == 'binding'),
- debug = $.fn.infinitescroll._debug;
-
- argument = argument || null;
- command = (validCommand) ? $.fn.infinitescroll[command](argument) : debug('Invalid command');
-
- return false;
- }
-
-
- // lets get started.
- var opts = $.infinitescroll.opts = $.extend({}, $.infinitescroll.defaults, options),
- props = $.infinitescroll, // shorthand
- innerContainerHeight, box, frag, desturl, pause, error, errorStatus, method, result;
- callback = $.fn.infinitescroll._callback = callback || function () { },
- debug = $.fn.infinitescroll._debug,
- error = $.fn.infinitescroll._error,
- pause = $.fn.infinitescroll.pause,
- destroy = $.fn.infinitescroll.destroy,
- binding = $.fn.infinitescroll.binding;
-
-
- // if selectors from opts aren't valid, return false
- if (!areSelectorsValid(opts)) { return false; }
-
-
- opts.container = opts.container || document.documentElement;
-
-
- // contentSelector we'll use for our ajax call
- opts.contentSelector = opts.contentSelector || this;
-
- // Generate unique instance ID
- opts.infid = (opts.infid == 0) ? generateInstanceID(opts.contentSelector) : opts.infid;
-
- // loadMsgSelector - if we want to place the load message in a specific selector, defaulted to the contentSelector
- opts.loadMsgSelector = opts.loadMsgSelector || opts.contentSelector;
-
-
- // get the relative URL - everything past the domain name.
- var relurl = /(.*?\/\/).*?(\/.*)/,
- path = $(opts.nextSelector).attr('href');
-
- if (!path) { debug('Navigation selector not found'); return; }
-
- // set the path to be a relative URL from root.
- opts.path = determinePath(path);
-
-
- // define loading msg
- props.loadingMsg = $('<div id="infscr-loading" style="text-align: center;"><img alt="Loading..." src="' +
-
- opts.loadingImg + '" /><div>' + opts.loadingText + '</div></div>');
- // preload the image
- (new Image()).src = opts.loadingImg;
-
-
- //Check if its HTML (window scroll) and set innerContainerHeight
- opts.binder = (opts.container.nodeName == "HTML") ? $(window) : $(opts.container);
- innerContainerHeight = (opts.container.nodeName == "HTML") ? $(document).height() : innerContainerHeight = hiddenHeight(opts.container);
- debug('Scrolling in: ',(opts.container.nodeName == "HTML") ? 'window' : opts.container);
-
- // distance from nav links to bottom
- // computed as: height of the document + top offset of container - top offset of nav link
- opts.pixelsFromNavToBottom = innerContainerHeight +
- (opts.container == document.documentElement ? 0 : $(opts.container).offset().top) -
- $(opts.navSelector).offset().top;
-
-
- // set up our bindings
- // bind scroll handler to element (if its a local scroll) or window
- binding('bind');
- opts.binder.trigger('smartscroll.infscr.' + opts.infid); // trigger the event, in case it's a short page
-
- return this;
-
- } // end of $.fn.infinitescroll()
-
-
- /* Defaults and read-only properties object
- ---------------------------------------------------*/
-
- $.infinitescroll = {
- defaults: {
- debug: false,
- binder: $(window),
- preload: false,
- nextSelector: "div.navigation a:first",
- loadingImg: "http://www.infinite-scroll.com/loading.gif",
- loadingText: "<em>Loading the next set of posts...</em>",
- donetext: "<em>Congratulations, you've reached the end of the internet.</em>",
- navSelector: "div.navigation",
- contentSelector: null, // not really a selector. :) it's whatever the method was called on..
- loadMsgSelector: null,
- loadingMsgRevealSpeed: 'fast', // controls how fast you want the loading message to come in, ex: 'fast', 'slow', 200 (milliseconds)
- extraScrollPx: 150,
- itemSelector: "div.post",
- animate: false,
- pathParse: undefined,
- dataType: 'html',
- appendCallback: true,
- bufferPx: 40,
- orientation: 'height',
- errorCallback: function () { },
- currPage: 1,
- infid: 0, //Instance ID (Generated at setup)
- isDuringAjax: false,
- isInvalidPage: false,
- isDestroyed: false,
- isDone: false, // for when it goes all the way through the archive.
- isPaused: false,
- container: undefined, //If left undefined uses window scroll, set as container for local scroll
- pixelsFromNavToBottom: undefined,
- path: undefined
- },
- loadingImg: undefined,
- loadingMsg: undefined,
- currDOMChunk: null // defined in setup()'s load()
- };
-
-
- /* Methods + Commands
- ---------------------------------------------------*/
-
- // Console log wrapper.
- $.fn.infinitescroll._debug = function infscr_debug() {
- if ($.infinitescroll.opts.debug) {
- return window.console && console.log.call(console, arguments);
- }
- }
-
-
- // shortcut function for...getting shortcuts
- $.fn.infinitescroll._shorthand = function infscr_shorthand() {
-
- // someone should write this, and it would rule
-
- };
-
-
- // Near Bottom (isNearBottom)
- $.fn.infinitescroll._nearbottom = function infscr_nearbottom() {
-
- // replace with shorthand function
- var opts = $.infinitescroll.opts,
- debug = $.fn.infinitescroll._debug,
- hiddenHeight = $.fn.infinitescroll._hiddenheight;
-
- // distance remaining in the scroll
- // computed as: document height - distance already scroll - viewport height - buffer
-
- if (opts.container.nodeName == "HTML") {
- var pixelsFromWindowBottomToBottom = 0
- + $(document).height()
- // have to do this bs because safari doesnt report a scrollTop on the html element
- - ($(opts.container).scrollTop() || $(opts.container.ownerDocument.body).scrollTop())
- - $(window).height();
- }
- else {
- var pixelsFromWindowBottomToBottom = 0
- + hiddenHeight(opts.container) - $(opts.container).scrollTop() - $(opts.container).height();
-
- }
-
- debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);
-
- // if distance remaining in the scroll (including buffer) is less than the orignal nav to bottom....
- return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.pixelsFromNavToBottom);
-
- }
-
-
- // Setup function (infscrSetup)
- $.fn.infinitescroll._setup = function infscr_setup() {
-
- // replace with shorthand function
- var props = $.infinitescroll,
- opts = $.infinitescroll.opts,
- isNearBottom = $.fn.infinitescroll._nearbottom,
- kickOffAjax = $.fn.infinitescroll.retrieve;
-
- if (opts.isDuringAjax || opts.isInvalidPage || opts.isDone || opts.isDestroyed || opts.isPaused) return;
-
- if (!isNearBottom(opts, props)) return;
-
- kickOffAjax();
-
- };
-
-
- // Ajax function (kickOffAjax)
- $.fn.infinitescroll.retrieve = function infscr_retrieve() {
-
- // replace with shorthand function
- var props = $.infinitescroll,
- opts = props.opts,
- debug = $.fn.infinitescroll._debug,
- loadCallback = $.fn.infinitescroll._loadcallback,
- error = $.fn.infinitescroll._error,
- path = opts.path, // get this
- box, frag, desturl, method, condition;
-
-
- // we dont want to fire the ajax multiple times
- opts.isDuringAjax = true;
-
-
- // show the loading message quickly
- // then hide the previous/next links after we're
- // sure the loading message was visible
- props.loadingMsg.appendTo(opts.loadMsgSelector).show();
-
- $(opts.navSelector).hide();
-
- // increment the URL bit. e.g. /page/3/
- opts.currPage++;
-
- debug('heading into ajax', path);
-
- // if we're dealing with a table we can't use DIVs
- box = $(opts.contentSelector).is('table') ? $('<tbody/>') : $('<div/>');
-
-
- // INSERT DEBUG ERROR FOR invalid desturl
- desturl = ($.isFunction(opts.pathParse)) ? opts.pathParse(path.join('2'), opts.currPage) : desturl = path.join(opts.currPage);
- // desturl = path.join(opts.currPage);
-
- // create switch parameter for append / callback
- // MAKE SURE CALLBACK EXISTS???
- method = (opts.dataType == 'html' || opts.dataType == 'json') ? opts.dataType : 'html+callback';
- if (opts.appendCallback && opts.dataType == 'html') method += '+callback';
-
- switch (method) {
-
- case 'html+callback':
-
- debug('Using HTML via .load() method');
- box.load(desturl + ' ' + opts.itemSelector, null, function(jqXHR,textStatus) {
- loadCallback(box,jqXHR.responseText);
- });
-
- break;
-
- case 'html':
- case 'json':
-
- debug('Using '+(method.toUpperCase())+' via $.ajax() method');
- $.ajax({
- // params
- url: desturl,
- dataType: opts.dataType,
- complete: function _infscrAjax(jqXHR,textStatus) {
- condition = (typeof(jqXHR.isResolved) !== 'undefined') ? (jqXHR.isResolved()) : (textStatus === "success" || textStatus === "notmodified");
- (condition) ? loadCallback(box,jqXHR.responseText) : error([404]);
- }
- });
-
- break;
-
- }
- };
-
-
- // Load callback
- $.fn.infinitescroll._loadcallback = function infscr_loadcallback(box,data) {
-
- // replace with shorthand function
- var props = $.infinitescroll,
- opts = $.infinitescroll.opts,
- error = $.fn.infinitescroll._error,
- showDoneMsg = $.fn.infinitescroll._donemsg,
- callback = $.fn.infinitescroll._callback, // GLOBAL OBJECT FOR CALLBACK
- result, frag;
-
- result = (opts.isDone) ? 'done' : (!opts.appendCallback) ? 'no-append' : 'append';
-
- switch (result) {
-
- case 'done':
-
- showDoneMsg();
- return false;
-
- break;
-
- case 'no-append':
-
- if (opts.dataType == 'html') {
- data = '<div>'+data+'</div>';
- data = $(data).find(opts.itemSelector);
- };
-
- break;
-
- case 'append':
-
- var children = box.children();
-
- // if it didn't return anything
- if (children.length == 0 || children.hasClass('error404')) {
- // trigger a 404 error so we can quit.
- return error([404]);
- }
-
-
- // use a documentFragment because it works when content is going into a table or UL
- frag = document.createDocumentFragment();
- while (box[0].firstChild) {
- frag.appendChild(box[0].firstChild);
- }
-
- $(opts.contentSelector)[0].appendChild(frag);
- // previously, we would pass in the new DOM element as context for the callback
- // however we're now using a documentfragment, which doesnt havent parents or children,
- // so the context is the contentContainer guy, and we pass in an array
- // of the elements collected as the first argument.
-
- data = children.get();
-
-
- break;
-
- }
-
- // fadeout currently makes the <em>'d text ugly in IE6
- props.loadingMsg.hide();
-
-
- // smooth scroll to ease in the new content
- if (opts.animate) {
- var scrollTo = $(window).scrollTop() + $('#infscr-loading').height() + opts.extraScrollPx + 'px';
- $('html,body').animate({ scrollTop: scrollTo }, 800, function () { opts.isDuringAjax = false; });
- }
-
- if (!opts.animate) opts.isDuringAjax = false; // once the call is done, we can allow it again.
-
- callback.call($(opts.contentSelector)[0], data);
-
- };
-
-
- // Show done message.
- $.fn.infinitescroll._donemsg = function infscr_donemsg() {
-
- // replace with shorthand function
- var props = $.infinitescroll,
- opts = $.infinitescroll.opts;
-
- props.loadingMsg
- .find('img')
- .hide()
- .parent()
- .find('div').html(opts.donetext).animate({ opacity: 1 }, 2000, function () {
- $(this).parent().fadeOut('normal');
- });
-
- // user provided callback when done
- opts.errorCallback();
- }
-
-
- // Pause function
- $.fn.infinitescroll.pause = function infscr_pause(pause) {
-
- // if pauseValue is not 'pause' or 'resume', toggle it's value
- var debug = $.fn.infinitescroll._debug,
- opts = $.infinitescroll.opts;
-
- if (pause !== 'pause' && pause !== 'resume' && pause !== 'toggle' && pause !== null) {
- debug('Invalid argument. Toggling pause value instead');
- };
-
- pause = (pause && (pause == 'pause' || pause == 'resume')) ? pause : 'toggle';
-
- switch (pause) {
- case 'pause':
- opts.isPaused = true;
- break;
-
- case 'resume':
- opts.isPaused = false;
- break;
-
- case 'toggle':
- opts.isPaused = !opts.isPaused;
- break;
- }
-
- debug('Paused',opts.isPaused);
- return false;
- }
-
-
- // Error function
- $.fn.infinitescroll._error = function infscr_error(xhr) {
-
- // replace with shorthand function
- var opts = $.infinitescroll.opts,
- binder = (opts.container.nodeName == "HTML") ? $(window) : $(opts.container),
- debug = $.fn.infinitescroll._debug,
- showDoneMsg = $.fn.infinitescroll._donemsg,
- error = (!opts.isDone && xhr == 404) ? 'end' : (opts.isDestroyed && xhr == 302) ? 'destroy' : 'unknown';
-
- switch (error) {
-
- case 'end':
-
- // die if we're out of pages.
- debug('Page not found. Self-destructing...');
- showDoneMsg();
- opts.isDone = true;
- opts.currPage = 1; // if you need to go back to this instance
- opts.isPaused = false;
- binder.unbind('smartscroll.infscr.' + opts.infid);
-
- break;
-
- case 'destroy':
-
- // die if destroyed.
- debug('Destroyed. Going to next instance...');
- opts.isDone = true;
- opts.currPage = 1; // if you need to go back to this instance
- opts.isPaused = false;
- binder.unbind('smartscroll.infscr.' + opts.infid);
-
- break;
-
- case 'unknown':
-
- // unknown error.
- debug('Unknown Error. WHAT DID YOU DO?!...');
- showDoneMsg();
- opts.isDone = true;
- opts.currPage = 1; // if you need to go back to this instance
- binder.unbind('smartscroll.infscr.' + opts.infid);
-
- break;
-
- }
-
- }
-
-
- // Destroy current instance of the plugin
- $.fn.infinitescroll.destroy = function infscr_destroy() {
-
- // replace with shorthand function
- var opts = $.infinitescroll.opts,
- error = $.fn.infinitescroll._error;
-
- opts.isDestroyed = true;
- return error([302]);
-
- }
-
-
- // Scroll binding + unbinding
- $.fn.infinitescroll.binding = function infscr_binding(binding) {
-
- // replace with shorthand function
- var opts = $.infinitescroll.opts,
- setup = $.fn.infinitescroll._setup,
- error = $.fn.infinitescroll._error,
- debug = $.fn.infinitescroll._debug;
-
- switch(binding) {
-
- case 'bind':
- opts.binder.bind('smartscroll.infscr.'+opts.infid, setup);
- break;
-
- case 'unbind':
- opts.binder.unbind('smartscroll.infscr.'+opts.infid);
- break;
-
- }
-
- debug('Binding',binding);
- return false;
-
- }
-
-
- /*
- * smartscroll: debounced scroll event for jQuery *
- * https://github.com/lukeshumard/smartscroll
- * Based on smartresize by @louis_remi: https://github.com/lrbabe/jquery.smartresize.js *
- * Copyright 2011 Louis-Remi & Luke Shumard * Licensed under the MIT license. *
- */
-
- var event = $.event,
- scrollTimeout;
-
- event.special.smartscroll = {
- setup: function() {
- $(this).bind( "scroll", event.special.smartscroll.handler );
- },
- teardown: function() {
- $(this).unbind( "scroll", event.special.smartscroll.handler );
- },
- handler: function( event, execAsap ) {
- // Save the context
- var context = this,
- args = arguments;
-
- // set correct event type
- event.type = "smartscroll";
-
- if (scrollTimeout) { clearTimeout(scrollTimeout); }
- scrollTimeout = setTimeout(function() {
- jQuery.event.handle.apply( context, args );
- }, execAsap === "execAsap"? 0 : 100);
- }
- };
-
- $.fn.smartscroll = function( fn ) {
- return fn ? this.bind( "smartscroll", fn ) : this.trigger( "smartscroll", ["execAsap"] );
- };
-
-
-})(jQuery);
diff --git a/public/javascripts/keycodes.js b/public/javascripts/keycodes.js
deleted file mode 100644
index ae6c143db..000000000
--- a/public/javascripts/keycodes.js
+++ /dev/null
@@ -1,116 +0,0 @@
-var KEYCODES = {
-BACKSPACE : 8,
-TAB : 9,
-ENTER : 13,
-RETURN : 13,
-SHIFT : 16,
-CTRL : 17,
-ALT : 18,
-PAUSE : 19,
-BREAK : 19,
-CAPSLOCK : 20,
-ESCAPE : 27,
-ESC : 27,
-SPACEBAR : 32,
-PAGEUP : 33,
-PAGEDOWN : 34,
-END : 35,
-HOME : 36,
-LEFT : 37,
-UP : 38,
-RIGHT : 39,
-DOWN : 40,
-INSERT : 45,
-DEL : 46,
-DELETE : 46,
-0 : 48,
-1 : 49,
-2 : 50,
-3 : 51,
-4 : 52,
-5 : 53,
-6 : 54,
-7 : 55,
-8 : 56,
-9 : 57,
-A : 65,
-B : 66,
-C : 67,
-D : 68,
-E : 69,
-F : 70,
-G : 71,
-H : 72,
-I : 73,
-J : 74,
-K : 75,
-L : 76,
-M : 77,
-N : 78,
-O : 79,
-P : 80,
-Q : 81,
-R : 82,
-S : 83,
-T : 84,
-U : 85,
-V : 86,
-W : 87,
-X : 88,
-Y : 89,
-Z : 90,
-LEFTWINDOW : 91,
-RIGHTWINDOW : 92,
-SELECT : 93,
-NUMPAD0 : 96,
-NUMPAD1 : 97,
-NUMPAD2 : 98,
-NUMPAD3 : 99,
-NUMPAD4 : 100,
-NUMPAD5 : 101,
-NUMPAD6 : 102,
-NUMPAD7 : 103,
-NUMPAD8 : 104,
-NUMPAD9 : 105,
-MULTIPLY : 106,
-ADD : 107,
-SUBTRACT : 109,
-DECIMALPOINT : 110,
-DIVIDE : 111,
-F1 : 112,
-F2 : 113,
-F3 : 114,
-F4 : 115,
-F5 : 116,
-F6 : 117,
-F7 : 118,
-F8 : 119,
-F9 : 120,
-F10 : 121,
-F11 : 122,
-F12 : 123,
-NUMLOCK : 144,
-SCROLLLOCK : 145,
-SEMICOLON : 186,
-EQUALSIGN : 187,
-COMMA : 188,
-DASH : 189,
-PERIOD : 190,
-FORWARDSLASH : 191,
-ACCENTGRAVE : 192,
-OPENBRACKET : 219,
-BACKSLASH : 220,
-CLOSEBRACKET : 221,
-SINGLEQUOTE : 222,
-isInsertion : function(keyCode){
- if(keyCode <= 46 && keyCode != this.RETURN && keyCode != this.SPACEBAR){
- return false;
- }else if(keyCode > 90 && keyCode < 96){
- return false;
- }else if(keyCode >= 112 && keyCode <= 145){
- return false;
- }else {
- return true;
- }
-}
-};
diff --git a/public/javascripts/login.js b/public/javascripts/login.js
deleted file mode 100644
index 6d39d4f60..000000000
--- a/public/javascripts/login.js
+++ /dev/null
@@ -1,26 +0,0 @@
-jQuery.fn.center = function () {
- this.css("position","absolute");
- this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
- this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
- return this;
-}
-
-$(document).ready( function(){
- var username = $("#user_username"),
- password = $("#user_password"),
- forgotPass = $("#forgot_password_link"),
- controls = $("#controls");
-
- $("#login").center();
- $(window).resize(function(){
- $("#login").center();
- });
-
- username.focus();
- $("form").submit(function(){
- $('#asterisk').addClass('rideSpinners');
- forgotPass.addClass('hidden');
- controls.addClass('hidden');
- });
-});
-
diff --git a/public/javascripts/mentions.js b/public/javascripts/mentions.js
deleted file mode 100644
index b6e230437..000000000
--- a/public/javascripts/mentions.js
+++ /dev/null
@@ -1,26 +0,0 @@
-var Mentions = {
- initialize: function(mentionsInput) {
- return mentionsInput.mentionsInput(Mentions.options);
- },
-
- fetchContacts : function(){
- Mentions.contacts || $.getJSON("/contacts", function(data) {
- Mentions.contacts = data;
- });
- },
-
- options: {
- elastic: false,
- minChars: 1,
-
- onDataRequest: function(mode, query, callback) {
- var filteredResults = _.filter(Mentions.contacts, function(item) { return item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
-
- callback.call(this, filteredResults.slice(0,5));
- },
-
- templates: {
- mentionItemSyntax: _.template("@{<%= mention.name %> ; <%= mention.handle %>}")
- }
- }
-};
diff --git a/public/javascripts/mobile.js b/public/javascripts/mobile.js
deleted file mode 100644
index 554c0f319..000000000
--- a/public/javascripts/mobile.js
+++ /dev/null
@@ -1,265 +0,0 @@
-$(document).ready(function(){
-
- $('.shield a').click(function(){
- $(this).parents('.shield_wrapper').remove();
- });
- var showLoader = function(link){
- link.addClass('loading');
- };
-
- var removeLoader = function(link){
- link.removeClass('loading')
- .toggleClass('active')
- .toggleClass('inactive');
- };
-
- /* Heart toggle */
- $(".like_action", ".stream").bind("tap click", function(evt){
- evt.preventDefault();
- var link = $(this),
- likeCounter = $(this).closest(".stream_element").find("like_count"),
- href = link.attr("href");
-
- if(!link.hasClass("loading")){
- if(link.hasClass('inactive')) {
- $.ajax({
- url: href,
- dataType: 'json',
- type: 'POST',
- beforeSend: showLoader(link),
- success: function(data){
- removeLoader(link);
- link.attr("href", href + "/" + data["id"]);
-
- if(likeCounter){
- likeCounter.text(parseInt(likeCounter.text) + 1);
- }
- }
- });
- }
- else if(link.hasClass("active")){
- $.ajax({
- url: link.attr("href"),
- dataType: 'json',
- type: 'DELETE',
- beforeSend: showLoader(link),
- complete: function(data){
- removeLoader(link);
- link.attr("href", href.replace(/\/\d+$/, ''));
-
- if(likeCounter){
- likeCounter.text(parseInt(likeCounter.text) - 1);
- }
- }
- });
- }
- }
- });
-
- /* Reshare */
- $(".reshare_action", ".stream").bind("tap click", function(evt){
- evt.preventDefault();
-
- var link = $(this),
- href = link.attr("href"),
- confirmText = link.attr('title');
-
- if(!link.hasClass("loading")) {
- if(link.hasClass('inactive')) {
- if(confirm(confirmText)) {
- $.ajax({
- url: href + "&provider_display_name=mobile",
- dataType: 'json',
- type: 'POST',
- beforeSend: showLoader(link),
- success: function(data){
- removeLoader(link);
- },
- error: function(data){
- removeLoader(link);
- alert("Failed to reshare!");
- }
- });
- }
- }
- }
- });
-
- /* Show comments */
- $(".show_comments", ".stream").bind("tap click", function(evt){
- evt.preventDefault();
- var link = $(this),
- parent = link.closest(".bottom_bar").first(),
- commentsContainer = function(){ return parent.find(".comment_container").first(); }
- existingCommentsContainer = commentsContainer();
-
- if( link.hasClass('active') ) {
- existingCommentsContainer.hide();
- if(!link.hasClass('bottom_collapse')){
- link.removeClass('active');
- } else {
- parent.find(".show_comments").first().removeClass('active');
- }
-
- $('html,body').scrollTop(parent.offset().top - parent.closest(".stream_element").height() - 8);
-
- } else if( existingCommentsContainer.length > 0) {
-
- if(!existingCommentsContainer.hasClass('noComments')) {
- $.ajax({
- url: link.attr('href'),
- success: function(data){
- parent.append($(data).find('.comments_container').html());
- link.addClass('active');
- existingCommentsContainer.show();
- scrollToOffset(parent, commentsContainer());
- }
- });
- } else {
- existingCommentsContainer.show();
- }
-
- link.addClass('active');
-
- } else {
- $.ajax({
- url: link.attr('href'),
- success: function(data){
- parent.append(data);
- link.addClass('active');
- scrollToOffset(parent, commentsContainer());
- }
- });
- }
-
- });
-
- var scrollToOffset = function(parent, commentsContainer){
- var commentCount = commentsContainer.find("li.comment").length;
- if( commentCount > 3 ) {
- var lastComment = commentsContainer.find("li:nth-child("+(commentCount-4)+")");
- $('html,body').animate({
- scrollTop: lastComment.offset().top
- }, 1000);
- }
- };
-
- $(".stream").delegate("a.comment_action", "tap click", function(evt){
- evt.preventDefault();
- var link = $(this);
-
- if(link.hasClass('inactive')) {
- var parent = link.closest(".bottom_bar").first(),
- container = link.closest('.bottom_bar').find('.add_comment_bottom_link_container').first();
-
- $.ajax({
- url: link.attr('href'),
- beforeSend: function(){
- link.addClass('loading');
- },
- context: link,
- success: function(data){
- var textarea = function(target) { return target.closest(".stream_element").find('textarea.comment_box').first()[0] };
- link.removeClass('loading')
-
- if(!link.hasClass("add_comment_bottom_link")){
- link.removeClass('inactive');
- }
-
- container.hide();
- parent.append(data);
-
- console.log($(this).closest(".stream_element").find('textarea'));
-
- MBP.autogrow(textarea($(this)));
- }
- });
- }
- });
-
- $(".stream").delegate("a.cancel_new_comment", "tap click", function(evt){
- evt.preventDefault();
- var link = $(this);
- form = link.closest("form"),
- commentActionLink = link.closest(".bottom_bar").find("a.comment_action").first();
- container = link.closest('.bottom_bar').find('.add_comment_bottom_link_container');
-
- if(container.length > 0 ){
- container.first().show();
- }
-
- commentActionLink.addClass("inactive");
- form.remove();
- });
-
- $(".new_comment").live("submit", function(evt){
- evt.preventDefault();
- var form = $(this);
-
- $.post(form.attr('action')+"?format=mobile", form.serialize(), function(data){
- var bottomBar = form.closest('.bottom_bar').first(),
- container = bottomBar.find('.add_comment_bottom_link_container'),
- commentActionLink = bottomBar.find("a.comment_action").first();
- reactionLink = bottomBar.find(".show_comments").first(),
- commentCount = bottomBar.find(".comment_count");
-
- if(container.length > 0) {
- container.before(data);
- form.remove();
- container.show();
-
- } else {
- var container = $("<div class='comments_container not_all_present'></div>"),
- comments = $("<ul class='comments'></ul>");
-
- comments.html(data);
- container.append(comments);
- form.remove();
- container.appendTo(bottomBar)
- }
-
- reactionLink.text(reactionLink.text().replace(/(\d+)/, function(match){ return parseInt(match) + 1; }));
- commentCount.text(commentCount.text().replace(/(\d+)/, function(match){ return parseInt(match) + 1; }));
- commentActionLink.addClass("inactive");
- }, 'html');
- });
-
-
- $(".service_icon").bind("tap click", function(evt) {
- var service = $(this).toggleClass("dim"),
- selectedServices = $("#new_status_message .service_icon:not(.dim)"),
- provider = service.attr("id"),
- hiddenField = $("#new_status_message input[name='services[]'][value='" + provider + "']"),
- publisherMaxChars = 40000,
- serviceMaxChars;
-
-
- $("#new_status_message .counter").remove();
-
- $.each(selectedServices, function() {
- serviceMaxChars = parseInt($(this).attr("maxchar"));
- if(publisherMaxChars > serviceMaxChars) {
- publisherMaxChars = serviceMaxChars;
- }
- });
-
- $('#status_message_text').charCount({allowed: publisherMaxChars, warning: publisherMaxChars/10 });
-
- if(hiddenField.length > 0) { hiddenField.remove(); }
- else {
- $("#new_status_message").append(
- $("<input/>", {
- name: "services[]",
- type: "hidden",
- value: provider
- })
- );
- }
- });
-
- $("#submit_new_message").bind("tap click", function(evt){
- evt.preventDefault();
- $("#new_status_message").submit();
- });
-
-});
diff --git a/public/javascripts/pages/aspects-index.js b/public/javascripts/pages/aspects-index.js
deleted file mode 100644
index c25257759..000000000
--- a/public/javascripts/pages/aspects-index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Diaspora.Pages.AspectsIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav"));
- });
-};
diff --git a/public/javascripts/pages/contacts-index.js b/public/javascripts/pages/contacts-index.js
deleted file mode 100644
index ac2e37eeb..000000000
--- a/public/javascripts/pages/contacts-index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-Diaspora.Pages.ContactsIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.infiniteScroll = self.instantiate("InfiniteScroll");
- $('.conversation_button').twipsy({position: 'below'});
- });
-
-};
diff --git a/public/javascripts/pages/featured-users-index.js b/public/javascripts/pages/featured-users-index.js
deleted file mode 100644
index 34cf8a8c4..000000000
--- a/public/javascripts/pages/featured-users-index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Diaspora.Pages.FeaturedUsersIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.infiniteScroll = self.instantiate("InfiniteScroll");
- });
-};
diff --git a/public/javascripts/pages/invitations-edit.js b/public/javascripts/pages/invitations-edit.js
deleted file mode 100644
index 8f8797294..000000000
--- a/public/javascripts/pages/invitations-edit.js
+++ /dev/null
@@ -1,8 +0,0 @@
-Diaspora.Pages.InvitationsEdit = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, body) {
- jQuery.ajaxSetup({'cache': true});
- $('#user_username').twipsy({trigger: 'select', placement: 'right'});
- });
-};
diff --git a/public/javascripts/pages/invitations-new.js b/public/javascripts/pages/invitations-new.js
deleted file mode 100644
index 4507695f8..000000000
--- a/public/javascripts/pages/invitations-new.js
+++ /dev/null
@@ -1,12 +0,0 @@
-Diaspora.Pages.InvitationsNew = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- var rtl = $('html').attr('dir') == 'rtl',
- position = rtl ? 'left' : 'right';
-
- $('#new_user [title]').twipsy({trigger: 'focus', placement: position});
- $('#user_email').focus();
- });
-};
-
diff --git a/public/javascripts/pages/notifications-index.js b/public/javascripts/pages/notifications-index.js
deleted file mode 100644
index f66c9adfd..000000000
--- a/public/javascripts/pages/notifications-index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-Diaspora.Pages.NotificationsIndex = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.infiniteScroll = self.instantiate("InfiniteScroll");
- self.instantiate("TimeAgo", document.find("abbr.timeago"));
- });
-};
diff --git a/public/javascripts/pages/services-finder.js b/public/javascripts/pages/services-finder.js
deleted file mode 100644
index b9a9b547b..000000000
--- a/public/javascripts/pages/services-finder.js
+++ /dev/null
@@ -1,7 +0,0 @@
-Diaspora.Pages.ServicesFinder = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, document) {
- self.infiniteScroll = self.instantiate("InfiniteScroll");
- });
-};
diff --git a/public/javascripts/pages/users-getting-started.js b/public/javascripts/pages/users-getting-started.js
deleted file mode 100644
index ec59feb8f..000000000
--- a/public/javascripts/pages/users-getting-started.js
+++ /dev/null
@@ -1,81 +0,0 @@
-Diaspora.Pages.UsersGettingStarted = function() {
- var self = this;
-
- this.subscribe("page/ready", function(evt, body) {
- self.peopleSearch = self.instantiate("Search", body.find("form.people.search_form"));
- self.tagSearch = self.instantiate("Search", body.find("form.tag_input.search_form"));
-
- $('#edit_profile').bind('ajax:success', function(evt, data, status, xhr){
- $('#gs-name-form-spinner').addClass("hidden");
- $('.profile .saved').show();
- $('.profile .saved').fadeOut(2000);
- });
-
- // It seems that the default behavior of rails ujs is to clear the remote form
- $('#edit_profile').bind('ajax:complete', function(evt, xhr, status){
- var firstNameField = $("#profile_first_name");
- firstNameField.val(firstNameField.data("cachedValue"));
-
- /* flash message prompt */
- var message = Diaspora.I18n.t("getting_started.hey", {'name': $("#profile_first_name").val()});
- Diaspora.page.flashMessages.render({success: true, notice: message});
- });
-
- $("#profile_first_name").bind("change", function(){
- $(this).data("cachedValue", $(this).val());
- $('#edit_profile').submit();
- $('#gs-name-form-spinner').removeClass("hidden");
- });
-
- $("#profile_first_name").bind("blur", function(){
- $(this).removeClass("active_input");
- });
-
- $("#profile_first_name").bind("focus", function(){
- $(this).addClass("active_input");
- });
-
- $("#awesome_button").bind("click", function(evt){
- evt.preventDefault();
-
- var confirmMessage = Diaspora.I18n.t("getting_started.no_tags");
-
- if(($("#as-selections-tags").find(".as-selection-item").length > 0) || confirm(confirmMessage)) {
- $('.tag_input').submit();
-
- /* flash message prompt */
- var message = Diaspora.I18n.t("getting_started.preparing_your_stream");
- Diaspora.page.flashMessages.render({success: true, notice: message});
- } else {
- /* flash message prompt */
- var message = Diaspora.I18n.t("getting_started.alright_ill_wait");
- Diaspora.page.flashMessages.render({success: true, notice: message});
- }
- });
-
- /* ------ */
- var autocompleteInput = $("#follow_tags");
-
- autocompleteInput.autoSuggest("/tags", {
- selectedItemProp: "name",
- searchObjProps: "name",
- asHtmlID: "tags",
- neverSubmit: true,
- retriveLimit: 10,
- selectionLimit: false,
- minChars: 2,
- keyDelay: 200,
- startText: "",
- emptyText: "no_results"
- });
-
- autocompleteInput.bind('keydown', function(evt){
- if(evt.keyCode == 13 || evt.keyCode == 9 || evt.keyCode == 32){
- evt.preventDefault();
- if( $('li.as-result-item.active').length == 0 ){
- $('li.as-result-item').first().click();
- }
- }
- });
- });
-};
diff --git a/public/javascripts/photo-show.js b/public/javascripts/photo-show.js
deleted file mode 100644
index d10e40094..000000000
--- a/public/javascripts/photo-show.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-$(document).ready(function() {
-
- //edit photo
- $("#edit_photo_toggle").bind('click', function(evt) {
- evt.preventDefault();
- $("#photo_edit_options").toggle();
- $(".edit_photo input:text").first().focus();
- });
-
- $('.edit_photo').bind('ajax:loading', function(data, json, xhr) {
- $("#photo_edit_options").toggle();
- $("#photo_spinner").show();
- $("#show_photo").find("img").fadeTo(200,0.3);
- });
-
- $('.edit_photo').bind('ajax:failure', function(data, json, xhr) {
- Diaspora.Alert.show("Failed to delete photo.", "Are you sure you own this?");
- $("#show_photo").find("img").fadeTo(200,1);
- $("#photo_spinner").hide();
- });
-
- $('.edit_photo').bind('ajax:success', function(data, json, xhr) {
- json = $.parseJSON(json);
- $(".edit_photo input:text").val(json.photo.text);
- $("#caption").html(json.photo.text);
- $("#show_photo").find("img").fadeTo(200,1);
- $("#photo_spinner").hide();
- });
-
- // make profile photo
- $('.make_profile_photo').bind('ajax:loading', function(data, json, xhr) {
- var person_id = $(this).closest(".photo_options").attr('data-actor_person');
-
- $("img[data-person_id='" + person_id + "']").fadeTo(200, 0.3);
- });
-
- $('.make_profile_photo').bind('ajax:success', function(data, json, xhr) {
- json = $.parseJSON(json);
-
- $("img[data-person_id='" + json.person_id + "']").fadeTo(200, 1).attr('src', json.image_url_small);
- });
-
- $('.make_profile_photo').bind('ajax:failure', function(data, json, xhr) {
- var person_id = $(this).closest(".photo_options").attr('data-actor_person');
- Diaspora.Alert.show("Failed to update profile photo!");
- $("img[data-person_id='" + person_id + "']").fadeTo(200, 1);
- });
-
- // right/left hotkeys
- $(document).keyup(function(e){
- if(!$(e.target).hasClass('comment_box')){
- //left
- if(e.keyCode == 37) {
- if( $("#photo_show_left").length > 0 ){
- document.location = $("#photo_show_left").attr('href');
- }
-
- //right
- } else if(e.keyCode == 39) {
- if( $("#photo_show_right").length > 0 ){
- document.location = $("#photo_show_right").attr('href');
- }
- }
- }
- });
-
-});
diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js
deleted file mode 100644
index 44552f65b..000000000
--- a/public/javascripts/publisher.js
+++ /dev/null
@@ -1,221 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-//TODO: make this a widget
-var Publisher = {
- bookmarklet : false,
-
- form: function(){
- return Publisher.cachedForm = Publisher.cachedForm || $('#publisher');
- },
-
- input: function(){
- return Publisher.cachedInput = Publisher.cachedInput || Publisher.form().find('#status_message_fake_text');
- },
-
- wrapper: function(){
- return Publisher.cachedWrapper = Publisher.cachedWrapper || Publisher.form().find('#publisher_textarea_wrapper');
- },
-
- hiddenInput: function(){
- return Publisher.cachedHiddenInput= Publisher.cachedHiddenInput || Publisher.form().find('#status_message_text');
- },
-
- submit: function(){
- return Publisher.cachedSubmit = Publisher.cachedSubmit || Publisher.form().find("input[type='submit']");
- },
-
- determineSubmitAvailability: function(){
- var onlyWhitespaces = ($.trim(Publisher.input().val()) === ''),
- isSubmitDisabled = Publisher.submit().attr('disabled'),
- isPhotoAttached = ($("#photodropzone").children().length > 0);
-
- if ((onlyWhitespaces && !isPhotoAttached) && !isSubmitDisabled) {
- Publisher.submit().attr('disabled', 'disabled');
- } else if ((!onlyWhitespaces || isPhotoAttached) && isSubmitDisabled) {
- Publisher.submit().removeAttr('disabled');
- }
- },
-
- clear: function(){
- $("#photodropzone").find('li').remove();
- Publisher.input().mentionsInput("reset");
- Publisher.wrapper().removeClass("with_attachments");
- Publisher.hiddenInput().val('');
- Publisher.determineSubmitAvailability()
- },
-
- bindServiceIcons: function(){
- $(".service_icon").bind("click", function(evt){
- $(this).toggleClass("dim");
- Publisher.toggleServiceField($(this));
- });
- },
-
- toggleServiceField: function(service){
- Publisher.createCounter(service);
-
- var provider = service.attr('id');
- var hidden_field = $('#publisher [name="services[]"][value="'+provider+'"]');
- if(hidden_field.length > 0){
- hidden_field.remove();
- } else {
- $("#publisher .content_creation form").append(
- '<input id="services_" name="services[]" type="hidden" value="'+provider+'">');
- }
- },
-
- isPublicPost: function(){
- return $('#publisher [name="aspect_ids[]"]').first().val() == "public";
- },
-
- isToAllAspects: function(){
- return $('#publisher [name="aspect_ids[]"]').first().val() == "all_aspects";
- },
-
- selectedAspectIds: function() {
- var aspects = $('#publisher [name="aspect_ids[]"]');
- var aspectIds = [];
- aspects.each(function() { aspectIds.push( parseInt($(this).attr('value'))); });
- return aspectIds;
- },
-
- removeRadioSelection: function(hiddenFields){
- $.each(hiddenFields, function(index, value){
- var el = $(value);
-
- if(el.val() == "all_aspects" || el.val() == "public") {
- el.remove();
- }
- });
- },
-
- toggleAspectIds: function(li) {
- var aspectId = li.attr('data-aspect_id'),
- hiddenFields = $('#publisher [name="aspect_ids[]"]'),
- appendId = function(){
- $("#publisher .content_creation form").append(
- '<input id="aspect_ids_" name="aspect_ids[]" type="hidden" value="'+aspectId+'">');
- };
-
- if(li.hasClass('radio')){
- $.each(hiddenFields, function(index, value){
- $(value).remove();
- });
- appendId();
-
- // close dropdown after selecting a binary option
- li.closest('.dropdown').removeClass('active');
-
- } else {
- var hiddenField = $('#publisher [name="aspect_ids[]"][value="'+aspectId+'"]');
-
- // remove all radio selections
- Publisher.removeRadioSelection(hiddenFields);
-
- if(hiddenField.length > 0){
- hiddenField.remove();
- } else {
- appendId();
- }
- }
- },
-
- createCounter: function(service){
- var counter = $("#publisher .counter");
- counter.remove();
-
- var min = 40000;
- var a = $('.service_icon:not(.dim)');
- if(a.length > 0){
- $.each(a, function(index, value){
- var num = parseInt($(value).attr('maxchar'));
- if (min > num) { min = num; }
- });
- $('#status_message_fake_text').charCount({allowed: min, warning: min/10 });
- }
- },
-
- bindAspectToggles: function() {
- $('#publisher .dropdown .dropdown_list li').bind("click", function(evt){
- var li = $(this),
- button = li.parent('.dropdown').find('.button');
-
- if(li.hasClass('radio')){
- AspectsDropdown.toggleRadio(li);
- } else {
- AspectsDropdown.toggleCheckbox(li);
- }
-
- AspectsDropdown.updateNumber(li.closest(".dropdown_list"), null, li.parent().find('li.selected').length, '');
-
- Publisher.toggleAspectIds(li);
- });
- },
-
- textChange : function(){
- Publisher.determineSubmitAvailability();
- Publisher.input().mentionsInput("val", function(value) {
- Publisher.hiddenInput().val(value);
- });
- },
-
- triggerGettingStarted: function(){
- Publisher.setUpPopovers("#publisher .dropdown", {trigger: 'manual', offset: 10, id: "message_visibility_explain", placement:'below', html:true}, 1000);
- Publisher.setUpPopovers("#publisher #status_message_fake_text", {trigger: 'manual', placement: 'right', offset: 30, id: "first_message_explain", html:true}, 600);
- Publisher.setUpPopovers("#gs-shim", {trigger: 'manual', placement: 'left', id:"stream_explain", offset: -5, html:true}, 1400);
-
- $("#publisher .button.creation").bind("click", function(){
- $("#publisher .dropdown").popover("hide");
- $("#publisher #status_message_fake_text").popover("hide");
- });
- },
-
- setUpPopovers: function(selector, options, timeout){
- var selection = $(selector);
- selection.popover(options);
- selection.bind("click", function(){$(this).popover("hide")});
-
- setTimeout(function(){
- selection.popover("show");
-
- var popup = selection.data('popover').$tip[0],
- closeIcon = $(popup).find(".close");
-
- closeIcon.bind("click",function(){
- if($(".popover").length == 1){
- $.get("/getting_started_completed");
- };
- selection.popover("hide");
- });
- }, timeout);
- },
-
- initialize: function() {
- Publisher.cachedForm = Publisher.cachedSubmit =
- Publisher.cachedInput = Publisher.cachedHiddenInput = false;
-
- Publisher.bindServiceIcons();
- Publisher.bindAspectToggles();
-
- Mentions.initialize(Publisher.input());
-
- Publisher.input().bind("focus", function(){
- Mentions.fetchContacts();
- })
-
- if(Publisher.hiddenInput().val() === "") {
- Publisher.hiddenInput().val(Publisher.input().val());
- }
-
- Publisher.input().autoResize({'extraSpace' : 10});
- Publisher.input().bind('textchange', Publisher.textChange);
- }
-};
-
-$(document).ready(function() {
- Publisher.initialize();
- Diaspora.page.subscribe("stream/reloaded", Publisher.initialize);
-});
diff --git a/public/javascripts/rails.validations.js b/public/javascripts/rails.validations.js
deleted file mode 100644
index c11030d24..000000000
--- a/public/javascripts/rails.validations.js
+++ /dev/null
@@ -1,404 +0,0 @@
-/*!
- * Rails 3 Client Side Validations - v3.1.0
- * https://github.com/bcardarlela/client_side_validations
- *
- * Copyright (c) 2011 Brian Cardarella
- * Licensed under the MIT license
- * http://www.opensource.org/licenses/mit-license.php
- */
-
-(function($) {
- $.fn.validate = function() {
- return this.filter('form[data-validate]').each(function() {
- var form = $(this);
- var settings = window[form.attr('id')];
-
- // Set up the events for the form
- form
- .submit(function() { return form.isValid(settings.validators); })
- .bind('ajax:beforeSend', function() { return form.isValid(settings.validators); })
- // Callbacks
- .bind('form:validate:after', function(eventData) { clientSideValidations.callbacks.form.after( form, eventData); })
- .bind('form:validate:before', function(eventData) { clientSideValidations.callbacks.form.before(form, eventData); })
- .bind('form:validate:fail', function(eventData) { clientSideValidations.callbacks.form.fail( form, eventData); })
- .bind('form:validate:pass', function(eventData) { clientSideValidations.callbacks.form.pass( form, eventData); })
-
- // Set up the events for each validatable form element
- .find('[data-validate]:input:not(:radio)')
- .live('focusout', function() { $(this).isValid(settings.validators); })
- .live('change', function() { $(this).data('changed', true); })
- // Callbacks
- .live('element:validate:after', function(eventData) { clientSideValidations.callbacks.element.after( $(this), eventData); })
- .live('element:validate:before', function(eventData) { clientSideValidations.callbacks.element.before($(this), eventData); })
- .live('element:validate:fail', function(eventData, message) {
- var element = $(this);
- clientSideValidations.callbacks.element.fail(element, message, function() {
- addError(element, message);
- }, eventData) })
- .live('element:validate:pass', function(eventData) {
- var element = $(this);
- clientSideValidations.callbacks.element.pass(element, function() {
- removeError(element);
- }, eventData) })
- // Checkboxes - Live events don't support filter
- .end().find('[data-validate]:checkbox')
- .live('click', function() { $(this).isValid(settings.validators); })
- // Inputs for confirmations
- .end().find('[id*=_confirmation]').each(function() {
- var confirmationElement = $(this),
- element = form.find('#' + this.id.match(/(.+)_confirmation/)[1] + '[data-validate]:input');
-
- if (element[0]) {
- $('#' + confirmationElement.attr('id'))
- .live('focusout', function() {
- element.data('changed', true).isValid(settings.validators);
- })
- .live('keyup', function() {
- element.data('changed', true).isValid(settings.validators);
- })
- }
- });
-
- var addError = function(element, message) {
- clientSideValidations.formBuilders[settings.type].add(element, settings, message);
- }
-
- var removeError = function(element) {
- clientSideValidations.formBuilders[settings.type].remove(element, settings);
- }
- });
- }
-
- $.fn.isValid = function(validators) {
- if ($(this[0]).is('form')) {
- return validateForm($(this[0]), validators);
- } else {
- return validateElement($(this[0]), validators[this[0].name]);
- }
- }
-
- var validateForm = function(form, validators) {
- var valid = true;
-
- form.trigger('form:validate:before').find('[data-validate]:input').each(function() {
- if (!$(this).isValid(validators)) { valid = false; }
- });
-
- if (valid) {
- form.trigger('form:validate:pass');
- } else {
- form.trigger('form:validate:fail');
- }
-
- form.trigger('form:validate:after');
- return valid;
- }
-
- var validateElement = function(element, validators) {
- element.trigger('element:validate:before');
-
- if (element.data('changed') !== false) {
- var valid = true;
- element.data('changed', false);
-
- // Because 'length' is defined on the list of validators we cannot call jQuery.each on
- // the clientSideValidations.validators.all() object
- for (kind in clientSideValidations.validators.all()) {
- if (validators[kind] && (message = clientSideValidations.validators.all()[kind](element, validators[kind]))) {
- element.trigger('element:validate:fail', message).data('valid', false);
- valid = false;
- break;
- }
- }
-
- if (valid) { element.data('valid', null); element.trigger('element:validate:pass'); }
- }
-
- element.trigger('element:validate:after');
- return element.data('valid') === false ? false : true;
- }
-
- // Main hook
- // If new forms are dynamically introduced into the DOM the .validate() method
- // must be invoked on that form
- $(function() { $('form[data-validate]').validate(); })
-})(jQuery);
-
-var clientSideValidations = {
- validators: {
- all: function() { return jQuery.extend({}, clientSideValidations.validators.local, clientSideValidations.validators.remote) },
- local: {
- presence: function(element, options) {
- if (/^\s*$/.test(element.val() || "")) {
- return options.message;
- }
- },
- acceptance: function(element, options) {
- switch (element.attr('type')) {
- case 'checkbox':
- if (!element.attr('checked')) {
- return options.message;
- }
- break;
- case 'text':
- if (element.val() != (options.accept || '1')) {
- return options.message;
- }
- break;
- }
- },
- format: function(element, options) {
- if ((message = this.presence(element, options)) && options.allow_blank == true) {
- return;
- } else if (message) {
- return message;
- } else {
- if (options['with'] && !options['with'].test(element.val())) {
- return options.message;
- } else if (options['without'] && options['without'].test(element.val())) {
- return options.message;
- }
- }
- },
- numericality: function(element, options) {
- if (!/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d*)?$/.test(element.val())) {
- return options.messages.numericality;
- }
-
- if (options.only_integer && !/^\d+$/.test(element.val())) {
- return options.messages.only_integer;
- }
-
- var CHECKS = { greater_than: '>', greater_than_or_equal_to: '>=',
- equal_to: '==', less_than: '<', less_than_or_equal_to: '<=' }
-
- for (var check in CHECKS) {
- if (options[check] != undefined && !(new Function("return " + element.val() + CHECKS[check] + options[check])())) {
- return options.messages[check];
- }
- }
-
- if (options.odd && !(parseInt(element.val()) % 2)) {
- return options.messages.odd;
- }
-
- if (options.even && (parseInt(element.val()) % 2)) {
- return options.messages.even;
- }
- },
- length: function(element, options) {
- var blankOptions = {};
- if (options.is) {
- blankOptions.message = options.messages.is;
- } else if (options.minimum) {
- blankOptions.message = options.messages.minimum;
- }
- if ((message = this.presence(element, blankOptions)) && options.allow_blank == true) {
- return;
- } else if (message) {
- return message;
- } else {
- var CHECKS = { is: '==', minimum: '>=', maximum: '<=' }
- var tokenizer = options.js_tokenizer || "split('')";
- var tokenized_length = new Function("element", "return (element.val()." + tokenizer + " || '').length;")(element);
-
- for (var check in CHECKS) {
- if (options[check] && !(new Function("return " + tokenized_length + CHECKS[check] + options[check])())) {
- return options.messages[check];
- }
- }
- }
- },
- exclusion: function(element, options) {
- if ((message = this.presence(element, options)) && options.allow_blank == true) {
- return;
- } else if (message) {
- return message;
- } else {
- if (options['in']) {
- for (var i = 0; i < options['in'].length; i++) {
- if (options['in'][i] == element.val()) {
- return options.message;
- }
- }
- } else if (options['range']) {
- var lower = options['range'][0],
- upper = options['range'][1];
- if (element.val() >= lower && element.val() <= upper) {
- return options.message;
- }
- }
- }
- },
- inclusion: function(element, options) {
- if ((message = this.presence(element, options)) && options.allow_blank == true) {
- return;
- } else if (message) {
- return message;
- } else {
- if (options['in']) {
- for (var i = 0; i < options['in'].length; i++) {
- if (options['in'][i] == element.val()) {
- return;
- }
- }
- return options.message;
- } else if (options['range']) {
- var lower = options['range'][0],
- upper = options['range'][1];
-
- if (element.val() >= lower && element.val() <= upper) {
- return;
- } else {
- return options.message;
- }
- }
- }
- },
- confirmation: function(element, options) {
- if (element.val() != jQuery('#' + element.attr('id') + '_confirmation').val()) {
- return options.message;
- }
- }
- },
- remote: {
- uniqueness: function(element, options) {
- var data = {};
- data['case_sensitive'] = !!options.case_sensitive;
- if (options.id) {
- data['id'] = options.id;
- }
-
- if (options.scope) {
- data.scope = {}
- for (key in options.scope) {
- var scoped_element = jQuery('[name="' + element.attr('name').replace(/\[\w+]$/, '[' + key + ']' + '"]'));
- if (scoped_element[0] && scoped_element.val() != options.scope[key]) {
- data.scope[key] = scoped_element.val();
- scoped_element.unbind('change.' + element.id).bind('change.' + element.id, function() { element.trigger('change'); element.trigger('focusout'); });
- } else {
- data.scope[key] = options.scope[key];
- }
- }
- }
-
- // Kind of a hack but this will isolate the resource name and attribute.
- // e.g. user[records_attributes][0][title] => records[title]
- // e.g. user[record_attributes][title] => record[title]
- // Server side handles classifying the resource properly
- if (/_attributes]/.test(element.attr('name'))) {
- var name = element.attr('name').match(/\[\w+_attributes]/g).pop().match(/\[(\w+)_attributes]/).pop();
- name += /(\[\w+])$/.exec(element.attr('name'))[1];
- } else {
- var name = element.attr('name');
- }
-
- // Override the name if a nested module class is passed
- if (options['class']) {
- name = options['class'] + '[' + name.split('[')[1]
- }
- data[name] = element.val();
-
- if (jQuery.ajax({
- url: '/validators/uniqueness',
- data: data,
- async: false
- }).status == 200) {
- return options.message;
- }
- }
- }
- },
- formBuilders: {
- 'ActionView::Helpers::FormBuilder': {
- add: function(element, settings, message) {
- if (element.data('valid') !== false && jQuery('label.message[for="' + element.attr('id') + '"]')[0] == undefined) {
- var inputErrorField = jQuery(settings.input_tag),
- labelErrorField = jQuery(settings.label_tag),
- label = jQuery('label[for="' + element.attr('id') + '"]:not(.message)');
-
- if (element.attr('autofocus')) { element.attr('autofocus', false) };
- element.before(inputErrorField);
- inputErrorField.find('span#input_tag').replaceWith(element);
- inputErrorField.find('label.message').attr('for', element.attr('id'));
- labelErrorField.find('label.message').attr('for', element.attr('id'));
- label.replaceWith(labelErrorField);
- labelErrorField.find('label#label_tag').replaceWith(label);
- }
- jQuery('label.message[for="' + element.attr('id') + '"]').text(message);
- },
- remove: function(element, settings) {
- var errorFieldClass = jQuery(settings.input_tag).attr('class'),
- inputErrorField = element.closest('.' + errorFieldClass),
- label = jQuery('label[for="' + element.attr('id') + '"]:not(.message)'),
- labelErrorField = label.closest('.' + errorFieldClass);
-
- if (inputErrorField[0]) {
- inputErrorField.find('#' + element.attr('id')).detach();
- inputErrorField.replaceWith(element);
- label.detach();
- labelErrorField.replaceWith(label);
- }
- }
- },
- 'SimpleForm::FormBuilder': {
- add: function(element, settings, message) {
- if (element.data('valid') !== false) {
- var wrapper = element.closest(settings.wrapper_tag);
- wrapper.addClass(settings.wrapper_error_class);
- var errorElement = $('<' + settings.error_tag + ' class="' + settings.error_class + '">' + message + '</' + settings.error_tag + '>');
- wrapper.append(errorElement);
- } else {
- element.parent().find(settings.error_tag + '.' + settings.error_class).text(message);
- }
- },
- remove: function(element, settings) {
- var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_error_class);
- wrapper.removeClass(settings.wrapper_error_class);
- var errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class);
- errorElement.remove();
- }
-
- },
- 'Formtastic::FormBuilder': {
- add: function(element, settings, message) {
- if (element.data('valid') !== false) {
- var wrapper = element.closest('li');
- wrapper.addClass('error');
- var errorElement = $('<p class="' + settings.inline_error_class + '">' + message + '</p>');
- wrapper.append(errorElement);
- } else {
- element.parent().find('p.' + settings.inline_error_class).text(message);
- }
- },
- remove: function(element, settings) {
- var wrapper = element.closest('li.error');
- wrapper.removeClass('error');
- var errorElement = wrapper.find('p.' + settings.inline_error_class);
- errorElement.remove();
- }
- },
- 'NestedForm::Builder': {
- add: function(element, settings, message) {
- clientSideValidations.formBuilders['ActionView::Helpers::FormBuilder'].add(element, settings, message);
- },
- remove: function(element, settings, message) {
- clientSideValidations.formBuilders['ActionView::Helpers::FormBuilder'].remove(element, settings, message);
- }
- }
- },
- callbacks: {
- element: {
- after: function(element, eventData) { },
- before: function(element, eventData) { },
- fail: function(element, message, addError, eventData) { addError() },
- pass: function(element, removeError, eventData) { removeError() }
- },
- form: {
- after: function(form, eventData) { },
- before: function(form, eventData) { },
- fail: function(form, eventData) { },
- pass: function(form, eventData) { }
- }
- }
-};
diff --git a/public/javascripts/vendor/backbone.js b/public/javascripts/vendor/backbone.js
deleted file mode 100644
index b2e49322b..000000000
--- a/public/javascripts/vendor/backbone.js
+++ /dev/null
@@ -1,1158 +0,0 @@
-// Backbone.js 0.5.3
-// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
-// Backbone may be freely distributed under the MIT license.
-// For all details and documentation:
-// http://documentcloud.github.com/backbone
-
-(function(){
-
- // Initial Setup
- // -------------
-
- // Save a reference to the global object.
- var root = this;
-
- // Save the previous value of the `Backbone` variable.
- var previousBackbone = root.Backbone;
-
- // The top-level namespace. All public Backbone classes and modules will
- // be attached to this. Exported for both CommonJS and the browser.
- var Backbone;
- if (typeof exports !== 'undefined') {
- Backbone = exports;
- } else {
- Backbone = root.Backbone = {};
- }
-
- // Current version of the library. Keep in sync with `package.json`.
- Backbone.VERSION = '0.5.3';
-
- // Require Underscore, if we're on the server, and it's not already present.
- var _ = root._;
- if (!_ && (typeof require !== 'undefined')) _ = require('underscore')._;
-
- // For Backbone's purposes, jQuery or Zepto owns the `$` variable.
- var $ = root.jQuery || root.Zepto;
-
- // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
- // to its previous owner. Returns a reference to this Backbone object.
- Backbone.noConflict = function() {
- root.Backbone = previousBackbone;
- return this;
- };
-
- // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option will
- // fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and set a
- // `X-Http-Method-Override` header.
- Backbone.emulateHTTP = false;
-
- // Turn on `emulateJSON` to support legacy servers that can't deal with direct
- // `application/json` requests ... will encode the body as
- // `application/x-www-form-urlencoded` instead and will send the model in a
- // form param named `model`.
- Backbone.emulateJSON = false;
-
- // Backbone.Events
- // -----------------
-
- // A module that can be mixed in to *any object* in order to provide it with
- // custom events. You may `bind` or `unbind` a callback function to an event;
- // `trigger`-ing an event fires all callbacks in succession.
- //
- // var object = {};
- // _.extend(object, Backbone.Events);
- // object.bind('expand', function(){ alert('expanded'); });
- // object.trigger('expand');
- //
- Backbone.Events = {
-
- // Bind an event, specified by a string name, `ev`, to a `callback` function.
- // Passing `"all"` will bind the callback to all events fired.
- bind : function(ev, callback, context) {
- var calls = this._callbacks || (this._callbacks = {});
- var list = calls[ev] || (calls[ev] = []);
- list.push([callback, context]);
- return this;
- },
-
- // Remove one or many callbacks. If `callback` is null, removes all
- // callbacks for the event. If `ev` is null, removes all bound callbacks
- // for all events.
- unbind : function(ev, callback) {
- var calls;
- if (!ev) {
- this._callbacks = {};
- } else if (calls = this._callbacks) {
- if (!callback) {
- calls[ev] = [];
- } else {
- var list = calls[ev];
- if (!list) return this;
- for (var i = 0, l = list.length; i < l; i++) {
- if (list[i] && callback === list[i][0]) {
- list[i] = null;
- break;
- }
- }
- }
- }
- return this;
- },
-
- // Trigger an event, firing all bound callbacks. Callbacks are passed the
- // same arguments as `trigger` is, apart from the event name.
- // Listening for `"all"` passes the true event name as the first argument.
- trigger : function(eventName) {
- var list, calls, ev, callback, args;
- var both = 2;
- if (!(calls = this._callbacks)) return this;
- while (both--) {
- ev = both ? eventName : 'all';
- if (list = calls[ev]) {
- for (var i = 0, l = list.length; i < l; i++) {
- if (!(callback = list[i])) {
- list.splice(i, 1); i--; l--;
- } else {
- args = both ? Array.prototype.slice.call(arguments, 1) : arguments;
- callback[0].apply(callback[1] || this, args);
- }
- }
- }
- }
- return this;
- }
-
- };
-
- // Backbone.Model
- // --------------
-
- // Create a new model, with defined attributes. A client id (`cid`)
- // is automatically generated and assigned for you.
- Backbone.Model = function(attributes, options) {
- var defaults;
- attributes || (attributes = {});
- if (defaults = this.defaults) {
- if (_.isFunction(defaults)) defaults = defaults.call(this);
- attributes = _.extend({}, defaults, attributes);
- }
- this.attributes = {};
- this._escapedAttributes = {};
- this.cid = _.uniqueId('c');
- this.set(attributes, {silent : true});
- this._changed = false;
- this._previousAttributes = _.clone(this.attributes);
- if (options && options.collection) this.collection = options.collection;
- this.initialize(attributes, options);
- };
-
- // Attach all inheritable methods to the Model prototype.
- _.extend(Backbone.Model.prototype, Backbone.Events, {
-
- // A snapshot of the model's previous attributes, taken immediately
- // after the last `"change"` event was fired.
- _previousAttributes : null,
-
- // Has the item been changed since the last `"change"` event?
- _changed : false,
-
- // The default name for the JSON `id` attribute is `"id"`. MongoDB and
- // CouchDB users may want to set this to `"_id"`.
- idAttribute : 'id',
-
- // Initialize is an empty function by default. Override it with your own
- // initialization logic.
- initialize : function(){},
-
- // Return a copy of the model's `attributes` object.
- toJSON : function() {
- return _.clone(this.attributes);
- },
-
- // Get the value of an attribute.
- get : function(attr) {
- return this.attributes[attr];
- },
-
- // Get the HTML-escaped value of an attribute.
- escape : function(attr) {
- var html;
- if (html = this._escapedAttributes[attr]) return html;
- var val = this.attributes[attr];
- return this._escapedAttributes[attr] = escapeHTML(val == null ? '' : '' + val);
- },
-
- // Returns `true` if the attribute contains a value that is not null
- // or undefined.
- has : function(attr) {
- return this.attributes[attr] != null;
- },
-
- // Set a hash of model attributes on the object, firing `"change"` unless you
- // choose to silence it.
- set : function(attrs, options) {
-
- // Extract attributes and options.
- options || (options = {});
- if (!attrs) return this;
- if (attrs.attributes) attrs = attrs.attributes;
- var now = this.attributes, escaped = this._escapedAttributes;
-
- // Run validation.
- if (!options.silent && this.validate && !this._performValidation(attrs, options)) return false;
-
- // Check for changes of `id`.
- if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
-
- // We're about to start triggering change events.
- var alreadyChanging = this._changing;
- this._changing = true;
-
- // Update attributes.
- for (var attr in attrs) {
- var val = attrs[attr];
- if (!_.isEqual(now[attr], val)) {
- now[attr] = val;
- delete escaped[attr];
- this._changed = true;
- if (!options.silent) this.trigger('change:' + attr, this, val, options);
- }
- }
-
- // Fire the `"change"` event, if the model has been changed.
- if (!alreadyChanging && !options.silent && this._changed) this.change(options);
- this._changing = false;
- return this;
- },
-
- // Remove an attribute from the model, firing `"change"` unless you choose
- // to silence it. `unset` is a noop if the attribute doesn't exist.
- unset : function(attr, options) {
- if (!(attr in this.attributes)) return this;
- options || (options = {});
- var value = this.attributes[attr];
-
- // Run validation.
- var validObj = {};
- validObj[attr] = void 0;
- if (!options.silent && this.validate && !this._performValidation(validObj, options)) return false;
-
- // Remove the attribute.
- delete this.attributes[attr];
- delete this._escapedAttributes[attr];
- if (attr == this.idAttribute) delete this.id;
- this._changed = true;
- if (!options.silent) {
- this.trigger('change:' + attr, this, void 0, options);
- this.change(options);
- }
- return this;
- },
-
- // Clear all attributes on the model, firing `"change"` unless you choose
- // to silence it.
- clear : function(options) {
- options || (options = {});
- var attr;
- var old = this.attributes;
-
- // Run validation.
- var validObj = {};
- for (attr in old) validObj[attr] = void 0;
- if (!options.silent && this.validate && !this._performValidation(validObj, options)) return false;
-
- this.attributes = {};
- this._escapedAttributes = {};
- this._changed = true;
- if (!options.silent) {
- for (attr in old) {
- this.trigger('change:' + attr, this, void 0, options);
- }
- this.change(options);
- }
- return this;
- },
-
- // Fetch the model from the server. If the server's representation of the
- // model differs from its current attributes, they will be overriden,
- // triggering a `"change"` event.
- fetch : function(options) {
- options || (options = {});
- var model = this;
- var success = options.success;
- options.success = function(resp, status, xhr) {
- if (!model.set(model.parse(resp, xhr), options)) return false;
- if (success) success(model, resp);
- };
- options.error = wrapError(options.error, model, options);
- return (this.sync || Backbone.sync).call(this, 'read', this, options);
- },
-
- // Set a hash of model attributes, and sync the model to the server.
- // If the server returns an attributes hash that differs, the model's
- // state will be `set` again.
- save : function(attrs, options) {
- options || (options = {});
- if (attrs && !this.set(attrs, options)) return false;
- var model = this;
- var success = options.success;
- options.success = function(resp, status, xhr) {
- if (!model.set(model.parse(resp, xhr), options)) return false;
- if (success) success(model, resp, xhr);
- };
- options.error = wrapError(options.error, model, options);
- var method = this.isNew() ? 'create' : 'update';
- return (this.sync || Backbone.sync).call(this, method, this, options);
- },
-
- // Destroy this model on the server if it was already persisted. Upon success, the model is removed
- // from its collection, if it has one.
- destroy : function(options) {
- options || (options = {});
- if (this.isNew()) return this.trigger('destroy', this, this.collection, options);
- var model = this;
- var success = options.success;
- options.success = function(resp) {
- model.trigger('destroy', model, model.collection, options);
- if (success) success(model, resp);
- };
- options.error = wrapError(options.error, model, options);
- return (this.sync || Backbone.sync).call(this, 'delete', this, options);
- },
-
- // Default URL for the model's representation on the server -- if you're
- // using Backbone's restful methods, override this to change the endpoint
- // that will be called.
- url : function() {
- var base = getUrl(this.collection) || this.urlRoot || urlError();
- if (this.isNew()) return base;
- return base + (base.charAt(base.length - 1) == '/' ? '' : '/') + encodeURIComponent(this.id);
- },
-
- // **parse** converts a response into the hash of attributes to be `set` on
- // the model. The default implementation is just to pass the response along.
- parse : function(resp, xhr) {
- return resp;
- },
-
- // Create a new model with identical attributes to this one.
- clone : function() {
- return new this.constructor(this);
- },
-
- // A model is new if it has never been saved to the server, and lacks an id.
- isNew : function() {
- return this.id == null;
- },
-
- // Call this method to manually fire a `change` event for this model.
- // Calling this will cause all objects observing the model to update.
- change : function(options) {
- this.trigger('change', this, options);
- this._previousAttributes = _.clone(this.attributes);
- this._changed = false;
- },
-
- // Determine if the model has changed since the last `"change"` event.
- // If you specify an attribute name, determine if that attribute has changed.
- hasChanged : function(attr) {
- if (attr) return this._previousAttributes[attr] != this.attributes[attr];
- return this._changed;
- },
-
- // Return an object containing all the attributes that have changed, or false
- // if there are no changed attributes. Useful for determining what parts of a
- // view need to be updated and/or what attributes need to be persisted to
- // the server.
- changedAttributes : function(now) {
- now || (now = this.attributes);
- var old = this._previousAttributes;
- var changed = false;
- for (var attr in now) {
- if (!_.isEqual(old[attr], now[attr])) {
- changed = changed || {};
- changed[attr] = now[attr];
- }
- }
- return changed;
- },
-
- // Get the previous value of an attribute, recorded at the time the last
- // `"change"` event was fired.
- previous : function(attr) {
- if (!attr || !this._previousAttributes) return null;
- return this._previousAttributes[attr];
- },
-
- // Get all of the attributes of the model at the time of the previous
- // `"change"` event.
- previousAttributes : function() {
- return _.clone(this._previousAttributes);
- },
-
- // Run validation against a set of incoming attributes, returning `true`
- // if all is well. If a specific `error` callback has been passed,
- // call that instead of firing the general `"error"` event.
- _performValidation : function(attrs, options) {
- var error = this.validate(attrs);
- if (error) {
- if (options.error) {
- options.error(this, error, options);
- } else {
- this.trigger('error', this, error, options);
- }
- return false;
- }
- return true;
- }
-
- });
-
- // Backbone.Collection
- // -------------------
-
- // Provides a standard collection class for our sets of models, ordered
- // or unordered. If a `comparator` is specified, the Collection will maintain
- // its models in sort order, as they're added and removed.
- Backbone.Collection = function(models, options) {
- options || (options = {});
- if (options.comparator) this.comparator = options.comparator;
- _.bindAll(this, '_onModelEvent', '_removeReference');
- this._reset();
- if (models) this.reset(models, {silent: true});
- this.initialize.apply(this, arguments);
- };
-
- // Define the Collection's inheritable methods.
- _.extend(Backbone.Collection.prototype, Backbone.Events, {
-
- // The default model for a collection is just a **Backbone.Model**.
- // This should be overridden in most cases.
- model : Backbone.Model,
-
- // Initialize is an empty function by default. Override it with your own
- // initialization logic.
- initialize : function(){},
-
- // The JSON representation of a Collection is an array of the
- // models' attributes.
- toJSON : function() {
- return this.map(function(model){ return model.toJSON(); });
- },
-
- // Add a model, or list of models to the set. Pass **silent** to avoid
- // firing the `added` event for every new model.
- add : function(models, options) {
- if (_.isArray(models)) {
- for (var i = 0, l = models.length; i < l; i++) {
- this._add(models[i], options);
- }
- } else {
- this._add(models, options);
- }
- return this;
- },
-
- // Remove a model, or a list of models from the set. Pass silent to avoid
- // firing the `removed` event for every model removed.
- remove : function(models, options) {
- if (_.isArray(models)) {
- for (var i = 0, l = models.length; i < l; i++) {
- this._remove(models[i], options);
- }
- } else {
- this._remove(models, options);
- }
- return this;
- },
-
- // Get a model from the set by id.
- get : function(id) {
- if (id == null) return null;
- return this._byId[id.id != null ? id.id : id];
- },
-
- // Get a model from the set by client id.
- getByCid : function(cid) {
- return cid && this._byCid[cid.cid || cid];
- },
-
- // Get the model at the given index.
- at: function(index) {
- return this.models[index];
- },
-
- // Force the collection to re-sort itself. You don't need to call this under normal
- // circumstances, as the set will maintain sort order as each item is added.
- sort : function(options) {
- options || (options = {});
- if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
- this.models = this.sortBy(this.comparator);
- if (!options.silent) this.trigger('reset', this, options);
- return this;
- },
-
- // Pluck an attribute from each model in the collection.
- pluck : function(attr) {
- return _.map(this.models, function(model){ return model.get(attr); });
- },
-
- // When you have more items than you want to add or remove individually,
- // you can reset the entire set with a new list of models, without firing
- // any `added` or `removed` events. Fires `reset` when finished.
- reset : function(models, options) {
- models || (models = []);
- options || (options = {});
- this.each(this._removeReference);
- this._reset();
- this.add(models, {silent: true});
- if (!options.silent) this.trigger('reset', this, options);
- return this;
- },
-
- // Fetch the default set of models for this collection, resetting the
- // collection when they arrive. If `add: true` is passed, appends the
- // models to the collection instead of resetting.
- fetch : function(options) {
- options || (options = {});
- var collection = this;
- var success = options.success;
- options.success = function(resp, status, xhr) {
- collection[options.add ? 'add' : 'reset'](collection.parse(resp, xhr), options);
- if (success) success(collection, resp);
- };
- options.error = wrapError(options.error, collection, options);
- return (this.sync || Backbone.sync).call(this, 'read', this, options);
- },
-
- // Create a new instance of a model in this collection. After the model
- // has been created on the server, it will be added to the collection.
- // Returns the model, or 'false' if validation on a new model fails.
- create : function(model, options) {
- var coll = this;
- options || (options = {});
- model = this._prepareModel(model, options);
- if (!model) return false;
- var success = options.success;
- options.success = function(nextModel, resp, xhr) {
- coll.add(nextModel, options);
- if (success) success(nextModel, resp, xhr);
- };
- model.save(null, options);
- return model;
- },
-
- // **parse** converts a response into a list of models to be added to the
- // collection. The default implementation is just to pass it through.
- parse : function(resp, xhr) {
- return resp;
- },
-
- // Proxy to _'s chain. Can't be proxied the same way the rest of the
- // underscore methods are proxied because it relies on the underscore
- // constructor.
- chain: function () {
- return _(this.models).chain();
- },
-
- // Reset all internal state. Called when the collection is reset.
- _reset : function(options) {
- this.length = 0;
- this.models = [];
- this._byId = {};
- this._byCid = {};
- },
-
- // Prepare a model to be added to this collection
- _prepareModel: function(model, options) {
- if (!(model instanceof Backbone.Model)) {
- var attrs = model;
- model = new this.model(attrs, {collection: this});
- if (model.validate && !model._performValidation(attrs, options)) model = false;
- } else if (!model.collection) {
- model.collection = this;
- }
- return model;
- },
-
- // Internal implementation of adding a single model to the set, updating
- // hash indexes for `id` and `cid` lookups.
- // Returns the model, or 'false' if validation on a new model fails.
- _add : function(model, options) {
- options || (options = {});
- model = this._prepareModel(model, options);
- if (!model) return false;
- var already = this.getByCid(model);
- if (already) throw new Error(["Can't add the same model to a set twice", already.id]);
- this._byId[model.id] = model;
- this._byCid[model.cid] = model;
- var index = options.at != null ? options.at :
- this.comparator ? this.sortedIndex(model, this.comparator) :
- this.length;
- this.models.splice(index, 0, model);
- model.bind('all', this._onModelEvent);
- this.length++;
- if (!options.silent) model.trigger('add', model, this, options);
- return model;
- },
-
- // Internal implementation of removing a single model from the set, updating
- // hash indexes for `id` and `cid` lookups.
- _remove : function(model, options) {
- options || (options = {});
- model = this.getByCid(model) || this.get(model);
- if (!model) return null;
- delete this._byId[model.id];
- delete this._byCid[model.cid];
- this.models.splice(this.indexOf(model), 1);
- this.length--;
- if (!options.silent) model.trigger('remove', model, this, options);
- this._removeReference(model);
- return model;
- },
-
- // Internal method to remove a model's ties to a collection.
- _removeReference : function(model) {
- if (this == model.collection) {
- delete model.collection;
- }
- model.unbind('all', this._onModelEvent);
- },
-
- // Internal method called every time a model in the set fires an event.
- // Sets need to update their indexes when models change ids. All other
- // events simply proxy through. "add" and "remove" events that originate
- // in other collections are ignored.
- _onModelEvent : function(ev, model, collection, options) {
- if ((ev == 'add' || ev == 'remove') && collection != this) return;
- if (ev == 'destroy') {
- this._remove(model, options);
- }
- if (model && ev === 'change:' + model.idAttribute) {
- delete this._byId[model.previous(model.idAttribute)];
- this._byId[model.id] = model;
- }
- this.trigger.apply(this, arguments);
- }
-
- });
-
- // Underscore methods that we want to implement on the Collection.
- var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find', 'detect',
- 'filter', 'select', 'reject', 'every', 'all', 'some', 'any', 'include',
- 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex', 'toArray', 'size',
- 'first', 'rest', 'last', 'without', 'indexOf', 'lastIndexOf', 'isEmpty', 'groupBy'];
-
- // Mix in each Underscore method as a proxy to `Collection#models`.
- _.each(methods, function(method) {
- Backbone.Collection.prototype[method] = function() {
- return _[method].apply(_, [this.models].concat(_.toArray(arguments)));
- };
- });
-
- // Backbone.Router
- // -------------------
-
- // Routers map faux-URLs to actions, and fire events when routes are
- // matched. Creating a new one sets its `routes` hash, if not set statically.
- Backbone.Router = function(options) {
- options || (options = {});
- if (options.routes) this.routes = options.routes;
- this._bindRoutes();
- this.initialize.apply(this, arguments);
- };
-
- // Cached regular expressions for matching named param parts and splatted
- // parts of route strings.
- var namedParam = /:([\w\d]+)/g;
- var splatParam = /\*([\w\d]+)/g;
- var escapeRegExp = /[-[\]{}()+?.,\\^$|#\s]/g;
-
- // Set up all inheritable **Backbone.Router** properties and methods.
- _.extend(Backbone.Router.prototype, Backbone.Events, {
-
- // Initialize is an empty function by default. Override it with your own
- // initialization logic.
- initialize : function(){},
-
- // Manually bind a single named route to a callback. For example:
- //
- // this.route('search/:query/p:num', 'search', function(query, num) {
- // ...
- // });
- //
- route : function(route, name, callback) {
- Backbone.history || (Backbone.history = new Backbone.History);
- if (!_.isRegExp(route)) route = this._routeToRegExp(route);
- Backbone.history.route(route, _.bind(function(fragment) {
- var args = this._extractParameters(route, fragment);
- callback.apply(this, args);
- this.trigger.apply(this, ['route:' + name].concat(args));
- }, this));
- },
-
- // Simple proxy to `Backbone.history` to save a fragment into the history.
- navigate : function(fragment, triggerRoute) {
- Backbone.history.navigate(fragment, triggerRoute);
- },
-
- // Bind all defined routes to `Backbone.history`. We have to reverse the
- // order of the routes here to support behavior where the most general
- // routes can be defined at the bottom of the route map.
- _bindRoutes : function() {
- if (!this.routes) return;
- var routes = [];
- for (var route in this.routes) {
- routes.unshift([route, this.routes[route]]);
- }
- for (var i = 0, l = routes.length; i < l; i++) {
- this.route(routes[i][0], routes[i][1], this[routes[i][1]]);
- }
- },
-
- // Convert a route string into a regular expression, suitable for matching
- // against the current location hash.
- _routeToRegExp : function(route) {
- route = route.replace(escapeRegExp, "\\$&")
- .replace(namedParam, "([^\/]*)")
- .replace(splatParam, "(.*?)");
- return new RegExp('^' + route + '$');
- },
-
- // Given a route, and a URL fragment that it matches, return the array of
- // extracted parameters.
- _extractParameters : function(route, fragment) {
- return route.exec(fragment).slice(1);
- }
-
- });
-
- // Backbone.History
- // ----------------
-
- // Handles cross-browser history management, based on URL fragments. If the
- // browser does not support `onhashchange`, falls back to polling.
- Backbone.History = function() {
- this.handlers = [];
- _.bindAll(this, 'checkUrl');
- };
-
- // Cached regex for cleaning hashes.
- var hashStrip = /^#*/;
-
- // Cached regex for detecting MSIE.
- var isExplorer = /msie [\w.]+/;
-
- // Has the history handling already been started?
- var historyStarted = false;
-
- // Set up all inheritable **Backbone.History** properties and methods.
- _.extend(Backbone.History.prototype, {
-
- // The default interval to poll for hash changes, if necessary, is
- // twenty times a second.
- interval: 50,
-
- // Get the cross-browser normalized URL fragment, either from the URL,
- // the hash, or the override.
- getFragment : function(fragment, forcePushState) {
- if (fragment == null) {
- if (this._hasPushState || forcePushState) {
- fragment = window.location.pathname;
- var search = window.location.search;
- if (search) fragment += search;
- if (fragment.indexOf(this.options.root) == 0) fragment = fragment.substr(this.options.root.length);
- } else {
- fragment = window.location.hash;
- }
- }
- return decodeURIComponent(fragment.replace(hashStrip, ''));
- },
-
- // Start the hash change handling, returning `true` if the current URL matches
- // an existing route, and `false` otherwise.
- start : function(options) {
-
- // Figure out the initial configuration. Do we need an iframe?
- // Is pushState desired ... is it available?
- if (historyStarted) throw new Error("Backbone.history has already been started");
- this.options = _.extend({}, {root: '/'}, this.options, options);
- this._wantsPushState = !!this.options.pushState;
- this._hasPushState = !!(this.options.pushState && window.history && window.history.pushState);
- var fragment = this.getFragment();
- var docMode = document.documentMode;
- var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
- if (oldIE) {
- this.iframe = $('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
- this.navigate(fragment);
- }
-
- // Depending on whether we're using pushState or hashes, and whether
- // 'onhashchange' is supported, determine how we check the URL state.
- if (this._hasPushState) {
- $(window).bind('popstate', this.checkUrl);
- } else if ('onhashchange' in window && !oldIE) {
- $(window).bind('hashchange', this.checkUrl);
- } else {
- setInterval(this.checkUrl, this.interval);
- }
-
- // Determine if we need to change the base url, for a pushState link
- // opened by a non-pushState browser.
- this.fragment = fragment;
- historyStarted = true;
- var loc = window.location;
- var atRoot = loc.pathname == this.options.root;
- if (this._wantsPushState && !this._hasPushState && !atRoot) {
- this.fragment = this.getFragment(null, true);
- window.location.replace(this.options.root + '#' + this.fragment);
- // Return immediately as browser will do redirect to new url
- return true;
- } else if (this._wantsPushState && this._hasPushState && atRoot && loc.hash) {
- this.fragment = loc.hash.replace(hashStrip, '');
- window.history.replaceState({}, document.title, loc.protocol + '//' + loc.host + this.options.root + this.fragment);
- }
-
- if (!this.options.silent) {
- return this.loadUrl();
- }
- },
-
- // Add a route to be tested when the fragment changes. Routes added later may
- // override previous routes.
- route : function(route, callback) {
- this.handlers.unshift({route : route, callback : callback});
- },
-
- // Checks the current URL to see if it has changed, and if it has,
- // calls `loadUrl`, normalizing across the hidden iframe.
- checkUrl : function(e) {
- var current = this.getFragment();
- if (current == this.fragment && this.iframe) current = this.getFragment(this.iframe.location.hash);
- if (current == this.fragment || current == decodeURIComponent(this.fragment)) return false;
- if (this.iframe) this.navigate(current);
- this.loadUrl() || this.loadUrl(window.location.hash);
- },
-
- // Attempt to load the current URL fragment. If a route succeeds with a
- // match, returns `true`. If no defined routes matches the fragment,
- // returns `false`.
- loadUrl : function(fragmentOverride) {
- var fragment = this.fragment = this.getFragment(fragmentOverride);
- var matched = _.any(this.handlers, function(handler) {
- if (handler.route.test(fragment)) {
- handler.callback(fragment);
- return true;
- }
- });
- return matched;
- },
-
- // Save a fragment into the hash history. You are responsible for properly
- // URL-encoding the fragment in advance. This does not trigger
- // a `hashchange` event.
- navigate : function(fragment, triggerRoute) {
- var frag = (fragment || '').replace(hashStrip, '');
- if (this.fragment == frag || this.fragment == decodeURIComponent(frag)) return;
- if (this._hasPushState) {
- var loc = window.location;
- if (frag.indexOf(this.options.root) != 0) frag = this.options.root + frag;
- this.fragment = frag;
- window.history.pushState({}, document.title, loc.protocol + '//' + loc.host + frag);
- } else {
- window.location.hash = this.fragment = frag;
- if (this.iframe && (frag != this.getFragment(this.iframe.location.hash))) {
- this.iframe.document.open().close();
- this.iframe.location.hash = frag;
- }
- }
- if (triggerRoute) this.loadUrl(fragment);
- }
-
- });
-
- // Backbone.View
- // -------------
-
- // Creating a Backbone.View creates its initial element outside of the DOM,
- // if an existing element is not provided...
- Backbone.View = function(options) {
- this.cid = _.uniqueId('view');
- this._configure(options || {});
- this._ensureElement();
- this.delegateEvents();
- this.initialize.apply(this, arguments);
- };
-
- // Element lookup, scoped to DOM elements within the current view.
- // This should be prefered to global lookups, if you're dealing with
- // a specific view.
- var selectorDelegate = function(selector) {
- return $(selector, this.el);
- };
-
- // Cached regex to split keys for `delegate`.
- var eventSplitter = /^(\S+)\s*(.*)$/;
-
- // List of view options to be merged as properties.
- var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName'];
-
- // Set up all inheritable **Backbone.View** properties and methods.
- _.extend(Backbone.View.prototype, Backbone.Events, {
-
- // The default `tagName` of a View's element is `"div"`.
- tagName : 'div',
-
- // Attach the `selectorDelegate` function as the `$` property.
- $ : selectorDelegate,
-
- // Initialize is an empty function by default. Override it with your own
- // initialization logic.
- initialize : function(){},
-
- // **render** is the core function that your view should override, in order
- // to populate its element (`this.el`), with the appropriate HTML. The
- // convention is for **render** to always return `this`.
- render : function() {
- return this;
- },
-
- // Remove this view from the DOM. Note that the view isn't present in the
- // DOM by default, so calling this method may be a no-op.
- remove : function() {
- $(this.el).remove();
- return this;
- },
-
- // For small amounts of DOM Elements, where a full-blown template isn't
- // needed, use **make** to manufacture elements, one at a time.
- //
- // var el = this.make('li', {'class': 'row'}, this.model.escape('title'));
- //
- make : function(tagName, attributes, content) {
- var el = document.createElement(tagName);
- if (attributes) $(el).attr(attributes);
- if (content) $(el).html(content);
- return el;
- },
-
- // Set callbacks, where `this.callbacks` is a hash of
- //
- // *{"event selector": "callback"}*
- //
- // {
- // 'mousedown .title': 'edit',
- // 'click .button': 'save'
- // }
- //
- // pairs. Callbacks will be bound to the view, with `this` set properly.
- // Uses event delegation for efficiency.
- // Omitting the selector binds the event to `this.el`.
- // This only works for delegate-able events: not `focus`, `blur`, and
- // not `change`, `submit`, and `reset` in Internet Explorer.
- delegateEvents : function(events) {
- if (!(events || (events = this.events))) return;
- if (_.isFunction(events)) events = events.call(this);
- $(this.el).unbind('.delegateEvents' + this.cid);
- for (var key in events) {
- var method = this[events[key]];
- if (!method) throw new Error('Event "' + events[key] + '" does not exist');
- var match = key.match(eventSplitter);
- var eventName = match[1], selector = match[2];
- method = _.bind(method, this);
- eventName += '.delegateEvents' + this.cid;
- if (selector === '') {
- $(this.el).bind(eventName, method);
- } else {
- $(this.el).delegate(selector, eventName, method);
- }
- }
- },
-
- // Performs the initial configuration of a View with a set of options.
- // Keys with special meaning *(model, collection, id, className)*, are
- // attached directly to the view.
- _configure : function(options) {
- if (this.options) options = _.extend({}, this.options, options);
- for (var i = 0, l = viewOptions.length; i < l; i++) {
- var attr = viewOptions[i];
- if (options[attr]) this[attr] = options[attr];
- }
- this.options = options;
- },
-
- // Ensure that the View has a DOM element to render into.
- // If `this.el` is a string, pass it through `$()`, take the first
- // matching element, and re-assign it to `el`. Otherwise, create
- // an element from the `id`, `className` and `tagName` proeprties.
- _ensureElement : function() {
- if (!this.el) {
- var attrs = this.attributes || {};
- if (this.id) attrs.id = this.id;
- if (this.className) attrs['class'] = this.className;
- this.el = this.make(this.tagName, attrs);
- } else if (_.isString(this.el)) {
- this.el = $(this.el).get(0);
- }
- }
-
- });
-
- // The self-propagating extend function that Backbone classes use.
- var extend = function (protoProps, classProps) {
- var child = inherits(this, protoProps, classProps);
- child.extend = this.extend;
- return child;
- };
-
- // Set up inheritance for the model, collection, and view.
- Backbone.Model.extend = Backbone.Collection.extend =
- Backbone.Router.extend = Backbone.View.extend = extend;
-
- // Map from CRUD to HTTP for our default `Backbone.sync` implementation.
- var methodMap = {
- 'create': 'POST',
- 'update': 'PUT',
- 'delete': 'DELETE',
- 'read' : 'GET'
- };
-
- // Backbone.sync
- // -------------
-
- // Override this function to change the manner in which Backbone persists
- // models to the server. You will be passed the type of request, and the
- // model in question. By default, uses makes a RESTful Ajax request
- // to the model's `url()`. Some possible customizations could be:
- //
- // * Use `setTimeout` to batch rapid-fire updates into a single request.
- // * Send up the models as XML instead of JSON.
- // * Persist models via WebSockets instead of Ajax.
- //
- // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
- // as `POST`, with a `_method` parameter containing the true HTTP method,
- // as well as all requests with the body as `application/x-www-form-urlencoded` instead of
- // `application/json` with the model in a param named `model`.
- // Useful when interfacing with server-side languages like **PHP** that make
- // it difficult to read the body of `PUT` requests.
- Backbone.sync = function(method, model, options) {
- var type = methodMap[method];
-
- // Default JSON-request options.
- var params = _.extend({
- type: type,
- dataType: 'json'
- }, options);
-
- // Ensure that we have a URL.
- if (!params.url) {
- params.url = getUrl(model) || urlError();
- }
-
- // Ensure that we have the appropriate request data.
- if (!params.data && model && (method == 'create' || method == 'update')) {
- params.contentType = 'application/json';
- params.data = JSON.stringify(model.toJSON());
- }
-
- // For older servers, emulate JSON by encoding the request into an HTML-form.
- if (Backbone.emulateJSON) {
- params.contentType = 'application/x-www-form-urlencoded';
- params.data = params.data ? {model : params.data} : {};
- }
-
- // For older servers, emulate HTTP by mimicking the HTTP method with `_method`
- // And an `X-HTTP-Method-Override` header.
- if (Backbone.emulateHTTP) {
- if (type === 'PUT' || type === 'DELETE') {
- if (Backbone.emulateJSON) params.data._method = type;
- params.type = 'POST';
- params.beforeSend = function(xhr) {
- xhr.setRequestHeader('X-HTTP-Method-Override', type);
- };
- }
- }
-
- // Don't process data on a non-GET request.
- if (params.type !== 'GET' && !Backbone.emulateJSON) {
- params.processData = false;
- }
-
- // Make the request.
- return $.ajax(params);
- };
-
- // Helpers
- // -------
-
- // Shared empty constructor function to aid in prototype-chain creation.
- var ctor = function(){};
-
- // Helper function to correctly set up the prototype chain, for subclasses.
- // Similar to `goog.inherits`, but uses a hash of prototype properties and
- // class properties to be extended.
- var inherits = function(parent, protoProps, staticProps) {
- var child;
-
- // The constructor function for the new subclass is either defined by you
- // (the "constructor" property in your `extend` definition), or defaulted
- // by us to simply call `super()`.
- if (protoProps && protoProps.hasOwnProperty('constructor')) {
- child = protoProps.constructor;
- } else {
- child = function(){ return parent.apply(this, arguments); };
- }
-
- // Inherit class (static) properties from parent.
- _.extend(child, parent);
-
- // Set the prototype chain to inherit from `parent`, without calling
- // `parent`'s constructor function.
- ctor.prototype = parent.prototype;
- child.prototype = new ctor();
-
- // Add prototype properties (instance properties) to the subclass,
- // if supplied.
- if (protoProps) _.extend(child.prototype, protoProps);
-
- // Add static properties to the constructor function, if supplied.
- if (staticProps) _.extend(child, staticProps);
-
- // Correctly set child's `prototype.constructor`.
- child.prototype.constructor = child;
-
- // Set a convenience property in case the parent's prototype is needed later.
- child.__super__ = parent.prototype;
-
- return child;
- };
-
- // Helper function to get a URL from a Model or Collection as a property
- // or as a function.
- var getUrl = function(object) {
- if (!(object && object.url)) return null;
- return _.isFunction(object.url) ? object.url() : object.url;
- };
-
- // Throw an error when a URL is needed, and none is supplied.
- var urlError = function() {
- throw new Error('A "url" property or function must be specified');
- };
-
- // Wrap an optional error callback with a fallback error event.
- var wrapError = function(onError, model, options) {
- return function(resp) {
- if (onError) {
- onError(model, resp, options);
- } else {
- model.trigger('error', model, resp, options);
- }
- };
- };
-
- // Helper function to escape a string for HTML rendering.
- var escapeHTML = function(string) {
- return string.replace(/&(?!\w+;|#\d+;|#x[\da-f]+;)/gi, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\//g,'&#x2F;');
- };
-
-}).call(this);
diff --git a/public/javascripts/vendor/bootstrap/bootstrap-modal.js b/public/javascripts/vendor/bootstrap/bootstrap-modal.js
deleted file mode 100644
index bac0dee18..000000000
--- a/public/javascripts/vendor/bootstrap/bootstrap-modal.js
+++ /dev/null
@@ -1,209 +0,0 @@
-/* =========================================================
- * bootstrap-modal.js v2.0.0
- * http://twitter.github.com/bootstrap/javascript.html#modals
- * =========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================= */
-
-
-!function( $ ){
-
- "use strict"
-
- /* MODAL CLASS DEFINITION
- * ====================== */
-
- var Modal = function ( content, options ) {
- this.options = $.extend({}, $.fn.modal.defaults, options)
- this.$element = $(content)
- .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
- }
-
- Modal.prototype = {
-
- constructor: Modal
-
- , toggle: function () {
- return this[!this.isShown ? 'show' : 'hide']()
- }
-
- , show: function () {
- var that = this
-
- if (this.isShown) return
-
- $('body').addClass('modal-open')
-
- this.isShown = true
- this.$element.trigger('show')
-
- escape.call(this)
- backdrop.call(this, function () {
- var transition = $.support.transition && that.$element.hasClass('fade')
-
- !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
-
- that.$element
- .show()
-
- if (transition) {
- that.$element[0].offsetWidth // force reflow
- }
-
- that.$element.addClass('in')
-
- transition ?
- that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
- that.$element.trigger('shown')
-
- })
- }
-
- , hide: function ( e ) {
- e && e.preventDefault()
-
- if (!this.isShown) return
-
- var that = this
- this.isShown = false
-
- $('body').removeClass('modal-open')
-
- escape.call(this)
-
- this.$element
- .trigger('hide')
- .removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade') ?
- hideWithTransition.call(this) :
- hideModal.call(this)
- }
-
- }
-
-
- /* MODAL PRIVATE METHODS
- * ===================== */
-
- function hideWithTransition() {
- var that = this
- , timeout = setTimeout(function () {
- that.$element.off($.support.transition.end)
- hideModal.call(that)
- }, 500)
-
- this.$element.one($.support.transition.end, function () {
- clearTimeout(timeout)
- hideModal.call(that)
- })
- }
-
- function hideModal( that ) {
- this.$element
- .hide()
- .trigger('hidden')
-
- backdrop.call(this)
- }
-
- function backdrop( callback ) {
- var that = this
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
-
- if (this.isShown && this.options.backdrop) {
- var doAnimate = $.support.transition && animate
-
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
- .appendTo(document.body)
-
- if (this.options.backdrop != 'static') {
- this.$backdrop.click($.proxy(this.hide, this))
- }
-
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
-
- this.$backdrop.addClass('in')
-
- doAnimate ?
- this.$backdrop.one($.support.transition.end, callback) :
- callback()
-
- } else if (!this.isShown && this.$backdrop) {
- this.$backdrop.removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
- removeBackdrop.call(this)
-
- } else if (callback) {
- callback()
- }
- }
-
- function removeBackdrop() {
- this.$backdrop.remove()
- this.$backdrop = null
- }
-
- function escape() {
- var that = this
- if (this.isShown && this.options.keyboard) {
- $(document).on('keyup.dismiss.modal', function ( e ) {
- e.which == 27 && that.hide()
- })
- } else if (!this.isShown) {
- $(document).off('keyup.dismiss.modal')
- }
- }
-
-
- /* MODAL PLUGIN DEFINITION
- * ======================= */
-
- $.fn.modal = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('modal')
- , options = typeof option == 'object' && option
- if (!data) $this.data('modal', (data = new Modal(this, options)))
- if (typeof option == 'string') data[option]()
- else data.show()
- })
- }
-
- $.fn.modal.defaults = {
- backdrop: true
- , keyboard: true
- }
-
- $.fn.modal.Constructor = Modal
-
-
- /* MODAL DATA-API
- * ============== */
-
- $(function () {
- $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
-
- e.preventDefault()
- $target.modal(option)
- })
- })
-
-}( window.jQuery ) \ No newline at end of file
diff --git a/public/javascripts/vendor/bootstrap/bootstrap-popover.js b/public/javascripts/vendor/bootstrap/bootstrap-popover.js
deleted file mode 100644
index 1cf4b8917..000000000
--- a/public/javascripts/vendor/bootstrap/bootstrap-popover.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/* ===========================================================
- * bootstrap-popover.js v1.3.0
- * http://twitter.github.com/bootstrap/javascript.html#popover
- * ===========================================================
- * Copyright 2011 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * =========================================================== */
-
-
-!function( $ ) {
-
- var Popover = function ( element, options ) {
- this.$element = $(element)
- this.options = options
- this.enabled = true
- this.fixTitle()
- }
-
- /* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
- ========================================= */
-
- Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
-
- setContent: function () {
- var $tip = this.tip()
- $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
- $tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
- $tip[0].className = 'popover'
- }
-
- , getContent: function () {
- var content
- , $e = this.$element
- , o = this.options
-
- if (typeof this.options.content == 'string') {
- content = $e.attr(o.content)
- } else if (typeof this.options.content == 'function') {
- content = this.options.content.call(this.$element[0])
- }
- return content
- }
-
- , tip: function() {
- if (!this.$tip) {
- this.$tip = $('<div class="popover" />')
- .html('<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>')
- }
- return this.$tip
- }
-
- })
-
-
- /* POPOVER PLUGIN DEFINITION
- * ======================= */
-
- $.fn.popover = function (options) {
- if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
- $.fn.twipsy.initWith.call(this, options, Popover, 'popover')
- return this
- }
-
- $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
-
-}( window.jQuery || window.ender ); \ No newline at end of file
diff --git a/public/javascripts/vendor/bootstrap/bootstrap-transition.js b/public/javascripts/vendor/bootstrap/bootstrap-transition.js
deleted file mode 100644
index 4b6bb0d95..000000000
--- a/public/javascripts/vendor/bootstrap/bootstrap-transition.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ===================================================
- * bootstrap-transition.js v2.0.0
- * http://twitter.github.com/bootstrap/javascript.html#transitions
- * ===================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-!function( $ ) {
-
- $(function () {
-
- "use strict"
-
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
- * ======================================================= */
-
- $.support.transition = (function () {
- var thisBody = document.body || document.documentElement
- , thisStyle = thisBody.style
- , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
-
- return support && {
- end: (function () {
- var transitionEnd = "TransitionEnd"
- if ( $.browser.webkit ) {
- transitionEnd = "webkitTransitionEnd"
- } else if ( $.browser.mozilla ) {
- transitionEnd = "transitionend"
- } else if ( $.browser.opera ) {
- transitionEnd = "oTransitionEnd"
- }
- return transitionEnd
- }())
- }
- })()
-
- })
-
-}( window.jQuery ) \ No newline at end of file
diff --git a/public/javascripts/vendor/bootstrap/bootstrap-twipsy.js b/public/javascripts/vendor/bootstrap/bootstrap-twipsy.js
deleted file mode 100644
index 97cf47f46..000000000
--- a/public/javascripts/vendor/bootstrap/bootstrap-twipsy.js
+++ /dev/null
@@ -1,303 +0,0 @@
-/* ==========================================================
- * bootstrap-twipsy.js v1.3.0
- * http://twitter.github.com/bootstrap/javascript.html#twipsy
- * Adapted from the original jQuery.tipsy by Jason Frame
- * ==========================================================
- * Copyright 2011 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function( $ ) {
-
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
- * ======================================================= */
-
- var transitionEnd
-
- $(document).ready(function () {
-
- $.support.transition = (function () {
- var thisBody = document.body || document.documentElement
- , thisStyle = thisBody.style
- , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
- return support
- })()
-
- // set CSS transition event type
- if ( $.support.transition ) {
- transitionEnd = "TransitionEnd"
- if ( $.browser.webkit ) {
- transitionEnd = "webkitTransitionEnd"
- } else if ( $.browser.mozilla ) {
- transitionEnd = "transitionend"
- } else if ( $.browser.opera ) {
- transitionEnd = "oTransitionEnd"
- }
- }
-
- })
-
-
- /* TWIPSY PUBLIC CLASS DEFINITION
- * ============================== */
-
- var Twipsy = function ( element, options ) {
- this.$element = $(element)
- this.options = options
- this.enabled = true
- this.fixTitle()
- }
-
- Twipsy.prototype = {
-
- show: function() {
- var pos
- , actualWidth
- , actualHeight
- , placement
- , $tip
- , tp
-
- if (this.getTitle() && this.enabled) {
- $tip = this.tip()
- this.setContent()
-
- if (this.options.animate) {
- $tip.addClass('fade')
- }
-
- $tip
- .remove()
- .css({ top: 0, left: 0, display: 'block' })
- .prependTo(document.body)
-
- pos = $.extend({}, this.$element.offset(), {
- width: this.$element[0].offsetWidth
- , height: this.$element[0].offsetHeight
- })
-
- actualWidth = $tip[0].offsetWidth
- actualHeight = $tip[0].offsetHeight
-
- placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])
-
- switch (placement) {
- case 'below':
- tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
- break
- case 'above':
- tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
- break
- case 'left':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
- break
- case 'right':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
- break
- }
-
- $tip
- .css(tp)
- .addClass(placement)
- .addClass('in')
- }
- }
-
- , setContent: function () {
- var $tip = this.tip()
- $tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
- $tip[0].className = 'twipsy'
- }
-
- , hide: function() {
- var that = this
- , $tip = this.tip()
-
- $tip.removeClass('in')
-
- function removeElement () {
- $tip.remove()
- }
-
- $.support.transition && this.$tip.hasClass('fade') ?
- $tip.bind(transitionEnd, removeElement) :
- removeElement()
- }
-
- , fixTitle: function() {
- var $e = this.$element
- if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
- $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
- }
- }
-
- , getTitle: function() {
- var title
- , $e = this.$element
- , o = this.options
-
- this.fixTitle()
-
- if (typeof o.title == 'string') {
- title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
- } else if (typeof o.title == 'function') {
- title = o.title.call($e[0])
- }
-
- title = ('' + title).replace(/(^\s*|\s*$)/, "")
-
- return title || o.fallback
- }
-
- , tip: function() {
- if (!this.$tip) {
- this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
- }
- return this.$tip
- }
-
- , validate: function() {
- if (!this.$element[0].parentNode) {
- this.hide()
- this.$element = null
- this.options = null
- }
- }
-
- , enable: function() {
- this.enabled = true
- }
-
- , disable: function() {
- this.enabled = false
- }
-
- , toggleEnabled: function() {
- this.enabled = !this.enabled
- }
-
- }
-
-
- /* TWIPSY PRIVATE METHODS
- * ====================== */
-
- function maybeCall ( thing, ctx, args ) {
- return typeof thing == 'function' ? thing.apply(ctx, args) : thing
- }
-
- /* TWIPSY PLUGIN DEFINITION
- * ======================== */
-
- $.fn.twipsy = function (options) {
- $.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
- return this
- }
-
- $.fn.twipsy.initWith = function (options, Constructor, name) {
- var twipsy
- , binder
- , eventIn
- , eventOut
-
- if (options === true) {
- return this.data(name)
- } else if (typeof options == 'string') {
- twipsy = this.data(name)
- if (twipsy) {
- twipsy[options]()
- }
- return this
- }
-
- options = $.extend({}, $.fn[name].defaults, options)
-
- function get(ele) {
- var twipsy = $.data(ele, name)
-
- if (!twipsy) {
- twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
- $.data(ele, name, twipsy)
- }
-
- return twipsy
- }
-
- function enter() {
- var twipsy = get(this)
- twipsy.hoverState = 'in'
-
- if (options.delayIn == 0) {
- twipsy.show()
- } else {
- twipsy.fixTitle()
- setTimeout(function() {
- if (twipsy.hoverState == 'in') {
- twipsy.show()
- }
- }, options.delayIn)
- }
- }
-
- function leave() {
- var twipsy = get(this)
- twipsy.hoverState = 'out'
- if (options.delayOut == 0) {
- twipsy.hide()
- } else {
- setTimeout(function() {
- if (twipsy.hoverState == 'out') {
- twipsy.hide()
- }
- }, options.delayOut)
- }
- }
-
- if (!options.live) {
- this.each(function() {
- get(this)
- })
- }
-
- if (options.trigger != 'manual') {
- binder = options.live ? 'live' : 'bind'
- eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
- eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
- this[binder](eventIn, enter)[binder](eventOut, leave)
- }
-
- return this
- }
-
- $.fn.twipsy.Twipsy = Twipsy
-
- $.fn.twipsy.defaults = {
- animate: true
- , delayIn: 0
- , delayOut: 0
- , fallback: ''
- , placement: 'above'
- , html: false
- , live: false
- , offset: 0
- , title: 'title'
- , trigger: 'hover'
- }
-
- $.fn.twipsy.elementOptions = function(ele, options) {
- return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
- }
-
-}( window.jQuery || window.ender ); \ No newline at end of file
diff --git a/public/javascripts/vendor/facebox.js b/public/javascripts/vendor/facebox.js
deleted file mode 100644
index 7d0e39d8f..000000000
--- a/public/javascripts/vendor/facebox.js
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Facebox (for jQuery)
- * version: 1.3
- * @requires jQuery v1.2 or later
- * @homepage https://github.com/defunkt/facebox
- *
- * Licensed under the MIT:
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Copyright Forever Chris Wanstrath, Kyle Neath
- *
- * Usage:
- *
- * jQuery(document).ready(function() {
- * jQuery('a[rel*=facebox]').facebox()
- * })
- *
- * <a href="#terms" rel="facebox">Terms</a>
- * Loads the #terms div in the box
- *
- * <a href="terms.html" rel="facebox">Terms</a>
- * Loads the terms.html page in the box
- *
- * <a href="terms.png" rel="facebox">Terms</a>
- * Loads the terms.png image in the box
- *
- *
- * You can also use it programmatically:
- *
- * jQuery.facebox('some html')
- * jQuery.facebox('some html', 'my-groovy-style')
- *
- * The above will open a facebox with "some html" as the content.
- *
- * jQuery.facebox(function($) {
- * $.get('blah.html', function(data) { $.facebox(data) })
- * })
- *
- * The above will show a loading screen before the passed function is called,
- * allowing for a better ajaxy experience.
- *
- * The facebox function can also display an ajax page, an image, or the contents of a div:
- *
- * jQuery.facebox({ ajax: 'remote.html' })
- * jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style')
- * jQuery.facebox({ image: 'stairs.jpg' })
- * jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style')
- * jQuery.facebox({ div: '#box' })
- * jQuery.facebox({ div: '#box' }, 'my-groovy-style')
- *
- * Want to close the facebox? Trigger the 'close.facebox' document event:
- *
- * jQuery(document).trigger('close.facebox')
- *
- * Facebox also has a bunch of other hooks:
- *
- * loading.facebox
- * beforeReveal.facebox
- * reveal.facebox (aliased as 'afterReveal.facebox')
- * init.facebox
- * afterClose.facebox
- *
- * Simply bind a function to any of these hooks:
- *
- * $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
- *
- */
-(function($) {
- $.facebox = function(data, klass) {
- $.facebox.loading()
-
- if (data.ajax) fillFaceboxFromAjax(data.ajax, klass)
- else if (data.image) fillFaceboxFromImage(data.image, klass)
- else if (data.div) fillFaceboxFromHref(data.div, klass)
- else if ($.isFunction(data)) data.call($)
- else $.facebox.reveal(data, klass)
- }
-
- /*
- * Public, $.facebox methods
- */
-
- $.extend($.facebox, {
- settings: {
- opacity : 0.2,
- overlay : true,
- loadingImage : '/facebox/loading.gif',
- closeImage : '/facebox/closelabel.png',
- imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
- faceboxHtml : '\
- <div id="facebox" style="display:none;"> \
- <div class="popup"> \
- <div class="content"> \
- </div> \
- <a href="#" class="close"></a> \
- </div> \
- </div>'
- },
-
- loading: function() {
- init()
- if ($('#facebox .loading').length == 1) return true
- showOverlay()
-
- $('#facebox .content').empty().
- append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')
-
- $('#facebox').show().css({
- top: getPageScroll()[1] + (getPageHeight() / 10),
- left: $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2)
- })
-
- $(document).bind('keydown.facebox', function(e) {
- if (e.keyCode == 27) $.facebox.close()
- return true
- })
- $(document).trigger('loading.facebox')
- },
-
- reveal: function(data, klass) {
- $(document).trigger('beforeReveal.facebox')
- if (klass) $('#facebox .content').addClass(klass)
- $('#facebox .content').empty().append(data)
- $('#facebox .popup').children().fadeIn('normal')
- $('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2))
- $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
- },
-
- close: function() {
- $(document).trigger('close.facebox')
- return false
- }
- })
-
- /*
- * Public, $.fn methods
- */
-
- $.fn.facebox = function(settings) {
- if ($(this).length == 0) return
-
- init(settings)
-
- function clickHandler() {
- $.facebox.loading(true)
-
- // support for rel="facebox.inline_popup" syntax, to add a class
- // also supports deprecated "facebox[.inline_popup]" syntax
- var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
- if (klass) klass = klass[1]
-
- fillFaceboxFromHref(this.href, klass)
- return false
- }
-
- return this.bind('click.facebox', clickHandler)
- }
-
- /*
- * Private methods
- */
-
- // called one time to setup facebox on this page
- function init(settings) {
- if ($.facebox.settings.inited) return true
- else $.facebox.settings.inited = true
-
- $(document).trigger('init.facebox')
- makeCompatible()
-
- var imageTypes = $.facebox.settings.imageTypes.join('|')
- $.facebox.settings.imageTypesRegexp = new RegExp('\\.(' + imageTypes + ')(\\?.*)?$', 'i')
-
- if (settings) $.extend($.facebox.settings, settings)
- $('body').append($.facebox.settings.faceboxHtml)
-
- var preload = [ new Image(), new Image() ]
- preload[0].src = $.facebox.settings.closeImage
- preload[1].src = $.facebox.settings.loadingImage
-
- $('#facebox').find('.b:first, .bl').each(function() {
- preload.push(new Image())
- preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
- })
-
- $('#facebox .close')
- .click($.facebox.close)
- .append('<img src="'
- + $.facebox.settings.closeImage
- + '" class="close_image" title="close">')
- }
-
- // getPageScroll() by quirksmode.com
- function getPageScroll() {
- var xScroll, yScroll;
- if (self.pageYOffset) {
- yScroll = self.pageYOffset;
- xScroll = self.pageXOffset;
- } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
- yScroll = document.documentElement.scrollTop;
- xScroll = document.documentElement.scrollLeft;
- } else if (document.body) {// all other Explorers
- yScroll = document.body.scrollTop;
- xScroll = document.body.scrollLeft;
- }
- return new Array(xScroll,yScroll)
- }
-
- // Adapted from getPageSize() by quirksmode.com
- function getPageHeight() {
- var windowHeight
- if (self.innerHeight) { // all except Explorer
- windowHeight = self.innerHeight;
- } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
- windowHeight = document.documentElement.clientHeight;
- } else if (document.body) { // other Explorers
- windowHeight = document.body.clientHeight;
- }
- return windowHeight
- }
-
- // Backwards compatibility
- function makeCompatible() {
- var $s = $.facebox.settings
-
- $s.loadingImage = $s.loading_image || $s.loadingImage
- $s.closeImage = $s.close_image || $s.closeImage
- $s.imageTypes = $s.image_types || $s.imageTypes
- $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
- }
-
- // Figures out what you want to display and displays it
- // formats are:
- // div: #id
- // image: blah.extension
- // ajax: anything else
- function fillFaceboxFromHref(href, klass) {
- // div
- if (href.match(/#/)) {
- var url = window.location.href.split('#')[0]
- var target = href.replace(url,'')
- if (target == '#') return
- $.facebox.reveal($(target).html(), klass)
-
- // image
- } else if (href.match($.facebox.settings.imageTypesRegexp)) {
- fillFaceboxFromImage(href, klass)
- // ajax
- } else {
- fillFaceboxFromAjax(href, klass)
- }
- }
-
- function fillFaceboxFromImage(href, klass) {
- var image = new Image()
- image.onload = function() {
- $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
- }
- image.src = href
- }
-
- function fillFaceboxFromAjax(href, klass) {
- $.get(href, function(data) { $.facebox.reveal(data, klass) })
- }
-
- function skipOverlay() {
- return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null
- }
-
- function showOverlay() {
- if (skipOverlay()) return
-
- if ($('#facebox_overlay').length == 0)
- $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')
-
- $('#facebox_overlay').hide().addClass("facebox_overlayBG")
- .css('opacity', $.facebox.settings.opacity)
- .click(function() { $(document).trigger('close.facebox') })
- .fadeIn(200)
- return false
- }
-
- function hideOverlay() {
- if (skipOverlay()) return
-
- $('#facebox_overlay').fadeOut(200, function(){
- $("#facebox_overlay").removeClass("facebox_overlayBG")
- $("#facebox_overlay").addClass("facebox_hide")
- $("#facebox_overlay").remove()
- })
-
- return false
- }
-
- /*
- * Bindings
- */
-
- $(document).bind('close.facebox', function() {
- $(document).unbind('keydown.facebox')
- $('#facebox').fadeOut(function() {
- $('#facebox .content').removeClass().addClass('content')
- $('#facebox .loading').remove()
- $(document).trigger('afterClose.facebox')
- })
- hideOverlay()
- })
-
-})(jQuery);
diff --git a/public/javascripts/vendor/handlebars-1.0.0.beta.6.js b/public/javascripts/vendor/handlebars-1.0.0.beta.6.js
deleted file mode 100644
index 83119ff88..000000000
--- a/public/javascripts/vendor/handlebars-1.0.0.beta.6.js
+++ /dev/null
@@ -1,1550 +0,0 @@
-// lib/handlebars/base.js
-var Handlebars = {};
-
-Handlebars.VERSION = "1.0.beta.6";
-
-Handlebars.helpers = {};
-Handlebars.partials = {};
-
-Handlebars.registerHelper = function(name, fn, inverse) {
- if(inverse) { fn.not = inverse; }
- this.helpers[name] = fn;
-};
-
-Handlebars.registerPartial = function(name, str) {
- this.partials[name] = str;
-};
-
-Handlebars.registerHelper('helperMissing', function(arg) {
- if(arguments.length === 2) {
- return undefined;
- } else {
- throw new Error("Could not find property '" + arg + "'");
- }
-});
-
-var toString = Object.prototype.toString, functionType = "[object Function]";
-
-Handlebars.registerHelper('blockHelperMissing', function(context, options) {
- var inverse = options.inverse || function() {}, fn = options.fn;
-
-
- var ret = "";
- var type = toString.call(context);
-
- if(type === functionType) { context = context.call(this); }
-
- if(context === true) {
- return fn(this);
- } else if(context === false || context == null) {
- return inverse(this);
- } else if(type === "[object Array]") {
- if(context.length > 0) {
- for(var i=0, j=context.length; i<j; i++) {
- ret = ret + fn(context[i]);
- }
- } else {
- ret = inverse(this);
- }
- return ret;
- } else {
- return fn(context);
- }
-});
-
-Handlebars.registerHelper('each', function(context, options) {
- var fn = options.fn, inverse = options.inverse;
- var ret = "";
-
- if(context && context.length > 0) {
- for(var i=0, j=context.length; i<j; i++) {
- ret = ret + fn(context[i]);
- }
- } else {
- ret = inverse(this);
- }
- return ret;
-});
-
-Handlebars.registerHelper('if', function(context, options) {
- var type = toString.call(context);
- if(type === functionType) { context = context.call(this); }
-
- if(!context || Handlebars.Utils.isEmpty(context)) {
- return options.inverse(this);
- } else {
- return options.fn(this);
- }
-});
-
-Handlebars.registerHelper('unless', function(context, options) {
- var fn = options.fn, inverse = options.inverse;
- options.fn = inverse;
- options.inverse = fn;
-
- return Handlebars.helpers['if'].call(this, context, options);
-});
-
-Handlebars.registerHelper('with', function(context, options) {
- return options.fn(context);
-});
-
-Handlebars.registerHelper('log', function(context) {
- Handlebars.log(context);
-});
-;
-// lib/handlebars/compiler/parser.js
-/* Jison generated parser */
-var handlebars = (function(){
-
-var parser = {trace: function trace() { },
-yy: {},
-symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"INTEGER":29,"BOOLEAN":30,"hashSegments":31,"hashSegment":32,"ID":33,"EQUALS":34,"pathSegments":35,"SEP":36,"$accept":0,"$end":1},
-terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},
-productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],
-performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
-
-var $0 = $$.length - 1;
-switch (yystate) {
-case 1: return $$[$0-1]
-break;
-case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0])
-break;
-case 3: this.$ = new yy.ProgramNode($$[$0])
-break;
-case 4: this.$ = new yy.ProgramNode([])
-break;
-case 5: this.$ = [$$[$0]]
-break;
-case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]
-break;
-case 7: this.$ = new yy.InverseNode($$[$0-2], $$[$0-1], $$[$0])
-break;
-case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0])
-break;
-case 9: this.$ = $$[$0]
-break;
-case 10: this.$ = $$[$0]
-break;
-case 11: this.$ = new yy.ContentNode($$[$0])
-break;
-case 12: this.$ = new yy.CommentNode($$[$0])
-break;
-case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
-break;
-case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
-break;
-case 15: this.$ = $$[$0-1]
-break;
-case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
-break;
-case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true)
-break;
-case 18: this.$ = new yy.PartialNode($$[$0-1])
-break;
-case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1])
-break;
-case 20:
-break;
-case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]
-break;
-case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null]
-break;
-case 23: this.$ = [[$$[$0-1]], $$[$0]]
-break;
-case 24: this.$ = [[$$[$0]], null]
-break;
-case 25: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
-break;
-case 26: this.$ = [$$[$0]]
-break;
-case 27: this.$ = $$[$0]
-break;
-case 28: this.$ = new yy.StringNode($$[$0])
-break;
-case 29: this.$ = new yy.IntegerNode($$[$0])
-break;
-case 30: this.$ = new yy.BooleanNode($$[$0])
-break;
-case 31: this.$ = new yy.HashNode($$[$0])
-break;
-case 32: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]
-break;
-case 33: this.$ = [$$[$0]]
-break;
-case 34: this.$ = [$$[$0-2], $$[$0]]
-break;
-case 35: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]
-break;
-case 36: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])]
-break;
-case 37: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])]
-break;
-case 38: this.$ = new yy.IdNode($$[$0])
-break;
-case 39: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
-break;
-case 40: this.$ = [$$[$0]]
-break;
-}
-},
-table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],
-defaultActions: {16:[2,1],37:[2,23],53:[2,21]},
-parseError: function parseError(str, hash) {
- throw new Error(str);
-},
-parse: function parse(input) {
- var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
- this.lexer.setInput(input);
- this.lexer.yy = this.yy;
- this.yy.lexer = this.lexer;
- if (typeof this.lexer.yylloc == "undefined")
- this.lexer.yylloc = {};
- var yyloc = this.lexer.yylloc;
- lstack.push(yyloc);
- if (typeof this.yy.parseError === "function")
- this.parseError = this.yy.parseError;
- function popStack(n) {
- stack.length = stack.length - 2 * n;
- vstack.length = vstack.length - n;
- lstack.length = lstack.length - n;
- }
- function lex() {
- var token;
- token = self.lexer.lex() || 1;
- if (typeof token !== "number") {
- token = self.symbols_[token] || token;
- }
- return token;
- }
- var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
- while (true) {
- state = stack[stack.length - 1];
- if (this.defaultActions[state]) {
- action = this.defaultActions[state];
- } else {
- if (symbol == null)
- symbol = lex();
- action = table[state] && table[state][symbol];
- }
- if (typeof action === "undefined" || !action.length || !action[0]) {
- if (!recovering) {
- expected = [];
- for (p in table[state])
- if (this.terminals_[p] && p > 2) {
- expected.push("'" + this.terminals_[p] + "'");
- }
- var errStr = "";
- if (this.lexer.showPosition) {
- errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + this.terminals_[symbol] + "'";
- } else {
- errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
- }
- this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
- }
- }
- if (action[0] instanceof Array && action.length > 1) {
- throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
- }
- switch (action[0]) {
- case 1:
- stack.push(symbol);
- vstack.push(this.lexer.yytext);
- lstack.push(this.lexer.yylloc);
- stack.push(action[1]);
- symbol = null;
- if (!preErrorSymbol) {
- yyleng = this.lexer.yyleng;
- yytext = this.lexer.yytext;
- yylineno = this.lexer.yylineno;
- yyloc = this.lexer.yylloc;
- if (recovering > 0)
- recovering--;
- } else {
- symbol = preErrorSymbol;
- preErrorSymbol = null;
- }
- break;
- case 2:
- len = this.productions_[action[1]][1];
- yyval.$ = vstack[vstack.length - len];
- yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
- r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
- if (typeof r !== "undefined") {
- return r;
- }
- if (len) {
- stack = stack.slice(0, -1 * len * 2);
- vstack = vstack.slice(0, -1 * len);
- lstack = lstack.slice(0, -1 * len);
- }
- stack.push(this.productions_[action[1]][0]);
- vstack.push(yyval.$);
- lstack.push(yyval._$);
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
- stack.push(newState);
- break;
- case 3:
- return true;
- }
- }
- return true;
-}
-};/* Jison generated lexer */
-var lexer = (function(){
-
-var lexer = ({EOF:1,
-parseError:function parseError(str, hash) {
- if (this.yy.parseError) {
- this.yy.parseError(str, hash);
- } else {
- throw new Error(str);
- }
- },
-setInput:function (input) {
- this._input = input;
- this._more = this._less = this.done = false;
- this.yylineno = this.yyleng = 0;
- this.yytext = this.matched = this.match = '';
- this.conditionStack = ['INITIAL'];
- this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
- return this;
- },
-input:function () {
- var ch = this._input[0];
- this.yytext+=ch;
- this.yyleng++;
- this.match+=ch;
- this.matched+=ch;
- var lines = ch.match(/\n/);
- if (lines) this.yylineno++;
- this._input = this._input.slice(1);
- return ch;
- },
-unput:function (ch) {
- this._input = ch + this._input;
- return this;
- },
-more:function () {
- this._more = true;
- return this;
- },
-pastInput:function () {
- var past = this.matched.substr(0, this.matched.length - this.match.length);
- return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
- },
-upcomingInput:function () {
- var next = this.match;
- if (next.length < 20) {
- next += this._input.substr(0, 20-next.length);
- }
- return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
- },
-showPosition:function () {
- var pre = this.pastInput();
- var c = new Array(pre.length + 1).join("-");
- return pre + this.upcomingInput() + "\n" + c+"^";
- },
-next:function () {
- if (this.done) {
- return this.EOF;
- }
- if (!this._input) this.done = true;
-
- var token,
- match,
- col,
- lines;
- if (!this._more) {
- this.yytext = '';
- this.match = '';
- }
- var rules = this._currentRules();
- for (var i=0;i < rules.length; i++) {
- match = this._input.match(this.rules[rules[i]]);
- if (match) {
- lines = match[0].match(/\n.*/g);
- if (lines) this.yylineno += lines.length;
- this.yylloc = {first_line: this.yylloc.last_line,
- last_line: this.yylineno+1,
- first_column: this.yylloc.last_column,
- last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
- this.yytext += match[0];
- this.match += match[0];
- this.matches = match;
- this.yyleng = this.yytext.length;
- this._more = false;
- this._input = this._input.slice(match[0].length);
- this.matched += match[0];
- token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);
- if (token) return token;
- else return;
- }
- }
- if (this._input === "") {
- return this.EOF;
- } else {
- this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
- {text: "", token: null, line: this.yylineno});
- }
- },
-lex:function lex() {
- var r = this.next();
- if (typeof r !== 'undefined') {
- return r;
- } else {
- return this.lex();
- }
- },
-begin:function begin(condition) {
- this.conditionStack.push(condition);
- },
-popState:function popState() {
- return this.conditionStack.pop();
- },
-_currentRules:function _currentRules() {
- return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
- },
-topState:function () {
- return this.conditionStack[this.conditionStack.length-2];
- },
-pushState:function begin(condition) {
- this.begin(condition);
- }});
-lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
-
-var YYSTATE=YY_START
-switch($avoiding_name_collisions) {
-case 0:
- if(yy_.yytext.slice(-1) !== "\\") this.begin("mu");
- if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu");
- if(yy_.yytext) return 14;
-
-break;
-case 1: return 14;
-break;
-case 2: this.popState(); return 14;
-break;
-case 3: return 24;
-break;
-case 4: return 16;
-break;
-case 5: return 20;
-break;
-case 6: return 19;
-break;
-case 7: return 19;
-break;
-case 8: return 23;
-break;
-case 9: return 23;
-break;
-case 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15;
-break;
-case 11: return 22;
-break;
-case 12: return 34;
-break;
-case 13: return 33;
-break;
-case 14: return 33;
-break;
-case 15: return 36;
-break;
-case 16: /*ignore whitespace*/
-break;
-case 17: this.popState(); return 18;
-break;
-case 18: this.popState(); return 18;
-break;
-case 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 28;
-break;
-case 20: return 30;
-break;
-case 21: return 30;
-break;
-case 22: return 29;
-break;
-case 23: return 33;
-break;
-case 24: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 33;
-break;
-case 25: return 'INVALID';
-break;
-case 26: return 5;
-break;
-}
-};
-lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/];
-lexer.conditions = {"mu":{"rules":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"INITIAL":{"rules":[0,1,26],"inclusive":true}};return lexer;})()
-parser.lexer = lexer;
-return parser;
-})();
-if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
-exports.parser = handlebars;
-exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }
-exports.main = function commonjsMain(args) {
- if (!args[1])
- throw new Error('Usage: '+args[0]+' FILE');
- if (typeof process !== 'undefined') {
- var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
- } else {
- var cwd = require("file").path(require("file").cwd());
- var source = cwd.join(args[1]).read({charset: "utf-8"});
- }
- return exports.parser.parse(source);
-}
-if (typeof module !== 'undefined' && require.main === module) {
- exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
-}
-};
-;
-// lib/handlebars/compiler/base.js
-Handlebars.Parser = handlebars;
-
-Handlebars.parse = function(string) {
- Handlebars.Parser.yy = Handlebars.AST;
- return Handlebars.Parser.parse(string);
-};
-
-Handlebars.print = function(ast) {
- return new Handlebars.PrintVisitor().accept(ast);
-};
-
-Handlebars.logger = {
- DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
-
- // override in the host environment
- log: function(level, str) {}
-};
-
-Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
-;
-// lib/handlebars/compiler/ast.js
-(function() {
-
- Handlebars.AST = {};
-
- Handlebars.AST.ProgramNode = function(statements, inverse) {
- this.type = "program";
- this.statements = statements;
- if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); }
- };
-
- Handlebars.AST.MustacheNode = function(params, hash, unescaped) {
- this.type = "mustache";
- this.id = params[0];
- this.params = params.slice(1);
- this.hash = hash;
- this.escaped = !unescaped;
- };
-
- Handlebars.AST.PartialNode = function(id, context) {
- this.type = "partial";
-
- // TODO: disallow complex IDs
-
- this.id = id;
- this.context = context;
- };
-
- var verifyMatch = function(open, close) {
- if(open.original !== close.original) {
- throw new Handlebars.Exception(open.original + " doesn't match " + close.original);
- }
- };
-
- Handlebars.AST.BlockNode = function(mustache, program, close) {
- verifyMatch(mustache.id, close);
- this.type = "block";
- this.mustache = mustache;
- this.program = program;
- };
-
- Handlebars.AST.InverseNode = function(mustache, program, close) {
- verifyMatch(mustache.id, close);
- this.type = "inverse";
- this.mustache = mustache;
- this.program = program;
- };
-
- Handlebars.AST.ContentNode = function(string) {
- this.type = "content";
- this.string = string;
- };
-
- Handlebars.AST.HashNode = function(pairs) {
- this.type = "hash";
- this.pairs = pairs;
- };
-
- Handlebars.AST.IdNode = function(parts) {
- this.type = "ID";
- this.original = parts.join(".");
-
- var dig = [], depth = 0;
-
- for(var i=0,l=parts.length; i<l; i++) {
- var part = parts[i];
-
- if(part === "..") { depth++; }
- else if(part === "." || part === "this") { this.isScoped = true; }
- else { dig.push(part); }
- }
-
- this.parts = dig;
- this.string = dig.join('.');
- this.depth = depth;
- this.isSimple = (dig.length === 1) && (depth === 0);
- };
-
- Handlebars.AST.StringNode = function(string) {
- this.type = "STRING";
- this.string = string;
- };
-
- Handlebars.AST.IntegerNode = function(integer) {
- this.type = "INTEGER";
- this.integer = integer;
- };
-
- Handlebars.AST.BooleanNode = function(bool) {
- this.type = "BOOLEAN";
- this.bool = bool;
- };
-
- Handlebars.AST.CommentNode = function(comment) {
- this.type = "comment";
- this.comment = comment;
- };
-
-})();;
-// lib/handlebars/utils.js
-Handlebars.Exception = function(message) {
- var tmp = Error.prototype.constructor.apply(this, arguments);
-
- for (var p in tmp) {
- if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }
- }
-
- this.message = tmp.message;
-};
-Handlebars.Exception.prototype = new Error;
-
-// Build out our basic SafeString type
-Handlebars.SafeString = function(string) {
- this.string = string;
-};
-Handlebars.SafeString.prototype.toString = function() {
- return this.string.toString();
-};
-
-(function() {
- var escape = {
- "<": "&lt;",
- ">": "&gt;",
- '"': "&quot;",
- "'": "&#x27;",
- "`": "&#x60;"
- };
-
- var badChars = /&(?!\w+;)|[<>"'`]/g;
- var possible = /[&<>"'`]/;
-
- var escapeChar = function(chr) {
- return escape[chr] || "&amp;";
- };
-
- Handlebars.Utils = {
- escapeExpression: function(string) {
- // don't escape SafeStrings, since they're already safe
- if (string instanceof Handlebars.SafeString) {
- return string.toString();
- } else if (string == null || string === false) {
- return "";
- }
-
- if(!possible.test(string)) { return string; }
- return string.replace(badChars, escapeChar);
- },
-
- isEmpty: function(value) {
- if (typeof value === "undefined") {
- return true;
- } else if (value === null) {
- return true;
- } else if (value === false) {
- return true;
- } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
- return true;
- } else {
- return false;
- }
- }
- };
-})();;
-// lib/handlebars/compiler/compiler.js
-Handlebars.Compiler = function() {};
-Handlebars.JavaScriptCompiler = function() {};
-
-(function(Compiler, JavaScriptCompiler) {
- Compiler.OPCODE_MAP = {
- appendContent: 1,
- getContext: 2,
- lookupWithHelpers: 3,
- lookup: 4,
- append: 5,
- invokeMustache: 6,
- appendEscaped: 7,
- pushString: 8,
- truthyOrFallback: 9,
- functionOrFallback: 10,
- invokeProgram: 11,
- invokePartial: 12,
- push: 13,
- assignToHash: 15,
- pushStringParam: 16
- };
-
- Compiler.MULTI_PARAM_OPCODES = {
- appendContent: 1,
- getContext: 1,
- lookupWithHelpers: 2,
- lookup: 1,
- invokeMustache: 3,
- pushString: 1,
- truthyOrFallback: 1,
- functionOrFallback: 1,
- invokeProgram: 3,
- invokePartial: 1,
- push: 1,
- assignToHash: 1,
- pushStringParam: 1
- };
-
- Compiler.DISASSEMBLE_MAP = {};
-
- for(var prop in Compiler.OPCODE_MAP) {
- var value = Compiler.OPCODE_MAP[prop];
- Compiler.DISASSEMBLE_MAP[value] = prop;
- }
-
- Compiler.multiParamSize = function(code) {
- return Compiler.MULTI_PARAM_OPCODES[Compiler.DISASSEMBLE_MAP[code]];
- };
-
- Compiler.prototype = {
- compiler: Compiler,
-
- disassemble: function() {
- var opcodes = this.opcodes, opcode, nextCode;
- var out = [], str, name, value;
-
- for(var i=0, l=opcodes.length; i<l; i++) {
- opcode = opcodes[i];
-
- if(opcode === 'DECLARE') {
- name = opcodes[++i];
- value = opcodes[++i];
- out.push("DECLARE " + name + " = " + value);
- } else {
- str = Compiler.DISASSEMBLE_MAP[opcode];
-
- var extraParams = Compiler.multiParamSize(opcode);
- var codes = [];
-
- for(var j=0; j<extraParams; j++) {
- nextCode = opcodes[++i];
-
- if(typeof nextCode === "string") {
- nextCode = "\"" + nextCode.replace("\n", "\\n") + "\"";
- }
-
- codes.push(nextCode);
- }
-
- str = str + " " + codes.join(" ");
-
- out.push(str);
- }
- }
-
- return out.join("\n");
- },
-
- guid: 0,
-
- compile: function(program, options) {
- this.children = [];
- this.depths = {list: []};
- this.options = options;
-
- // These changes will propagate to the other compiler components
- var knownHelpers = this.options.knownHelpers;
- this.options.knownHelpers = {
- 'helperMissing': true,
- 'blockHelperMissing': true,
- 'each': true,
- 'if': true,
- 'unless': true,
- 'with': true,
- 'log': true
- };
- if (knownHelpers) {
- for (var name in knownHelpers) {
- this.options.knownHelpers[name] = knownHelpers[name];
- }
- }
-
- return this.program(program);
- },
-
- accept: function(node) {
- return this[node.type](node);
- },
-
- program: function(program) {
- var statements = program.statements, statement;
- this.opcodes = [];
-
- for(var i=0, l=statements.length; i<l; i++) {
- statement = statements[i];
- this[statement.type](statement);
- }
- this.isSimple = l === 1;
-
- this.depths.list = this.depths.list.sort(function(a, b) {
- return a - b;
- });
-
- return this;
- },
-
- compileProgram: function(program) {
- var result = new this.compiler().compile(program, this.options);
- var guid = this.guid++;
-
- this.usePartial = this.usePartial || result.usePartial;
-
- this.children[guid] = result;
-
- for(var i=0, l=result.depths.list.length; i<l; i++) {
- depth = result.depths.list[i];
-
- if(depth < 2) { continue; }
- else { this.addDepth(depth - 1); }
- }
-
- return guid;
- },
-
- block: function(block) {
- var mustache = block.mustache;
- var depth, child, inverse, inverseGuid;
-
- var params = this.setupStackForMustache(mustache);
-
- var programGuid = this.compileProgram(block.program);
-
- if(block.program.inverse) {
- inverseGuid = this.compileProgram(block.program.inverse);
- this.declare('inverse', inverseGuid);
- }
-
- this.opcode('invokeProgram', programGuid, params.length, !!mustache.hash);
- this.declare('inverse', null);
- this.opcode('append');
- },
-
- inverse: function(block) {
- var params = this.setupStackForMustache(block.mustache);
-
- var programGuid = this.compileProgram(block.program);
-
- this.declare('inverse', programGuid);
-
- this.opcode('invokeProgram', null, params.length, !!block.mustache.hash);
- this.declare('inverse', null);
- this.opcode('append');
- },
-
- hash: function(hash) {
- var pairs = hash.pairs, pair, val;
-
- this.opcode('push', '{}');
-
- for(var i=0, l=pairs.length; i<l; i++) {
- pair = pairs[i];
- val = pair[1];
-
- this.accept(val);
- this.opcode('assignToHash', pair[0]);
- }
- },
-
- partial: function(partial) {
- var id = partial.id;
- this.usePartial = true;
-
- if(partial.context) {
- this.ID(partial.context);
- } else {
- this.opcode('push', 'depth0');
- }
-
- this.opcode('invokePartial', id.original);
- this.opcode('append');
- },
-
- content: function(content) {
- this.opcode('appendContent', content.string);
- },
-
- mustache: function(mustache) {
- var params = this.setupStackForMustache(mustache);
-
- this.opcode('invokeMustache', params.length, mustache.id.original, !!mustache.hash);
-
- if(mustache.escaped && !this.options.noEscape) {
- this.opcode('appendEscaped');
- } else {
- this.opcode('append');
- }
- },
-
- ID: function(id) {
- this.addDepth(id.depth);
-
- this.opcode('getContext', id.depth);
-
- this.opcode('lookupWithHelpers', id.parts[0] || null, id.isScoped || false);
-
- for(var i=1, l=id.parts.length; i<l; i++) {
- this.opcode('lookup', id.parts[i]);
- }
- },
-
- STRING: function(string) {
- this.opcode('pushString', string.string);
- },
-
- INTEGER: function(integer) {
- this.opcode('push', integer.integer);
- },
-
- BOOLEAN: function(bool) {
- this.opcode('push', bool.bool);
- },
-
- comment: function() {},
-
- // HELPERS
- pushParams: function(params) {
- var i = params.length, param;
-
- while(i--) {
- param = params[i];
-
- if(this.options.stringParams) {
- if(param.depth) {
- this.addDepth(param.depth);
- }
-
- this.opcode('getContext', param.depth || 0);
- this.opcode('pushStringParam', param.string);
- } else {
- this[param.type](param);
- }
- }
- },
-
- opcode: function(name, val1, val2, val3) {
- this.opcodes.push(Compiler.OPCODE_MAP[name]);
- if(val1 !== undefined) { this.opcodes.push(val1); }
- if(val2 !== undefined) { this.opcodes.push(val2); }
- if(val3 !== undefined) { this.opcodes.push(val3); }
- },
-
- declare: function(name, value) {
- this.opcodes.push('DECLARE');
- this.opcodes.push(name);
- this.opcodes.push(value);
- },
-
- addDepth: function(depth) {
- if(depth === 0) { return; }
-
- if(!this.depths[depth]) {
- this.depths[depth] = true;
- this.depths.list.push(depth);
- }
- },
-
- setupStackForMustache: function(mustache) {
- var params = mustache.params;
-
- this.pushParams(params);
-
- if(mustache.hash) {
- this.hash(mustache.hash);
- }
-
- this.ID(mustache.id);
-
- return params;
- }
- };
-
- JavaScriptCompiler.prototype = {
- // PUBLIC API: You can override these methods in a subclass to provide
- // alternative compiled forms for name lookup and buffering semantics
- nameLookup: function(parent, name, type) {
- if (/^[0-9]+$/.test(name)) {
- return parent + "[" + name + "]";
- } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
- return parent + "." + name;
- }
- else {
- return parent + "['" + name + "']";
- }
- },
-
- appendToBuffer: function(string) {
- if (this.environment.isSimple) {
- return "return " + string + ";";
- } else {
- return "buffer += " + string + ";";
- }
- },
-
- initializeBuffer: function() {
- return this.quotedString("");
- },
-
- namespace: "Handlebars",
- // END PUBLIC API
-
- compile: function(environment, options, context, asObject) {
- this.environment = environment;
- this.options = options || {};
-
- this.name = this.environment.name;
- this.isChild = !!context;
- this.context = context || {
- programs: [],
- aliases: { self: 'this' },
- registers: {list: []}
- };
-
- this.preamble();
-
- this.stackSlot = 0;
- this.stackVars = [];
-
- this.compileChildren(environment, options);
-
- var opcodes = environment.opcodes, opcode;
-
- this.i = 0;
-
- for(l=opcodes.length; this.i<l; this.i++) {
- opcode = this.nextOpcode(0);
-
- if(opcode[0] === 'DECLARE') {
- this.i = this.i + 2;
- this[opcode[1]] = opcode[2];
- } else {
- this.i = this.i + opcode[1].length;
- this[opcode[0]].apply(this, opcode[1]);
- }
- }
-
- return this.createFunctionContext(asObject);
- },
-
- nextOpcode: function(n) {
- var opcodes = this.environment.opcodes, opcode = opcodes[this.i + n], name, val;
- var extraParams, codes;
-
- if(opcode === 'DECLARE') {
- name = opcodes[this.i + 1];
- val = opcodes[this.i + 2];
- return ['DECLARE', name, val];
- } else {
- name = Compiler.DISASSEMBLE_MAP[opcode];
-
- extraParams = Compiler.multiParamSize(opcode);
- codes = [];
-
- for(var j=0; j<extraParams; j++) {
- codes.push(opcodes[this.i + j + 1 + n]);
- }
-
- return [name, codes];
- }
- },
-
- eat: function(opcode) {
- this.i = this.i + opcode.length;
- },
-
- preamble: function() {
- var out = [];
-
- // this register will disambiguate helper lookup from finding a function in
- // a context. This is necessary for mustache compatibility, which requires
- // that context functions in blocks are evaluated by blockHelperMissing, and
- // then proceed as if the resulting value was provided to blockHelperMissing.
- this.useRegister('foundHelper');
-
- if (!this.isChild) {
- var namespace = this.namespace;
- var copies = "helpers = helpers || " + namespace + ".helpers;";
- if(this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; }
- out.push(copies);
- } else {
- out.push('');
- }
-
- if (!this.environment.isSimple) {
- out.push(", buffer = " + this.initializeBuffer());
- } else {
- out.push("");
- }
-
- // track the last context pushed into place to allow skipping the
- // getContext opcode when it would be a noop
- this.lastContext = 0;
- this.source = out;
- },
-
- createFunctionContext: function(asObject) {
- var locals = this.stackVars;
- if (!this.isChild) {
- locals = locals.concat(this.context.registers.list);
- }
-
- if(locals.length > 0) {
- this.source[1] = this.source[1] + ", " + locals.join(", ");
- }
-
- // Generate minimizer alias mappings
- if (!this.isChild) {
- var aliases = []
- for (var alias in this.context.aliases) {
- this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
- }
- }
-
- if (this.source[1]) {
- this.source[1] = "var " + this.source[1].substring(2) + ";";
- }
-
- // Merge children
- if (!this.isChild) {
- this.source[1] += '\n' + this.context.programs.join('\n') + '\n';
- }
-
- if (!this.environment.isSimple) {
- this.source.push("return buffer;");
- }
-
- var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"];
-
- for(var i=0, l=this.environment.depths.list.length; i<l; i++) {
- params.push("depth" + this.environment.depths.list[i]);
- }
-
- if (asObject) {
- params.push(this.source.join("\n "));
-
- return Function.apply(this, params);
- } else {
- var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + this.source.join("\n ") + '}';
- Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n");
- return functionSource;
- }
- },
-
- appendContent: function(content) {
- this.source.push(this.appendToBuffer(this.quotedString(content)));
- },
-
- append: function() {
- var local = this.popStack();
- this.source.push("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }");
- if (this.environment.isSimple) {
- this.source.push("else { " + this.appendToBuffer("''") + " }");
- }
- },
-
- appendEscaped: function() {
- var opcode = this.nextOpcode(1), extra = "";
- this.context.aliases.escapeExpression = 'this.escapeExpression';
-
- if(opcode[0] === 'appendContent') {
- extra = " + " + this.quotedString(opcode[1][0]);
- this.eat(opcode);
- }
-
- this.source.push(this.appendToBuffer("escapeExpression(" + this.popStack() + ")" + extra));
- },
-
- getContext: function(depth) {
- if(this.lastContext !== depth) {
- this.lastContext = depth;
- }
- },
-
- lookupWithHelpers: function(name, isScoped) {
- if(name) {
- var topStack = this.nextStack();
-
- this.usingKnownHelper = false;
-
- var toPush;
- if (!isScoped && this.options.knownHelpers[name]) {
- toPush = topStack + " = " + this.nameLookup('helpers', name, 'helper');
- this.usingKnownHelper = true;
- } else if (isScoped || this.options.knownHelpersOnly) {
- toPush = topStack + " = " + this.nameLookup('depth' + this.lastContext, name, 'context');
- } else {
- this.register('foundHelper', this.nameLookup('helpers', name, 'helper'));
- toPush = topStack + " = foundHelper || " + this.nameLookup('depth' + this.lastContext, name, 'context');
- }
-
- toPush += ';';
- this.source.push(toPush);
- } else {
- this.pushStack('depth' + this.lastContext);
- }
- },
-
- lookup: function(name) {
- var topStack = this.topStack();
- this.source.push(topStack + " = (" + topStack + " === null || " + topStack + " === undefined || " + topStack + " === false ? " +
- topStack + " : " + this.nameLookup(topStack, name, 'context') + ");");
- },
-
- pushStringParam: function(string) {
- this.pushStack('depth' + this.lastContext);
- this.pushString(string);
- },
-
- pushString: function(string) {
- this.pushStack(this.quotedString(string));
- },
-
- push: function(name) {
- this.pushStack(name);
- },
-
- invokeMustache: function(paramSize, original, hasHash) {
- this.populateParams(paramSize, this.quotedString(original), "{}", null, hasHash, function(nextStack, helperMissingString, id) {
- if (!this.usingKnownHelper) {
- this.context.aliases.helperMissing = 'helpers.helperMissing';
- this.context.aliases.undef = 'void 0';
- this.source.push("else if(" + id + "=== undef) { " + nextStack + " = helperMissing.call(" + helperMissingString + "); }");
- if (nextStack !== id) {
- this.source.push("else { " + nextStack + " = " + id + "; }");
- }
- }
- });
- },
-
- invokeProgram: function(guid, paramSize, hasHash) {
- var inverse = this.programExpression(this.inverse);
- var mainProgram = this.programExpression(guid);
-
- this.populateParams(paramSize, null, mainProgram, inverse, hasHash, function(nextStack, helperMissingString, id) {
- if (!this.usingKnownHelper) {
- this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
- this.source.push("else { " + nextStack + " = blockHelperMissing.call(" + helperMissingString + "); }");
- }
- });
- },
-
- populateParams: function(paramSize, helperId, program, inverse, hasHash, fn) {
- var needsRegister = hasHash || this.options.stringParams || inverse || this.options.data;
- var id = this.popStack(), nextStack;
- var params = [], param, stringParam, stringOptions;
-
- if (needsRegister) {
- this.register('tmp1', program);
- stringOptions = 'tmp1';
- } else {
- stringOptions = '{ hash: {} }';
- }
-
- if (needsRegister) {
- var hash = (hasHash ? this.popStack() : '{}');
- this.source.push('tmp1.hash = ' + hash + ';');
- }
-
- if(this.options.stringParams) {
- this.source.push('tmp1.contexts = [];');
- }
-
- for(var i=0; i<paramSize; i++) {
- param = this.popStack();
- params.push(param);
-
- if(this.options.stringParams) {
- this.source.push('tmp1.contexts.push(' + this.popStack() + ');');
- }
- }
-
- if(inverse) {
- this.source.push('tmp1.fn = tmp1;');
- this.source.push('tmp1.inverse = ' + inverse + ';');
- }
-
- if(this.options.data) {
- this.source.push('tmp1.data = data;');
- }
-
- params.push(stringOptions);
-
- this.populateCall(params, id, helperId || id, fn, program !== '{}');
- },
-
- populateCall: function(params, id, helperId, fn, program) {
- var paramString = ["depth0"].concat(params).join(", ");
- var helperMissingString = ["depth0"].concat(helperId).concat(params).join(", ");
-
- var nextStack = this.nextStack();
-
- if (this.usingKnownHelper) {
- this.source.push(nextStack + " = " + id + ".call(" + paramString + ");");
- } else {
- this.context.aliases.functionType = '"function"';
- var condition = program ? "foundHelper && " : ""
- this.source.push("if(" + condition + "typeof " + id + " === functionType) { " + nextStack + " = " + id + ".call(" + paramString + "); }");
- }
- fn.call(this, nextStack, helperMissingString, id);
- this.usingKnownHelper = false;
- },
-
- invokePartial: function(context) {
- params = [this.nameLookup('partials', context, 'partial'), "'" + context + "'", this.popStack(), "helpers", "partials"];
-
- if (this.options.data) {
- params.push("data");
- }
-
- this.pushStack("self.invokePartial(" + params.join(", ") + ");");
- },
-
- assignToHash: function(key) {
- var value = this.popStack();
- var hash = this.topStack();
-
- this.source.push(hash + "['" + key + "'] = " + value + ";");
- },
-
- // HELPERS
-
- compiler: JavaScriptCompiler,
-
- compileChildren: function(environment, options) {
- var children = environment.children, child, compiler;
-
- for(var i=0, l=children.length; i<l; i++) {
- child = children[i];
- compiler = new this.compiler();
-
- this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
- var index = this.context.programs.length;
- child.index = index;
- child.name = 'program' + index;
- this.context.programs[index] = compiler.compile(child, options, this.context);
- }
- },
-
- programExpression: function(guid) {
- if(guid == null) { return "self.noop"; }
-
- var child = this.environment.children[guid],
- depths = child.depths.list;
- var programParams = [child.index, child.name, "data"];
-
- for(var i=0, l = depths.length; i<l; i++) {
- depth = depths[i];
-
- if(depth === 1) { programParams.push("depth0"); }
- else { programParams.push("depth" + (depth - 1)); }
- }
-
- if(depths.length === 0) {
- return "self.program(" + programParams.join(", ") + ")";
- } else {
- programParams.shift();
- return "self.programWithDepth(" + programParams.join(", ") + ")";
- }
- },
-
- register: function(name, val) {
- this.useRegister(name);
- this.source.push(name + " = " + val + ";");
- },
-
- useRegister: function(name) {
- if(!this.context.registers[name]) {
- this.context.registers[name] = true;
- this.context.registers.list.push(name);
- }
- },
-
- pushStack: function(item) {
- this.source.push(this.nextStack() + " = " + item + ";");
- return "stack" + this.stackSlot;
- },
-
- nextStack: function() {
- this.stackSlot++;
- if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
- return "stack" + this.stackSlot;
- },
-
- popStack: function() {
- return "stack" + this.stackSlot--;
- },
-
- topStack: function() {
- return "stack" + this.stackSlot;
- },
-
- quotedString: function(str) {
- return '"' + str
- .replace(/\\/g, '\\\\')
- .replace(/"/g, '\\"')
- .replace(/\n/g, '\\n')
- .replace(/\r/g, '\\r') + '"';
- }
- };
-
- var reservedWords = (
- "break else new var" +
- " case finally return void" +
- " catch for switch while" +
- " continue function this with" +
- " default if throw" +
- " delete in try" +
- " do instanceof typeof" +
- " abstract enum int short" +
- " boolean export interface static" +
- " byte extends long super" +
- " char final native synchronized" +
- " class float package throws" +
- " const goto private transient" +
- " debugger implements protected volatile" +
- " double import public let yield"
- ).split(" ");
-
- var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
-
- for(var i=0, l=reservedWords.length; i<l; i++) {
- compilerWords[reservedWords[i]] = true;
- }
-
- JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
- if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
- return true;
- }
- return false;
- }
-
-})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
-
-Handlebars.precompile = function(string, options) {
- options = options || {};
-
- var ast = Handlebars.parse(string);
- var environment = new Handlebars.Compiler().compile(ast, options);
- return new Handlebars.JavaScriptCompiler().compile(environment, options);
-};
-
-Handlebars.compile = function(string, options) {
- options = options || {};
-
- var compiled;
- function compile() {
- var ast = Handlebars.parse(string);
- var environment = new Handlebars.Compiler().compile(ast, options);
- var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
- return Handlebars.template(templateSpec);
- }
-
- // Template is only compiled on first use and cached after that point.
- return function(context, options) {
- if (!compiled) {
- compiled = compile();
- }
- return compiled.call(this, context, options);
- };
-};
-;
-// lib/handlebars/runtime.js
-Handlebars.VM = {
- template: function(templateSpec) {
- // Just add water
- var container = {
- escapeExpression: Handlebars.Utils.escapeExpression,
- invokePartial: Handlebars.VM.invokePartial,
- programs: [],
- program: function(i, fn, data) {
- var programWrapper = this.programs[i];
- if(data) {
- return Handlebars.VM.program(fn, data);
- } else if(programWrapper) {
- return programWrapper;
- } else {
- programWrapper = this.programs[i] = Handlebars.VM.program(fn);
- return programWrapper;
- }
- },
- programWithDepth: Handlebars.VM.programWithDepth,
- noop: Handlebars.VM.noop
- };
-
- return function(context, options) {
- options = options || {};
- return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
- };
- },
-
- programWithDepth: function(fn, data, $depth) {
- var args = Array.prototype.slice.call(arguments, 2);
-
- return function(context, options) {
- options = options || {};
-
- return fn.apply(this, [context, options.data || data].concat(args));
- };
- },
- program: function(fn, data) {
- return function(context, options) {
- options = options || {};
-
- return fn(context, options.data || data);
- };
- },
- noop: function() { return ""; },
- invokePartial: function(partial, name, context, helpers, partials, data) {
- options = { helpers: helpers, partials: partials, data: data };
-
- if(partial === undefined) {
- throw new Handlebars.Exception("The partial " + name + " could not be found");
- } else if(partial instanceof Function) {
- return partial(context, options);
- } else if (!Handlebars.compile) {
- throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
- } else {
- partials[name] = Handlebars.compile(partial);
- return partials[name](context, options);
- }
- }
-};
-
-Handlebars.template = Handlebars.VM.template;
-;
diff --git a/public/javascripts/vendor/jquery-ui-1.8.9.custom.min.js b/public/javascripts/vendor/jquery-ui-1.8.9.custom.min.js
deleted file mode 100755
index 72b4f512c..000000000
--- a/public/javascripts/vendor/jquery-ui-1.8.9.custom.min.js
+++ /dev/null
@@ -1,442 +0,0 @@
-/*!
- * jQuery UI 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI
- */
-(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.9",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
-NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
-"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
-if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
-"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
-d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
-c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
-b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
-;/*!
- * jQuery UI Widget 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Widget
- */
-(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
-a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
-e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
-this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
-widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
-enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
-;/*!
- * jQuery UI Mouse 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Mouse
- *
- * Depends:
- * jquery.ui.widget.js
- */
-(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(true===c.data(b.target,a.widgetName+".preventClickEvent")){c.removeData(b.target,a.widgetName+".preventClickEvent");b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=
-a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
-this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);
-return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&c.data(a.target,this.widgetName+".preventClickEvent",
-true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
-;/*
- * jQuery UI Draggable 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Draggables
- *
- * Depends:
- * jquery.ui.core.js
- * jquery.ui.mouse.js
- * jquery.ui.widget.js
- */
-(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
-"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
-this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-
-this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();
-d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||
-this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&
-this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==
-a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||
-0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
-this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-
-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment==
-"parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?
-0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),
-10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor==
-Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():
-f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;
-if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/
-b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-
-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=
-this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.9"});
-d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=
-0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=
-c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,
-true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=
-0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=
-a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},
-stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=
-document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-
-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-
-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable",
-"snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=
-c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",
-{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t=p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,
-left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&&(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,
-a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,
-b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
-;/*
- * jQuery UI Droppable 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Droppables
- *
- * Depends:
- * jquery.ui.core.js
- * jquery.ui.widget.js
- * jquery.ui.mouse.js
- * jquery.ui.draggable.js
- */
-(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);
-a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&
-this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);
-this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g=
-d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",
-a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.9"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height;
-switch(c){case "fit":return i<=e&&g<=k&&j<=f&&h<=l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=
-i&&e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!=
-"none";if(c[f].visible){c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight};e=="mousedown"&&c[f]._activate.call(c[f],b)}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||
-a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e=
-d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})}}})(jQuery);
-;/*
- * jQuery UI Effects 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/
- */
-jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
-16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
-a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
-a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor",
-"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
-0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
-211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,
-d){if(f.isFunction(b)){d=b;b=null}return this.queue("fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l=h.splice(h.length-1,1)[0];
-h.splice(1,0,l);f.dequeue(this)})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,
-a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.9",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,
-a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",
-border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);
-return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments);
-else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),
-b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,
-a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,
-a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==
-e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=
-g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/
-h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,
-a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
-;/*
- * jQuery UI Effects Blind 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Blind
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,
-g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
-;/*
- * jQuery UI Effects Bounce 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Bounce
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
-3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
-b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);
-;/*
- * jQuery UI Effects Clip 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Clip
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,
-c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
-;/*
- * jQuery UI Effects Drop 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Drop
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e==
-"show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
-;/*
- * jQuery UI Effects Explode 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Explode
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
-0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
-e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
-;/*
- * jQuery UI Effects Fade 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Fade
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
-;/*
- * jQuery UI Effects Fold 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Fold
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],
-10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
-;/*
- * jQuery UI Effects Highlight 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Highlight
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
-this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
-;/*
- * jQuery UI Effects Pulsate 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Pulsate
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
-a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
-;/*
- * jQuery UI Effects Scale 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Scale
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
-b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
-1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","bottom","left","right","width","height","overflow","opacity"],g=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],
-p=c.effects.setMode(a,b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};
-if(m=="box"||m=="both"){if(d.from.y!=d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);
-a.css("overflow","hidden").css(a.from);if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);
-child.to=c.effects.setTransition(child,f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,
-n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
-;/*
- * jQuery UI Effects Shake 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Shake
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=
-(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
-;/*
- * jQuery UI Effects Slide 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Slide
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e);
-var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
-;/*
- * jQuery UI Effects Transfer 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Effects/Transfer
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
-b.dequeue()})})}})(jQuery);
-;
-/*
- * jQuery UI Sortable 1.8.9
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Sortables
- *
- * Depends:
- * jquery.ui.core.js
- * jquery.ui.mouse.js
- * jquery.ui.widget.js
- */
-(function($,undefined){$.widget("ui.sortable",$.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:'auto',cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:'> *',opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000},_create:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css('float')):false;this.offset=this.element.offset();this._mouseInit();},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--)
-this.items[i].item.removeData("sortable-item");return this;},_setOption:function(key,value){if(key==="disabled"){this.options[key]=value;this.widget()
-[value?"addClass":"removeClass"]("ui-sortable-disabled");}else{$.Widget.prototype._setOption.apply(this,arguments);}},_mouseCapture:function(event,overrideHandle){if(this.reverting){return false;}
-if(this.options.disabled||this.options.type=='static')return false;this._refreshItems(event);var currentItem=null,self=this,nodes=$(event.target).parents().each(function(){if($.data(this,'sortable-item')==self){currentItem=$(this);return false;}});if($.data(event.target,'sortable-item')==self)currentItem=$(event.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==event.target)validHandle=true;});if(!validHandle)return false;}
-this.currentItem=currentItem;this._removeCurrentsFromItems();return true;},_mouseStart:function(event,overrideHandle,noActivation){var o=this.options,self=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide();}
-this._createPlaceholder();if(o.containment)
-this._setContainment();if(o.cursor){if($('body').css("cursor"))this._storedCursor=$('body').css("cursor");$('body').css("cursor",o.cursor);}
-if(o.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",o.opacity);}
-if(o.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",o.zIndex);}
-if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML')
-this.overflowOffset=this.scrollParent.offset();this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions)
-this._cacheHelperProportions();if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,self._uiHash(this));}}
-if($.ui.ddmanager)
-$.ui.ddmanager.current=this;if($.ui.ddmanager&&!o.dropBehaviour)
-$.ui.ddmanager.prepareOffsets(this,event);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);return true;},_mouseDrag:function(event){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs;}
-if(this.options.scroll){var o=this.options,scrolled=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML'){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity)
-this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity)
-this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed;if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity)
-this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity)
-this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed;}else{if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)
-scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)
-scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)
-scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)
-scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}
-if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)
-$.ui.ddmanager.prepareOffsets(this,event);}
-this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';for(var i=this.items.length-1;i>=0;i--){var item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item);if(!intersection)continue;if(itemElement!=this.currentItem[0]&&this.placeholder[intersection==1?"next":"prev"]()[0]!=itemElement&&!$.ui.contains(this.placeholder[0],itemElement)&&(this.options.type=='semi-dynamic'?!$.ui.contains(this.element[0],itemElement):true)){this.direction=intersection==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item);}else{break;}
-this._trigger("change",event,this._uiHash());break;}}
-this._contactContainers(event);if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);this._trigger('sort',event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false;},_mouseStop:function(event,noPropagation){if(!event)return;if($.ui.ddmanager&&!this.options.dropBehaviour)
-$.ui.ddmanager.drop(this,event);if(this.options.revert){var self=this;var cur=self.placeholder.offset();self.reverting=true;$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self._clear(event);});}else{this._clear(event,noPropagation);}
-return false;},cancel:function(){var self=this;if(this.dragging){this._mouseUp({target:null});if(this.options.helper=="original")
-this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");else
-this.currentItem.show();for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,self._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,self._uiHash(this));this.containers[i].containerCache.over=0;}}}
-if(this.placeholder){if(this.placeholder[0].parentNode)this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode)this.helper.remove();$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem);}else{$(this.domPosition.parent).prepend(this.currentItem);}}
-return this;},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||'id')||'').match(o.expression||(/(.+)[-=_](.+)/));if(res)str.push((o.key||res[1]+'[]')+'='+(o.key&&o.expression?res[1]:res[2]));});if(!str.length&&o.key){str.push(o.key+'=');}
-return str.join('&');},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||'id')||'');});return ret;},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var isOverElement=(y1+dyClick)>t&&(y1+dyClick)<b&&(x1+dxClick)>l&&(x1+dxClick)<r;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?'width':'height']>item[this.floating?'width':'height'])){return isOverElement;}else{return(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b);}},_intersectsWithPointer:function(item){var isOverElementHeight=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth,verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(!isOverElement)
-return false;return this.floating?(((horizontalDirection&&horizontalDirection=="right")||verticalDirection=="down")?2:1):(verticalDirection&&(verticalDirection=="down"?2:1));},_intersectsWithSides:function(item){var isOverBottomHalf=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+(item.height/2),item.height),isOverRightHalf=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+(item.width/2),item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return((horizontalDirection=="right"&&isOverRightHalf)||(horizontalDirection=="left"&&!isOverRightHalf));}else{return verticalDirection&&((verticalDirection=="down"&&isOverBottomHalf)||(verticalDirection=="up"&&!isOverBottomHalf));}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!=0&&(delta>0?"down":"up");},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!=0&&(delta>0?"right":"left");},refresh:function(event){this._refreshItems(event);this.refreshPositions();return this;},_connectWith:function(){var options=this.options;return options.connectWith.constructor==String?[options.connectWith]:options.connectWith;},_getItemsAsjQuery:function(connected){var self=this;var items=[];var queries=[];var connectWith=this._connectWith();if(connectWith&&connected){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'),inst]);}};};}
-queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'),this]);for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){items.push(this);});};return $(items);},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data(sortable-item)");for(var i=0;i<this.items.length;i++){for(var j=0;j<list.length;j++){if(list[j]==this.items[i].item[0])
-this.items.splice(i,1);};};},_refreshItems:function(event){this.items=[];this.containers=[this];var items=this.items;var self=this;var queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]];var connectWith=this._connectWith();if(connectWith){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}};};}
-for(var i=queries.length-1;i>=0;i--){var targetData=queries[i][1];var _queries=queries[i][0];for(var j=0,queriesLength=_queries.length;j<queriesLength;j++){var item=$(_queries[j]);item.data('sortable-item',targetData);items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0});};};},refreshPositions:function(fast){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset();}
-for(var i=this.items.length-1;i>=0;i--){var item=this.items[i];var t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight();}
-var p=t.offset();item.left=p.left;item.top=p.top;};if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();};}
-return this;},_createPlaceholder:function(that){var self=that||this,o=self.options;if(!o.placeholder||o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){var el=$(document.createElement(self.currentItem[0].nodeName)).addClass(className||self.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!className)
-el.style.visibility="hidden";return el;},update:function(container,p){if(className&&!o.forcePlaceholderSize)return;if(!p.height()){p.height(self.currentItem.innerHeight()-parseInt(self.currentItem.css('paddingTop')||0,10)-parseInt(self.currentItem.css('paddingBottom')||0,10));};if(!p.width()){p.width(self.currentItem.innerWidth()-parseInt(self.currentItem.css('paddingLeft')||0,10)-parseInt(self.currentItem.css('paddingRight')||0,10));};}};}
-self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem));self.currentItem.after(self.placeholder);o.placeholder.update(self,self.placeholder);},_contactContainers:function(event){var innermostContainer=null,innermostIndex=null;for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.currentItem[0],this.containers[i].element[0]))
-continue;if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$.ui.contains(this.containers[i].element[0],innermostContainer.element[0]))
-continue;innermostContainer=this.containers[i];innermostIndex=i;}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0;}}}
-if(!innermostContainer)return;if(this.containers.length===1){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}else if(this.currentContainer!=this.containers[innermostIndex]){var dist=10000;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[innermostIndex].floating?'left':'top'];for(var j=this.items.length-1;j>=0;j--){if(!$.ui.contains(this.containers[innermostIndex].element[0],this.items[j].item[0]))continue;var cur=this.items[j][this.containers[innermostIndex].floating?'left':'top'];if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j];}}
-if(!itemWithLeastDistance&&!this.options.dropOnEmpty)
-return;this.currentContainer=this.containers[innermostIndex];itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[innermostIndex].element,true);this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):(o.helper=='clone'?this.currentItem.clone():this.currentItem);if(!helper.parents('body').length)
-$(o.appendTo!='parent'?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0]);if(helper[0]==this.currentItem[0])
-this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(helper[0].style.width==''||o.forceHelperSize)helper.width(this.currentItem.width());if(helper[0].style.height==''||o.forceHelperSize)helper.height(this.currentItem.height());return helper;},_adjustOffsetFromHelper:function(obj){if(typeof obj=='string'){obj=obj.split(' ');}
-if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
-if('left'in obj){this.offset.click.left=obj.left+this.margins.left;}
-if('right'in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
-if('top'in obj){this.offset.click.top=obj.top+this.margins.top;}
-if('bottom'in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
-if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie))
-po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top
-+this.offset.relative.top*mod
-+this.offset.parent.top*mod
--($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left
-+this.offset.relative.left*mod
-+this.offset.parent.left*mod
--($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition=='relative'&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}
-var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;}
-if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
-return{top:(pageY
--this.offset.click.top
--this.offset.relative.top
--this.offset.parent.top
-+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX
--this.offset.click.left
--this.offset.relative.left
--this.offset.parent.left
-+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=='down'?i.item[0]:i.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var self=this,counter=this.counter;window.setTimeout(function(){if(counter==self.counter)self.refreshPositions(!hardRefresh);},0);},_clear:function(event,noPropagation){this.reverting=false;var delayedTriggers=[],self=this;if(!this._noFinalSort&&this.currentItem[0].parentNode)this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var i in this._storedCSS){if(this._storedCSS[i]=='auto'||this._storedCSS[i]=='static')this._storedCSS[i]='';}
-this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else{this.currentItem.show();}
-if(this.fromOutside&&!noPropagation)delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside));});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!noPropagation)delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash());});if(!$.ui.contains(this.element[0],this.currentItem[0])){if(!noPropagation)delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash());});for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.containers[i].element[0],this.currentItem[0])&&!noPropagation){delayedTriggers.push((function(c){return function(event){c._trigger("receive",event,this._uiHash(this));};}).call(this,this.containers[i]));delayedTriggers.push((function(c){return function(event){c._trigger("update",event,this._uiHash(this));};}).call(this,this.containers[i]));}};};for(var i=this.containers.length-1;i>=0;i--){if(!noPropagation)delayedTriggers.push((function(c){return function(event){c._trigger("deactivate",event,this._uiHash(this));};}).call(this,this.containers[i]));if(this.containers[i].containerCache.over){delayedTriggers.push((function(c){return function(event){c._trigger("out",event,this._uiHash(this));};}).call(this,this.containers[i]));this.containers[i].containerCache.over=0;}}
-if(this._storedCursor)$('body').css("cursor",this._storedCursor);if(this._storedOpacity)this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=='auto'?'':this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);};this._trigger("stop",event,this._uiHash());}
-return false;}
-if(!noPropagation)this._trigger("beforeStop",event,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0])this.helper.remove();this.helper=null;if(!noPropagation){for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);};this._trigger("stop",event,this._uiHash());}
-this.fromOutside=false;return true;},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel();}},_uiHash:function(inst){var self=inst||this;return{helper:self.helper,placeholder:self.placeholder||$([]),position:self.position,originalPosition:self.originalPosition,offset:self.positionAbs,item:self.currentItem,sender:inst?inst.element:null};}});$.extend($.ui.sortable,{version:"1.8.9"});})(jQuery);
-
diff --git a/public/javascripts/vendor/jquery.autoSuggest.custom.js b/public/javascripts/vendor/jquery.autoSuggest.custom.js
deleted file mode 100644
index bafd35cbc..000000000
--- a/public/javascripts/vendor/jquery.autoSuggest.custom.js
+++ /dev/null
@@ -1,372 +0,0 @@
- /*
- * AutoSuggest
- * Copyright 2009-2010 Drew Wilson
- * www.drewwilson.com
- * code.drewwilson.com/entry/autosuggest-jquery-plugin
- *
- * Version 1.4 - Updated: Mar. 23, 2010
- *
- * This Plug-In will auto-complete or auto-suggest completed search queries
- * for you as you type. You can add multiple selections and remove them on
- * the fly. It supports keybord navigation (UP + DOWN + RETURN), as well
- * as multiple AutoSuggest fields on the same page.
- *
- * Inspied by the Autocomplete plugin by: Jrn Zaefferer
- * and the Facelist plugin by: Ian Tearle (iantearle.com)
- *
- * This AutoSuggest jQuery plug-in is dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-
-(function($){
- $.fn.autoSuggest = function(data, options) {
- var defaults = {
- asHtmlID: false,
- startText: "Enter Name Here",
- emptyText: "No Results Found",
- preFill: {},
- limitText: "No More Selections Are Allowed",
- selectedItemProp: "value", //name of object property
- selectedValuesProp: "value", //name of object property
- searchObjProps: "value", //comma separated list of object property names
- queryParam: "q",
- retrieveLimit: false, //number for 'limit' param on ajax request
- extraParams: "",
- matchCase: false,
- minChars: 1,
- keyDelay: 400,
- resultsHighlight: true,
- neverSubmit: false,
- selectionLimit: false,
- showResultList: true,
- start: function(){},
- selectionClick: function(elem){},
- selectionAdded: function(elem){},
- selectionRemoved: function(elem){ elem.remove(); },
- formatList: false, //callback function
- beforeRetrieve: function(string){ return string; },
- retrieveComplete: function(data){ return data; },
- resultClick: function(data){},
- resultsComplete: function(){}
- };
- var opts = $.extend(defaults, options);
-
- var d_type = "object";
- var d_count = 0;
- if(typeof data == "string") {
- d_type = "string";
- var req_string = data;
- } else {
- var org_data = data;
- for (k in data) if (data.hasOwnProperty(k)) d_count++;
- }
- if((d_type == "object" && d_count > 0) || d_type == "string"){
- return this.each(function(x){
- if(!opts.asHtmlID){
- x = x+""+Math.floor(Math.random()*100); //this ensures there will be unique IDs on the page if autoSuggest() is called multiple times
- var x_id = "as-input-"+x;
- } else {
- x = opts.asHtmlID;
- var x_id = x;
- }
- opts.start.call(this);
- var input = $(this);
- input.attr("autocomplete","off").addClass("as-input").attr("id",x_id).val(opts.startText);
- var input_focus = false;
-
- // Setup basic elements and render them to the DOM
- input.wrap('<ul class="as-selections" id="as-selections-'+x+'"></ul>').wrap('<li class="as-original" id="as-original-'+x+'"></li>');
- var selections_holder = $("#as-selections-"+x);
- var org_li = $("#as-original-"+x);
- var results_holder = $('<div class="as-results" id="as-results-'+x+'"></div>').hide();
- var results_ul = $('<ul class="as-list"></ul>');
- var values_input = $('<input type="hidden" class="as-values" name="'+x+'" id="as-values-'+x+'" />');
- var prefill_value = "";
- if(typeof opts.preFill == "string"){
- var vals = opts.preFill.split(",");
- for(var i=0; i < vals.length; i++){
- var v_data = {};
- v_data[opts.selectedValuesProp] = vals[i];
- if(vals[i] != ""){
- add_selected_item(v_data, "000"+i);
- }
- }
- prefill_value = opts.preFill;
- } else {
- prefill_value = "";
- var prefill_count = 0;
- for (k in opts.preFill) if (opts.preFill.hasOwnProperty(k)) prefill_count++;
- if(prefill_count > 0){
- for(var i=0; i < prefill_count; i++){
- var new_v = opts.preFill[i][opts.selectedValuesProp];
- if(new_v == undefined){ new_v = ""; }
- prefill_value = prefill_value+new_v+",";
- if(new_v != ""){
- add_selected_item(opts.preFill[i], "000"+i);
- }
- }
- }
- }
- if(prefill_value != ""){
- input.val("");
- var lastChar = prefill_value.substring(prefill_value.length-1);
- if(lastChar != ","){ prefill_value = prefill_value+","; }
- values_input.val(","+prefill_value);
- $("li.as-selection-item", selections_holder).addClass("blur").removeClass("selected");
- }
- input.after(values_input);
- selections_holder.click(function(){
- input_focus = true;
- input.focus();
- }).mousedown(function(){ input_focus = false; }).after(results_holder);
-
- var timeout = null;
- var prev = "";
- var totalSelections = 0;
- var tab_press = false;
-
- // Handle input field events
- input.focus(function(){
- if($(this).val() == opts.startText && values_input.val() == ""){
- $(this).val("");
- } else if(input_focus){
- $("li.as-selection-item", selections_holder).removeClass("blur");
- if($(this).val() != ""){
- results_ul.css("width",selections_holder.outerWidth());
- results_holder.show();
- }
- }
- input_focus = true;
- return true;
- }).blur(function(){
- if($(this).val() == "" && values_input.val() == "" && prefill_value == ""){
- $(this).val(opts.startText);
- } else if(input_focus){
- $("li.as-selection-item", selections_holder).addClass("blur").removeClass("selected");
- results_holder.hide();
- }
- }).keydown(function(e) {
- // track last key pressed
- lastKeyPressCode = e.keyCode;
- first_focus = false;
- switch(e.keyCode) {
- case 38: // up
- e.preventDefault();
- moveSelection("up");
- break;
- case 40: // down
- e.preventDefault();
- moveSelection("down");
- break;
- case 8: // delete
- if(input.val() == ""){
- var last = values_input.val().split(",");
- last = last[last.length - 2];
- selections_holder.children().not(org_li.prev()).removeClass("selected");
- if(org_li.prev().hasClass("selected")){
- values_input.val(values_input.val().replace(","+last+",",","));
- opts.selectionRemoved.call(this, org_li.prev());
- } else {
- opts.selectionClick.call(this, org_li.prev());
- org_li.prev().addClass("selected");
- }
- }
- if(input.val().length == 1){
- results_holder.hide();
- prev = "";
- }
- if($(":visible",results_holder).length > 0){
- if (timeout){ clearTimeout(timeout); }
- timeout = setTimeout(function(){ keyChange(); }, opts.keyDelay);
- }
- break;
- /*case 9: case 188: // tab or comma
- tab_press = true;
- var i_input = input.val().replace(/(,)/g, "");
- if(i_input != "" && values_input.val().search(","+i_input+",") < 0 && i_input.length >= opts.minChars){
- e.preventDefault();
- var n_data = {};
- n_data[opts.selectedItemProp] = i_input;
- n_data[opts.selectedValuesProp] = i_input;
- var lis = $("li", selections_holder).length;
- add_selected_item(n_data, "00"+(lis+1));
- input.val("");
- }*/
- case 9: // tab
- if(input.val() == ''){
- break;
- }
- case 13: case 188: // return, comma
- tab_press = false;
- var active = $("li.active:first", results_holder);
- if(active.length > 0){
- active.click();
- results_holder.hide();
- }
- if(opts.neverSubmit || active.length > 0){
- e.preventDefault();
- }
- break;
- default:
- if(opts.showResultList){
- if(opts.selectionLimit && $("li.as-selection-item", selections_holder).length >= opts.selectionLimit){
- results_ul.html('<li class="as-message">'+opts.limitText+'</li>');
- results_holder.show();
- } else {
- if (timeout){ clearTimeout(timeout); }
- timeout = setTimeout(function(){ keyChange(); }, opts.keyDelay);
- }
- }
- break;
- }
- });
-
- function keyChange() {
- // ignore if the following keys are pressed: [del] [shift] [capslock]
- if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ){ return results_holder.hide(); }
- var string = input.val().replace(/[\\]+|[\/]+/g,"");
- if (string == prev) return;
- prev = string;
- if (string.length >= opts.minChars) {
- selections_holder.addClass("loading");
- if(d_type == "string"){
- var limit = "";
- if(opts.retrieveLimit){
- limit = "&limit="+encodeURIComponent(opts.retrieveLimit);
- }
- if(opts.beforeRetrieve){
- string = opts.beforeRetrieve.call(this, string);
- }
- $.getJSON(req_string+"?"+opts.queryParam+"="+encodeURIComponent(string)+limit+opts.extraParams, function(data){
- d_count = 0;
- var new_data = opts.retrieveComplete.call(this, data);
- for (k in new_data) if (new_data.hasOwnProperty(k)) d_count++;
- processData(new_data, string);
- });
- } else {
- if(opts.beforeRetrieve){
- string = opts.beforeRetrieve.call(this, string);
- }
- processData(org_data, string);
- }
- } else {
- selections_holder.removeClass("loading");
- results_holder.hide();
- }
- }
- var num_count = 0;
- function processData(data, query){
- if (!opts.matchCase){ query = query.toLowerCase(); }
- var matchCount = 0;
- results_holder.html(results_ul.html("")).hide();
- for(var i=0;i<d_count;i++){
- var num = i;
- num_count++;
- var forward = false;
- if(opts.searchObjProps == "value") {
- var str = data[num].value;
- } else {
- var str = "";
- var names = opts.searchObjProps.split(",");
- for(var y=0;y<names.length;y++){
- var name = $.trim(names[y]);
- str = str+data[num][name]+" ";
- }
- }
- if(str){
- if (!opts.matchCase){ str = str.toLowerCase(); }
- if(str.search(query) != -1 && values_input.val().search(","+data[num][opts.selectedValuesProp]+",") == -1){
- forward = true;
- }
- }
- if(forward){
- var formatted = $('<li class="as-result-item" id="as-result-item-'+num+'"></li>').click(function(){
- var raw_data = $(this).data("data");
- var number = raw_data.num;
- if($("#as-selection-"+number, selections_holder).length <= 0 && !tab_press){
- var data = raw_data.attributes;
- input.val("").focus();
- prev = "";
- add_selected_item(data, number);
- opts.resultClick.call(this, raw_data);
- results_holder.hide();
- }
- tab_press = false;
- }).mousedown(function(){ input_focus = false; }).mouseover(function(){
- $("li", results_ul).removeClass("active");
- $(this).addClass("active");
- }).data("data",{attributes: data[num], num: num_count});
- var this_data = $.extend({},data[num]);
- if (!opts.matchCase){
- var regx = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "gi");
- } else {
- var regx = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "g");
- }
-
- if(opts.resultsHighlight){
- this_data[opts.selectedItemProp] = this_data[opts.selectedItemProp].replace(regx,"<em>$1</em>");
- }
- if(!opts.formatList){
- formatted = formatted.html(this_data[opts.selectedItemProp]);
- } else {
- formatted = opts.formatList.call(this, this_data, formatted);
- }
- results_ul.append(formatted);
- delete this_data;
- matchCount++;
- if(opts.retrieveLimit && opts.retrieveLimit == matchCount ){ break; }
- }
- }
- selections_holder.removeClass("loading");
- if(matchCount <= 0){
- results_ul.html('<li class="as-message">'+opts.emptyText+'</li>');
- }
- results_ul.css("width", selections_holder.outerWidth());
- results_holder.show();
- opts.resultsComplete.call(this);
- }
-
- function add_selected_item(data, num){
- values_input.val(values_input.val()+data[opts.selectedValuesProp]+",");
- var item = $('<li class="as-selection-item" id="as-selection-'+num+'"></li>').click(function(){
- opts.selectionClick.call(this, $(this));
- selections_holder.children().removeClass("selected");
- $(this).addClass("selected");
- }).mousedown(function(){ input_focus = false; });
- var close = $('<a class="as-close">&times;</a>').click(function(){
- values_input.val(values_input.val().replace(","+data[opts.selectedValuesProp]+",",","));
- opts.selectionRemoved.call(this, item);
- input_focus = true;
- input.focus();
- return false;
- });
- org_li.before(item.html(data[opts.selectedItemProp]).prepend(close));
- opts.selectionAdded.call(this, org_li.prev());
- }
-
- function moveSelection(direction){
- if($(":visible",results_holder).length > 0){
- var lis = $("li", results_holder);
- if(direction == "down"){
- var start = lis.eq(0);
- } else {
- var start = lis.filter(":last");
- }
- var active = $("li.active:first", results_holder);
- if(active.length > 0){
- if(direction == "down"){
- start = active.next();
- } else {
- start = active.prev();
- }
- }
- lis.removeClass("active");
- start.addClass("active");
- }
- }
-
- });
- }
- }
-})(jQuery);
diff --git a/public/javascripts/vendor/jquery.autoresize.js b/public/javascripts/vendor/jquery.autoresize.js
deleted file mode 100644
index 4bc0959ae..000000000
--- a/public/javascripts/vendor/jquery.autoresize.js
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * jQuery.fn.autoResize 1.14
- * --
- * https://github.com/padolsey/jQuery.fn.autoResize
- * --
- * This program is free software. It comes without any warranty, to
- * the extent permitted by applicable law. You can redistribute it
- * and/or modify it under the terms of the Do What The Fuck You Want
- * To Public License, Version 2, as published by Sam Hocevar. See
- * http://sam.zoy.org/wtfpl/COPYING for more details. */
-
-(function($){
-
- var uid = 'ar' + +new Date,
-
- defaults = autoResize.defaults = {
- onResize: function(){},
- onBeforeResize: function(){return 123},
- onAfterResize: function(){return 555},
- animate: {
- duration: 200,
- complete: function(){}
- },
- extraSpace: 50,
- minHeight: 'original',
- maxHeight: 500,
- minWidth: 'original',
- maxWidth: 500
- };
-
- autoResize.cloneCSSProperties = [
- 'lineHeight', 'textDecoration', 'letterSpacing',
- 'fontSize', 'fontFamily', 'fontStyle', 'fontWeight',
- 'textTransform', 'textAlign', 'direction', 'wordSpacing', 'fontSizeAdjust',
- 'paddingTop', 'paddingLeft', 'paddingBottom', 'paddingRight', 'width'
- ];
-
- autoResize.cloneCSSValues = {
- position: 'absolute',
- top: -9999,
- left: -9999,
- opacity: 0,
- overflow: 'hidden'
- };
-
- autoResize.resizableFilterSelector = [
- 'textarea:not(textarea.' + uid + ')',
- 'input:not(input[type])',
- 'input[type=text]',
- 'input[type=password]',
- 'input[type=email]',
- 'input[type=url]'
- ].join(',');
-
- autoResize.AutoResizer = AutoResizer;
-
- $.fn.autoResize = autoResize;
-
- function autoResize(config) {
- this.filter(autoResize.resizableFilterSelector).each(function(){
- new AutoResizer( $(this), config );
- });
- return this;
- }
-
- function AutoResizer(el, config) {
-
- if (el.data('AutoResizer')) {
- el.data('AutoResizer').destroy();
- }
-
- config = this.config = $.extend({}, autoResize.defaults, config);
- this.el = el;
-
- this.nodeName = el[0].nodeName.toLowerCase();
-
- this.originalHeight = el.height();
- this.previousScrollTop = null;
-
- this.value = el.val();
-
- if (config.maxWidth === 'original') config.maxWidth = el.width();
- if (config.minWidth === 'original') config.minWidth = el.width();
- if (config.maxHeight === 'original') config.maxHeight = el.height();
- if (config.minHeight === 'original') config.minHeight = el.height();
-
- if (this.nodeName === 'textarea') {
- el.css({
- resize: 'none',
- overflowY: 'hidden'
- });
- }
-
- el.data('AutoResizer', this);
-
- // Make sure onAfterResize is called upon animation completion
- config.animate.complete = (function(f){
- return function() {
- config.onAfterResize.call(el);
- return f.apply(this, arguments);
- };
- }(config.animate.complete));
-
- this.bind();
-
- }
-
- AutoResizer.prototype = {
-
- bind: function() {
-
- var check = $.proxy(function(){
- this.check();
- return true;
- }, this);
-
- this.unbind();
-
- this.el
- .bind('keyup.autoResize', check)
- //.bind('keydown.autoResize', check)
- .bind('change.autoResize', check)
- .bind('paste.autoResize', function() {
- setTimeout(function() { check(); }, 0);
- });
-
- if (!this.el.is(':hidden')) {
- this.check(null, true);
- }
-
- },
-
- unbind: function() {
- this.el.unbind('.autoResize');
- },
-
- createClone: function() {
-
- var el = this.el,
- clone = this.nodeName === 'textarea' ? el.clone() : $('<span/>');
-
- this.clone = clone;
-
- $.each(autoResize.cloneCSSProperties, function(i, p){
- clone[0].style[p] = el.css(p);
- });
-
- clone
- .removeAttr('name')
- .removeAttr('id')
- .addClass(uid)
- .attr('tabIndex', -1)
- .css(autoResize.cloneCSSValues);
-
- if (this.nodeName === 'textarea') {
- clone.height('auto');
- } else {
- clone.width('auto').css({
- whiteSpace: 'nowrap'
- });
- }
-
- },
-
- check: function(e, immediate) {
-
- if (!this.clone) {
- this.createClone();
- this.injectClone();
- }
-
- var config = this.config,
- clone = this.clone,
- el = this.el,
- value = el.val();
-
- // Do nothing if value hasn't changed
- if (value === this.prevValue) { return true; }
- this.prevValue = value;
-
- if (this.nodeName === 'input') {
-
- clone.text(value);
-
- // Calculate new width + whether to change
- var cloneWidth = clone.width(),
- newWidth = (cloneWidth + config.extraSpace) >= config.minWidth ?
- cloneWidth + config.extraSpace : config.minWidth,
- currentWidth = el.width();
-
- newWidth = Math.min(newWidth, config.maxWidth);
-
- if (
- (newWidth < currentWidth && newWidth >= config.minWidth) ||
- (newWidth >= config.minWidth && newWidth <= config.maxWidth)
- ) {
-
- config.onBeforeResize.call(el);
- config.onResize.call(el);
-
- el.scrollLeft(0);
-
- if (config.animate && !immediate) {
- el.stop(1,1).animate({
- width: newWidth
- }, config.animate);
- } else {
- el.width(newWidth);
- config.onAfterResize.call(el);
- }
-
- }
-
- return;
-
- }
-
- // TEXTAREA
-
- clone.width(el.width()).height(0).val(value).scrollTop(10000);
-
- var scrollTop = clone[0].scrollTop;
-
- // Don't do anything if scrollTop hasen't changed:
- if (this.previousScrollTop === scrollTop) {
- return;
- }
-
- this.previousScrollTop = scrollTop;
-
- if (scrollTop + config.extraSpace >= config.maxHeight) {
- el.css('overflowY', '');
- scrollTop = config.maxHeight;
- immediate = true;
- } else if (scrollTop <= config.minHeight) {
- scrollTop = config.minHeight;
- } else {
- el.css('overflowY', 'hidden');
- scrollTop += config.extraSpace;
- }
-
- config.onBeforeResize.call(el);
- config.onResize.call(el);
-
- // Either animate or directly apply height:
- if (config.animate && !immediate) {
- el.stop(1,1).animate({
- height: scrollTop
- }, config.animate);
- } else {
- el.height(scrollTop);
- config.onAfterResize.call(el);
- }
-
- },
-
- destroy: function() {
- this.unbind();
- this.el.removeData('AutoResizer');
- this.clone.remove();
- delete this.el;
- delete this.clone;
- },
-
- injectClone: function() {
- (
- autoResize.cloneContainer ||
- (autoResize.cloneContainer = $('<arclones/>').appendTo('body'))
- ).append(this.clone);
- }
-
- };
-
-})(jQuery);
diff --git a/public/javascripts/vendor/jquery.charcount.js b/public/javascripts/vendor/jquery.charcount.js
deleted file mode 100644
index 67d1442d4..000000000
--- a/public/javascripts/vendor/jquery.charcount.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Character Count Plugin - jQuery plugin
- * Dynamic character count for text areas and input fields
- * written by Alen Grakalic
- * http://cssglobe.com/post/7161/jquery-plugin-simplest-twitterlike-dynamic-character-count-for-textareas
- *
- * Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * Built for jQuery library
- * http://jquery.com
- *
- */
-
-(function($) {
-
- $.fn.charCount = function(options){
-
- // default configuration properties
- var defaults = {
- allowed: 140,
- warning: 25,
- css: 'counter',
- counterElement: 'span',
- cssWarning: 'warning',
- cssExceeded: 'exceeded',
- counterText: ''
- };
-
- var options = $.extend(defaults, options);
-
- function calculate(obj){
- var count = $(obj).val().length;
- var available = options.allowed - count;
- if(available <= options.warning && available >= 0){
- $(obj).next().addClass(options.cssWarning);
- } else {
- $(obj).next().removeClass(options.cssWarning);
- }
- if(available < 0){
- $(obj).next().addClass(options.cssExceeded);
- } else {
- $(obj).next().removeClass(options.cssExceeded);
- }
- $(obj).next().html(options.counterText + available);
- };
-
- this.each(function() {
- $(this).after('<'+ options.counterElement +' class="' + options.css + '">'+ options.counterText +'</'+ options.counterElement +'>');
- calculate(this);
- $(this).keyup(function(){calculate(this)});
- $(this).change(function(){calculate(this)});
- });
-
- };
-
-})(jQuery);
diff --git a/public/javascripts/vendor/jquery.elastic.js b/public/javascripts/vendor/jquery.elastic.js
deleted file mode 100644
index 9b1ed2b83..000000000
--- a/public/javascripts/vendor/jquery.elastic.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
-* @name Elastic
-* @descripton Elastic is jQuery plugin that grow and shrink your textareas automatically
-* @version 1.6.11
-* @requires jQuery 1.2.6+
-*
-* @author Jan Jarfalk
-* @author-email jan.jarfalk@unwrongest.com
-* @author-website http://www.unwrongest.com
-*
-* @licence MIT License - http://www.opensource.org/licenses/mit-license.php
-*/
-
-(function($){
- jQuery.fn.extend({
- elastic: function() {
-
- // We will create a div clone of the textarea
- // by copying these attributes from the textarea to the div.
- var mimics = [
- 'paddingTop',
- 'paddingRight',
- 'paddingBottom',
- 'paddingLeft',
- 'fontSize',
- 'lineHeight',
- 'fontFamily',
- 'width',
- 'fontWeight',
- 'border-top-width',
- 'border-right-width',
- 'border-bottom-width',
- 'border-left-width',
- 'borderTopStyle',
- 'borderTopColor',
- 'borderRightStyle',
- 'borderRightColor',
- 'borderBottomStyle',
- 'borderBottomColor',
- 'borderLeftStyle',
- 'borderLeftColor'
- ];
-
- return this.each( function() {
-
- // Elastic only works on textareas
- if ( this.type !== 'textarea' ) {
- return false;
- }
-
- var $textarea = jQuery(this),
- $twin = jQuery('<div />').css({
- 'position' : 'absolute',
- 'display' : 'none',
- 'word-wrap' : 'break-word',
- 'white-space' :'pre-wrap'
- }),
- lineHeight = parseInt($textarea.css('line-height'),10) || parseInt($textarea.css('font-size'),'10'),
- minheight = parseInt($textarea.css('height'),10) || lineHeight*3,
- maxheight = parseInt($textarea.css('max-height'),10) || Number.MAX_VALUE,
- goalheight = 0;
-
- // Opera returns max-height of -1 if not set
- if (maxheight < 0) { maxheight = Number.MAX_VALUE; }
-
- // Append the twin to the DOM
- // We are going to meassure the height of this, not the textarea.
- $twin.appendTo($textarea.parent());
-
- // Copy the essential styles (mimics) from the textarea to the twin
- var i = mimics.length;
- while(i--){
- $twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));
- }
-
- // Updates the width of the twin. (solution for textareas with widths in percent)
- function setTwinWidth(){
- var curatedWidth = Math.floor(parseInt($textarea.width(),10));
- if($twin.width() !== curatedWidth){
- $twin.css({'width': curatedWidth + 'px'});
-
- // Update height of textarea
- update(true);
- }
- }
-
- // Sets a given height and overflow state on the textarea
- function setHeightAndOverflow(height, overflow){
-
- var curratedHeight = Math.floor(parseInt(height,10));
- if($textarea.height() !== curratedHeight){
- $textarea.css({'height': curratedHeight + 'px','overflow':overflow});
- }
- }
-
- // This function will update the height of the textarea if necessary
- function update(forced) {
-
- // Get curated content from the textarea.
- var textareaContent = $textarea.val().replace(/&/g,'&amp;').replace(/ {2}/g, '&nbsp;').replace(/<|>/g, '&gt;').replace(/\n/g, '<br />');
-
- // Compare curated content with curated twin.
- var twinContent = $twin.html().replace(/<br>/ig,'<br />');
-
- if(forced || textareaContent+'&nbsp;' !== twinContent){
-
- // Add an extra white space so new rows are added when you are at the end of a row.
- $twin.html(textareaContent+'&nbsp;');
-
- // Change textarea height if twin plus the height of one line differs more than 3 pixel from textarea height
- if(Math.abs($twin.height() + lineHeight - $textarea.height()) > 3){
-
- var goalheight = $twin.height()+lineHeight;
- if(goalheight >= maxheight) {
- setHeightAndOverflow(maxheight,'auto');
- } else if(goalheight <= minheight) {
- setHeightAndOverflow(minheight,'hidden');
- } else {
- setHeightAndOverflow(goalheight,'hidden');
- }
-
- }
-
- }
-
- }
-
- // Hide scrollbars
- $textarea.css({'overflow':'hidden'});
-
- // Update textarea size on keyup, change, cut and paste
- $textarea.bind('keyup change cut paste', function(){
- update();
- });
-
- // Update width of twin if browser or textarea is resized (solution for textareas with widths in percent)
- $(window).bind('resize', setTwinWidth);
- $textarea.bind('resize', setTwinWidth);
- $textarea.bind('update', update);
-
- // Compact textarea on blur
- $textarea.bind('blur',function(){
- if($twin.height() < maxheight){
- if($twin.height() > minheight) {
- $textarea.height($twin.height());
- } else {
- $textarea.height(minheight);
- }
- }
- });
-
- // And this line is to catch the browser paste event
- $textarea.bind('input paste',function(e){ setTimeout( update, 250); });
-
- // Run update once when elastic is initialized
- update();
-
- });
-
- }
- });
-})(jQuery); \ No newline at end of file
diff --git a/public/javascripts/vendor/jquery.events.input.js b/public/javascripts/vendor/jquery.events.input.js
deleted file mode 100644
index 9b2bbbfb3..000000000
--- a/public/javascripts/vendor/jquery.events.input.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- jQuery `input` special event v1.0
-
- http://whattheheadsaid.com/projects/input-special-event
-
- (c) 2010-2011 Andy Earnshaw
- MIT license
- www.opensource.org/licenses/mit-license.php
-
- Modified by Kenneth Auchenberg
- * Disabled usage of onPropertyChange event in IE, since its a bit delayed, if you type really fast.
-*/
-
-(function($) {
- // Handler for propertychange events only
- function propHandler() {
- var $this = $(this);
- if (window.event.propertyName == "value" && !$this.data("triggering.inputEvent")) {
- $this.data("triggering.inputEvent", true).trigger("input");
- window.setTimeout(function () {
- $this.data("triggering.inputEvent", false);
- }, 0);
- }
- }
-
- $.event.special.input = {
- setup: function(data, namespaces) {
- var timer,
- // Get a reference to the element
- elem = this,
- // Store the current state of the element
- state = elem.value,
- // Create a dummy element that we can use for testing event support
- tester = document.createElement(this.tagName),
- // Check for native oninput
- oninput = "oninput" in tester || checkEvent(tester),
- // Check for onpropertychange
- onprop = "onpropertychange" in tester,
- // Generate a random namespace for event bindings
- ns = "inputEventNS" + ~~(Math.random() * 10000000),
- // Last resort event names
- evts = ["focus", "blur", "paste", "cut", "keydown", "drop", ""].join("." + ns + " ");
-
- function checkState() {
- var $this = $(elem);
- if (elem.value != state && !$this.data("triggering.inputEvent")) {
- state = elem.value;
-
- $this.data("triggering.inputEvent", true).trigger("input");
- window.setTimeout(function () {
- $this.data("triggering.inputEvent", false);
- }, 0);
- }
- }
-
- // Set up a function to handle the different events that may fire
- function handler(e) {
- // When focusing, set a timer that polls for changes to the value
- if (e.type == "focus") {
- checkState();
- clearInterval(timer);
- timer = window.setInterval(checkState, 250);
- } else if (e.type == "blur") {
- // When blurring, cancel the aforeset timer
- window.clearInterval(timer);
- } else {
- // For all other events, queue a timer to check state ASAP
- window.setTimeout(checkState, 0);
- }
- }
-
- // Bind to native event if available
- if (oninput) {
- return false;
-// } else if (onprop) {
-// // Else fall back to propertychange if available
-// $(this).find("input, textarea").andSelf().filter("input, textarea").bind("propertychange." + ns, propHandler);
- } else {
- // Else clutch at straws!
- $(this).find("input, textarea").andSelf().filter("input, textarea").bind(evts, handler);
- }
- $(this).data("inputEventHandlerNS", ns);
- },
- teardown: function () {
- var elem = $(this);
- elem.find("input, textarea").unbind(elem.data("inputEventHandlerNS"));
- elem.data("inputEventHandlerNS", "");
- }
- };
-
- // Setup our jQuery shorthand method
- $.fn.input = function (handler) {
- return handler ? this.bind("input", handler) : this.trigger("input");
- };
-
- /*
- The following function tests the element for oninput support in Firefox. Many thanks to
- http://blog.danielfriesen.name/2010/02/16/html5-browser-maze-oninput-support/
- */
- function checkEvent(el) {
- // First check, for if Firefox fixes its issue with el.oninput = function
- el.setAttribute("oninput", "return");
- if (typeof el.oninput == "function") {
- return true;
- }
- // Second check, because Firefox doesn't map oninput attribute to oninput property
- try {
-
- // "* Note * : Disabled focus and dispatch of keypress event due to conflict with DOMready, which resulted in scrolling down to the bottom of the page, possibly because layout wasn't finished rendering.
- var e = document.createEvent("KeyboardEvent"),
- ok = false,
- tester = function(e) {
- ok = true;
- e.preventDefault();
- e.stopPropagation();
- };
-
- // e.initKeyEvent("keypress", true, true, window, false, false, false, false, 0, "e".charCodeAt(0));
-
- document.body.appendChild(el);
- el.addEventListener("input", tester, false);
- // el.focus();
- // el.dispatchEvent(e);
- el.removeEventListener("input", tester, false);
- document.body.removeChild(el);
- return ok;
-
- } catch(error) {
-
- }
- }
-})(jQuery); \ No newline at end of file
diff --git a/public/javascripts/vendor/jquery.hotkeys.js b/public/javascripts/vendor/jquery.hotkeys.js
deleted file mode 100644
index 5c9d557fd..000000000
--- a/public/javascripts/vendor/jquery.hotkeys.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * jQuery Hotkeys Plugin
- * Copyright 2010, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- *
- * Based upon the plugin by Tzury Bar Yochay:
- * http://github.com/tzuryby/hotkeys
- *
- * Original idea by:
- * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
-*/
-
-(function(jQuery){
-
- jQuery.hotkeys = {
- version: "0.8",
-
- specialKeys: {
- 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
- 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
- 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
- 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
- 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
- 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
- 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
- },
-
- shiftNums: {
- "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
- "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
- ".": ">", "/": "?", "\\": "|"
- }
- };
-
- function keyHandler( handleObj ) {
- // Only care when a possible input has been specified
- if ( typeof handleObj.data !== "string" ) {
- return;
- }
-
- var origHandler = handleObj.handler,
- keys = handleObj.data.toLowerCase().split(" ");
-
- handleObj.handler = function( event ) {
- // Don't fire in text-accepting inputs that we didn't directly bind to
- if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
- event.target.type === "text") ) {
- return;
- }
-
- // Keypress represents characters, not special keys
- var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
- character = String.fromCharCode( event.which ).toLowerCase(),
- key, modif = "", possible = {};
-
- // check combinations (alt|ctrl|shift+anything)
- if ( event.altKey && special !== "alt" ) {
- modif += "alt+";
- }
-
- if ( event.ctrlKey && special !== "ctrl" ) {
- modif += "ctrl+";
- }
-
- // TODO: Need to make sure this works consistently across platforms
- if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
- modif += "meta+";
- }
-
- if ( event.shiftKey && special !== "shift" ) {
- modif += "shift+";
- }
-
- if ( special ) {
- possible[ modif + special ] = true;
-
- } else {
- possible[ modif + character ] = true;
- possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
-
- // "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
- if ( modif === "shift+" ) {
- possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
- }
- }
-
- for ( var i = 0, l = keys.length; i < l; i++ ) {
- if ( possible[ keys[i] ] ) {
- return origHandler.apply( this, arguments );
- }
- }
- };
- }
-
- jQuery.each([ "keydown", "keyup", "keypress" ], function() {
- jQuery.event.special[ this ] = { add: keyHandler };
- });
-
-})( jQuery );
diff --git a/public/javascripts/vendor/jquery.idle-timer.js b/public/javascripts/vendor/jquery.idle-timer.js
deleted file mode 100644
index 8df88d61e..000000000
--- a/public/javascripts/vendor/jquery.idle-timer.js
+++ /dev/null
@@ -1,246 +0,0 @@
-/*!
- * jQuery idleTimer plugin
- * version 0.9.100511
- * by Paul Irish.
- * http://github.com/paulirish/yui-misc/tree/
- * MIT license
-
- * adapted from YUI idle timer by nzakas:
- * http://github.com/nzakas/yui-misc/
-*/
-/*
- * Copyright (c) 2009 Nicholas C. Zakas
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/* updated to fix Chrome setTimeout issue by Zaid Zawaideh */
-
- // API available in <= v0.8
- /*******************************
-
- // idleTimer() takes an optional argument that defines the idle timeout
- // timeout is in milliseconds; defaults to 30000
- $.idleTimer(10000);
-
-
- $(document).bind("idle.idleTimer", function(){
- // function you want to fire when the user goes idle
- });
-
-
- $(document).bind("active.idleTimer", function(){
- // function you want to fire when the user becomes active again
- });
-
- // pass the string 'destroy' to stop the timer
- $.idleTimer('destroy');
-
- // you can query if the user is idle or not with data()
- $.data(document,'idleTimer'); // 'idle' or 'active'
-
- // you can get time elapsed since user when idle/active
- $.idleTimer('getElapsedTime'); // time since state change in ms
-
- ********/
-
-
-
- // API available in >= v0.9
- /*************************
-
- // bind to specific elements, allows for multiple timer instances
- $(elem).idleTimer(timeout|'destroy'|'getElapsedTime');
- $.data(elem,'idleTimer'); // 'idle' or 'active'
-
- // if you're using the old $.idleTimer api, you should not do $(document).idleTimer(...)
-
- // element bound timers will only watch for events inside of them.
- // you may just want page-level activity, in which case you may set up
- // your timers on document, document.documentElement, and document.body
-
-
- ********/
-
-(function($){
-
-$.idleTimer = function(newTimeout, elem){
-
- // defaults that are to be stored as instance props on the elem
-
- var idle = false, //indicates if the user is idle
- enabled = true, //indicates if the idle timer is enabled
- timeout = 30000, //the amount of time (ms) before the user is considered idle
- events = 'mousemove keydown DOMMouseScroll mousewheel mousedown touchstart touchmove'; // activity is one of these events
-
-
- elem = elem || document;
-
-
-
- /* (intentionally not documented)
- * Toggles the idle state and fires an appropriate event.
- * @return {void}
- */
- var toggleIdleState = function(myelem){
-
- // curse you, mozilla setTimeout lateness bug!
- if (typeof myelem === 'number'){
- myelem = undefined;
- }
-
- var obj = $.data(myelem || elem,'idleTimerObj');
-
- //toggle the state
- obj.idle = !obj.idle;
-
- // reset timeout
- var elapsed = (+new Date()) - obj.olddate;
- obj.olddate = +new Date();
-
- // handle Chrome always triggering idle after js alert or comfirm popup
- if (obj.idle && (elapsed < timeout)) {
- obj.idle = false;
- clearTimeout($.idleTimer.tId);
- if (enabled)
- $.idleTimer.tId = setTimeout(toggleIdleState, timeout);
- return;
- }
-
- //fire appropriate event
-
- // create a custom event, but first, store the new state on the element
- // and then append that string to a namespace
- var event = jQuery.Event( $.data(elem,'idleTimer', obj.idle ? "idle" : "active" ) + '.idleTimer' );
-
- // we do want this to bubble, at least as a temporary fix for jQuery 1.7
- // event.stopPropagation();
- $(elem).trigger(event);
- },
-
- /**
- * Stops the idle timer. This removes appropriate event handlers
- * and cancels any pending timeouts.
- * @return {void}
- * @method stop
- * @static
- */
- stop = function(elem){
-
- var obj = $.data(elem,'idleTimerObj') || {};
-
- //set to disabled
- obj.enabled = false;
-
- //clear any pending timeouts
- clearTimeout(obj.tId);
-
- //detach the event handlers
- $(elem).off('.idleTimer');
- },
-
-
- /* (intentionally not documented)
- * Handles a user event indicating that the user isn't idle.
- * @param {Event} event A DOM2-normalized event object.
- * @return {void}
- */
- handleUserEvent = function(){
-
- var obj = $.data(this,'idleTimerObj');
-
- //clear any existing timeout
- clearTimeout(obj.tId);
-
-
-
- //if the idle timer is enabled
- if (obj.enabled){
-
-
- //if it's idle, that means the user is no longer idle
- if (obj.idle){
- toggleIdleState(this);
- }
-
- //set a new timeout
- obj.tId = setTimeout(toggleIdleState, obj.timeout);
-
- }
- };
-
-
- /**
- * Starts the idle timer. This adds appropriate event handlers
- * and starts the first timeout.
- * @param {int} newTimeout (Optional) A new value for the timeout period in ms.
- * @return {void}
- * @method $.idleTimer
- * @static
- */
-
-
- var obj = $.data(elem,'idleTimerObj') || {};
-
- obj.olddate = obj.olddate || +new Date();
-
- //assign a new timeout if necessary
- if (typeof newTimeout === "number"){
- timeout = newTimeout;
- } else if (newTimeout === 'destroy') {
- stop(elem);
- return this;
- } else if (newTimeout === 'getElapsedTime'){
- return (+new Date()) - obj.olddate;
- }
-
- //assign appropriate event handlers
- $(elem).on($.trim((events+' ').split(' ').join('.idleTimer ')),handleUserEvent);
-
-
- obj.idle = idle;
- obj.enabled = enabled;
- obj.timeout = timeout;
-
-
- //set a timeout to toggle state
- obj.tId = setTimeout(toggleIdleState, obj.timeout);
-
- // assume the user is active for the first x seconds.
- $.data(elem,'idleTimer',"active");
-
- // store our instance on the object
- $.data(elem,'idleTimerObj',obj);
-
-
-
-}; // end of $.idleTimer()
-
-
-// v0.9 API for defining multiple timers.
-$.fn.idleTimer = function(newTimeout){
- if(this[0]){
- $.idleTimer(newTimeout,this[0]);
- }
-
- return this;
-};
-
-
-})(jQuery);
diff --git a/public/javascripts/vendor/jquery.mentionsInput.js b/public/javascripts/vendor/jquery.mentionsInput.js
deleted file mode 100644
index a61746ac6..000000000
--- a/public/javascripts/vendor/jquery.mentionsInput.js
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Mentions Input
- * Version 1.0
- * Written by: Kenneth Auchenberg (Podio)
- *
- * Using underscore.js
- *
- * License: MIT License - http://www.opensource.org/licenses/mit-license.php
- */
-
-(function ($, _, undefined) {
-
- // Settings
- var KEY = { BACKSPACE : 8, TAB : 9, RETURN : 13, ESC : 27, LEFT : 37, UP : 38, RIGHT : 39, DOWN : 40, COMMA : 188, SPACE : 32, HOME : 36, END : 35 }; // Keys "enum"
- var defaultSettings = {
- triggerChar : '@',
- onDataRequest : $.noop,
- minChars : 2,
- showAvatars : true,
- elastic : true,
- classes : {
- autoCompleteItemActive : "active"
- },
- templates : {
- wrapper : _.template('<div class="mentions-input-box"></div>'),
- autocompleteList : _.template('<div class="mentions-autocomplete-list"></div>'),
- autocompleteListItem : _.template('<li data-ref-id="<%= id %>" data-ref-type="<%= type %>" data-display="<%= display %>"><%= content %></li>'),
- autocompleteListItemAvatar : _.template('<img src="<%= avatar %>" />'),
- autocompleteListItemIcon : _.template('<div class="icon <%= icon %>"></div>'),
- mentionsOverlay : _.template('<div class="mentions"><div></div></div>'),
- mentionItemSyntax : _.template('@[<%= name %>](<%= type %>:<%= id %>)'),
- mentionItemHighlight : _.template('<strong><span><%= name %></span></strong>')
- }
- };
-
- var utils = {
- htmlEncode : function (str) {
- return _.escape(str);
- },
- highlightTerm : function (value, term) {
- if (!term && !term.length) {
- return value;
- }
- return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>");
- },
- setCaratPosition : function (domNode, caretPos) {
- if (domNode.createTextRange) {
- var range = domNode.createTextRange();
- range.move('character', caretPos);
- range.select();
- } else {
- if (domNode.selectionStart) {
- domNode.focus();
- domNode.setSelectionRange(caretPos, caretPos);
- } else {
- domNode.focus();
- }
- }
- }
- };
-
- var MentionsInput = function (input) {
- var settings;
- var elmInputBox, elmInputWrapper, elmAutocompleteList, elmWrapperBox, elmMentionsOverlay, elmActiveAutoCompleteItem;
- var mentionsCollection = [];
- var inputBuffer = [];
- var currentDataQuery = '';
-
- function initTextarea() {
- elmInputBox = $(input);
-
- if (elmInputBox.attr('data-mentions-input') == 'true') {
- return;
- }
-
- elmInputWrapper = elmInputBox.parent();
- elmWrapperBox = $(settings.templates.wrapper());
- elmInputBox.wrapAll(elmWrapperBox);
- elmWrapperBox = elmInputWrapper.find('> div');
-
- elmInputBox.attr('data-mentions-input', 'true');
- elmInputBox.bind('keydown', onInputBoxKeyDown);
- elmInputBox.bind('keypress', onInputBoxKeyPress);
- elmInputBox.bind('input', onInputBoxInput);
- elmInputBox.bind('click', onInputBoxClick);
-
- if (settings.elastic) {
- elmInputBox.elastic();
- }
- }
-
- function initAutocomplete() {
- elmAutocompleteList = $(settings.templates.autocompleteList());
- elmAutocompleteList.appendTo(elmWrapperBox);
- elmAutocompleteList.delegate('li', 'click', onAutoCompleteItemClick);
- }
-
- function initMentionsOverlay() {
- elmMentionsOverlay = $(settings.templates.mentionsOverlay());
- elmMentionsOverlay.prependTo(elmWrapperBox);
- }
-
- function updateNames() {
- var syntaxMessage = getInputBoxValue();
-
- _.each(mentionsCollection, function (mention) {
- var textSyntax = settings.templates.mentionItemSyntax({ name : mention.name, type : 'contact', id : mention.id, mention: mention });
-
- syntaxMessage = syntaxMessage.replace(mention.name, textSyntax);
- });
-
- var mentionText = utils.htmlEncode(syntaxMessage);
-
- _.each(mentionsCollection, function (mention) {
- var textSyntax = settings.templates.mentionItemSyntax({ name : utils.htmlEncode(mention.name), type : 'contact', id : mention.id, mention : mention });
- var textHighlight = settings.templates.mentionItemHighlight({ name : utils.htmlEncode(mention.name), mention : mention });
-
- mentionText = mentionText.replace(textSyntax, textHighlight);
- });
-
- mentionText = mentionText.replace(/\n/g, '<br />');
- mentionText = mentionText.replace(/ {2}/g, '&nbsp; ');
-
- elmInputBox.data('messageText', syntaxMessage);
- elmMentionsOverlay.find('div').html(mentionText);
- }
-
- function resetBuffer() {
- inputBuffer = [];
- }
-
- function updateMentionsCollection() {
- var inputText = getInputBoxValue();
-
- mentionsCollection = _.reject(mentionsCollection, function (mention, index) {
- return !mention.name || inputText.indexOf(mention.name) == -1;
- });
- mentionsCollection = _.compact(mentionsCollection);
- }
-
- function addMention(mention) {
- var currentMessage = getInputBoxValue();
-
- // Using a regex to figure out positions
- var regex = new RegExp("\\" + settings.triggerChar + currentDataQuery, "gi");
- regex.exec(currentMessage);
-
- var startCaretPosition = regex.lastIndex - currentDataQuery.length - 1;
- var currentCaretPosition = regex.lastIndex;
-
- var start = currentMessage.substr(0, startCaretPosition);
- var end = currentMessage.substr(currentCaretPosition, currentMessage.length);
- var startEndIndex = (start + mention.name).length;
-
- var updatedMessageText = start + mention.name + end;
-
- mentionsCollection.push(mention);
-
- // Cleaning before inserting the value, otherwise auto-complete would be triggered with "old" inputbuffer
- resetBuffer();
- currentDataQuery = '';
- hideAutoComplete();
-
- // Mentions & syntax message
- elmInputBox.val(updatedMessageText);
- updateNames();
-
- // Set correct focus and selection
- elmInputBox.focus();
- utils.setCaratPosition(elmInputBox[0], startEndIndex);
- }
-
- function getInputBoxValue() {
- return $.trim(elmInputBox.val());
- }
-
- function onAutoCompleteItemClick(e) {
- var mention = $(this).data("mention");
-
- addMention(mention);
-
- return false;
- }
-
- function onInputBoxClick(e) {
- resetBuffer();
- }
-
- function onInputBoxInput(e) {
- updateNames();
- updateMentionsCollection();
- hideAutoComplete();
-
- var triggerCharIndex = _.lastIndexOf(inputBuffer, settings.triggerChar);
- if (triggerCharIndex > -1) {
- currentDataQuery = inputBuffer.slice(triggerCharIndex + 1).join('');
-
- _.defer(_.bind(doSearch, this, currentDataQuery));
- }
- }
-
- function onInputBoxKeyPress(e) {
- var typedValue = String.fromCharCode(e.which || e.keyCode);
- inputBuffer.push(typedValue);
- }
-
- function onInputBoxKeyDown(e) {
-
- // This also matches HOME/END on OSX which is CMD+LEFT, CMD+RIGHT
- if (e.keyCode == KEY.LEFT || e.keyCode == KEY.RIGHT || e.keyCode == KEY.HOME || e.keyCode == KEY.END) {
- // Defer execution to ensure carat pos has changed after HOME/END keys
- _.defer(resetBuffer);
- return;
- }
-
- if (e.keyCode == KEY.BACKSPACE) {
- inputBuffer = inputBuffer.slice(0, -1 + inputBuffer.length); // Can't use splice, not available in IE
- return;
- }
-
- if (!elmAutocompleteList.is(':visible')) {
- return true;
- }
-
- switch (e.keyCode) {
- case KEY.UP:
- case KEY.DOWN:
- var elmCurrentAutoCompleteItem = null;
- if (e.keyCode == KEY.DOWN) {
- if (elmActiveAutoCompleteItem && elmActiveAutoCompleteItem.length) {
- elmCurrentAutoCompleteItem = elmActiveAutoCompleteItem.next();
- } else {
- elmCurrentAutoCompleteItem = elmAutocompleteList.find('li').first();
- }
- } else {
- elmCurrentAutoCompleteItem = $(elmActiveAutoCompleteItem).prev();
- }
-
- if (elmCurrentAutoCompleteItem.length) {
- selectAutoCompleteItem(elmCurrentAutoCompleteItem);
- }
-
- return false;
-
- case KEY.RETURN:
- case KEY.TAB:
- if (elmActiveAutoCompleteItem && elmActiveAutoCompleteItem.length) {
- elmActiveAutoCompleteItem.click();
- return false;
- }
-
- break;
- }
-
- return true;
- }
-
- function hideAutoComplete() {
- elmActiveAutoCompleteItem = null;
- elmAutocompleteList.empty().hide();
- }
-
- function selectAutoCompleteItem(elmItem) {
- elmItem.addClass(settings.classes.autoCompleteItemActive);
- elmItem.siblings().removeClass(settings.classes.autoCompleteItemActive);
-
- elmActiveAutoCompleteItem = elmItem;
- }
-
- function populateDropdown(query, results) {
- elmAutocompleteList.show();
-
- // Filter items that has already been mentioned
- var mentionedNames = _.pluck(mentionsCollection, 'name');
- results = _.reject(results, function (item) {
- return _.include(mentionedNames, item.name);
- });
-
- if (!results.length) {
- hideAutoComplete();
- return;
- }
-
- elmAutocompleteList.empty();
- var elmDropDownList = $("<ul>").appendTo(elmAutocompleteList).hide();
-
- _.each(results, function (item, index) {
- var elmListItem = $(settings.templates.autocompleteListItem({
- 'id' : utils.htmlEncode(item.id),
- 'display' : utils.htmlEncode(item.name),
- 'type' : utils.htmlEncode(item.type),
- 'content' : utils.highlightTerm(utils.htmlEncode((item.name)), query)
- })).data('mention', item);
-
- if (index === 0) {
- selectAutoCompleteItem(elmListItem);
- }
-
- if (settings.showAvatars) {
- var elmIcon;
-
- if (item.avatar) {
- elmIcon = $(settings.templates.autocompleteListItemAvatar({ avatar : item.avatar }));
- } else {
- elmIcon = $(settings.templates.autocompleteListItemIcon({ icon : item.icon }));
- }
- elmIcon.prependTo(elmListItem);
- }
- elmListItem = elmListItem.appendTo(elmDropDownList);
- });
-
- elmAutocompleteList.show();
- elmDropDownList.show();
- }
-
- function doSearch(query) {
- if (query && query.length && query.length >= settings.minChars) {
- settings.onDataRequest.call(this, 'search', query, function (responseData) {
- populateDropdown(query, responseData);
- });
- }
- }
-
- // Public methods
- return {
- init : function (options) {
- settings = options;
-
- initTextarea();
- initAutocomplete();
- initMentionsOverlay();
-
- if(options.prefillMention) {
- addMention(options.prefillMention);
- }
- },
-
- val : function (callback) {
- if (!_.isFunction(callback)) {
- return;
- }
-
- var value = mentionsCollection.length ? elmInputBox.data('messageText') : getInputBoxValue();
- callback.call(this, value);
- },
-
- reset : function () {
- elmInputBox.val('');
- mentionsCollection = [];
- updateNames();
- },
-
- getMentions : function (callback) {
- if (!_.isFunction(callback)) {
- return;
- }
-
- callback.call(this, mentionsCollection);
- }
- };
- };
-
- $.fn.mentionsInput = function (method, settings) {
-
- if (typeof method === 'object' || !method) {
- settings = $.extend(true, {}, defaultSettings, method);
- }
-
- var outerArguments = arguments;
-
- return this.each(function () {
- var instance = $.data(this, 'mentionsInput') || $.data(this, 'mentionsInput', new MentionsInput(this));
-
- if (_.isFunction(instance[method])) {
- return instance[method].apply(this, Array.prototype.slice.call(outerArguments, 1));
-
- } else if (typeof method === 'object' || !method) {
- return instance.init.call(this, settings);
-
- } else {
- $.error('Method ' + method + ' does not exist');
- }
-
- });
- };
-
-})(jQuery, _);
diff --git a/public/javascripts/vendor/jquery.placeholder.js b/public/javascripts/vendor/jquery.placeholder.js
deleted file mode 100644
index b4bbc7cbe..000000000
--- a/public/javascripts/vendor/jquery.placeholder.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/*! http://mths.be/placeholder v1.8.7 by @mathias */
-;(function(window, document, $) {
-
- var isInputSupported = 'placeholder' in document.createElement('input'),
- isTextareaSupported = 'placeholder' in document.createElement('textarea'),
- prototype = $.fn,
- placeholder;
-
- if (isInputSupported && isTextareaSupported) {
-
- placeholder = prototype.placeholder = function() {
- return this;
- };
-
- placeholder.input = placeholder.textarea = true;
-
- } else {
-
- placeholder = prototype.placeholder = function() {
- return this
- .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
- .not('.placeholder')
- .bind('focus.placeholder', clearPlaceholder)
- .bind('blur.placeholder', setPlaceholder)
- .trigger('blur.placeholder').end();
- };
-
- placeholder.input = isInputSupported;
- placeholder.textarea = isTextareaSupported;
-
- $(function() {
- // Look for forms
- $(document).delegate('form', 'submit.placeholder', function() {
- // Clear the placeholder values so they don’t get submitted
- var $inputs = $('.placeholder', this).each(clearPlaceholder);
- setTimeout(function() {
- $inputs.each(setPlaceholder);
- }, 10);
- });
- });
-
- // Clear placeholder values upon page reload
- $(window).bind('unload.placeholder', function() {
- $('.placeholder').val('');
- });
-
- }
-
- function args(elem) {
- // Return an object of element attributes
- var newAttrs = {},
- rinlinejQuery = /^jQuery\d+$/;
- $.each(elem.attributes, function(i, attr) {
- if (attr.specified && !rinlinejQuery.test(attr.name)) {
- newAttrs[attr.name] = attr.value;
- }
- });
- return newAttrs;
- }
-
- function clearPlaceholder() {
- var $input = $(this);
- if ($input.val() === $input.attr('placeholder') && $input.hasClass('placeholder')) {
- if ($input.data('placeholder-password')) {
- $input.hide().next().show().focus().attr('id', $input.removeAttr('id').data('placeholder-id'));
- } else {
- $input.val('').removeClass('placeholder');
- }
- }
- }
-
- function setPlaceholder() {
- var $replacement,
- $input = $(this),
- $origInput = $input,
- id = this.id;
- if ($input.val() === '') {
- if ($input.is(':password')) {
- if (!$input.data('placeholder-textinput')) {
- try {
- $replacement = $input.clone().attr({ 'type': 'text' });
- } catch(e) {
- $replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
- }
- $replacement
- .removeAttr('name')
- // We could just use the `.data(obj)` syntax here, but that wouldn’t work in pre-1.4.3 jQueries
- .data('placeholder-password', true)
- .data('placeholder-id', id)
- .bind('focus.placeholder', clearPlaceholder);
- $input
- .data('placeholder-textinput', $replacement)
- .data('placeholder-id', id)
- .before($replacement);
- }
- $input = $input.removeAttr('id').hide().prev().attr('id', id).show();
- }
- $input.addClass('placeholder').val($input.attr('placeholder'));
- } else {
- $input.removeClass('placeholder');
- }
- }
-
-}(this, document, jQuery)); \ No newline at end of file
diff --git a/public/javascripts/vendor/jquery.textchange.min.js b/public/javascripts/vendor/jquery.textchange.min.js
deleted file mode 100644
index 93f179a23..000000000
--- a/public/javascripts/vendor/jquery.textchange.min.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*!
- * jQuery TextChange Plugin
- * http://www.zurb.com/playground/jquery-text-change-custom-event
- *
- * Copyright 2010, ZURB
- * Released under the MIT License
- */
- (function(a){a.event.special.textchange={setup:function(){a(this).data("lastValue",this.contentEditable==="true"?a(this).html():a(this).val());a(this).bind("keyup.textchange",a.event.special.textchange.handler);a(this).bind("cut.textchange paste.textchange input.textchange",a.event.special.textchange.delayedHandler)},teardown:function(){a(this).unbind(".textchange")},handler:function(){a.event.special.textchange.triggerIfChanged(a(this))},delayedHandler:function(){var c=a(this);setTimeout(function(){a.event.special.textchange.triggerIfChanged(c)},
- 25)},triggerIfChanged:function(a){var b=a[0].contentEditable==="true"?a.html():a.val();b!==a.data("lastValue")&&(a.trigger("textchange",[a.data("lastValue")]),a.data("lastValue",b))}};a.event.special.hastext={setup:function(){a(this).bind("textchange",a.event.special.hastext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.hastext.handler)},handler:function(c,b){b===""&&b!==a(this).val()&&a(this).trigger("hastext")}};a.event.special.notext={setup:function(){a(this).bind("textchange",
- a.event.special.notext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.notext.handler)},handler:function(c,b){a(this).val()===""&&a(this).val()!==b&&a(this).trigger("notext")}}})(jQuery); \ No newline at end of file
diff --git a/public/javascripts/vendor/mailchimp/jquery.form.js b/public/javascripts/vendor/mailchimp/jquery.form.js
deleted file mode 100644
index 2ee5c9626..000000000
--- a/public/javascripts/vendor/mailchimp/jquery.form.js
+++ /dev/null
@@ -1,872 +0,0 @@
-/*
- * jQuery Form Plugin
- * version: 2.02 (12/16/2007)
- * @requires jQuery v1.1 or later
- *
- * Examples at: http://malsup.com/jquery/form/
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id$
- */
- (function($) {
-/**
- * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
- *
- * ajaxSubmit accepts a single argument which can be either a success callback function
- * or an options Object. If a function is provided it will be invoked upon successful
- * completion of the submit and will be passed the response from the server.
- * If an options Object is provided, the following attributes are supported:
- *
- * target: Identifies the element(s) in the page to be updated with the server response.
- * This value may be specified as a jQuery selection string, a jQuery object,
- * or a DOM element.
- * default value: null
- *
- * url: URL to which the form data will be submitted.
- * default value: value of form's 'action' attribute
- *
- * type: The method in which the form data should be submitted, 'GET' or 'POST'.
- * default value: value of form's 'method' attribute (or 'GET' if none found)
- *
- * data: Additional data to add to the request, specified as key/value pairs (see $.ajax).
- *
- * beforeSubmit: Callback method to be invoked before the form is submitted.
- * default value: null
- *
- * success: Callback method to be invoked after the form has been successfully submitted
- * and the response has been returned from the server
- * default value: null
- *
- * dataType: Expected dataType of the response. One of: null, 'xml', 'script', or 'json'
- * default value: null
- *
- * semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
- * default value: false
- *
- * resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
- *
- * clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
- *
- *
- * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
- * validating the form data. If the 'beforeSubmit' callback returns false then the form will
- * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
- * in array format, the jQuery object, and the options object passed into ajaxSubmit.
- * The form data array takes the following form:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * If a 'success' callback method is provided it is invoked after the response has been returned
- * from the server. It is passed the responseText or responseXML value (depending on dataType).
- * See jQuery.ajax for further details.
- *
- *
- * The dataType option provides a means for specifying how the server response should be handled.
- * This maps directly to the jQuery.httpData method. The following values are supported:
- *
- * 'xml': if dataType == 'xml' the server response is treated as XML and the 'success'
- * callback method, if specified, will be passed the responseXML value
- * 'json': if dataType == 'json' the server response will be evaluted and passed to
- * the 'success' callback, if specified
- * 'script': if dataType == 'script' the server response is evaluated in the global context
- *
- *
- * Note that it does not make sense to use both the 'target' and 'dataType' options. If both
- * are provided the target will be ignored.
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * This is normally true anyway, unless the form contains input elements of type='image'.
- * If your form must be submitted with name/value pairs in semantic order and your form
- * contains an input of type='image" then pass true for this arg, otherwise pass false
- * (or nothing) to avoid the overhead for this logic.
- *
- *
- * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
- *
- * $("#form-id").submit(function() {
- * $(this).ajaxSubmit(options);
- * return false; // cancel conventional submit
- * });
- *
- * When using ajaxForm(), however, this is done for you.
- *
- * @example
- * $('#myForm').ajaxSubmit(function(data) {
- * alert('Form submit succeeded! Server returned: ' + data);
- * });
- * @desc Submit form and alert server response
- *
- *
- * @example
- * var options = {
- * target: '#myTargetDiv'
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Submit form and update page element with server response
- *
- *
- * @example
- * var options = {
- * success: function(responseText) {
- * alert(responseText);
- * }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Submit form and alert the server response
- *
- *
- * @example
- * var options = {
- * beforeSubmit: function(formArray, jqForm) {
- * if (formArray.length == 0) {
- * alert('Please enter data.');
- * return false;
- * }
- * }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Pre-submit validation which aborts the submit operation if form data is empty
- *
- *
- * @example
- * var options = {
- * url: myJsonUrl.php,
- * dataType: 'json',
- * success: function(data) {
- * // 'data' is an object representing the the evaluated json data
- * }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc json data returned and evaluated
- *
- *
- * @example
- * var options = {
- * url: myXmlUrl.php,
- * dataType: 'xml',
- * success: function(responseXML) {
- * // responseXML is XML document object
- * var data = $('myElement', responseXML).text();
- * }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc XML data returned from server
- *
- *
- * @example
- * var options = {
- * resetForm: true
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc submit form and reset it if successful
- *
- * @example
- * $('#myForm).submit(function() {
- * $(this).ajaxSubmit();
- * return false;
- * });
- * @desc Bind form's submit event to use ajaxSubmit
- *
- *
- * @name ajaxSubmit
- * @type jQuery
- * @param options object literal containing options which control the form submission process
- * @cat Plugins/Form
- * @return jQuery
- */
-$.fn.ajaxSubmit = function(options) {
- if (typeof options == 'function')
- options = { success: options };
-
- options = $.extend({
- url: this.attr('action') || window.location.toString(),
- type: this.attr('method') || 'GET'
- }, options || {});
-
- // hook for manipulating the form data before it is extracted;
- // convenient for use with rich editors like tinyMCE or FCKEditor
- var veto = {};
- $.event.trigger('form.pre.serialize', [this, options, veto]);
- if (veto.veto) return this;
-
- var a = this.formToArray(options.semantic);
- if (options.data) {
- for (var n in options.data)
- a.push( { name: n, value: options.data[n] } );
- }
-
- // give pre-submit callback an opportunity to abort the submit
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;
-
- // fire vetoable 'validate' event
- $.event.trigger('form.submit.validate', [a, this, options, veto]);
- if (veto.veto) return this;
-
- var q = $.param(a);//.replace(/%20/g,'+');
-
- if (options.type.toUpperCase() == 'GET') {
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
- options.data = null; // data is null for 'get'
- }
- else
- options.data = q; // data is the query string for 'post'
-
- var $form = this, callbacks = [];
- if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
- if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
-
- // perform a load on the target only if dataType is not provided
- if (!options.dataType && options.target) {
- var oldSuccess = options.success || function(){};
- callbacks.push(function(data) {
- if (this.evalScripts)
- $(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, arguments);
- else // jQuery v1.1.4
- $(options.target).html(data).each(oldSuccess, arguments);
- });
- }
- else if (options.success)
- callbacks.push(options.success);
-
- options.success = function(data, status) {
- for (var i=0, max=callbacks.length; i < max; i++)
- callbacks[i](data, status, $form);
- };
-
- // are there files to upload?
- var files = $('input:file', this).fieldValue();
- var found = false;
- for (var j=0; j < files.length; j++)
- if (files[j])
- found = true;
-
- // options.iframe allows user to force iframe mode
- if (options.iframe || found) {
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
- if ($.browser.safari && options.closeKeepAlive)
- $.get(options.closeKeepAlive, fileUpload);
- else
- fileUpload();
- }
- else
- $.ajax(options);
-
- // fire 'notify' event
- $.event.trigger('form.submit.notify', [this, options]);
- return this;
-
-
- // private function for handling file uploads (hat tip to YAHOO!)
- function fileUpload() {
- var form = $form[0];
- var opts = $.extend({}, $.ajaxSettings, options);
-
- var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
- var $io = $('<iframe id="' + id + '" name="' + id + '" />');
- var io = $io[0];
- var op8 = $.browser.opera && window.opera.version() < 9;
- if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
-
- var xhr = { // mock object
- responseText: null,
- responseXML: null,
- status: 0,
- statusText: 'n/a',
- getAllResponseHeaders: function() {},
- getResponseHeader: function() {},
- setRequestHeader: function() {}
- };
-
- var g = opts.global;
- // trigger ajax global events so that activity/block indicators work like normal
- if (g && ! $.active++) $.event.trigger("ajaxStart");
- if (g) $.event.trigger("ajaxSend", [xhr, opts]);
-
- var cbInvoked = 0;
- var timedOut = 0;
-
- // take a breath so that pending repaints get some cpu time before the upload starts
- setTimeout(function() {
- // make sure form attrs are set
- var encAttr = form.encoding ? 'encoding' : 'enctype';
- var t = $form.attr('target');
- $form.attr({
- target: id,
- method: 'POST',
- action: opts.url
- });
- form[encAttr] = 'multipart/form-data';
-
- // support timout
- if (opts.timeout)
- setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
-
- // add iframe to doc and submit the form
- $io.appendTo('body');
- io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
- form.submit();
- $form.attr('target', t); // reset target
- }, 10);
-
- function cb() {
- if (cbInvoked++) return;
-
- io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
-
- var ok = true;
- try {
- if (timedOut) throw 'timeout';
- // extract the server response from the iframe
- var data, doc;
- doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
- xhr.responseText = doc.body ? doc.body.innerHTML : null;
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
-
- if (opts.dataType == 'json' || opts.dataType == 'script') {
- var ta = doc.getElementsByTagName('textarea')[0];
- data = ta ? ta.value : xhr.responseText;
- if (opts.dataType == 'json')
- eval("data = " + data);
- else
- $.globalEval(data);
- }
- else if (opts.dataType == 'xml') {
- data = xhr.responseXML;
- if (!data && xhr.responseText != null)
- data = toXml(xhr.responseText);
- }
- else {
- data = xhr.responseText;
- }
- }
- catch(e){
- ok = false;
- $.handleError(opts, xhr, 'error', e);
- }
-
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
- if (ok) {
- opts.success(data, 'success');
- if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
- }
- if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
- if (g && ! --$.active) $.event.trigger("ajaxStop");
- if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
-
- // clean up
- setTimeout(function() {
- $io.remove();
- xhr.responseXML = null;
- }, 100);
- };
-
- function toXml(s, doc) {
- if (window.ActiveXObject) {
- doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML(s);
- }
- else
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
- return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
- };
- };
-};
-$.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
- * is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- * used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * Note that for accurate x/y coordinates of image submit elements in all browsers
- * you need to also use the "dimensions" plugin (this method will auto-detect its presence).
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself. See ajaxSubmit for a full description of the options argument.
- *
- *
- * @example
- * var options = {
- * target: '#myTargetDiv'
- * };
- * $('#myForm').ajaxSForm(options);
- * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
- * when the form is submitted.
- *
- *
- * @example
- * var options = {
- * success: function(responseText) {
- * alert(responseText);
- * }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Bind form's submit event so that server response is alerted after the form is submitted.
- *
- *
- * @example
- * var options = {
- * beforeSubmit: function(formArray, jqForm) {
- * if (formArray.length == 0) {
- * alert('Please enter data.');
- * return false;
- * }
- * }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Bind form's submit event so that pre-submit callback is invoked before the form
- * is submitted.
- *
- *
- * @name ajaxForm
- * @param options object literal containing options which control the form submission process
- * @return jQuery
- * @cat Plugins/Form
- * @type jQuery
- */
-$.fn.ajaxForm = function(options) {
- return this.ajaxFormUnbind().submit(submitHandler).each(function() {
- // store options in hash
- this.formPluginId = $.fn.ajaxForm.counter++;
- $.fn.ajaxForm.optionHash[this.formPluginId] = options;
- $(":submit,input:image", this).click(clickHandler);
- });
-};
-
-$.fn.ajaxForm.counter = 1;
-$.fn.ajaxForm.optionHash = {};
-
-function clickHandler(e) {
- var $form = this.form;
- $form.clk = this;
- if (this.type == 'image') {
- if (e.offsetX != undefined) {
- $form.clk_x = e.offsetX;
- $form.clk_y = e.offsetY;
- } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
- var offset = $(this).offset();
- $form.clk_x = e.pageX - offset.left;
- $form.clk_y = e.pageY - offset.top;
- } else {
- $form.clk_x = e.pageX - this.offsetLeft;
- $form.clk_y = e.pageY - this.offsetTop;
- }
- }
- // clear form vars
- setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
-};
-
-function submitHandler() {
- // retrieve options from hash
- var id = this.formPluginId;
- var options = $.fn.ajaxForm.optionHash[id];
- $(this).ajaxSubmit(options);
- return false;
-};
-
-/**
- * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
- *
- * @name ajaxFormUnbind
- * @return jQuery
- * @cat Plugins/Form
- * @type jQuery
- */
-$.fn.ajaxFormUnbind = function() {
- this.unbind('submit', submitHandler);
- return this.each(function() {
- $(":submit,input:image", this).unbind('click', clickHandler);
- });
-
-};
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property. An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * This is normally true anyway, unless the form contains input elements of type='image'.
- * If your form must be submitted with name/value pairs in semantic order and your form
- * contains an input of type='image" then pass true for this arg, otherwise pass false
- * (or nothing) to avoid the overhead for this logic.
- *
- * @example var data = $("#myForm").formToArray();
- * $.post( "myscript.cgi", data );
- * @desc Collect all the data from a form and submit it to the server.
- *
- * @name formToArray
- * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
- * @type Array<Object>
- * @cat Plugins/Form
- */
-$.fn.formToArray = function(semantic) {
- var a = [];
- if (this.length == 0) return a;
-
- var form = this[0];
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
- if (!els) return a;
- for(var i=0, max=els.length; i < max; i++) {
- var el = els[i];
- var n = el.name;
- if (!n) continue;
-
- if (semantic && form.clk && el.type == "image") {
- // handle image inputs on the fly when semantic == true
- if(!el.disabled && form.clk == el)
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- continue;
- }
-
- var v = $.fieldValue(el, true);
- if (v && v.constructor == Array) {
- for(var j=0, jmax=v.length; j < jmax; j++)
- a.push({name: n, value: v[j]});
- }
- else if (v !== null && typeof v != 'undefined')
- a.push({name: n, value: v});
- }
-
- if (!semantic && form.clk) {
- // input type=='image' are not found in elements array! handle them here
- var inputs = form.getElementsByTagName("input");
- for(var i=0, max=inputs.length; i < max; i++) {
- var input = inputs[i];
- var n = input.name;
- if(n && !input.disabled && input.type == "image" && form.clk == input)
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- }
- return a;
-};
-
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&amp;name2=value2
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * If your form must be submitted with name/value pairs in semantic order then pass
- * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
- * this logic (which can be significant for very large forms).
- *
- * @example var data = $("#myForm").formSerialize();
- * $.ajax('POST', "myscript.cgi", data);
- * @desc Collect all the data from a form into a single string
- *
- * @name formSerialize
- * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
- * @type String
- * @cat Plugins/Form
- */
-$.fn.formSerialize = function(semantic) {
- //hand off to jQuery.param for proper encoding
- return $.param(this.formToArray(semantic));
-};
-
-
-/**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&amp;name2=value2
- *
- * The successful argument controls whether or not serialization is limited to
- * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.
- *
- * @example var data = $("input").formSerialize();
- * @desc Collect the data from all successful input elements into a query string
- *
- * @example var data = $(":radio").formSerialize();
- * @desc Collect the data from all successful radio input elements into a query string
- *
- * @example var data = $("#myForm :checkbox").formSerialize();
- * @desc Collect the data from all successful checkbox input elements in myForm into a query string
- *
- * @example var data = $("#myForm :checkbox").formSerialize(false);
- * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
- *
- * @example var data = $(":input").formSerialize();
- * @desc Collect the data from all successful input, select, textarea and button elements into a query string
- *
- * @name fieldSerialize
- * @param successful true if only successful controls should be serialized (default is true)
- * @type String
- * @cat Plugins/Form
- */
-$.fn.fieldSerialize = function(successful) {
- var a = [];
- this.each(function() {
- var n = this.name;
- if (!n) return;
- var v = $.fieldValue(this, successful);
- if (v && v.constructor == Array) {
- for (var i=0,max=v.length; i < max; i++)
- a.push({name: n, value: v[i]});
- }
- else if (v !== null && typeof v != 'undefined')
- a.push({name: this.name, value: v});
- });
- //hand off to jQuery.param for proper encoding
- return $.param(a);
-};
-
-
-/**
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
- *
- * <form><fieldset>
- * <input name="A" type="text" />
- * <input name="A" type="text" />
- * <input name="B" type="checkbox" value="B1" />
- * <input name="B" type="checkbox" value="B2"/>
- * <input name="C" type="radio" value="C1" />
- * <input name="C" type="radio" value="C2" />
- * </fieldset></form>
- *
- * var v = $(':text').fieldValue();
- * // if no values are entered into the text inputs
- * v == ['','']
- * // if values entered into the text inputs are 'foo' and 'bar'
- * v == ['foo','bar']
- *
- * var v = $(':checkbox').fieldValue();
- * // if neither checkbox is checked
- * v === undefined
- * // if both checkboxes are checked
- * v == ['B1', 'B2']
- *
- * var v = $(':radio').fieldValue();
- * // if neither radio is checked
- * v === undefined
- * // if first radio is checked
- * v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true. If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array. If no valid value can be determined the
- * array will be empty, otherwise it will contain one or more values.
- *
- * @example var data = $("#myPasswordElement").fieldValue();
- * alert(data[0]);
- * @desc Alerts the current value of the myPasswordElement element
- *
- * @example var data = $("#myForm :input").fieldValue();
- * @desc Get the value(s) of the form elements in myForm
- *
- * @example var data = $("#myForm :checkbox").fieldValue();
- * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
- *
- * @example var data = $("#mySingleSelect").fieldValue();
- * @desc Get the value(s) of the select control
- *
- * @example var data = $(':text').fieldValue();
- * @desc Get the value(s) of the text input or textarea elements
- *
- * @example var data = $("#myMultiSelect").fieldValue();
- * @desc Get the values for the select-multiple control
- *
- * @name fieldValue
- * @param Boolean successful true if only the values for successful controls should be returned (default is true)
- * @type Array<String>
- * @cat Plugins/Form
- */
-$.fn.fieldValue = function(successful) {
- for (var val=[], i=0, max=this.length; i < max; i++) {
- var el = this[i];
- var v = $.fieldValue(el, successful);
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
- continue;
- v.constructor == Array ? $.merge(val, v) : val.push(v);
- }
- return val;
-};
-
-/**
- * Returns the value of the field element.
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true. If the given element is not
- * successful and the successful arg is not false then the returned value will be null.
- *
- * Note: If the successful flag is true (default) but the element is not successful, the return will be null
- * Note: The value returned for a successful select-multiple element will always be an array.
- * Note: If the element has no value the return value will be undefined.
- *
- * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
- * @desc Gets the current value of the myPasswordElement element
- *
- * @name fieldValue
- * @param Element el The DOM element for which the value will be returned
- * @param Boolean successful true if value returned must be for a successful controls (default is true)
- * @type String or Array<String> or null or undefined
- * @cat Plugins/Form
- */
-$.fieldValue = function(el, successful) {
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
- if (typeof successful == 'undefined') successful = true;
-
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
- (t == 'checkbox' || t == 'radio') && !el.checked ||
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
- tag == 'select' && el.selectedIndex == -1))
- return null;
-
- if (tag == 'select') {
- var index = el.selectedIndex;
- if (index < 0) return null;
- var a = [], ops = el.options;
- var one = (t == 'select-one');
- var max = (one ? index+1 : ops.length);
- for(var i=(one ? index : 0); i < max; i++) {
- var op = ops[i];
- if (op.selected) {
- // extra pain for IE...
- var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
- if (one) return v;
- a.push(v);
- }
- }
- return a;
- }
- return el.value;
-};
-
-
-/**
- * Clears the form data. Takes the following actions on the form's input fields:
- * - input text fields will have their 'value' property set to the empty string
- * - select elements will have their 'selectedIndex' property set to -1
- * - checkbox and radio inputs will have their 'checked' property set to false
- * - inputs of type submit, button, reset, and hidden will *not* be effected
- * - button elements will *not* be effected
- *
- * @example $('form').clearForm();
- * @desc Clears all forms on the page.
- *
- * @name clearForm
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.clearForm = function() {
- return this.each(function() {
- $('input,select,textarea', this).clearFields();
- });
-};
-
-/**
- * Clears the selected form elements. Takes the following actions on the matched elements:
- * - input text fields will have their 'value' property set to the empty string
- * - select elements will have their 'selectedIndex' property set to -1
- * - checkbox and radio inputs will have their 'checked' property set to false
- * - inputs of type submit, button, reset, and hidden will *not* be effected
- * - button elements will *not* be effected
- *
- * @example $('.myInputs').clearFields();
- * @desc Clears all inputs with class myInputs
- *
- * @name clearFields
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.clearFields = $.fn.clearInputs = function() {
- return this.each(function() {
- var t = this.type, tag = this.tagName.toLowerCase();
- if (t == 'text' || t == 'password' || tag == 'textarea')
- this.value = '';
- else if (t == 'checkbox' || t == 'radio')
- this.checked = false;
- else if (tag == 'select')
- this.selectedIndex = -1;
- });
-};
-
-
-/**
- * Resets the form data. Causes all form elements to be reset to their original value.
- *
- * @example $('form').resetForm();
- * @desc Resets all forms on the page.
- *
- * @name resetForm
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.resetForm = function() {
- return this.each(function() {
- // guard against an input with the name of 'reset'
- // note that IE reports the reset function as an 'object'
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
- this.reset();
- });
-};
-
-
-/**
- * Enables or disables any matching elements.
- *
- * @example $(':radio').enabled(false);
- * @desc Disables all radio buttons
- *
- * @name select
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.enable = function(b) {
- if (b == undefined) b = true;
- return this.each(function() {
- this.disabled = !b
- });
-};
-
-/**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- *
- * @example $(':checkbox').selected();
- * @desc Checks all checkboxes
- *
- * @name select
- * @type jQuery
- * @cat Plugins/Form
- */
-$.fn.select = function(select) {
- if (select == undefined) select = true;
- return this.each(function() {
- var t = this.type;
- if (t == 'checkbox' || t == 'radio')
- this.checked = select;
- else if (this.tagName.toLowerCase() == 'option') {
- var $sel = $(this).parent('select');
- if (select && $sel[0] && $sel[0].type == 'select-one') {
- // deselect all other options
- $sel.find('option').select(false);
- }
- this.selected = select;
- }
- });
-};
-
-})(jQuery);
diff --git a/public/javascripts/vendor/mailchimp/jquery.validate.js b/public/javascripts/vendor/mailchimp/jquery.validate.js
deleted file mode 100644
index e0ac96b3f..000000000
--- a/public/javascripts/vendor/mailchimp/jquery.validate.js
+++ /dev/null
@@ -1,1118 +0,0 @@
-/*
- * jQuery validation plug-in 1.5.1
- *
- * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
- * http://docs.jquery.com/Plugins/Validation
- *
- * Copyright (c) 2006 - 2008 Jörn Zaefferer
- *
- * $Id: jquery.validate.js 6096 2009-01-12 14:12:04Z joern.zaefferer $
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-
-(function($) {
-
-$.extend($.fn, {
- // http://docs.jquery.com/Plugins/Validation/validate
- validate: function( options ) {
-
- // if nothing is selected, return nothing; can't chain anyway
- if (!this.length) {
- options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" );
- return;
- }
-
- // check if a validator for this form was already created
- var validator = $.data(this[0], 'validator');
- if ( validator ) {
- return validator;
- }
-
- validator = new $.validator( options, this[0] );
- $.data(this[0], 'validator', validator);
-
- if ( validator.settings.onsubmit ) {
-
- // allow suppresing validation by adding a cancel class to the submit button
- this.find("input, button").filter(".cancel").click(function() {
- validator.cancelSubmit = true;
- });
-
- // validate the form on submit
- this.submit( function( event ) {
- if ( validator.settings.debug )
- // prevent form submit to be able to see console output
- event.preventDefault();
-
- function handle() {
- if ( validator.settings.submitHandler ) {
- validator.settings.submitHandler.call( validator, validator.currentForm );
- return false;
- }
- return true;
- }
-
- // prevent submit for invalid forms or custom submit handlers
- if ( validator.cancelSubmit ) {
- validator.cancelSubmit = false;
- return handle();
- }
- if ( validator.form() ) {
- if ( validator.pendingRequest ) {
- validator.formSubmitted = true;
- return false;
- }
- return handle();
- } else {
- validator.focusInvalid();
- return false;
- }
- });
- }
-
- return validator;
- },
- // http://docs.jquery.com/Plugins/Validation/valid
- valid: function() {
- if ( $(this[0]).is('form')) {
- return this.validate().form();
- } else {
- var valid = false;
- var validator = $(this[0].form).validate();
- this.each(function() {
- valid |= validator.element(this);
- });
- return valid;
- }
- },
- // attributes: space seperated list of attributes to retrieve and remove
- removeAttrs: function(attributes) {
- var result = {},
- $element = this;
- $.each(attributes.split(/\s/), function(index, value) {
- result[value] = $element.attr(value);
- $element.removeAttr(value);
- });
- return result;
- },
- // http://docs.jquery.com/Plugins/Validation/rules
- rules: function(command, argument) {
- var element = this[0];
-
- if (command) {
- var settings = $.data(element.form, 'validator').settings;
- var staticRules = settings.rules;
- var existingRules = $.validator.staticRules(element);
- switch(command) {
- case "add":
- $.extend(existingRules, $.validator.normalizeRule(argument));
- staticRules[element.name] = existingRules;
- if (argument.messages)
- settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
- break;
- case "remove":
- if (!argument) {
- delete staticRules[element.name];
- return existingRules;
- }
- var filtered = {};
- $.each(argument.split(/\s/), function(index, method) {
- filtered[method] = existingRules[method];
- delete existingRules[method];
- });
- return filtered;
- }
- }
-
- var data = $.validator.normalizeRules(
- $.extend(
- {},
- $.validator.metadataRules(element),
- $.validator.classRules(element),
- $.validator.attributeRules(element),
- $.validator.staticRules(element)
- ), element);
-
- // make sure required is at front
- if (data.required) {
- var param = data.required;
- delete data.required;
- data = $.extend({required: param}, data);
- }
-
- return data;
- }
-});
-
-// Custom selectors
-$.extend($.expr[":"], {
- // http://docs.jquery.com/Plugins/Validation/blank
- blank: function(a) {return !$.trim(a.value);},
- // http://docs.jquery.com/Plugins/Validation/filled
- filled: function(a) {return !!$.trim(a.value);},
- // http://docs.jquery.com/Plugins/Validation/unchecked
- unchecked: function(a) {return !a.checked;}
-});
-
-
-$.format = function(source, params) {
- if ( arguments.length == 1 )
- return function() {
- var args = $.makeArray(arguments);
- args.unshift(source);
- return $.format.apply( this, args );
- };
- if ( arguments.length > 2 && params.constructor != Array ) {
- params = $.makeArray(arguments).slice(1);
- }
- if ( params.constructor != Array ) {
- params = [ params ];
- }
- $.each(params, function(i, n) {
- source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
- });
- return source;
-};
-
-// constructor for validator
-$.validator = function( options, form ) {
- this.settings = $.extend( {}, $.validator.defaults, options );
- this.currentForm = form;
- this.init();
-};
-
-$.extend($.validator, {
-
- defaults: {
- messages: {},
- groups: {},
- rules: {},
- errorClass: "error",
- errorElement: "label",
- errorStyle: "",
- focusInvalid: true,
- errorContainer: $( [] ),
- errorLabelContainer: $( [] ),
- onsubmit: true,
- ignore: [],
- ignoreTitle: false,
- onfocusin: function(element) {
- this.lastActive = element;
-
- // hide error label and remove error class on focus if enabled
- if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
- this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass );
- this.errorsFor(element).hide();
- }
- },
- onfocusout: function(element) {
- if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
- this.element(element);
- }
- },
- onkeyup: function(element) {
- if ( element.name in this.submitted || element == this.lastElement ) {
- this.element(element);
- }
- },
- onclick: function(element) {
- if ( element.name in this.submitted )
- this.element(element);
- },
- highlight: function( element, errorClass ) {
- $( element ).addClass( errorClass );
- },
- unhighlight: function( element, errorClass ) {
- $( element ).removeClass( errorClass );
- }
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
- setDefaults: function(settings) {
- $.extend( $.validator.defaults, settings );
- },
-
- messages: {
- required: "This field is required.",
- remote: "Please fix this field.",
- email: "Please enter a valid email address.",
- url: "Please enter a valid URL.",
- date: "Please enter a valid date.",
- dateISO: "Please enter a valid date (ISO).",
- dateDE: "Bitte geben Sie ein gültiges Datum ein.",
- number: "Please enter a valid number.",
- numberDE: "Bitte geben Sie eine Nummer ein.",
- digits: "Please enter only digits",
- creditcard: "Please enter a valid credit card number.",
- equalTo: "Please enter the same value again.",
- accept: "Please enter a value with a valid extension.",
- maxlength: $.format("Please enter no more than {0} characters."),
- minlength: $.format("Please enter at least {0} characters."),
- rangelength: $.format("Please enter a value between {0} and {1} characters long."),
- range: $.format("Please enter a value between {0} and {1}."),
- max: $.format("Please enter a value less than or equal to {0}."),
- min: $.format("Please enter a value greater than or equal to {0}.")
- },
-
- autoCreateRanges: false,
-
- prototype: {
-
- init: function() {
- this.labelContainer = $(this.settings.errorLabelContainer);
- this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
- this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
- this.submitted = {};
- this.valueCache = {};
- this.pendingRequest = 0;
- this.pending = {};
- this.invalid = {};
- this.reset();
-
- var groups = (this.groups = {});
- $.each(this.settings.groups, function(key, value) {
- $.each(value.split(/\s/), function(index, name) {
- groups[name] = key;
- });
- });
- var rules = this.settings.rules;
- $.each(rules, function(key, value) {
- rules[key] = $.validator.normalizeRule(value);
- });
-
- function delegate(event) {
- var validator = $.data(this[0].form, "validator");
- validator.settings["on" + event.type] && validator.settings["on" + event.type].call(validator, this[0] );
- }
- $(this.currentForm)
- .delegate("focusin focusout keyup", ":text, :password, :file, select, textarea", delegate)
- .delegate("click", ":radio, :checkbox", delegate);
-
- if (this.settings.invalidHandler)
- $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/form
- form: function() {
- this.checkForm();
- $.extend(this.submitted, this.errorMap);
- this.invalid = $.extend({}, this.errorMap);
- if (!this.valid())
- $(this.currentForm).triggerHandler("invalid-form", [this]);
- this.showErrors();
- return this.valid();
- },
-
- checkForm: function() {
- this.prepareForm();
- for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
- this.check( elements[i] );
- }
- return this.valid();
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/element
- element: function( element ) {
- element = this.clean( element );
- this.lastElement = element;
- this.prepareElement( element );
- this.currentElements = $(element);
- var result = this.check( element );
- if ( result ) {
- delete this.invalid[element.name];
- } else {
- this.invalid[element.name] = true;
- }
- if ( !this.numberOfInvalids() ) {
- // Hide error containers on last error
- this.toHide = this.toHide.add( this.containers );
- }
- this.showErrors();
- return result;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/showErrors
- showErrors: function(errors) {
- if(errors) {
- // add items to error list and map
- $.extend( this.errorMap, errors );
- this.errorList = [];
- for ( var name in errors ) {
- this.errorList.push({
- message: errors[name],
- element: this.findByName(name)[0]
- });
- }
- // remove items from success list
- this.successList = $.grep( this.successList, function(element) {
- return !(element.name in errors);
- });
- }
- this.settings.showErrors
- ? this.settings.showErrors.call( this, this.errorMap, this.errorList )
- : this.defaultShowErrors();
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/resetForm
- resetForm: function() {
- if ( $.fn.resetForm )
- $( this.currentForm ).resetForm();
- this.submitted = {};
- this.prepareForm();
- this.hideErrors();
- this.elements().removeClass( this.settings.errorClass );
- },
-
- numberOfInvalids: function() {
- return this.objectLength(this.invalid);
- },
-
- objectLength: function( obj ) {
- var count = 0;
- for ( var i in obj )
- count++;
- return count;
- },
-
- hideErrors: function() {
- this.addWrapper( this.toHide ).hide();
- },
-
- valid: function() {
- return this.size() == 0;
- },
-
- size: function() {
- return this.errorList.length;
- },
-
- focusInvalid: function() {
- if( this.settings.focusInvalid ) {
- try {
- $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus();
- } catch(e) {
- // ignore IE throwing errors when focusing hidden elements
- }
- }
- },
-
- findLastActive: function() {
- var lastActive = this.lastActive;
- return lastActive && $.grep(this.errorList, function(n) {
- return n.element.name == lastActive.name;
- }).length == 1 && lastActive;
- },
-
- elements: function() {
- var validator = this,
- rulesCache = {};
-
- // select all valid inputs inside the form (no submit or reset buttons)
- // workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved
- return $([]).add(this.currentForm.elements)
- .filter(":input")
- .not(":submit, :reset, :image, [disabled]")
- .not( this.settings.ignore )
- .filter(function() {
- !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);
-
- // select only the first element for each name, and only those with rules specified
- if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
- return false;
-
- rulesCache[this.name] = true;
- return true;
- });
- },
-
- clean: function( selector ) {
- return $( selector )[0];
- },
-
- errors: function() {
- return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext );
- },
-
- reset: function() {
- this.successList = [];
- this.errorList = [];
- this.errorMap = {};
- this.toShow = $([]);
- this.toHide = $([]);
- this.formSubmitted = false;
- this.currentElements = $([]);
- },
-
- prepareForm: function() {
- this.reset();
- this.toHide = this.errors().add( this.containers );
- },
-
- prepareElement: function( element ) {
- this.reset();
- this.toHide = this.errorsFor(element);
- },
-
- check: function( element ) {
- element = this.clean( element );
-
- // if radio/checkbox, validate first element in group instead
- if (this.checkable(element)) {
- element = this.findByName( element.name )[0];
- }
-
- var rules = $(element).rules();
- var dependencyMismatch = false;
- for( method in rules ) {
- var rule = { method: method, parameters: rules[method] };
- try {
- var result = $.validator.methods[method].call( this, element.value, element, rule.parameters );
-
- // if a method indicates that the field is optional and therefore valid,
- // don't mark it as valid when there are no other rules
- if ( result == "dependency-mismatch" ) {
- dependencyMismatch = true;
- continue;
- }
- dependencyMismatch = false;
-
- if ( result == "pending" ) {
- this.toHide = this.toHide.not( this.errorsFor(element) );
- return;
- }
-
- if( !result ) {
- this.formatAndAdd( element, rule );
- return false;
- }
- } catch(e) {
- this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
- + ", check the '" + rule.method + "' method");
- throw e;
- }
- }
- if (dependencyMismatch)
- return;
- if ( this.objectLength(rules) )
- this.successList.push(element);
- return true;
- },
-
- // return the custom message for the given element and validation method
- // specified in the element's "messages" metadata
- customMetaMessage: function(element, method) {
- if (!$.metadata)
- return;
-
- var meta = this.settings.meta
- ? $(element).metadata()[this.settings.meta]
- : $(element).metadata();
-
- return meta && meta.messages && meta.messages[method];
- },
-
- // return the custom message for the given element name and validation method
- customMessage: function( name, method ) {
- var m = this.settings.messages[name];
- return m && (m.constructor == String
- ? m
- : m[method]);
- },
-
- // return the first defined argument, allowing empty strings
- findDefined: function() {
- for(var i = 0; i < arguments.length; i++) {
- if (arguments[i] !== undefined)
- return arguments[i];
- }
- return undefined;
- },
-
- defaultMessage: function( element, method) {
- return this.findDefined(
- this.customMessage( element.name, method ),
- this.customMetaMessage( element, method ),
- // title is never undefined, so handle empty string as undefined
- !this.settings.ignoreTitle && element.title || undefined,
- $.validator.messages[method],
- "<strong>Warning: No message defined for " + element.name + "</strong>"
- );
- },
-
- formatAndAdd: function( element, rule ) {
- var message = this.defaultMessage( element, rule.method );
- if ( typeof message == "function" )
- message = message.call(this, rule.parameters, element);
- this.errorList.push({
- message: message,
- element: element
- });
- this.errorMap[element.name] = message;
- this.submitted[element.name] = message;
- },
-
- addWrapper: function(toToggle) {
- if ( this.settings.wrapper )
- toToggle = toToggle.add( toToggle.parents( this.settings.wrapper ) );
- return toToggle;
- },
-
- defaultShowErrors: function() {
- for ( var i = 0; this.errorList[i]; i++ ) {
- var error = this.errorList[i];
- this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass );
- this.showLabel( error.element, error.message );
- }
- if( this.errorList.length ) {
- this.toShow = this.toShow.add( this.containers );
- }
- if (this.settings.success) {
- for ( var i = 0; this.successList[i]; i++ ) {
- this.showLabel( this.successList[i] );
- }
- }
- if (this.settings.unhighlight) {
- for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {
- this.settings.unhighlight.call( this, elements[i], this.settings.errorClass );
- }
- }
- this.toHide = this.toHide.not( this.toShow );
- this.hideErrors();
- this.addWrapper( this.toShow ).show();
- },
-
- validElements: function() {
- return this.currentElements.not(this.invalidElements());
- },
-
- invalidElements: function() {
- return $(this.errorList).map(function() {
- return this.element;
- });
- },
-
- showLabel: function(element, message) {
- var label = this.errorsFor( element );
- if ( label.length ) {
- // refresh error/success class
- label.removeClass().addClass( this.settings.errorClass );
- label.attr('style', this.settings.errorStyle );
-
- // check if we have a generated label, replace the message then
- label.attr("generated") && label.html(message);
- } else {
- // create label
- label = $("<" + this.settings.errorElement + "/>")
- .attr({"for": this.idOrName(element), generated: true})
- .addClass(this.settings.errorClass)
- .attr('style', this.settings.errorStyle )
- .html(message || "");
- if ( this.settings.wrapper ) {
- // make sure the element is visible, even in IE
- // actually showing the wrapped element is handled elsewhere
- label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
- }
- if ( !this.labelContainer.append(label).length )
- this.settings.errorPlacement
- ? this.settings.errorPlacement(label, $(element) )
- : label.insertAfter(element);
- }
- if ( !message && this.settings.success ) {
- label.text("");
- typeof this.settings.success == "string"
- ? label.addClass( this.settings.success )
- : this.settings.success( label );
- }
- this.toShow = this.toShow.add(label);
- },
-
- errorsFor: function(element) {
- return this.errors().filter("[for='" + this.idOrName(element) + "']");
- },
-
- idOrName: function(element) {
- return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
- },
-
- checkable: function( element ) {
- return /radio|checkbox/i.test(element.type);
- },
-
- findByName: function( name ) {
- // select by name and filter by form for performance over form.find("[name=...]")
- var form = this.currentForm;
- return $(document.getElementsByName(name)).map(function(index, element) {
- return element.form == form && element.name == name && element || null;
- });
- },
-
- getLength: function(value, element) {
- switch( element.nodeName.toLowerCase() ) {
- case 'select':
- return $("option:selected", element).length;
- case 'input':
- if( this.checkable( element) )
- return this.findByName(element.name).filter(':checked').length;
- }
- return value.length;
- },
-
- depend: function(param, element) {
- return this.dependTypes[typeof param]
- ? this.dependTypes[typeof param](param, element)
- : true;
- },
-
- dependTypes: {
- "boolean": function(param, element) {
- return param;
- },
- "string": function(param, element) {
- return !!$(param, element.form).length;
- },
- "function": function(param, element) {
- return param(element);
- }
- },
-
- optional: function(element) {
- return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
- },
-
- startRequest: function(element) {
- if (!this.pending[element.name]) {
- this.pendingRequest++;
- this.pending[element.name] = true;
- }
- },
-
- stopRequest: function(element, valid) {
- this.pendingRequest--;
- // sometimes synchronization fails, make sure pendingRequest is never < 0
- if (this.pendingRequest < 0)
- this.pendingRequest = 0;
- delete this.pending[element.name];
- if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) {
- $(this.currentForm).submit();
- } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
- $(this.currentForm).triggerHandler("invalid-form", [this]);
- }
- },
-
- previousValue: function(element) {
- return $.data(element, "previousValue") || $.data(element, "previousValue", previous = {
- old: null,
- valid: true,
- message: this.defaultMessage( element, "remote" )
- });
- }
-
- },
-
- classRuleSettings: {
- required: {required: true},
- email: {email: true},
- url: {url: true},
- date: {date: true},
- dateISO: {dateISO: true},
- dateDE: {dateDE: true},
- number: {number: true},
- numberDE: {numberDE: true},
- digits: {digits: true},
- creditcard: {creditcard: true}
- },
-
- addClassRules: function(className, rules) {
- className.constructor == String ?
- this.classRuleSettings[className] = rules :
- $.extend(this.classRuleSettings, className);
- },
-
- classRules: function(element) {
- var rules = {};
- var classes = $(element).attr('class');
- classes && $.each(classes.split(' '), function() {
- if (this in $.validator.classRuleSettings) {
- $.extend(rules, $.validator.classRuleSettings[this]);
- }
- });
- return rules;
- },
-
- attributeRules: function(element) {
- var rules = {};
- var $element = $(element);
-
- for (method in $.validator.methods) {
- var value = $element.attr(method);
- if (value) {
- rules[method] = value;
- }
- }
-
- // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
- if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
- delete rules.maxlength;
- }
-
- return rules;
- },
-
- metadataRules: function(element) {
- if (!$.metadata) return {};
-
- var meta = $.data(element.form, 'validator').settings.meta;
- return meta ?
- $(element).metadata()[meta] :
- $(element).metadata();
- },
-
- staticRules: function(element) {
- var rules = {};
- var validator = $.data(element.form, 'validator');
- if (validator.settings.rules) {
- rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
- }
- return rules;
- },
-
- normalizeRules: function(rules, element) {
- // handle dependency check
- $.each(rules, function(prop, val) {
- // ignore rule when param is explicitly false, eg. required:false
- if (val === false) {
- delete rules[prop];
- return;
- }
- if (val.param || val.depends) {
- var keepRule = true;
- switch (typeof val.depends) {
- case "string":
- keepRule = !!$(val.depends, element.form).length;
- break;
- case "function":
- keepRule = val.depends.call(element, element);
- break;
- }
- if (keepRule) {
- rules[prop] = val.param !== undefined ? val.param : true;
- } else {
- delete rules[prop];
- }
- }
- });
-
- // evaluate parameters
- $.each(rules, function(rule, parameter) {
- rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
- });
-
- // clean number parameters
- $.each(['minlength', 'maxlength', 'min', 'max'], function() {
- if (rules[this]) {
- rules[this] = Number(rules[this]);
- }
- });
- $.each(['rangelength', 'range'], function() {
- if (rules[this]) {
- rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
- }
- });
-
- if ($.validator.autoCreateRanges) {
- // auto-create ranges
- if (rules.min && rules.max) {
- rules.range = [rules.min, rules.max];
- delete rules.min;
- delete rules.max;
- }
- if (rules.minlength && rules.maxlength) {
- rules.rangelength = [rules.minlength, rules.maxlength];
- delete rules.minlength;
- delete rules.maxlength;
- }
- }
-
- // To support custom messages in metadata ignore rule methods titled "messages"
- if (rules.messages) {
- delete rules.messages
- }
-
- return rules;
- },
-
- // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
- normalizeRule: function(data) {
- if( typeof data == "string" ) {
- var transformed = {};
- $.each(data.split(/\s/), function() {
- transformed[this] = true;
- });
- data = transformed;
- }
- return data;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Validator/addMethod
- addMethod: function(name, method, message) {
- $.validator.methods[name] = method;
- $.validator.messages[name] = message;
- if (method.length < 3) {
- $.validator.addClassRules(name, $.validator.normalizeRule(name));
- }
- },
-
- methods: {
-
- // http://docs.jquery.com/Plugins/Validation/Methods/required
- required: function(value, element, param) {
- // check if dependency is met
- if ( !this.depend(param, element) )
- return "dependency-mismatch";
- switch( element.nodeName.toLowerCase() ) {
- case 'select':
- var options = $("option:selected", element);
- return options.length > 0 && ( element.type == "select-multiple" || ($.browser.msie && !(options[0].attributes['value'].specified) ? options[0].text : options[0].value).length > 0);
- case 'input':
- if ( this.checkable(element) )
- return this.getLength(value, element) > 0;
- default:
- return $.trim(value).length > 0;
- }
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/remote
- remote: function(value, element, param) {
- if ( this.optional(element) )
- return "dependency-mismatch";
-
- var previous = this.previousValue(element);
-
- if (!this.settings.messages[element.name] )
- this.settings.messages[element.name] = {};
- this.settings.messages[element.name].remote = typeof previous.message == "function" ? previous.message(value) : previous.message;
-
- param = typeof param == "string" && {url:param} || param;
-
- if ( previous.old !== value ) {
- previous.old = value;
- var validator = this;
- this.startRequest(element);
- var data = {};
- data[element.name] = value;
- $.ajax($.extend(true, {
- url: param,
- mode: "abort",
- port: "validate" + element.name,
- dataType: "json",
- data: data,
- success: function(response) {
- if ( response ) {
- var submitted = validator.formSubmitted;
- validator.prepareElement(element);
- validator.formSubmitted = submitted;
- validator.successList.push(element);
- validator.showErrors();
- } else {
- var errors = {};
- errors[element.name] = response || validator.defaultMessage( element, "remote" );
- validator.showErrors(errors);
- }
- previous.valid = response;
- validator.stopRequest(element, response);
- }
- }, param));
- return "pending";
- } else if( this.pending[element.name] ) {
- return "pending";
- }
- return previous.valid;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/minlength
- minlength: function(value, element, param) {
- return this.optional(element) || this.getLength($.trim(value), element) >= param;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/maxlength
- maxlength: function(value, element, param) {
- return this.optional(element) || this.getLength($.trim(value), element) <= param;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/rangelength
- rangelength: function(value, element, param) {
- var length = this.getLength($.trim(value), element);
- return this.optional(element) || ( length >= param[0] && length <= param[1] );
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/min
- min: function( value, element, param ) {
- return this.optional(element) || value >= param;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/max
- max: function( value, element, param ) {
- return this.optional(element) || value <= param;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/range
- range: function( value, element, param ) {
- return this.optional(element) || ( value >= param[0] && value <= param[1] );
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/email
- email: function(value, element) {
- // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
- return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/url
- url: function(value, element) {
- // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
- return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/date
- date: function(value, element) {
- //ES - Chrome does not use the locale when new Date objects instantiated:
- // http://geekswithblogs.net/EltonStoneman/archive/2009/10/29/jquery-date-validation-in-chrome.aspx
- //return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
- var d = new Date();
- return this.optional(element) || !/Invalid|NaN/.test(new Date(d.toLocaleDateString(value)));
- },
- // http://docs.jquery.com/Plugins/Validation/Methods/dateISO
- dateISO: function(value, element) {
- return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/dateDE
- dateDE: function(value, element) {
- return this.optional(element) || /^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/number
- number: function(value, element) {
- return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/numberDE
- numberDE: function(value, element) {
- return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/digits
- digits: function(value, element) {
- return this.optional(element) || /^\d+$/.test(value);
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/creditcard
- // based on http://en.wikipedia.org/wiki/Luhn
- creditcard: function(value, element) {
- if ( this.optional(element) )
- return "dependency-mismatch";
- // accept only digits and dashes
- if (/[^0-9-]+/.test(value))
- return false;
- var nCheck = 0,
- nDigit = 0,
- bEven = false;
-
- value = value.replace(/\D/g, "");
-
- for (n = value.length - 1; n >= 0; n--) {
- var cDigit = value.charAt(n);
- var nDigit = parseInt(cDigit, 10);
- if (bEven) {
- if ((nDigit *= 2) > 9)
- nDigit -= 9;
- }
- nCheck += nDigit;
- bEven = !bEven;
- }
-
- return (nCheck % 10) == 0;
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/accept
- accept: function(value, element, param) {
- param = typeof param == "string" ? param : "png|jpe?g|gif";
- return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
- },
-
- // http://docs.jquery.com/Plugins/Validation/Methods/equalTo
- equalTo: function(value, element, param) {
- return value == $(param).val();
- }
-
- }
-
-});
-
-})(jQuery);
-
-// ajax mode: abort
-// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
-// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
-;(function($) {
- var ajax = $.ajax;
- var pendingRequests = {};
- $.ajax = function(settings) {
- // create settings for compatibility with ajaxSetup
- settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings));
- var port = settings.port;
- if (settings.mode == "abort") {
- if ( pendingRequests[port] ) {
- pendingRequests[port].abort();
- }
- return (pendingRequests[port] = ajax.apply(this, arguments));
- }
- return ajax.apply(this, arguments);
- };
-})(jQuery);
-
-// provides cross-browser focusin and focusout events
-// IE has native support, in other browsers, use event caputuring (neither bubbles)
-
-// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
-// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
-
-// provides triggerEvent(type: String, target: Element) to trigger delegated events
-;(function($) {
- $.each({
- focus: 'focusin',
- blur: 'focusout'
- }, function( original, fix ){
- $.event.special[fix] = {
- setup:function() {
- if ( $.browser.msie ) return false;
- this.addEventListener( original, $.event.special[fix].handler, true );
- },
- teardown:function() {
- if ( $.browser.msie ) return false;
- this.removeEventListener( original,
- $.event.special[fix].handler, true );
- },
- handler: function(e) {
- arguments[0] = $.event.fix(e);
- arguments[0].type = fix;
- return $.event.handle.apply(this, arguments);
- }
- };
- });
- $.extend($.fn, {
- delegate: function(type, delegate, handler) {
- return this.bind(type, function(event) {
- var target = $(event.target);
- if (target.is(delegate)) {
- return handler.apply(target, arguments);
- }
- });
- },
- triggerEvent: function(type, target) {
- return this.triggerHandler(type, [$.event.fix({ type: type, target: target })]);
- }
- })
-})(jQuery);
diff --git a/public/javascripts/vendor/mailchimp/jquery126.min.js b/public/javascripts/vendor/mailchimp/jquery126.min.js
deleted file mode 100644
index 6289c9943..000000000
--- a/public/javascripts/vendor/mailchimp/jquery126.min.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * jQuery 1.2.6 - New Wave Javascript
- *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * $Date: 2008/05/26 $
- * $Rev: 5685 $
- */
-(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
-return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
-return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
-selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
-return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
-this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
-return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
-jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
-script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
-for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
-for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
-jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
-ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
-while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
-while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
-for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
-jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
-xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
-jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
-for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
-s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
-e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); \ No newline at end of file
diff --git a/public/javascripts/vendor/markdown/Markdown.Converter.js b/public/javascripts/vendor/markdown/Markdown.Converter.js
deleted file mode 100644
index 34a624b3a..000000000
--- a/public/javascripts/vendor/markdown/Markdown.Converter.js
+++ /dev/null
@@ -1,1332 +0,0 @@
-var Markdown;
-
-if (typeof exports === "object" && typeof require === "function") // we're in a CommonJS (e.g. Node.js) module
- Markdown = exports;
-else
- Markdown = {};
-
-// The following text is included for historical reasons, but should
-// be taken with a pinch of salt; it's not all true anymore.
-
-//
-// Wherever possible, Showdown is a straight, line-by-line port
-// of the Perl version of Markdown.
-//
-// This is not a normal parser design; it's basically just a
-// series of string substitutions. It's hard to read and
-// maintain this way, but keeping Showdown close to the original
-// design makes it easier to port new features.
-//
-// More importantly, Showdown behaves like markdown.pl in most
-// edge cases. So web applications can do client-side preview
-// in Javascript, and then build identical HTML on the server.
-//
-// This port needs the new RegExp functionality of ECMA 262,
-// 3rd Edition (i.e. Javascript 1.5). Most modern web browsers
-// should do fine. Even with the new regular expression features,
-// We do a lot of work to emulate Perl's regex functionality.
-// The tricky changes in this file mostly have the "attacklab:"
-// label. Major or self-explanatory changes don't.
-//
-// Smart diff tools like Araxis Merge will be able to match up
-// this file with markdown.pl in a useful way. A little tweaking
-// helps: in a copy of markdown.pl, replace "#" with "//" and
-// replace "$text" with "text". Be sure to ignore whitespace
-// and line endings.
-//
-
-
-//
-// Usage:
-//
-// var text = "Markdown *rocks*.";
-//
-// var converter = new Markdown.Converter();
-// var html = converter.makeHtml(text);
-//
-// alert(html);
-//
-// Note: move the sample code to the bottom of this
-// file before uncommenting it.
-//
-
-(function () {
-
- function identity(x) { return x; }
- function returnFalse(x) { return false; }
-
- function HookCollection() { }
-
- HookCollection.prototype = {
-
- chain: function (hookname, func) {
- var original = this[hookname];
- if (!original)
- throw new Error("unknown hook " + hookname);
-
- if (original === identity)
- this[hookname] = func;
- else
- this[hookname] = function (x) { return func(original(x)); }
- },
- set: function (hookname, func) {
- if (!this[hookname])
- throw new Error("unknown hook " + hookname);
- this[hookname] = func;
- },
- addNoop: function (hookname) {
- this[hookname] = identity;
- },
- addFalse: function (hookname) {
- this[hookname] = returnFalse;
- }
- };
-
- Markdown.HookCollection = HookCollection;
-
- // g_urls and g_titles allow arbitrary user-entered strings as keys. This
- // caused an exception (and hence stopped the rendering) when the user entered
- // e.g. [push] or [__proto__]. Adding a prefix to the actual key prevents this
- // (since no builtin property starts with "s_"). See
- // http://meta.stackoverflow.com/questions/64655/strange-wmd-bug
- // (granted, switching from Array() to Object() alone would have left only __proto__
- // to be a problem)
- function SaveHash() { }
- SaveHash.prototype = {
- set: function (key, value) {
- this["s_" + key] = value;
- },
- get: function (key) {
- return this["s_" + key];
- }
- };
-
- Markdown.Converter = function () {
- var pluginHooks = this.hooks = new HookCollection();
- pluginHooks.addNoop("plainLinkText"); // given a URL that was encountered by itself (without markup), should return the link text that's to be given to this link
- pluginHooks.addNoop("preConversion"); // called with the orignal text as given to makeHtml. The result of this plugin hook is the actual markdown source that will be cooked
- pluginHooks.addNoop("postConversion"); // called with the final cooked HTML code. The result of this plugin hook is the actual output of makeHtml
-
- //
- // Private state of the converter instance:
- //
-
- // Global hashes, used by various utility routines
- var g_urls;
- var g_titles;
- var g_html_blocks;
-
- // Used to track when we're inside an ordered or unordered list
- // (see _ProcessListItems() for details):
- var g_list_level;
-
- this.makeHtml = function (text) {
-
- //
- // Main function. The order in which other subs are called here is
- // essential. Link and image substitutions need to happen before
- // _EscapeSpecialCharsWithinTagAttributes(), so that any *'s or _'s in the <a>
- // and <img> tags get encoded.
- //
-
- // This will only happen if makeHtml on the same converter instance is called from a plugin hook.
- // Don't do that.
- if (g_urls)
- throw new Error("Recursive call to converter.makeHtml");
-
- // Create the private state objects.
- g_urls = new SaveHash();
- g_titles = new SaveHash();
- g_html_blocks = [];
- g_list_level = 0;
-
- text = pluginHooks.preConversion(text);
-
- // attacklab: Replace ~ with ~T
- // This lets us use tilde as an escape char to avoid md5 hashes
- // The choice of character is arbitray; anything that isn't
- // magic in Markdown will work.
- text = text.replace(/~/g, "~T");
-
- // attacklab: Replace $ with ~D
- // RegExp interprets $ as a special character
- // when it's in a replacement string
- text = text.replace(/\$/g, "~D");
-
- // Standardize line endings
- text = text.replace(/\r\n/g, "\n"); // DOS to Unix
- text = text.replace(/\r/g, "\n"); // Mac to Unix
-
- // Make sure text begins and ends with a couple of newlines:
- text = "\n\n" + text + "\n\n";
-
- // Convert all tabs to spaces.
- text = _Detab(text);
-
- // Strip any lines consisting only of spaces and tabs.
- // This makes subsequent regexen easier to write, because we can
- // match consecutive blank lines with /\n+/ instead of something
- // contorted like /[ \t]*\n+/ .
- text = text.replace(/^[ \t]+$/mg, "");
-
- // Turn block-level HTML blocks into hash entries
- text = _HashHTMLBlocks(text);
-
- // Strip link definitions, store in hashes.
- text = _StripLinkDefinitions(text);
-
- text = _RunBlockGamut(text);
-
- text = _UnescapeSpecialChars(text);
-
- // attacklab: Restore dollar signs
- text = text.replace(/~D/g, "$$");
-
- // attacklab: Restore tildes
- text = text.replace(/~T/g, "~");
-
- text = pluginHooks.postConversion(text);
-
- g_html_blocks = g_titles = g_urls = null;
-
- return text;
- };
-
- function _StripLinkDefinitions(text) {
- //
- // Strips link definitions from text, stores the URLs and titles in
- // hash references.
- //
-
- // Link defs are in the form: ^[id]: url "optional title"
-
- /*
- text = text.replace(/
- ^[ ]{0,3}\[(.+)\]: // id = $1 attacklab: g_tab_width - 1
- [ \t]*
- \n? // maybe *one* newline
- [ \t]*
- <?(\S+?)>? // url = $2
- (?=\s|$) // lookahead for whitespace instead of the lookbehind removed below
- [ \t]*
- \n? // maybe one newline
- [ \t]*
- ( // (potential) title = $3
- (\n*) // any lines skipped = $4 attacklab: lookbehind removed
- [ \t]+
- ["(]
- (.+?) // title = $5
- [")]
- [ \t]*
- )? // title is optional
- (?:\n+|$)
- /gm, function(){...});
- */
-
- text = text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,
- function (wholeMatch, m1, m2, m3, m4, m5) {
- m1 = m1.toLowerCase();
- g_urls.set(m1, _EncodeAmpsAndAngles(m2)); // Link IDs are case-insensitive
- if (m4) {
- // Oops, found blank lines, so it's not a title.
- // Put back the parenthetical statement we stole.
- return m3;
- } else if (m5) {
- g_titles.set(m1, m5.replace(/"/g, "&quot;"));
- }
-
- // Completely remove the definition from the text
- return "";
- }
- );
-
- return text;
- }
-
- function _HashHTMLBlocks(text) {
-
- // Hashify HTML blocks:
- // We only want to do this for block-level HTML tags, such as headers,
- // lists, and tables. That's because we still want to wrap <p>s around
- // "paragraphs" that are wrapped in non-block-level tags, such as anchors,
- // phrase emphasis, and spans. The list of tags we're looking for is
- // hard-coded:
- var block_tags_a = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del"
- var block_tags_b = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math"
-
- // First, look for nested blocks, e.g.:
- // <div>
- // <div>
- // tags for inner block must be indented.
- // </div>
- // </div>
- //
- // The outermost tags must start at the left margin for this to match, and
- // the inner nested divs must be indented.
- // We need to do this before the next, more liberal match, because the next
- // match will start at the first `<div>` and stop at the first `</div>`.
-
- // attacklab: This regex can be expensive when it fails.
-
- /*
- text = text.replace(/
- ( // save in $1
- ^ // start of line (with /m)
- <($block_tags_a) // start tag = $2
- \b // word break
- // attacklab: hack around khtml/pcre bug...
- [^\r]*?\n // any number of lines, minimally matching
- </\2> // the matching end tag
- [ \t]* // trailing spaces/tabs
- (?=\n+) // followed by a newline
- ) // attacklab: there are sentinel newlines at end of document
- /gm,function(){...}};
- */
- text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm, hashElement);
-
- //
- // Now match more liberally, simply from `\n<tag>` to `</tag>\n`
- //
-
- /*
- text = text.replace(/
- ( // save in $1
- ^ // start of line (with /m)
- <($block_tags_b) // start tag = $2
- \b // word break
- // attacklab: hack around khtml/pcre bug...
- [^\r]*? // any number of lines, minimally matching
- .*</\2> // the matching end tag
- [ \t]* // trailing spaces/tabs
- (?=\n+) // followed by a newline
- ) // attacklab: there are sentinel newlines at end of document
- /gm,function(){...}};
- */
- text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm, hashElement);
-
- // Special case just for <hr />. It was easier to make a special case than
- // to make the other regex more complicated.
-
- /*
- text = text.replace(/
- \n // Starting after a blank line
- [ ]{0,3}
- ( // save in $1
- (<(hr) // start tag = $2
- \b // word break
- ([^<>])*?
- \/?>) // the matching end tag
- [ \t]*
- (?=\n{2,}) // followed by a blank line
- )
- /g,hashElement);
- */
- text = text.replace(/\n[ ]{0,3}((<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, hashElement);
-
- // Special case for standalone HTML comments:
-
- /*
- text = text.replace(/
- \n\n // Starting after a blank line
- [ ]{0,3} // attacklab: g_tab_width - 1
- ( // save in $1
- <!
- (--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--) // see http://www.w3.org/TR/html-markup/syntax.html#comments and http://meta.stackoverflow.com/q/95256
- >
- [ \t]*
- (?=\n{2,}) // followed by a blank line
- )
- /g,hashElement);
- */
- text = text.replace(/\n\n[ ]{0,3}(<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>[ \t]*(?=\n{2,}))/g, hashElement);
-
- // PHP and ASP-style processor instructions (<?...?> and <%...%>)
-
- /*
- text = text.replace(/
- (?:
- \n\n // Starting after a blank line
- )
- ( // save in $1
- [ ]{0,3} // attacklab: g_tab_width - 1
- (?:
- <([?%]) // $2
- [^\r]*?
- \2>
- )
- [ \t]*
- (?=\n{2,}) // followed by a blank line
- )
- /g,hashElement);
- */
- text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, hashElement);
-
- return text;
- }
-
- function hashElement(wholeMatch, m1) {
- var blockText = m1;
-
- // Undo double lines
- blockText = blockText.replace(/^\n+/, "");
-
- // strip trailing blank lines
- blockText = blockText.replace(/\n+$/g, "");
-
- // Replace the element text with a marker ("~KxK" where x is its key)
- blockText = "\n\n~K" + (g_html_blocks.push(blockText) - 1) + "K\n\n";
-
- return blockText;
- }
-
- function _RunBlockGamut(text, doNotUnhash) {
- //
- // These are all the transformations that form block-level
- // tags like paragraphs, headers, and list items.
- //
- text = _DoHeaders(text);
-
- // Do Horizontal Rules:
- var replacement = "<hr />\n";
- text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, replacement);
- text = text.replace(/^[ ]{0,2}([ ]?-[ ]?){3,}[ \t]*$/gm, replacement);
- text = text.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm, replacement);
-
- text = _DoLists(text);
- text = _DoCodeBlocks(text);
- text = _DoBlockQuotes(text);
-
- // We already ran _HashHTMLBlocks() before, in Markdown(), but that
- // was to escape raw HTML in the original Markdown source. This time,
- // we're escaping the markup we've just created, so that we don't wrap
- // <p> tags around block-level tags.
- text = _HashHTMLBlocks(text);
- text = _FormParagraphs(text, doNotUnhash);
-
- return text;
- }
-
- function _RunSpanGamut(text) {
- //
- // These are all the transformations that occur *within* block-level
- // tags like paragraphs, headers, and list items.
- //
-
- text = _DoCodeSpans(text);
- text = _EscapeSpecialCharsWithinTagAttributes(text);
- text = _EncodeBackslashEscapes(text);
-
- // Process anchor and image tags. Images must come first,
- // because ![foo][f] looks like an anchor.
- text = _DoImages(text);
- text = _DoAnchors(text);
-
- // Make links out of things like `<http://example.com/>`
- // Must come after _DoAnchors(), because you can use < and >
- // delimiters in inline links like [this](<url>).
- text = _DoAutoLinks(text);
-
- text = text.replace(/~P/g, "://"); // put in place to prevent autolinking; reset now
-
- text = _EncodeAmpsAndAngles(text);
- text = _DoItalicsAndBold(text);
-
- // Do hard breaks:
- text = text.replace(/ +\n/g, " <br>\n");
-
- return text;
- }
-
- function _EscapeSpecialCharsWithinTagAttributes(text) {
- //
- // Within tags -- meaning between < and > -- encode [\ ` * _] so they
- // don't conflict with their use in Markdown for code, italics and strong.
- //
-
- // Build a regex to find HTML tags and comments. See Friedl's
- // "Mastering Regular Expressions", 2nd Ed., pp. 200-201.
-
- // SE: changed the comment part of the regex
-
- var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>)/gi;
-
- text = text.replace(regex, function (wholeMatch) {
- var tag = wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`");
- tag = escapeCharacters(tag, wholeMatch.charAt(1) == "!" ? "\\`*_/" : "\\`*_"); // also escape slashes in comments to prevent autolinking there -- http://meta.stackoverflow.com/questions/95987
- return tag;
- });
-
- return text;
- }
-
- function _DoAnchors(text) {
- //
- // Turn Markdown link shortcuts into XHTML <a> tags.
- //
- //
- // First, handle reference-style links: [link text] [id]
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- (
- (?:
- \[[^\]]*\] // allow brackets nested one level
- |
- [^\[] // or anything else
- )*
- )
- \]
-
- [ ]? // one optional space
- (?:\n[ ]*)? // one optional newline followed by spaces
-
- \[
- (.*?) // id = $3
- \]
- )
- ()()()() // pad remaining backreferences
- /g, writeAnchorTag);
- */
- text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeAnchorTag);
-
- //
- // Next, inline-style links: [link text](url "optional title")
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- (
- (?:
- \[[^\]]*\] // allow brackets nested one level
- |
- [^\[\]] // or anything else
- )*
- )
- \]
- \( // literal paren
- [ \t]*
- () // no id, so leave $3 empty
- <?( // href = $4
- (?:
- \([^)]*\) // allow one level of (correctly nested) parens (think MSDN)
- |
- [^()]
- )*?
- )>?
- [ \t]*
- ( // $5
- (['"]) // quote char = $6
- (.*?) // Title = $7
- \6 // matching quote
- [ \t]* // ignore any spaces/tabs between closing quote and )
- )? // title is optional
- \)
- )
- /g, writeAnchorTag);
- */
-
- text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?((?:\([^)]*\)|[^()])*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeAnchorTag);
-
- //
- // Last, handle reference-style shortcuts: [link text]
- // These must come last in case you've also got [link test][1]
- // or [link test](/foo)
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- \[
- ([^\[\]]+) // link text = $2; can't contain '[' or ']'
- \]
- )
- ()()()()() // pad rest of backreferences
- /g, writeAnchorTag);
- */
- text = text.replace(/(\[([^\[\]]+)\])()()()()()/g, writeAnchorTag);
-
- return text;
- }
-
- function writeAnchorTag(wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
- if (m7 == undefined) m7 = "";
- var whole_match = m1;
- var link_text = m2.replace(/:\/\//g, "~P"); // to prevent auto-linking withing the link. will be converted back after the auto-linker runs
- var link_id = m3.toLowerCase();
- var url = m4;
- var title = m7;
-
- if (url == "") {
- if (link_id == "") {
- // lower-case and turn embedded newlines into spaces
- link_id = link_text.toLowerCase().replace(/ ?\n/g, " ");
- }
- url = "#" + link_id;
-
- if (g_urls.get(link_id) != undefined) {
- url = g_urls.get(link_id);
- if (g_titles.get(link_id) != undefined) {
- title = g_titles.get(link_id);
- }
- }
- else {
- if (whole_match.search(/\(\s*\)$/m) > -1) {
- // Special case for explicit empty url
- url = "";
- } else {
- return whole_match;
- }
- }
- }
- url = encodeProblemUrlChars(url);
- url = escapeCharacters(url, "*_");
- var result = "<a href=\"" + url + "\"";
-
- if (title != "") {
- title = attributeEncode(title);
- title = escapeCharacters(title, "*_");
- result += " title=\"" + title + "\"";
- }
-
- result += ">" + link_text + "</a>";
-
- return result;
- }
-
- function _DoImages(text) {
- //
- // Turn Markdown image shortcuts into <img> tags.
- //
-
- //
- // First, handle reference-style labeled images: ![alt text][id]
- //
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- !\[
- (.*?) // alt text = $2
- \]
-
- [ ]? // one optional space
- (?:\n[ ]*)? // one optional newline followed by spaces
-
- \[
- (.*?) // id = $3
- \]
- )
- ()()()() // pad rest of backreferences
- /g, writeImageTag);
- */
- text = text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, writeImageTag);
-
- //
- // Next, handle inline images: ![alt text](url "optional title")
- // Don't forget: encode * and _
-
- /*
- text = text.replace(/
- ( // wrap whole match in $1
- !\[
- (.*?) // alt text = $2
- \]
- \s? // One optional whitespace character
- \( // literal paren
- [ \t]*
- () // no id, so leave $3 empty
- <?(\S+?)>? // src url = $4
- [ \t]*
- ( // $5
- (['"]) // quote char = $6
- (.*?) // title = $7
- \6 // matching quote
- [ \t]*
- )? // title is optional
- \)
- )
- /g, writeImageTag);
- */
- text = text.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, writeImageTag);
-
- return text;
- }
-
- function attributeEncode(text) {
- // unconditionally replace angle brackets here -- what ends up in an attribute (e.g. alt or title)
- // never makes sense to have verbatim HTML in it (and the sanitizer would totally break it)
- return text.replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
- }
-
- function writeImageTag(wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
- var whole_match = m1;
- var alt_text = m2;
- var link_id = m3.toLowerCase();
- var url = m4;
- var title = m7;
-
- if (!title) title = "";
-
- if (url == "") {
- if (link_id == "") {
- // lower-case and turn embedded newlines into spaces
- link_id = alt_text.toLowerCase().replace(/ ?\n/g, " ");
- }
- url = "#" + link_id;
-
- if (g_urls.get(link_id) != undefined) {
- url = g_urls.get(link_id);
- if (g_titles.get(link_id) != undefined) {
- title = g_titles.get(link_id);
- }
- }
- else {
- return whole_match;
- }
- }
-
- alt_text = escapeCharacters(attributeEncode(alt_text), "*_[]()");
- url = escapeCharacters(url, "*_");
- var result = "<img src=\"" + url + "\" alt=\"" + alt_text + "\"";
-
- // attacklab: Markdown.pl adds empty title attributes to images.
- // Replicate this bug.
-
- //if (title != "") {
- title = attributeEncode(title);
- title = escapeCharacters(title, "*_");
- result += " title=\"" + title + "\"";
- //}
-
- result += " />";
-
- return result;
- }
-
- function _DoHeaders(text) {
-
- // Setext-style headers:
- // Header 1
- // ========
- //
- // Header 2
- // --------
- //
- text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,
- function (wholeMatch, m1) { return "<h1>" + _RunSpanGamut(m1) + "</h1>\n\n"; }
- );
-
- text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,
- function (matchFound, m1) { return "<h2>" + _RunSpanGamut(m1) + "</h2>\n\n"; }
- );
-
- // atx-style headers:
- // # Header 1
- // ## Header 2
- // ## Header 2 with closing hashes ##
- // ...
- // ###### Header 6
- //
-
- /*
- text = text.replace(/
- ^(\#{1,6}) // $1 = string of #'s
- [ \t]*
- (.+?) // $2 = Header text
- [ \t]*
- \#* // optional closing #'s (not counted)
- \n+
- /gm, function() {...});
- */
-
- text = text.replace(/^(\#{1,6})[ \t]+(.+?)[ \t]*\#*\n+/gm,
- function (wholeMatch, m1, m2) {
- var h_level = m1.length;
- return "<h" + h_level + ">" + _RunSpanGamut(m2) + "</h" + h_level + ">\n\n";
- }
- );
-
- return text;
- }
-
- function _DoLists(text) {
- //
- // Form HTML ordered (numbered) and unordered (bulleted) lists.
- //
-
- // attacklab: add sentinel to hack around khtml/safari bug:
- // http://bugs.webkit.org/show_bug.cgi?id=11231
- text += "~0";
-
- // Re-usable pattern to match any entirel ul or ol list:
-
- /*
- var whole_list = /
- ( // $1 = whole list
- ( // $2
- [ ]{0,3} // attacklab: g_tab_width - 1
- ([*+-]|\d+[.]) // $3 = first list item marker
- [ \t]+
- )
- [^\r]+?
- ( // $4
- ~0 // sentinel for workaround; should be $
- |
- \n{2,}
- (?=\S)
- (?! // Negative lookahead for another list item marker
- [ \t]*
- (?:[*+-]|\d+[.])[ \t]+
- )
- )
- )
- /g
- */
- var whole_list = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
-
- if (g_list_level) {
- text = text.replace(whole_list, function (wholeMatch, m1, m2) {
- var list = m1;
- var list_type = (m2.search(/[*+-]/g) > -1) ? "ul" : "ol";
-
- var result = _ProcessListItems(list, list_type);
-
- // Trim any trailing whitespace, to put the closing `</$list_type>`
- // up on the preceding line, to get it past the current stupid
- // HTML block parser. This is a hack to work around the terrible
- // hack that is the HTML block parser.
- result = result.replace(/\s+$/, "");
- result = "<" + list_type + ">" + result + "</" + list_type + ">\n";
- return result;
- });
- } else {
- whole_list = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;
- text = text.replace(whole_list, function (wholeMatch, m1, m2, m3) {
- var runup = m1;
- var list = m2;
-
- var list_type = (m3.search(/[*+-]/g) > -1) ? "ul" : "ol";
- var result = _ProcessListItems(list, list_type);
- result = runup + "<" + list_type + ">\n" + result + "</" + list_type + ">\n";
- return result;
- });
- }
-
- // attacklab: strip sentinel
- text = text.replace(/~0/, "");
-
- return text;
- }
-
- var _listItemMarkers = { ol: "\\d+[.]", ul: "[*+-]" };
-
- function _ProcessListItems(list_str, list_type) {
- //
- // Process the contents of a single ordered or unordered list, splitting it
- // into individual list items.
- //
- // list_type is either "ul" or "ol".
-
- // The $g_list_level global keeps track of when we're inside a list.
- // Each time we enter a list, we increment it; when we leave a list,
- // we decrement. If it's zero, we're not in a list anymore.
- //
- // We do this because when we're not inside a list, we want to treat
- // something like this:
- //
- // I recommend upgrading to version
- // 8. Oops, now this line is treated
- // as a sub-list.
- //
- // As a single paragraph, despite the fact that the second line starts
- // with a digit-period-space sequence.
- //
- // Whereas when we're inside a list (or sub-list), that line will be
- // treated as the start of a sub-list. What a kludge, huh? This is
- // an aspect of Markdown's syntax that's hard to parse perfectly
- // without resorting to mind-reading. Perhaps the solution is to
- // change the syntax rules such that sub-lists must start with a
- // starting cardinal number; e.g. "1." or "a.".
-
- g_list_level++;
-
- // trim trailing blank lines:
- list_str = list_str.replace(/\n{2,}$/, "\n");
-
- // attacklab: add sentinel to emulate \z
- list_str += "~0";
-
- // In the original attacklab showdown, list_type was not given to this function, and anything
- // that matched /[*+-]|\d+[.]/ would just create the next <li>, causing this mismatch:
- //
- // Markdown rendered by WMD rendered by MarkdownSharp
- // ------------------------------------------------------------------
- // 1. first 1. first 1. first
- // 2. second 2. second 2. second
- // - third 3. third * third
- //
- // We changed this to behave identical to MarkdownSharp. This is the constructed RegEx,
- // with {MARKER} being one of \d+[.] or [*+-], depending on list_type:
-
- /*
- list_str = list_str.replace(/
- (^[ \t]*) // leading whitespace = $1
- ({MARKER}) [ \t]+ // list marker = $2
- ([^\r]+? // list item text = $3
- (\n+)
- )
- (?=
- (~0 | \2 ({MARKER}) [ \t]+)
- )
- /gm, function(){...});
- */
-
- var marker = _listItemMarkers[list_type];
- var re = new RegExp("(^[ \\t]*)(" + marker + ")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1(" + marker + ")[ \\t]+))", "gm");
- var last_item_had_a_double_newline = false;
- list_str = list_str.replace(re,
- function (wholeMatch, m1, m2, m3) {
- var item = m3;
- var leading_space = m1;
- var ends_with_double_newline = /\n\n$/.test(item);
- var contains_double_newline = ends_with_double_newline || item.search(/\n{2,}/) > -1;
-
- if (contains_double_newline || last_item_had_a_double_newline) {
- item = _RunBlockGamut(_Outdent(item), /* doNotUnhash = */true);
- }
- else {
- // Recursion for sub-lists:
- item = _DoLists(_Outdent(item));
- item = item.replace(/\n$/, ""); // chomp(item)
- item = _RunSpanGamut(item);
- }
- last_item_had_a_double_newline = ends_with_double_newline;
- return "<li>" + item + "</li>\n";
- }
- );
-
- // attacklab: strip sentinel
- list_str = list_str.replace(/~0/g, "");
-
- g_list_level--;
- return list_str;
- }
-
- function _DoCodeBlocks(text) {
- //
- // Process Markdown `<pre><code>` blocks.
- //
-
- /*
- text = text.replace(/
- (?:\n\n|^)
- ( // $1 = the code block -- one or more lines, starting with a space/tab
- (?:
- (?:[ ]{4}|\t) // Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width
- .*\n+
- )+
- )
- (\n*[ ]{0,3}[^ \t\n]|(?=~0)) // attacklab: g_tab_width
- /g ,function(){...});
- */
-
- // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
- text += "~0";
-
- text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
- function (wholeMatch, m1, m2) {
- var codeblock = m1;
- var nextChar = m2;
-
- codeblock = _EncodeCode(_Outdent(codeblock));
- codeblock = _Detab(codeblock);
- codeblock = codeblock.replace(/^\n+/g, ""); // trim leading newlines
- codeblock = codeblock.replace(/\n+$/g, ""); // trim trailing whitespace
-
- codeblock = "<pre><code>" + codeblock + "\n</code></pre>";
-
- return "\n\n" + codeblock + "\n\n" + nextChar;
- }
- );
-
- // attacklab: strip sentinel
- text = text.replace(/~0/, "");
-
- return text;
- }
-
- function hashBlock(text) {
- text = text.replace(/(^\n+|\n+$)/g, "");
- return "\n\n~K" + (g_html_blocks.push(text) - 1) + "K\n\n";
- }
-
- function _DoCodeSpans(text) {
- //
- // * Backtick quotes are used for <code></code> spans.
- //
- // * You can use multiple backticks as the delimiters if you want to
- // include literal backticks in the code span. So, this input:
- //
- // Just type ``foo `bar` baz`` at the prompt.
- //
- // Will translate to:
- //
- // <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
- //
- // There's no arbitrary limit to the number of backticks you
- // can use as delimters. If you need three consecutive backticks
- // in your code, use four for delimiters, etc.
- //
- // * You can use spaces to get literal backticks at the edges:
- //
- // ... type `` `bar` `` ...
- //
- // Turns to:
- //
- // ... type <code>`bar`</code> ...
- //
-
- /*
- text = text.replace(/
- (^|[^\\]) // Character before opening ` can't be a backslash
- (`+) // $2 = Opening run of `
- ( // $3 = The code block
- [^\r]*?
- [^`] // attacklab: work around lack of lookbehind
- )
- \2 // Matching closer
- (?!`)
- /gm, function(){...});
- */
-
- text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
- function (wholeMatch, m1, m2, m3, m4) {
- var c = m3;
- c = c.replace(/^([ \t]*)/g, ""); // leading whitespace
- c = c.replace(/[ \t]*$/g, ""); // trailing whitespace
- c = _EncodeCode(c);
- c = c.replace(/:\/\//g, "~P"); // to prevent auto-linking. Not necessary in code *blocks*, but in code spans. Will be converted back after the auto-linker runs.
- return m1 + "<code>" + c + "</code>";
- }
- );
-
- return text;
- }
-
- function _EncodeCode(text) {
- //
- // Encode/escape certain characters inside Markdown code runs.
- // The point is that in code, these characters are literals,
- // and lose their special Markdown meanings.
- //
- // Encode all ampersands; HTML entities are not
- // entities within a Markdown code span.
- text = text.replace(/&/g, "&amp;");
-
- // Do the angle bracket song and dance:
- text = text.replace(/</g, "&lt;");
- text = text.replace(/>/g, "&gt;");
-
- // Now, escape characters that are magic in Markdown:
- text = escapeCharacters(text, "\*_{}[]\\", false);
-
- // jj the line above breaks this:
- //---
-
- //* Item
-
- // 1. Subitem
-
- // special char: *
- //---
-
- return text;
- }
-
- function _DoItalicsAndBold(text) {
-
- // <strong> must go first:
- text = text.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g,
- "$1<strong>$3</strong>$4");
-
- text = text.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g,
- "$1<em>$3</em>$4");
-
- return text;
- }
-
- function _DoBlockQuotes(text) {
-
- /*
- text = text.replace(/
- ( // Wrap whole match in $1
- (
- ^[ \t]*>[ \t]? // '>' at the start of a line
- .+\n // rest of the first line
- (.+\n)* // subsequent consecutive lines
- \n* // blanks
- )+
- )
- /gm, function(){...});
- */
-
- text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,
- function (wholeMatch, m1) {
- var bq = m1;
-
- // attacklab: hack around Konqueror 3.5.4 bug:
- // "----------bug".replace(/^-/g,"") == "bug"
-
- bq = bq.replace(/^[ \t]*>[ \t]?/gm, "~0"); // trim one level of quoting
-
- // attacklab: clean up hack
- bq = bq.replace(/~0/g, "");
-
- bq = bq.replace(/^[ \t]+$/gm, ""); // trim whitespace-only lines
- bq = _RunBlockGamut(bq); // recurse
-
- bq = bq.replace(/(^|\n)/g, "$1 ");
- // These leading spaces screw with <pre> content, so we need to fix that:
- bq = bq.replace(
- /(\s*<pre>[^\r]+?<\/pre>)/gm,
- function (wholeMatch, m1) {
- var pre = m1;
- // attacklab: hack around Konqueror 3.5.4 bug:
- pre = pre.replace(/^ /mg, "~0");
- pre = pre.replace(/~0/g, "");
- return pre;
- });
-
- return hashBlock("<blockquote>\n" + bq + "\n</blockquote>");
- }
- );
- return text;
- }
-
- function _FormParagraphs(text, doNotUnhash) {
- //
- // Params:
- // $text - string to process with html <p> tags
- //
-
- // Strip leading and trailing lines:
- text = text.replace(/^\n+/g, "");
- text = text.replace(/\n+$/g, "");
-
- var grafs = text.split(/\n{2,}/g);
- var grafsOut = [];
-
- var markerRe = /~K(\d+)K/;
-
- //
- // Wrap <p> tags.
- //
- var end = grafs.length;
- for (var i = 0; i < end; i++) {
- var str = grafs[i];
-
- // if this is an HTML marker, copy it
- if (markerRe.test(str)) {
- grafsOut.push(str);
- }
- else if (/\S/.test(str)) {
- str = _RunSpanGamut(str);
- str = str.replace(/^([ \t]*)/g, "<p>");
- str += "</p>"
- grafsOut.push(str);
- }
-
- }
- //
- // Unhashify HTML blocks
- //
- if (!doNotUnhash) {
- end = grafsOut.length;
- for (var i = 0; i < end; i++) {
- var foundAny = true;
- while (foundAny) { // we may need several runs, since the data may be nested
- foundAny = false;
- grafsOut[i] = grafsOut[i].replace(/~K(\d+)K/g, function (wholeMatch, id) {
- foundAny = true;
- return g_html_blocks[id];
- });
- }
- }
- }
- return grafsOut.join("\n\n");
- }
-
- function _EncodeAmpsAndAngles(text) {
- // Smart processing for ampersands and angle brackets that need to be encoded.
-
- // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
- // http://bumppo.net/projects/amputator/
- text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&amp;");
-
- // Encode naked <'s
- text = text.replace(/<(?![a-z\/?\$!])/gi, "&lt;");
-
- return text;
- }
-
- function _EncodeBackslashEscapes(text) {
- //
- // Parameter: String.
- // Returns: The string, with after processing the following backslash
- // escape sequences.
- //
-
- // attacklab: The polite way to do this is with the new
- // escapeCharacters() function:
- //
- // text = escapeCharacters(text,"\\",true);
- // text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
- //
- // ...but we're sidestepping its use of the (slow) RegExp constructor
- // as an optimization for Firefox. This function gets called a LOT.
-
- text = text.replace(/\\(\\)/g, escapeCharacters_callback);
- text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g, escapeCharacters_callback);
- return text;
- }
-
- function _DoAutoLinks(text) {
-
- // note that at this point, all other URL in the text are already hyperlinked as <a href=""></a>
- // *except* for the <http://www.foo.com> case
-
- // automatically add < and > around unadorned raw hyperlinks
- // must be preceded by space/BOF and followed by non-word/EOF character
- text = text.replace(/(^|\s)(https?|ftp)(:\/\/[-A-Z0-9+&@#\/%?=~_|\[\]\(\)!:,\.;]*[-A-Z0-9+&@#\/%=~_|\[\]])($|\W)/gi, "$1<$2$3>$4");
-
- // autolink anything like <http://example.com>
-
- var replacer = function (wholematch, m1) { return "<a href=\"" + m1 + "\">" + pluginHooks.plainLinkText(m1) + "</a>"; }
- text = text.replace(/<((https?|ftp):[^'">\s]+)>/gi, replacer);
-
- // Email addresses: <address@domain.foo>
- /*
- text = text.replace(/
- <
- (?:mailto:)?
- (
- [-.\w]+
- \@
- [-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+
- )
- >
- /gi, _DoAutoLinks_callback());
- */
-
- /* disabling email autolinking, since we don't do that on the server, either
- text = text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
- function(wholeMatch,m1) {
- return _EncodeEmailAddress( _UnescapeSpecialChars(m1) );
- }
- );
- */
- return text;
- }
-
- function _UnescapeSpecialChars(text) {
- //
- // Swap back in all the special characters we've hidden.
- //
- text = text.replace(/~E(\d+)E/g,
- function (wholeMatch, m1) {
- var charCodeToReplace = parseInt(m1);
- return String.fromCharCode(charCodeToReplace);
- }
- );
- return text;
- }
-
- function _Outdent(text) {
- //
- // Remove one level of line-leading tabs or spaces
- //
-
- // attacklab: hack around Konqueror 3.5.4 bug:
- // "----------bug".replace(/^-/g,"") == "bug"
-
- text = text.replace(/^(\t|[ ]{1,4})/gm, "~0"); // attacklab: g_tab_width
-
- // attacklab: clean up hack
- text = text.replace(/~0/g, "")
-
- return text;
- }
-
- function _Detab(text) {
- if (!/\t/.test(text))
- return text;
-
- var spaces = [" ", " ", " ", " "],
- skew = 0,
- v;
-
- return text.replace(/[\n\t]/g, function (match, offset) {
- if (match === "\n") {
- skew = offset + 1;
- return match;
- }
- v = (offset - skew) % 4;
- skew = offset + 1;
- return spaces[v];
- });
- }
-
- //
- // attacklab: Utility functions
- //
-
- var _problemUrlChars = /(?:["'*()[\]:]|~D)/g;
-
- // hex-encodes some unusual "problem" chars in URLs to avoid URL detection problems
- function encodeProblemUrlChars(url) {
- if (!url)
- return "";
-
- var len = url.length;
-
- return url.replace(_problemUrlChars, function (match, offset) {
- if (match == "~D") // escape for dollar
- return "%24";
- if (match == ":") {
- if (offset == len - 1 || /[0-9\/]/.test(url.charAt(offset + 1)))
- return ":"
- }
- return "%" + match.charCodeAt(0).toString(16);
- });
- }
-
-
- function escapeCharacters(text, charsToEscape, afterBackslash) {
- // First we have to escape the escape characters so that
- // we can build a character class out of them
- var regexString = "([" + charsToEscape.replace(/([\[\]\\])/g, "\\$1") + "])";
-
- if (afterBackslash) {
- regexString = "\\\\" + regexString;
- }
-
- var regex = new RegExp(regexString, "g");
- text = text.replace(regex, escapeCharacters_callback);
-
- return text;
- }
-
-
- function escapeCharacters_callback(wholeMatch, m1) {
- var charCodeToEscape = m1.charCodeAt(0);
- return "~E" + charCodeToEscape + "E";
- }
-
- }; // end of the Markdown.Converter constructor
-
-})();
diff --git a/public/javascripts/vendor/markdown/Markdown.Sanitizer.js b/public/javascripts/vendor/markdown/Markdown.Sanitizer.js
deleted file mode 100644
index cc5826fa8..000000000
--- a/public/javascripts/vendor/markdown/Markdown.Sanitizer.js
+++ /dev/null
@@ -1,108 +0,0 @@
-(function () {
- var output, Converter;
- if (typeof exports === "object" && typeof require === "function") { // we're in a CommonJS (e.g. Node.js) module
- output = exports;
- Converter = require("./Markdown.Converter").Converter;
- } else {
- output = window.Markdown;
- Converter = output.Converter;
- }
-
- output.getSanitizingConverter = function () {
- var converter = new Converter();
- converter.hooks.chain("postConversion", sanitizeHtml);
- converter.hooks.chain("postConversion", balanceTags);
- return converter;
- }
-
- function sanitizeHtml(html) {
- return html.replace(/<[^>]*>?/gi, sanitizeTag);
- }
-
- // (tags that can be opened/closed) | (tags that stand alone)
- var basic_tag_whitelist = /^(<\/?(b|blockquote|code|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|pre|s|sup|sub|strong|strike|ul)>|<(br|hr)\s?\/?>)$/i;
- // <a href="url..." optional title>|</a>
- var a_white = /^(<a\shref="((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\stitle="[^"<>]+")?\s?>|<\/a>)$/i;
-
- // <img src="url..." optional width optional height optional alt optional title
- var img_white = /^(<img\ssrc="(https?:\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\swidth="\d{1,3}")?(\sheight="\d{1,3}")?(\salt="[^"<>]*")?(\stitle="[^"<>]*")?\s?\/?>)$/i;
-
- function sanitizeTag(tag) {
- if (tag.match(basic_tag_whitelist) || tag.match(a_white) || tag.match(img_white))
- return tag;
- else
- return "";
- }
-
- /// <summary>
- /// attempt to balance HTML tags in the html string
- /// by removing any unmatched opening or closing tags
- /// IMPORTANT: we *assume* HTML has *already* been
- /// sanitized and is safe/sane before balancing!
- ///
- /// adapted from CODESNIPPET: A8591DBA-D1D3-11DE-947C-BA5556D89593
- /// </summary>
- function balanceTags(html) {
-
- if (html == "")
- return "";
-
- var re = /<\/?\w+[^>]*(\s|$|>)/g;
- // convert everything to lower case; this makes
- // our case insensitive comparisons easier
- var tags = html.toLowerCase().match(re);
-
- // no HTML tags present? nothing to do; exit now
- var tagcount = (tags || []).length;
- if (tagcount == 0)
- return html;
-
- var tagname, tag;
- var ignoredtags = "<p><img><br><li><hr>";
- var match;
- var tagpaired = [];
- var tagremove = [];
- var needsRemoval = false;
-
- // loop through matched tags in forward order
- for (var ctag = 0; ctag < tagcount; ctag++) {
- tagname = tags[ctag].replace(/<\/?(\w+).*/, "$1");
- // skip any already paired tags
- // and skip tags in our ignore list; assume they're self-closed
- if (tagpaired[ctag] || ignoredtags.search("<" + tagname + ">") > -1)
- continue;
-
- tag = tags[ctag];
- match = -1;
-
- if (!/^<\//.test(tag)) {
- // this is an opening tag
- // search forwards (next tags), look for closing tags
- for (var ntag = ctag + 1; ntag < tagcount; ntag++) {
- if (!tagpaired[ntag] && tags[ntag] == "</" + tagname + ">") {
- match = ntag;
- break;
- }
- }
- }
-
- if (match == -1)
- needsRemoval = tagremove[ctag] = true; // mark for removal
- else
- tagpaired[match] = true; // mark paired
- }
-
- if (!needsRemoval)
- return html;
-
- // delete all orphaned tags from the string
-
- var ctag = 0;
- html = html.replace(re, function (match) {
- var res = tagremove[ctag] ? "" : match;
- ctag++;
- return res;
- });
- return html;
- }
-})();
diff --git a/public/javascripts/vendor/mbp-helper.js b/public/javascripts/vendor/mbp-helper.js
deleted file mode 100644
index 026baea4f..000000000
--- a/public/javascripts/vendor/mbp-helper.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * MBP - Mobile boilerplate helper functions
- */
-(function(document){
-
-window.MBP = window.MBP || {};
-
-// Fix for iPhone viewport scale bug
-// http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
-
-MBP.viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]');
-MBP.ua = navigator.userAgent;
-
-MBP.scaleFix = function () {
- if (MBP.viewportmeta && /iPhone|iPad/.test(MBP.ua) && !/Opera Mini/.test(MBP.ua)) {
- MBP.viewportmeta.content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
- document.addEventListener("gesturestart", MBP.gestureStart, false);
- }
-};
-MBP.gestureStart = function () {
- MBP.viewportmeta.content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
-};
-
-
-// Hide URL Bar for iOS and Android by Scott Jehl
-// https://gist.github.com/1183357
-
-MBP.hideUrlBar = function () {
- var win = window,
- doc = win.document;
-
- // If there's a hash, or addEventListener is undefined, stop here
- if( !location.hash || !win.addEventListener ){
-
- //scroll to 1
- window.scrollTo( 0, 1 );
- var scrollTop = 1,
-
- //reset to 0 on bodyready, if needed
- bodycheck = setInterval(function(){
- if( doc.body ){
- clearInterval( bodycheck );
- scrollTop = "scrollTop" in doc.body ? doc.body.scrollTop : 1;
- win.scrollTo( 0, scrollTop === 1 ? 0 : 1 );
- }
- }, 15 );
-
- win.addEventListener( "load", function(){
- setTimeout(function(){
- //reset to hide addr bar at onload
- win.scrollTo( 0, scrollTop === 1 ? 0 : 1 );
- }, 0);
- }, false );
- }
-};
-
-
-// Fast Buttons - read wiki below before using
-// https://github.com/shichuan/mobile-html5-boilerplate/wiki/JavaScript-Helper
-
-MBP.fastButton = function (element, handler) {
- this.element = element;
- this.handler = handler;
- if (element.addEventListener) {
- element.addEventListener('touchstart', this, false);
- element.addEventListener('click', this, false);
- }
-};
-
-MBP.fastButton.prototype.handleEvent = function(event) {
- switch (event.type) {
- case 'touchstart': this.onTouchStart(event); break;
- case 'touchmove': this.onTouchMove(event); break;
- case 'touchend': this.onClick(event); break;
- case 'click': this.onClick(event); break;
- }
-};
-
-MBP.fastButton.prototype.onTouchStart = function(event) {
- event.stopPropagation();
- this.element.addEventListener('touchend', this, false);
- document.body.addEventListener('touchmove', this, false);
- this.startX = event.touches[0].clientX;
- this.startY = event.touches[0].clientY;
- this.element.style.backgroundColor = "rgba(0,0,0,.7)";
-};
-
-MBP.fastButton.prototype.onTouchMove = function(event) {
- if(Math.abs(event.touches[0].clientX - this.startX) > 10 ||
- Math.abs(event.touches[0].clientY - this.startY) > 10 ) {
- this.reset();
- }
-};
-
-MBP.fastButton.prototype.onClick = function(event) {
- event.stopPropagation();
- this.reset();
- this.handler(event);
- if(event.type == 'touchend') {
- MBP.preventGhostClick(this.startX, this.startY);
- }
- this.element.style.backgroundColor = "";
-};
-
-MBP.fastButton.prototype.reset = function() {
- this.element.removeEventListener('touchend', this, false);
- document.body.removeEventListener('touchmove', this, false);
- this.element.style.backgroundColor = "";
-};
-
-MBP.preventGhostClick = function (x, y) {
- MBP.coords.push(x, y);
- window.setTimeout(function (){
- MBP.coords.splice(0, 2);
- }, 2500);
-};
-
-MBP.ghostClickHandler = function (event) {
- for(var i = 0, len = MBP.coords.length; i < len; i += 2) {
- var x = MBP.coords[i];
- var y = MBP.coords[i + 1];
- if(Math.abs(event.clientX - x) < 25 && Math.abs(event.clientY - y) < 25) {
- event.stopPropagation();
- event.preventDefault();
- }
- }
-};
-
-if (document.addEventListener) {
- document.addEventListener('click', MBP.ghostClickHandler, true);
-}
-
-MBP.coords = [];
-
-
-// iOS Startup Image
-// https://github.com/shichuan/mobile-html5-boilerplate/issues#issue/2
-
-MBP.splash = function () {
- var filename = navigator.platform === 'iPad' ? 'h/' : 'l/';
- document.write('<link rel="apple-touch-startup-image" href="/img/' + filename + 'splash.png" />' );
-};
-
-
-// Autogrow
-// http://googlecode.blogspot.com/2009/07/gmail-for-mobile-html5-series.html
-
-MBP.autogrow = function (element, lh) {
-
- function handler(e){
- var newHeight = this.scrollHeight,
- currentHeight = this.clientHeight;
- if (newHeight > currentHeight) {
- this.style.height = newHeight + 3 * textLineHeight + "px";
- }
- }
-
- var setLineHeight = (lh) ? lh : 12,
- textLineHeight = element.currentStyle ? element.currentStyle.lineHeight :
- getComputedStyle(element, null).lineHeight;
-
- textLineHeight = (textLineHeight.indexOf("px") == -1) ? setLineHeight :
- parseInt(textLineHeight, 10);
-
- element.style.overflow = "hidden";
- element.addEventListener ? element.addEventListener('keyup', handler, false) :
- element.attachEvent('onkeyup', handler);
-};
-
-})(document);
-
diff --git a/public/javascripts/vendor/timeago.js b/public/javascripts/vendor/timeago.js
deleted file mode 100644
index 51443051b..000000000
--- a/public/javascripts/vendor/timeago.js
+++ /dev/null
@@ -1,143 +0,0 @@
-
-/*
- * timeago: a jQuery plugin, version: 0.9.2 (2010-09-14)
- * @requires jQuery v1.2.3 or later
- *
- * Timeago is a jQuery plugin that makes it easy to support automatically
- * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
- *
- * For usage and examples, visit:
- * http://timeago.yarp.com/
- *
- * Licensed under the MIT:
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org)
- */
-(function($) {
- $.timeago = function(timestamp) {
- if (timestamp instanceof Date) return inWords(timestamp);
- else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp));
- else return inWords($.timeago.datetime(timestamp));
- };
- var $t = $.timeago;
-
- $.extend($.timeago, {
- settings: {
- refreshMillis: 60000,
- allowFuture: false,
- strings: {
- prefixAgo: null,
- prefixFromNow: null,
- suffixAgo: "ago",
- suffixFromNow: "from now",
- seconds: "less than a minute",
- minute: "about a minute",
- minutes: "%d minutes",
- hour: "about an hour",
- hours: "about %d hours",
- day: "a day",
- days: "%d days",
- month: "about a month",
- months: "%d months",
- year: "about a year",
- years: "%d years",
- numbers: []
- }
- },
- inWords: function(distanceMillis) {
- var $l = this.settings.strings;
- var prefix = $l.prefixAgo;
- var suffix = $l.suffixAgo;
- if (this.settings.allowFuture) {
- if (distanceMillis < 0) {
- prefix = $l.prefixFromNow;
- suffix = $l.suffixFromNow;
- }
- distanceMillis = Math.abs(distanceMillis);
- }
-
- var seconds = distanceMillis / 1000;
- var minutes = seconds / 60;
- var hours = minutes / 60;
- var days = hours / 24;
- var years = days / 365;
-
- function substitute(stringOrFunction, number) {
- var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
- var value = ($l.numbers && $l.numbers[number]) || number;
- return string.replace(/%d/i, value);
- }
-
- var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
- seconds < 90 && substitute($l.minute, 1) ||
- minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
- minutes < 90 && substitute($l.hour, 1) ||
- hours < 24 && substitute($l.hours, Math.round(hours)) ||
- hours < 48 && substitute($l.day, 1) ||
- days < 30 && substitute($l.days, Math.floor(days)) ||
- days < 60 && substitute($l.month, 1) ||
- days < 365 && substitute($l.months, Math.floor(days / 30)) ||
- years < 2 && substitute($l.year, 1) ||
- substitute($l.years, Math.floor(years));
-
- return $.trim([prefix, words, suffix].join(" "));
- },
- parse: function(iso8601) {
- var s = $.trim(iso8601);
- s = s.replace(/\.\d\d\d+/,""); // remove milliseconds
- s = s.replace(/-/,"/").replace(/-/,"/");
- s = s.replace(/T/," ").replace(/Z/," UTC");
- s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
- return new Date(s);
- },
- datetime: function(elem) {
- // jQuery's `is()` doesn't play well with HTML5 in IE
- var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time");
- var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title");
- return $t.parse(iso8601);
- }
- });
-
- $.fn.timeago = function() {
- var self = this;
- self.each(refresh);
-
- var $s = $t.settings;
- if ($s.refreshMillis > 0) {
- setInterval(function() { self.each(refresh); }, $s.refreshMillis);
- }
- return self;
- };
-
- function refresh() {
- var data = prepareData(this);
- if (!isNaN(data.datetime)) {
- $(this).text(inWords(data.datetime));
- }
- return this;
- }
-
- function prepareData(element) {
- element = $(element);
- if (!element.data("timeago")) {
- element.data("timeago", { datetime: $t.datetime(element) });
- var text = $.trim(element.text());
- if (text.length > 0) element.attr("title", text);
- }
- return element.data("timeago");
- }
-
- function inWords(date) {
- return $t.inWords(distance(date));
- }
-
- function distance(date) {
- return (new Date().getTime() - date.getTime());
- }
-
- // fix for IE6 suckage
- document.createElement("abbr");
- document.createElement("time");
-})(jQuery);
-
diff --git a/public/javascripts/vendor/underscore.js b/public/javascripts/vendor/underscore.js
deleted file mode 100644
index 208d4cd89..000000000
--- a/public/javascripts/vendor/underscore.js
+++ /dev/null
@@ -1,999 +0,0 @@
-// Underscore.js 1.3.1
-// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
-// Underscore is freely distributable under the MIT license.
-// Portions of Underscore are inspired or borrowed from Prototype,
-// Oliver Steele's Functional, and John Resig's Micro-Templating.
-// For all details and documentation:
-// http://documentcloud.github.com/underscore
-
-(function() {
-
- // Baseline setup
- // --------------
-
- // Establish the root object, `window` in the browser, or `global` on the server.
- var root = this;
-
- // Save the previous value of the `_` variable.
- var previousUnderscore = root._;
-
- // Establish the object that gets returned to break out of a loop iteration.
- var breaker = {};
-
- // Save bytes in the minified (but not gzipped) version:
- var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
-
- // Create quick reference variables for speed access to core prototypes.
- var slice = ArrayProto.slice,
- unshift = ArrayProto.unshift,
- toString = ObjProto.toString,
- hasOwnProperty = ObjProto.hasOwnProperty;
-
- // All **ECMAScript 5** native function implementations that we hope to use
- // are declared here.
- var
- nativeForEach = ArrayProto.forEach,
- nativeMap = ArrayProto.map,
- nativeReduce = ArrayProto.reduce,
- nativeReduceRight = ArrayProto.reduceRight,
- nativeFilter = ArrayProto.filter,
- nativeEvery = ArrayProto.every,
- nativeSome = ArrayProto.some,
- nativeIndexOf = ArrayProto.indexOf,
- nativeLastIndexOf = ArrayProto.lastIndexOf,
- nativeIsArray = Array.isArray,
- nativeKeys = Object.keys,
- nativeBind = FuncProto.bind;
-
- // Create a safe reference to the Underscore object for use below.
- var _ = function(obj) { return new wrapper(obj); };
-
- // Export the Underscore object for **Node.js**, with
- // backwards-compatibility for the old `require()` API. If we're in
- // the browser, add `_` as a global object via a string identifier,
- // for Closure Compiler "advanced" mode.
- if (typeof exports !== 'undefined') {
- if (typeof module !== 'undefined' && module.exports) {
- exports = module.exports = _;
- }
- exports._ = _;
- } else {
- root['_'] = _;
- }
-
- // Current version.
- _.VERSION = '1.3.1';
-
- // Collection Functions
- // --------------------
-
- // The cornerstone, an `each` implementation, aka `forEach`.
- // Handles objects with the built-in `forEach`, arrays, and raw objects.
- // Delegates to **ECMAScript 5**'s native `forEach` if available.
- var each = _.each = _.forEach = function(obj, iterator, context) {
- if (obj == null) return;
- if (nativeForEach && obj.forEach === nativeForEach) {
- obj.forEach(iterator, context);
- } else if (obj.length === +obj.length) {
- for (var i = 0, l = obj.length; i < l; i++) {
- if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
- }
- } else {
- for (var key in obj) {
- if (_.has(obj, key)) {
- if (iterator.call(context, obj[key], key, obj) === breaker) return;
- }
- }
- }
- };
-
- // Return the results of applying the iterator to each element.
- // Delegates to **ECMAScript 5**'s native `map` if available.
- _.map = _.collect = function(obj, iterator, context) {
- var results = [];
- if (obj == null) return results;
- if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
- each(obj, function(value, index, list) {
- results[results.length] = iterator.call(context, value, index, list);
- });
- if (obj.length === +obj.length) results.length = obj.length;
- return results;
- };
-
- // **Reduce** builds up a single result from a list of values, aka `inject`,
- // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
- _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
- var initial = arguments.length > 2;
- if (obj == null) obj = [];
- if (nativeReduce && obj.reduce === nativeReduce) {
- if (context) iterator = _.bind(iterator, context);
- return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
- }
- each(obj, function(value, index, list) {
- if (!initial) {
- memo = value;
- initial = true;
- } else {
- memo = iterator.call(context, memo, value, index, list);
- }
- });
- if (!initial) throw new TypeError('Reduce of empty array with no initial value');
- return memo;
- };
-
- // The right-associative version of reduce, also known as `foldr`.
- // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
- _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
- var initial = arguments.length > 2;
- if (obj == null) obj = [];
- if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
- if (context) iterator = _.bind(iterator, context);
- return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
- }
- var reversed = _.toArray(obj).reverse();
- if (context && !initial) iterator = _.bind(iterator, context);
- return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
- };
-
- // Return the first value which passes a truth test. Aliased as `detect`.
- _.find = _.detect = function(obj, iterator, context) {
- var result;
- any(obj, function(value, index, list) {
- if (iterator.call(context, value, index, list)) {
- result = value;
- return true;
- }
- });
- return result;
- };
-
- // Return all the elements that pass a truth test.
- // Delegates to **ECMAScript 5**'s native `filter` if available.
- // Aliased as `select`.
- _.filter = _.select = function(obj, iterator, context) {
- var results = [];
- if (obj == null) return results;
- if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
- each(obj, function(value, index, list) {
- if (iterator.call(context, value, index, list)) results[results.length] = value;
- });
- return results;
- };
-
- // Return all the elements for which a truth test fails.
- _.reject = function(obj, iterator, context) {
- var results = [];
- if (obj == null) return results;
- each(obj, function(value, index, list) {
- if (!iterator.call(context, value, index, list)) results[results.length] = value;
- });
- return results;
- };
-
- // Determine whether all of the elements match a truth test.
- // Delegates to **ECMAScript 5**'s native `every` if available.
- // Aliased as `all`.
- _.every = _.all = function(obj, iterator, context) {
- var result = true;
- if (obj == null) return result;
- if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
- each(obj, function(value, index, list) {
- if (!(result = result && iterator.call(context, value, index, list))) return breaker;
- });
- return result;
- };
-
- // Determine if at least one element in the object matches a truth test.
- // Delegates to **ECMAScript 5**'s native `some` if available.
- // Aliased as `any`.
- var any = _.some = _.any = function(obj, iterator, context) {
- iterator || (iterator = _.identity);
- var result = false;
- if (obj == null) return result;
- if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
- each(obj, function(value, index, list) {
- if (result || (result = iterator.call(context, value, index, list))) return breaker;
- });
- return !!result;
- };
-
- // Determine if a given value is included in the array or object using `===`.
- // Aliased as `contains`.
- _.include = _.contains = function(obj, target) {
- var found = false;
- if (obj == null) return found;
- if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
- found = any(obj, function(value) {
- return value === target;
- });
- return found;
- };
-
- // Invoke a method (with arguments) on every item in a collection.
- _.invoke = function(obj, method) {
- var args = slice.call(arguments, 2);
- return _.map(obj, function(value) {
- return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
- });
- };
-
- // Convenience version of a common use case of `map`: fetching a property.
- _.pluck = function(obj, key) {
- return _.map(obj, function(value){ return value[key]; });
- };
-
- // Return the maximum element or (element-based computation).
- _.max = function(obj, iterator, context) {
- if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);
- if (!iterator && _.isEmpty(obj)) return -Infinity;
- var result = {computed : -Infinity};
- each(obj, function(value, index, list) {
- var computed = iterator ? iterator.call(context, value, index, list) : value;
- computed >= result.computed && (result = {value : value, computed : computed});
- });
- return result.value;
- };
-
- // Return the minimum element (or element-based computation).
- _.min = function(obj, iterator, context) {
- if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);
- if (!iterator && _.isEmpty(obj)) return Infinity;
- var result = {computed : Infinity};
- each(obj, function(value, index, list) {
- var computed = iterator ? iterator.call(context, value, index, list) : value;
- computed < result.computed && (result = {value : value, computed : computed});
- });
- return result.value;
- };
-
- // Shuffle an array.
- _.shuffle = function(obj) {
- var shuffled = [], rand;
- each(obj, function(value, index, list) {
- if (index == 0) {
- shuffled[0] = value;
- } else {
- rand = Math.floor(Math.random() * (index + 1));
- shuffled[index] = shuffled[rand];
- shuffled[rand] = value;
- }
- });
- return shuffled;
- };
-
- // Sort the object's values by a criterion produced by an iterator.
- _.sortBy = function(obj, iterator, context) {
- return _.pluck(_.map(obj, function(value, index, list) {
- return {
- value : value,
- criteria : iterator.call(context, value, index, list)
- };
- }).sort(function(left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }), 'value');
- };
-
- // Groups the object's values by a criterion. Pass either a string attribute
- // to group by, or a function that returns the criterion.
- _.groupBy = function(obj, val) {
- var result = {};
- var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
- each(obj, function(value, index) {
- var key = iterator(value, index);
- (result[key] || (result[key] = [])).push(value);
- });
- return result;
- };
-
- // Use a comparator function to figure out at what index an object should
- // be inserted so as to maintain order. Uses binary search.
- _.sortedIndex = function(array, obj, iterator) {
- iterator || (iterator = _.identity);
- var low = 0, high = array.length;
- while (low < high) {
- var mid = (low + high) >> 1;
- iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
- }
- return low;
- };
-
- // Safely convert anything iterable into a real, live array.
- _.toArray = function(iterable) {
- if (!iterable) return [];
- if (iterable.toArray) return iterable.toArray();
- if (_.isArray(iterable)) return slice.call(iterable);
- if (_.isArguments(iterable)) return slice.call(iterable);
- return _.values(iterable);
- };
-
- // Return the number of elements in an object.
- _.size = function(obj) {
- return _.toArray(obj).length;
- };
-
- // Array Functions
- // ---------------
-
- // Get the first element of an array. Passing **n** will return the first N
- // values in the array. Aliased as `head`. The **guard** check allows it to work
- // with `_.map`.
- _.first = _.head = function(array, n, guard) {
- return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
- };
-
- // Returns everything but the last entry of the array. Especcialy useful on
- // the arguments object. Passing **n** will return all the values in
- // the array, excluding the last N. The **guard** check allows it to work with
- // `_.map`.
- _.initial = function(array, n, guard) {
- return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
- };
-
- // Get the last element of an array. Passing **n** will return the last N
- // values in the array. The **guard** check allows it to work with `_.map`.
- _.last = function(array, n, guard) {
- if ((n != null) && !guard) {
- return slice.call(array, Math.max(array.length - n, 0));
- } else {
- return array[array.length - 1];
- }
- };
-
- // Returns everything but the first entry of the array. Aliased as `tail`.
- // Especially useful on the arguments object. Passing an **index** will return
- // the rest of the values in the array from that index onward. The **guard**
- // check allows it to work with `_.map`.
- _.rest = _.tail = function(array, index, guard) {
- return slice.call(array, (index == null) || guard ? 1 : index);
- };
-
- // Trim out all falsy values from an array.
- _.compact = function(array) {
- return _.filter(array, function(value){ return !!value; });
- };
-
- // Return a completely flattened version of an array.
- _.flatten = function(array, shallow) {
- return _.reduce(array, function(memo, value) {
- if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
- memo[memo.length] = value;
- return memo;
- }, []);
- };
-
- // Return a version of the array that does not contain the specified value(s).
- _.without = function(array) {
- return _.difference(array, slice.call(arguments, 1));
- };
-
- // Produce a duplicate-free version of the array. If the array has already
- // been sorted, you have the option of using a faster algorithm.
- // Aliased as `unique`.
- _.uniq = _.unique = function(array, isSorted, iterator) {
- var initial = iterator ? _.map(array, iterator) : array;
- var result = [];
- _.reduce(initial, function(memo, el, i) {
- if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) {
- memo[memo.length] = el;
- result[result.length] = array[i];
- }
- return memo;
- }, []);
- return result;
- };
-
- // Produce an array that contains the union: each distinct element from all of
- // the passed-in arrays.
- _.union = function() {
- return _.uniq(_.flatten(arguments, true));
- };
-
- // Produce an array that contains every item shared between all the
- // passed-in arrays. (Aliased as "intersect" for back-compat.)
- _.intersection = _.intersect = function(array) {
- var rest = slice.call(arguments, 1);
- return _.filter(_.uniq(array), function(item) {
- return _.every(rest, function(other) {
- return _.indexOf(other, item) >= 0;
- });
- });
- };
-
- // Take the difference between one array and a number of other arrays.
- // Only the elements present in just the first array will remain.
- _.difference = function(array) {
- var rest = _.flatten(slice.call(arguments, 1));
- return _.filter(array, function(value){ return !_.include(rest, value); });
- };
-
- // Zip together multiple lists into a single array -- elements that share
- // an index go together.
- _.zip = function() {
- var args = slice.call(arguments);
- var length = _.max(_.pluck(args, 'length'));
- var results = new Array(length);
- for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
- return results;
- };
-
- // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
- // we need this function. Return the position of the first occurrence of an
- // item in an array, or -1 if the item is not included in the array.
- // Delegates to **ECMAScript 5**'s native `indexOf` if available.
- // If the array is large and already in sort order, pass `true`
- // for **isSorted** to use binary search.
- _.indexOf = function(array, item, isSorted) {
- if (array == null) return -1;
- var i, l;
- if (isSorted) {
- i = _.sortedIndex(array, item);
- return array[i] === item ? i : -1;
- }
- if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
- for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
- return -1;
- };
-
- // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
- _.lastIndexOf = function(array, item) {
- if (array == null) return -1;
- if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
- var i = array.length;
- while (i--) if (i in array && array[i] === item) return i;
- return -1;
- };
-
- // Generate an integer Array containing an arithmetic progression. A port of
- // the native Python `range()` function. See
- // [the Python documentation](http://docs.python.org/library/functions.html#range).
- _.range = function(start, stop, step) {
- if (arguments.length <= 1) {
- stop = start || 0;
- start = 0;
- }
- step = arguments[2] || 1;
-
- var len = Math.max(Math.ceil((stop - start) / step), 0);
- var idx = 0;
- var range = new Array(len);
-
- while(idx < len) {
- range[idx++] = start;
- start += step;
- }
-
- return range;
- };
-
- // Function (ahem) Functions
- // ------------------
-
- // Reusable constructor function for prototype setting.
- var ctor = function(){};
-
- // Create a function bound to a given object (assigning `this`, and arguments,
- // optionally). Binding with arguments is also known as `curry`.
- // Delegates to **ECMAScript 5**'s native `Function.bind` if available.
- // We check for `func.bind` first, to fail fast when `func` is undefined.
- _.bind = function bind(func, context) {
- var bound, args;
- if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
- if (!_.isFunction(func)) throw new TypeError;
- args = slice.call(arguments, 2);
- return bound = function() {
- if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
- ctor.prototype = func.prototype;
- var self = new ctor;
- var result = func.apply(self, args.concat(slice.call(arguments)));
- if (Object(result) === result) return result;
- return self;
- };
- };
-
- // Bind all of an object's methods to that object. Useful for ensuring that
- // all callbacks defined on an object belong to it.
- _.bindAll = function(obj) {
- var funcs = slice.call(arguments, 1);
- if (funcs.length == 0) funcs = _.functions(obj);
- each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
- return obj;
- };
-
- // Memoize an expensive function by storing its results.
- _.memoize = function(func, hasher) {
- var memo = {};
- hasher || (hasher = _.identity);
- return function() {
- var key = hasher.apply(this, arguments);
- return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
- };
- };
-
- // Delays a function for the given number of milliseconds, and then calls
- // it with the arguments supplied.
- _.delay = function(func, wait) {
- var args = slice.call(arguments, 2);
- return setTimeout(function(){ return func.apply(func, args); }, wait);
- };
-
- // Defers a function, scheduling it to run after the current call stack has
- // cleared.
- _.defer = function(func) {
- return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
- };
-
- // Returns a function, that, when invoked, will only be triggered at most once
- // during a given window of time.
- _.throttle = function(func, wait) {
- var context, args, timeout, throttling, more;
- var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
- return function() {
- context = this; args = arguments;
- var later = function() {
- timeout = null;
- if (more) func.apply(context, args);
- whenDone();
- };
- if (!timeout) timeout = setTimeout(later, wait);
- if (throttling) {
- more = true;
- } else {
- func.apply(context, args);
- }
- whenDone();
- throttling = true;
- };
- };
-
- // Returns a function, that, as long as it continues to be invoked, will not
- // be triggered. The function will be called after it stops being called for
- // N milliseconds.
- _.debounce = function(func, wait) {
- var timeout;
- return function() {
- var context = this, args = arguments;
- var later = function() {
- timeout = null;
- func.apply(context, args);
- };
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- };
- };
-
- // Returns a function that will be executed at most one time, no matter how
- // often you call it. Useful for lazy initialization.
- _.once = function(func) {
- var ran = false, memo;
- return function() {
- if (ran) return memo;
- ran = true;
- return memo = func.apply(this, arguments);
- };
- };
-
- // Returns the first function passed as an argument to the second,
- // allowing you to adjust arguments, run code before and after, and
- // conditionally execute the original function.
- _.wrap = function(func, wrapper) {
- return function() {
- var args = [func].concat(slice.call(arguments, 0));
- return wrapper.apply(this, args);
- };
- };
-
- // Returns a function that is the composition of a list of functions, each
- // consuming the return value of the function that follows.
- _.compose = function() {
- var funcs = arguments;
- return function() {
- var args = arguments;
- for (var i = funcs.length - 1; i >= 0; i--) {
- args = [funcs[i].apply(this, args)];
- }
- return args[0];
- };
- };
-
- // Returns a function that will only be executed after being called N times.
- _.after = function(times, func) {
- if (times <= 0) return func();
- return function() {
- if (--times < 1) { return func.apply(this, arguments); }
- };
- };
-
- // Object Functions
- // ----------------
-
- // Retrieve the names of an object's properties.
- // Delegates to **ECMAScript 5**'s native `Object.keys`
- _.keys = nativeKeys || function(obj) {
- if (obj !== Object(obj)) throw new TypeError('Invalid object');
- var keys = [];
- for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
- return keys;
- };
-
- // Retrieve the values of an object's properties.
- _.values = function(obj) {
- return _.map(obj, _.identity);
- };
-
- // Return a sorted list of the function names available on the object.
- // Aliased as `methods`
- _.functions = _.methods = function(obj) {
- var names = [];
- for (var key in obj) {
- if (_.isFunction(obj[key])) names.push(key);
- }
- return names.sort();
- };
-
- // Extend a given object with all the properties in passed-in object(s).
- _.extend = function(obj) {
- each(slice.call(arguments, 1), function(source) {
- for (var prop in source) {
- obj[prop] = source[prop];
- }
- });
- return obj;
- };
-
- // Fill in a given object with default properties.
- _.defaults = function(obj) {
- each(slice.call(arguments, 1), function(source) {
- for (var prop in source) {
- if (obj[prop] == null) obj[prop] = source[prop];
- }
- });
- return obj;
- };
-
- // Create a (shallow-cloned) duplicate of an object.
- _.clone = function(obj) {
- if (!_.isObject(obj)) return obj;
- return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
- };
-
- // Invokes interceptor with the obj, and then returns obj.
- // The primary purpose of this method is to "tap into" a method chain, in
- // order to perform operations on intermediate results within the chain.
- _.tap = function(obj, interceptor) {
- interceptor(obj);
- return obj;
- };
-
- // Internal recursive comparison function.
- function eq(a, b, stack) {
- // Identical objects are equal. `0 === -0`, but they aren't identical.
- // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
- if (a === b) return a !== 0 || 1 / a == 1 / b;
- // A strict comparison is necessary because `null == undefined`.
- if (a == null || b == null) return a === b;
- // Unwrap any wrapped objects.
- if (a._chain) a = a._wrapped;
- if (b._chain) b = b._wrapped;
- // Invoke a custom `isEqual` method if one is provided.
- if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);
- if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);
- // Compare `[[Class]]` names.
- var className = toString.call(a);
- if (className != toString.call(b)) return false;
- switch (className) {
- // Strings, numbers, dates, and booleans are compared by value.
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return a == String(b);
- case '[object Number]':
- // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
- // other numeric values.
- return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a == +b;
- // RegExps are compared by their source patterns and flags.
- case '[object RegExp]':
- return a.source == b.source &&
- a.global == b.global &&
- a.multiline == b.multiline &&
- a.ignoreCase == b.ignoreCase;
- }
- if (typeof a != 'object' || typeof b != 'object') return false;
- // Assume equality for cyclic structures. The algorithm for detecting cyclic
- // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
- var length = stack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- if (stack[length] == a) return true;
- }
- // Add the first object to the stack of traversed objects.
- stack.push(a);
- var size = 0, result = true;
- // Recursively compare objects and arrays.
- if (className == '[object Array]') {
- // Compare array lengths to determine if a deep comparison is necessary.
- size = a.length;
- result = size == b.length;
- if (result) {
- // Deep compare the contents, ignoring non-numeric properties.
- while (size--) {
- // Ensure commutative equality for sparse arrays.
- if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;
- }
- }
- } else {
- // Objects with different constructors are not equivalent.
- if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
- // Deep compare objects.
- for (var key in a) {
- if (_.has(a, key)) {
- // Count the expected number of properties.
- size++;
- // Deep compare each member.
- if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
- }
- }
- // Ensure that both objects contain the same number of properties.
- if (result) {
- for (key in b) {
- if (_.has(b, key) && !(size--)) break;
- }
- result = !size;
- }
- }
- // Remove the first object from the stack of traversed objects.
- stack.pop();
- return result;
- }
-
- // Perform a deep comparison to check if two objects are equal.
- _.isEqual = function(a, b) {
- return eq(a, b, []);
- };
-
- // Is a given array, string, or object empty?
- // An "empty" object has no enumerable own-properties.
- _.isEmpty = function(obj) {
- if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
- for (var key in obj) if (_.has(obj, key)) return false;
- return true;
- };
-
- // Is a given value a DOM element?
- _.isElement = function(obj) {
- return !!(obj && obj.nodeType == 1);
- };
-
- // Is a given value an array?
- // Delegates to ECMA5's native Array.isArray
- _.isArray = nativeIsArray || function(obj) {
- return toString.call(obj) == '[object Array]';
- };
-
- // Is a given variable an object?
- _.isObject = function(obj) {
- return obj === Object(obj);
- };
-
- // Is a given variable an arguments object?
- _.isArguments = function(obj) {
- return toString.call(obj) == '[object Arguments]';
- };
- if (!_.isArguments(arguments)) {
- _.isArguments = function(obj) {
- return !!(obj && _.has(obj, 'callee'));
- };
- }
-
- // Is a given value a function?
- _.isFunction = function(obj) {
- return toString.call(obj) == '[object Function]';
- };
-
- // Is a given value a string?
- _.isString = function(obj) {
- return toString.call(obj) == '[object String]';
- };
-
- // Is a given value a number?
- _.isNumber = function(obj) {
- return toString.call(obj) == '[object Number]';
- };
-
- // Is the given value `NaN`?
- _.isNaN = function(obj) {
- // `NaN` is the only value for which `===` is not reflexive.
- return obj !== obj;
- };
-
- // Is a given value a boolean?
- _.isBoolean = function(obj) {
- return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
- };
-
- // Is a given value a date?
- _.isDate = function(obj) {
- return toString.call(obj) == '[object Date]';
- };
-
- // Is the given value a regular expression?
- _.isRegExp = function(obj) {
- return toString.call(obj) == '[object RegExp]';
- };
-
- // Is a given value equal to null?
- _.isNull = function(obj) {
- return obj === null;
- };
-
- // Is a given variable undefined?
- _.isUndefined = function(obj) {
- return obj === void 0;
- };
-
- // Has own property?
- _.has = function(obj, key) {
- return hasOwnProperty.call(obj, key);
- };
-
- // Utility Functions
- // -----------------
-
- // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
- // previous owner. Returns a reference to the Underscore object.
- _.noConflict = function() {
- root._ = previousUnderscore;
- return this;
- };
-
- // Keep the identity function around for default iterators.
- _.identity = function(value) {
- return value;
- };
-
- // Run a function **n** times.
- _.times = function (n, iterator, context) {
- for (var i = 0; i < n; i++) iterator.call(context, i);
- };
-
- // Escape a string for HTML interpolation.
- _.escape = function(string) {
- return (''+string).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\//g,'&#x2F;');
- };
-
- // Add your own custom functions to the Underscore object, ensuring that
- // they're correctly added to the OOP wrapper as well.
- _.mixin = function(obj) {
- each(_.functions(obj), function(name){
- addToWrapper(name, _[name] = obj[name]);
- });
- };
-
- // Generate a unique integer id (unique within the entire client session).
- // Useful for temporary DOM ids.
- var idCounter = 0;
- _.uniqueId = function(prefix) {
- var id = idCounter++;
- return prefix ? prefix + id : id;
- };
-
- // By default, Underscore uses ERB-style template delimiters, change the
- // following template settings to use alternative delimiters.
- _.templateSettings = {
- evaluate : /<%([\s\S]+?)%>/g,
- interpolate : /<%=([\s\S]+?)%>/g,
- escape : /<%-([\s\S]+?)%>/g
- };
-
- // When customizing `templateSettings`, if you don't want to define an
- // interpolation, evaluation or escaping regex, we need one that is
- // guaranteed not to match.
- var noMatch = /.^/;
-
- // Within an interpolation, evaluation, or escaping, remove HTML escaping
- // that had been previously added.
- var unescape = function(code) {
- return code.replace(/\\\\/g, '\\').replace(/\\'/g, "'");
- };
-
- // JavaScript micro-templating, similar to John Resig's implementation.
- // Underscore templating handles arbitrary delimiters, preserves whitespace,
- // and correctly escapes quotes within interpolated code.
- _.template = function(str, data) {
- var c = _.templateSettings;
- var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
- 'with(obj||{}){__p.push(\'' +
- str.replace(/\\/g, '\\\\')
- .replace(/'/g, "\\'")
- .replace(c.escape || noMatch, function(match, code) {
- return "',_.escape(" + unescape(code) + "),'";
- })
- .replace(c.interpolate || noMatch, function(match, code) {
- return "'," + unescape(code) + ",'";
- })
- .replace(c.evaluate || noMatch, function(match, code) {
- return "');" + unescape(code).replace(/[\r\n\t]/g, ' ') + ";__p.push('";
- })
- .replace(/\r/g, '\\r')
- .replace(/\n/g, '\\n')
- .replace(/\t/g, '\\t')
- + "');}return __p.join('');";
- var func = new Function('obj', '_', tmpl);
- if (data) return func(data, _);
- return function(data) {
- return func.call(this, data, _);
- };
- };
-
- // Add a "chain" function, which will delegate to the wrapper.
- _.chain = function(obj) {
- return _(obj).chain();
- };
-
- // The OOP Wrapper
- // ---------------
-
- // If Underscore is called as a function, it returns a wrapped object that
- // can be used OO-style. This wrapper holds altered versions of all the
- // underscore functions. Wrapped objects may be chained.
- var wrapper = function(obj) { this._wrapped = obj; };
-
- // Expose `wrapper.prototype` as `_.prototype`
- _.prototype = wrapper.prototype;
-
- // Helper function to continue chaining intermediate results.
- var result = function(obj, chain) {
- return chain ? _(obj).chain() : obj;
- };
-
- // A method to easily add functions to the OOP wrapper.
- var addToWrapper = function(name, func) {
- wrapper.prototype[name] = function() {
- var args = slice.call(arguments);
- unshift.call(args, this._wrapped);
- return result(func.apply(_, args), this._chain);
- };
- };
-
- // Add all of the Underscore functions to the wrapper object.
- _.mixin(_);
-
- // Add all mutator Array functions to the wrapper.
- each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
- var method = ArrayProto[name];
- wrapper.prototype[name] = function() {
- var wrapped = this._wrapped;
- method.apply(wrapped, arguments);
- var length = wrapped.length;
- if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
- return result(wrapped, this._chain);
- };
- });
-
- // Add all accessor Array functions to the wrapper.
- each(['concat', 'join', 'slice'], function(name) {
- var method = ArrayProto[name];
- wrapper.prototype[name] = function() {
- return result(method.apply(this._wrapped, arguments), this._chain);
- };
- });
-
- // Start chaining a wrapped Underscore object.
- wrapper.prototype.chain = function() {
- this._chain = true;
- return this;
- };
-
- // Extracts the result from a wrapped and chained object.
- wrapper.prototype.value = function() {
- return this._wrapped;
- };
-
-}).call(this);
diff --git a/public/javascripts/view.js b/public/javascripts/view.js
deleted file mode 100644
index 9728b1083..000000000
--- a/public/javascripts/view.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
-* licensed under the Affero General Public License version 3 or later. See
-* the COPYRIGHT file.
-*/
-var View = {
- initialize: function() {
- /* Buttons */
- $("input:submit").addClass("button");
-
- /* label placeholders */
- $("input, textarea").placeholder();
-
- /* "Toggling" the search input */
- $(this.search.selector)
- .blur(this.search.blur)
- .focus(this.search.focus)
-
- /* Submit the form when the user hits enter */
- .keypress(this.search.keyPress);
-
- /* Dropdowns */
- $(this.dropdowns.selector)
- .live('click', this.dropdowns.click);
-
- /* Avatars */
- $(this.avatars.selector).error(this.avatars.fallback);
-
- /* Clear forms after successful submit, this is some legacy dan hanson stuff, do we still want it? */
- $.fn.clearForm = function() {
- return this.each(function() {
- if ($(this).is('form')) {
- return $(':input', this).clearForm();
- }
- if ($(this).hasClass('clear_on_submit') || $(this).is(':text') || $(this).is(':password') || $(this).is('textarea')) {
- $(this).val('');
- } else if ($(this).is(':checkbox') || $(this).is(':radio')) {
- $(this).attr('checked', false);
- } else if ($(this).is('select')) {
- this.selectedIndex = -1;
- } else if ($(this).attr('name') == 'photos[]') {
- $(this).val('');
- }
- $(this).blur();
- });
- };
-
- $('form[data-remote]').live('ajax:success', function (e) {
- $(this).clearForm();
- $(this).focusout();
- });
-
- /* tag following */
- $("#new_tag_following .tag_input").bind('focus', function(evt){
- $(this).siblings("#tag_following_submit").removeClass('hidden');
- });
-
- /* photo exporting in the works */
- $("#photo-export-button").bind("click", function(evt){
- evt.preventDefault();
- alert($(this).attr('title'));
- });
-
- $(document.body).click(this.dropdowns.removeFocus);
-
- /* facebox */
- $.facebox.settings.closeImage = '/images/facebox/closelabel.png';
- $.facebox.settings.loadingImage = '/images/facebox/loading.gif';
- $.facebox.settings.opacity = 0.75;
-
- $('a[rel*=facebox]').facebox();
- $(document).bind('reveal.facebox', function() {
- Diaspora.page.directionDetector.updateBinds();
- });
-
- $("a.new_aspect").click(function(e){
- $("input#aspect_name").focus()
- });
-
- /* facebox 'done' buttons */
- $("*[rel*=close]").live('click', function(){ $.facebox.close(); });
-
- /* notification routing */
- $("#notification").delegate('.hard_object_link', 'click', function(evt){
- var post = $("#"+ $(this).attr('data-ref')),
- lastComment = post.find('.comment.posted').last();
-
- if(post.length > 0){
- evt.preventDefault();
- $('html, body').animate({scrollTop: parseInt(lastComment.offset().top)-80 }, 'fast');
- }
- });
- },
-
- search: {
- blur: function() {
- $(this).removeClass("active");
- },
- focus: function() {
- $(this).addClass("active");
- },
- selector: "#q"
- },
-
- dropdowns: {
- click: function(evt) {
- $(this).parent('.dropdown').toggleClass("active");
- evt.preventDefault();
- },
- removeFocus: function(evt) {
- var $target = $(evt.target);
- if(!$target.is('.dropdown_list *') && !$target.is('.dropdown.active > .toggle')) {
- $(View.dropdowns.selector).parent().removeClass("active");
- }
- },
- selector: ".dropdown > .toggle",
- parentSelector: ".dropdown > .wrapper"
- },
-
- avatars: {
- fallback: function(evt) {
- $(this).attr("src", "/assets/user/default.png");
- },
- selector: "img.avatar"
- }
-};
-
-$(function() {
- View.initialize();
-});
diff --git a/public/javascripts/widgets/aspect-navigation.js b/public/javascripts/widgets/aspect-navigation.js
deleted file mode 100644
index e04170c5d..000000000
--- a/public/javascripts/widgets/aspect-navigation.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (c) 2010, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-(function() {
- Diaspora.Widgets.AspectNavigation = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, aspectNavigation) {
- $.extend(self, {
- aspectNavigation: aspectNavigation,
- aspectSelectors: aspectNavigation.find("a.aspect_selector[data-guid]"),
- aspectLis: aspectNavigation.find("li[data-aspect_id]"),
- toggleSelector: aspectNavigation.find("a.toggle_selector")
- });
-
- self.aspectSelectors.click(self.toggleAspect);
- self.toggleSelector.click(self.toggleAll);
- });
-
- this.selectedAspects = function() {
- return self.aspectNavigation.find("li.active[data-aspect_id]").map(function() { return $(this).data('aspect_id') });
- };
-
- this.toggleAspect = function(evt) {
- evt.preventDefault();
-
- $(this).parent().toggleClass("active");
- self.perform();
- };
-
- this.toggleAll = function(evt) {
- evt.preventDefault();
-
- if (self.allSelected()) {
- self.aspectLis.removeClass("active");
- } else {
- self.aspectLis.addClass("active");
- }
- self.perform();
- };
-
- this.perform = function() {
- if (self.noneSelected()) {
- return;
- } else {
- window.location = self.generateURL(); // hella hax
- }
- };
-
- this.calculateToggleText = function() {
- if (self.allSelected()) {
- self.toggleSelector.text(Diaspora.I18n.t('aspect_navigation.deselect_all'));
- } else {
- self.toggleSelector.text(Diaspora.I18n.t('aspect_navigation.select_all'));
- }
- };
-
- this.generateURL = function() {
- var baseURL = 'aspects';
-
- // generate new url
- baseURL = baseURL.replace('#','');
- baseURL += '?';
-
- self.aspectLis.each(function() {
- var aspectLi = $(this);
- if (aspectLi.hasClass("active")) {
- baseURL += "a_ids[]=" + aspectLi.data("aspect_id") + "&";
- }
- });
-
- if(!$("#publisher").hasClass("closed")) {
- // open publisher
- baseURL += "op=true";
- } else {
- // slice last '&'
- baseURL = baseURL.slice(0,baseURL.length-1);
- }
- return baseURL;
- };
-
- this.noneSelected = function() {
- return self.aspectLis.filter(".active").length === 0;
- }
-
- this.allSelected = function() {
- return self.aspectLis.not(".active").length === 0;
- }
- };
-})();
diff --git a/public/javascripts/widgets/back-to-top.js b/public/javascripts/widgets/back-to-top.js
deleted file mode 100644
index a76c09439..000000000
--- a/public/javascripts/widgets/back-to-top.js
+++ /dev/null
@@ -1,33 +0,0 @@
-(function() {
- var BackToTop = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, button) {
- $.extend(self, {
- button: button,
- body: $("html, body"),
- window: $(window)
- });
-
- self.button.click(self.backToTop);
-
- var throttledScroll = _.throttle($.proxy(self.throttledScroll, self), 250);
- self.window.scroll(throttledScroll);
- });
-
- this.backToTop = function(evt) {
- evt.preventDefault();
- self.body.animate({scrollTop: 0});
- };
-
- this.toggleVisibility = function() {
- self.button[
- (self.body.scrollTop() > 1000) ?
- 'addClass' :
- 'removeClass'
- ]('visible')
- };
- };
-
- Diaspora.Widgets.BackToTop = BackToTop;
-})();
diff --git a/public/javascripts/widgets/direction-detector.js b/public/javascripts/widgets/direction-detector.js
deleted file mode 100644
index 8c886e6f3..000000000
--- a/public/javascripts/widgets/direction-detector.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-/* Modified version of https://gitorious.org/statusnet/mainline/blobs/master/plugins/DirectionDetector/jquery.DirectionDetector.js */
-(function() {
- var DirectionDetector = function() {
- var self = this;
- this.binds = [];
- this.cleaner = new RegExp("@[^ ]+|^RT[: ]{1}| RT | RT: |[♺♻:]+", "g");
-
- this.subscribe("widget/ready", function() {
- self.updateBinds();
-
- self.globalSubscribe("stream/scrolled", function() {
- self.updateBinds();
- });
- });
-
- this.isRTL = function(str) {
- if(typeof str !== "string" || str.length < 1) {
- return false;
- }
-
- var charCode = str.charCodeAt(0);
- if(charCode >= 1536 && charCode <= 1791) // Sarabic, Persian, ...
- return true;
-
- else if(charCode >= 65136 && charCode <= 65279) // Arabic present 1
- return true;
-
- else if(charCode >= 64336 && charCode <= 65023) // Arabic present 2
- return true;
-
- else if(charCode>=1424 && charCode<=1535) // Hebrew
- return true;
-
- else if(charCode>=64256 && charCode<=64335) // Hebrew present
- return true;
-
- else if(charCode>=1792 && charCode<=1871) // Syriac
- return true;
-
- else if(charCode>=1920 && charCode<=1983) // Thaana
- return true;
-
- else if(charCode>=1984 && charCode<=2047) // NKo
- return true;
-
- else if(charCode>=11568 && charCode<=11647) // Tifinagh
- return true;
-
- return false;
- };
-
- this.updateBinds = function() {
- $.each(self.binds, function(index, bind) {
- bind.unbind("keyup", self.updateDirection);
- });
-
- self.binds = [];
-
- $("textarea, input[type='text'], input[type='search']").each(self.bind);
- };
-
- this.bind = function() {
- self.binds.push(
- $(this).bind("keyup", self.updateDirection)
- );
- };
-
- this.updateDirection = function() {
- var textArea = $(this),
- cleaned = textArea.val().replace(self.cleaner, "").replace(/^[ ]+/, "");
-
- if(self.isRTL(cleaned)) {
- textArea.css("direction", "rtl");
- }
- else {
- textArea.css("direction", "ltr");
- }
- };
- };
-
- Diaspora.Widgets.DirectionDetector = DirectionDetector;
-})();
diff --git a/public/javascripts/widgets/flash-messages.js b/public/javascripts/widgets/flash-messages.js
deleted file mode 100644
index 3abf71150..000000000
--- a/public/javascripts/widgets/flash-messages.js
+++ /dev/null
@@ -1,35 +0,0 @@
-(function() {
- var FlashMessages = function() {
- var self = this;
-
- this.subscribe("widget/ready", function() {
- self.animateMessages();
- });
-
- this.animateMessages = function() {
- var flashMessages = $("#flash_notice, #flash_error, #flash_alert");
- flashMessages.animate({
- top: 0
- }, 400).delay(4000).animate({
- top: -100
- }, 400, function(){
- $(this).remove();
- });
- };
-
- this.render = function(result) {
- $("<div/>", {
- id: result.success ? "flash_notice" : "flash_error"
- })
- .html($("<div/>", {
- 'class': "message"
- })
- .html(result.notice))
- .prependTo(document.body);
-
- self.animateMessages();
- };
- };
-
- Diaspora.Widgets.FlashMessages = FlashMessages;
-})();
diff --git a/public/javascripts/widgets/header.js b/public/javascripts/widgets/header.js
deleted file mode 100644
index a1fa4ec88..000000000
--- a/public/javascripts/widgets/header.js
+++ /dev/null
@@ -1,21 +0,0 @@
-(function() {
- var Header = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, header) {
- self.notifications = self.instantiate("Notifications",
- header.find("#notification_badge .badge_count"),
- header.find("#notification_dropdown")
- );
-
- self.notificationsDropdown = self.instantiate("NotificationsDropdown",
- header.find("#notification_badge"),
- header.find("#notification_dropdown")
- );
-
- self.search = self.instantiate("Search", header.find(".search_form"));
- });
- };
-
- Diaspora.Widgets.Header = Header;
-})();
diff --git a/public/javascripts/widgets/hovercard.js b/public/javascripts/widgets/hovercard.js
deleted file mode 100644
index 080b46656..000000000
--- a/public/javascripts/widgets/hovercard.js
+++ /dev/null
@@ -1,138 +0,0 @@
-(function() {
- var HoverCard = function() {
- var self = this;
-
- self.jXHRs = [];
-
- self.subscribe("widget/ready", function(evt, hoverCard) {
- self.personCache = new self.Cache();
- self.dropdownCache = new self.Cache();
-
- self.hoverCard = {
- tip: $("#hovercard_container"),
- dropdownContainer: $("#hovercard_dropdown_container"),
- offset: {
- left: -10,
- top: 13
- },
- personLink: hoverCard.find("a.person"),
- personHandle: hoverCard.find("p.handle"),
- avatar: hoverCard.find(".avatar"),
- dropdown: hoverCard.find(".dropdown_list"),
- hashtags: hoverCard.find(".hashtags")
- };
-
- $(document.body).delegate("a.hovercardable:not(.self)", "hover", self.handleHoverEvent);
- self.hoverCard.tip.hover(self.hoverCardHover, self.clearTimeout);
-
- self.subscribe("aspectDropdown/updated aspectDropdown/blurred", function(evt, personId, dropdownHtml) {
- self.dropdownCache.cache["/people/" + personId + "/aspect_membership_button"] = $(dropdownHtml).removeClass("active").get(0).outerHTML;
- });
- });
-
- this.handleHoverEvent = function(evt) {
- self.target = $(evt.target);
-
- if(evt.type === "mouseenter") {
- self.startHover();
- }
- else {
- self.clearTimeout(evt);
- }
- };
-
- this.startHover = function(evt) {
- if(!self.hoverCardTimeout) {
- self.clearTimeout(false);
- }
- self.timeout = setTimeout(self.showHoverCard, 600);
- };
-
- this.showHoverCard = function() {
- self.hoverCard.tip.hide();
- self.hoverCard.tip.prependTo(self.target.parent());
-
- self.personCache.get(self.target.attr("data-hovercard") + ".json?includes=tags", function(person) {
- self.populateHovercard(person);
- });
- };
-
- this.populateHovercard = function(person) {
- var position = self.target.position();
- self.hoverCard.tip.css({
- left: position.left + self.hoverCard.offset.left,
- top: position.top + self.hoverCard.offset.top
- });
-
- self.hoverCard.avatar.attr("src", person.avatar);
- self.hoverCard.personLink.attr("href", person.url);
- self.hoverCard.personLink.text(person.name);
- self.hoverCard.personHandle.text(person.handle);
- self.hoverCard.dropdown.attr("data-person-id", person.id);
-
- self.hoverCard.hashtags.html("");
- $.each(person.tags, function(index, hashtag) {
- self.hoverCard.hashtags.append(
- $("<a/>", {
- href: "/tags/" + hashtag.substring(1)
- }).text(hashtag)
- );
- });
-
- self.dropdownCache.get(self.target.attr("data-hovercard") + "/aspect_membership_button", function(dropdown) {
- self.hoverCard.dropdownContainer.html(dropdown);
- self.hoverCard.tip.fadeIn(140);
- });
- };
-
- this.clearTimeout = function(delayed) {
- self.personCache.clearjXHRs();
- self.dropdownCache.clearjXHRs();
-
- function callback() {
- self.timeout = clearTimeout(self.timeout);
- self.hoverCard.tip.hide();
- self.hoverCard.dropdownContainer.html("");
- }
-
- if((typeof delayed === "boolean" && delayed) || (typeof delayed === "object" && delayed.type === "mouseleave")) {
- self.hoverCardTimeout = setTimeout(callback, 20);
- }
- else {
- callback();
- }
- };
-
- this.hoverCardHover = function() {
- self.hoverCardTimeout = clearTimeout(self.hoverCardTimeout);
- };
-
- this.Cache = function() {
- var self = this;
- this.cache = {};
- this.jXHRs = [];
-
- this.get = function(key, callback) {
- if(typeof self.cache[key] === "undefined") {
- self.jXHRs.push($.get(key, function(response) {
- self.cache[key] = response;
- callback(response);
- self.jXHRs.shift();
- }));
- }
- else {
- callback(self.cache[key]);
- }
- };
-
- this.clearjXHRs = function() {
- $.each(self.jXHRs, function(index, jXHR) {
- jXHR.abort();
- });
- self.jXHRs = [];
- };
- };
- };
-
- Diaspora.Widgets.HoverCard = HoverCard;
-})();
diff --git a/public/javascripts/widgets/infinite-scroll.js b/public/javascripts/widgets/infinite-scroll.js
deleted file mode 100644
index 6c3511642..000000000
--- a/public/javascripts/widgets/infinite-scroll.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
-* licensed under the Affero General Public License version 3 or later. See
-* the COPYRIGHT file.
-*/
-
-(function() {
- var InfiniteScroll = function() {
- var self = this;
- this.options = {
- bufferPx: 500,
- debug: false,
- donetext: Diaspora.I18n.t("infinite_scroll.no_more"),
- loadingText: "",
- loadingImg: "/images/ajax-loader.gif",
- navSelector: "#pagination",
- nextSelector: ".paginate",
- itemSelector: ".stream_element",
- pathParse: function(pathStr) {
- var newPath = pathStr.replace("?", "?only_posts=true&"),
- lastTime = $('#main_stream .stream_element').last().find(".time").attr("integer");
-
- if(lastTime === undefined){
- lastTime = $('#main_stream').data('time_for_scroll');
- }
-
- return newPath.replace(/max_time=\d+/, "max_time=" + lastTime);
- }
- };
-
- this.subscribe("widget/ready", function() {
- if($('#main_stream').length !== 0) {
- $('#main_stream').infinitescroll(self.options, function(newElements) {
- self.globalPublish("stream/scrolled", newElements);
- });
- } else if($('#people_stream').length !== 0) {
- $("#people_stream").infinitescroll($.extend(self.options, {
- navSelector : ".pagination",
- nextSelector : ".next_page",
- pathParse : function(pathStr, nextPage) {
- return pathStr.replace("page=2", "page=" + nextPage);
- }
- }), function(newElements) {
- self.globalPublish("stream/scrolled", newElements);
- });
- }
- });
-
- this.reInitialize = function() {
- $("#main_stream").infinitescroll("destroy");
- self.publish("widget/ready");
- };
-
- this.globalSubscribe("stream/reloaded", self.reInitialize, this);
- };
-
- Diaspora.Widgets.InfiniteScroll = InfiniteScroll;
-})();
-
diff --git a/public/javascripts/widgets/lightbox.js b/public/javascripts/widgets/lightbox.js
deleted file mode 100644
index 30c969845..000000000
--- a/public/javascripts/widgets/lightbox.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-
-
-jQuery.fn.center = (function() {
- var $window = $(window);
- return function () {
- this.css({
- position: "absolute",
- top: ($window.height() - this.height()) / 2 + $window.scrollTop() + "px",
- left:($window.width() - this.width()) / 2 + $window.scrollLeft() + "px"
- });
- return this;
- };
-})();
-
-(function() {
- var Lightbox = function() {
- var self = this;
-
- self.options = {
- imageParent: '.stream_element',
- imageSelector: 'img.stream-photo'
- };
-
- this.subscribe("widget/ready", function(evt) {
- $.extend(self, {
- lightbox: $("#lightbox"),
- imageset: $("#lightbox-imageset"),
- backdrop: $("#lightbox-backdrop"),
- closelink: $("#lightbox-close-link"),
- image: $("#lightbox-image"),
- body: $(document.body),
- window: $(window)
- });
-
- //self.post.delegate("a.stream-photo-link", "click", self.lightboxImageClicked);
- self.imageset.delegate("img", "click", self.imagesetImageClicked);
-
- self.window.resize(function() {
- self.lightbox.css("max-height", (self.window.height() - 100) + "px");
- }).trigger("resize");
-
- self.closelink.click(function(evt){
- evt.preventDefault();
- self.resetLightbox();
- });
- self.backdrop.click(self.resetLightbox);
- self.lightbox.click(self.resetLightbox);
-
- self.backdrop.click(function(evt) {
- evt.preventDefault();
- self.resetLightbox();
- });
-
- self.body.keydown(function(evt) {
- var imageThumb = self.imageset.find("img.selected");
-
- switch(evt.keyCode) {
- case 27:
- self.resetLightbox();
- break;
- case 37:
- //left
- self.selectImage(self.prevImage(imageThumb));
- break;
- case 39:
- //right
- self.selectImage(self.nextImage(imageThumb));
- break;
- }
- });
- });
-
- this.nextImage = function(thumb){
- var next = thumb.next();
- if (next.length == 0) {
- next = self.imageset.find("img").first();
- }
- return(next);
- };
-
- this.prevImage = function(thumb){
- var prev = thumb.prev();
- if (prev.length == 0) {
- prev = self.imageset.find("img").last();
- }
- return(prev);
- };
-
- this.lightboxImageClicked = function(evt) {
- evt.preventDefault();
-
- var selectedImage = $(this).find(self.options.imageSelector),
- imageUrl = selectedImage.attr("data-full-photo"),
- images = selectedImage.parents(self.options.imageParent).find(self.options.imageSelector),
- imageThumb;
-
- if( $.browser.msie ) {
- /* No fancy schmancy lightbox for IE, because it doesn't work in IE */
- window.open(imageUrl);
- return;
- }
-
- self.imageset.html("");
- images.each(function(index, image) {
- image = $(image);
- var thumb = $("<img/>", {
- src: image.attr("data-small-photo"),
- "data-full-photo": image.attr("data-full-photo")
- });
-
- if(image.attr("data-full-photo") == imageUrl) {
- imageThumb = thumb;
- };
-
- self.imageset.append(thumb);
- });
-
- self
- .selectImage(imageThumb)
- .revealLightbox();
- };
-
- this.imagesetImageClicked = function(evt) {
- evt.preventDefault();
- evt.stopPropagation();
-
- self.selectImage($(this));
- };
-
- this.selectImage = function(imageThumb) {
- $(".selected", self.imageset).removeClass("selected");
- imageThumb.addClass("selected");
- self.image.attr("src", imageThumb.attr("data-full-photo"));
-
- return self;
- };
-
- this.revealLightbox = function() {
- self.body.addClass("lightboxed");
- self.lightbox
- .css("max-height", (self.window.height() - 100) + "px")
- .show();
-
- return self;
- };
-
- this.resetLightbox = function() {
- self.lightbox.hide();
- self.body.removeClass("lightboxed");
- };
-
- this.set = function(opts) {
- $.extend(self.options, opts);
- };
- };
-
- Diaspora.Widgets.Lightbox = Lightbox;
-})();
diff --git a/public/javascripts/widgets/notifications-badge.js b/public/javascripts/widgets/notifications-badge.js
deleted file mode 100644
index 53fd75099..000000000
--- a/public/javascripts/widgets/notifications-badge.js
+++ /dev/null
@@ -1,87 +0,0 @@
-(function() {
- var NotificationDropdown = function() {
- var self = this;
-
- this.subscribe("widget/ready",function(evt, badge, dropdown) {
- $.extend(self, {
- badge: badge,
- badgeLink: badge.find("a"),
- documentBody: $(document.body),
- dropdown: dropdown,
- dropdownNotifications: dropdown.find(".notifications"),
- ajaxLoader: dropdown.find(".ajax_loader")
- });
-
- if( ! $.browser.msie ) {
- self.badgeLink.toggle(self.showDropdown, self.hideDropdown);
- }
-
- self.dropdown.click(function(evt) {
- evt.stopPropagation();
- });
-
- self.documentBody.click(function(evt) {
- if(self.dropdownShowing()) {
- self.badgeLink.click();
- }
- });
- });
-
-
- this.dropdownShowing = function() {
- return this.dropdown.css("display") === "block";
- };
-
- this.showDropdown = function(evt) {
- evt.preventDefault();
-
- self.ajaxLoader.show();
- self.badge.addClass("active");
- self.dropdown.css("display", "block");
-
- self.getNotifications();
- };
-
- this.hideDropdown = function(evt) {
- evt.preventDefault();
-
- self.badge.removeClass("active");
- self.dropdown.css("display", "none");
- };
-
- this.getNotifications = function() {
- $.getJSON("/notifications?per_page=5", function(notifications) {
- self.notifications = notifications;
- self.renderNotifications();
- });
- };
-
- this.renderNotifications = function() {
- self.dropdownNotifications.empty();
-
- $.each(self.notifications, function(index, notifications) {
- $.each(notifications, function(index, notification) {
- self.dropdownNotifications.append(notification.note_html);
- });
- });
- self.dropdownNotifications.find("abbr.timeago").timeago();
-
- self.dropdownNotifications.find('.unread').each(function(index) {
- Diaspora.page.header.notifications.setUpUnread( $(this) );
- });
- self.dropdownNotifications.find('.read').each(function(index) {
- Diaspora.page.header.notifications.setUpRead( $(this) );
- });
- self.dropdownNotifications.find('.unread').each(function(index) {
- var myItem = $(this);
- setTimeout(function(){
- if ( self.dropdownNotifications.is(":visible") )
- myItem.trigger('click');
- }, 2000 );
- });
- self.ajaxLoader.hide();
- };
- };
-
- Diaspora.Widgets.NotificationsDropdown = NotificationDropdown;
-})();
diff --git a/public/javascripts/widgets/notifications.js b/public/javascripts/widgets/notifications.js
deleted file mode 100644
index 55e64d0af..000000000
--- a/public/javascripts/widgets/notifications.js
+++ /dev/null
@@ -1,165 +0,0 @@
-
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
-* licensed under the Affero General Public License version 3 or later. See
-* the COPYRIGHT file.
-*/
-
-(function() {
- var Notifications = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, badge, notificationMenu) {
- $.extend(self, {
- badge: badge,
- count: parseInt(badge.html()) || 0,
- notificationArea: null,
- notificationMenu: notificationMenu
- });
-
- $("a.more").click( function(evt) {
- evt.preventDefault();
- $(this).hide()
- .next(".hidden")
- .removeClass("hidden");
- });
- self.notificationMenu.find('a#mark_all_read_link').click(function() {
- $.ajax({
- url: "/notifications/read_all",
- type: "GET",
- dataType:'json',
- success: function(){
- self.notificationMenu.find('.unread').each(function(index) {
- self.setUpRead( $(this) );
- });
- if ( self.notificationArea ) {
- self.notificationArea.find('.unread').each(function(index) {
- self.setUpRead( $(this) );
- });
- }
- self.resetCount();
- }
- });
- return false;
- });
- });
- this.setUpNotificationPage = function( contentArea ) {
- self.notificationArea = contentArea;
- contentArea.find(".unread,.read").each(function(index) {
- if ( $(this).hasClass("unread") ) {
- self.setUpUnread( $(this) );
- } else {
- self.setUpRead( $(this) );
- }
- });
- }
- this.unreadClick = function() {
- $.ajax({
- url: "/notifications/" + $(this).closest(".stream_element").data("guid"),
- data: { set_unread: true },
- type: "PUT",
- success: self.clickSuccess
- });
- };
- this.readClick = function() {
- $.ajax({
- url: "/notifications/" + $(this).data("guid"),
- data: { set_unread: false },
- type: "PUT",
- success: self.clickSuccess
- });
- };
- this.setUpUnread = function( an_obj ) {
- an_obj.removeClass("read").addClass( "unread" );
- an_obj.find('.unread-setter').hide();
- an_obj.find('.unread-setter').unbind("click");
- an_obj.unbind( "mouseenter mouseleave" );
- an_obj.click(self.readClick);
- }
- this.setUpRead = function( an_obj ) {
- an_obj.removeClass("unread").addClass( "read" );
- an_obj.unbind( "click" );
- an_obj.find(".unread-setter").click(Diaspora.page.header.notifications.unreadClick);
- an_obj.hover(
- function () {
- $(this).find(".unread-setter").show();
- },
- function () {
- $(this).find(".unread-setter").hide();
- }
- );
- }
- this.clickSuccess = function( data ) {
- var itemID = data["guid"]
- var isUnread = data["unread"]
- if ( isUnread ) {
- self.incrementCount();
- }else{
- self.decrementCount();
- }
- self.notificationMenu.find('.read,.unread').each(function(index) {
- if ( $(this).data("guid") == itemID ) {
- if ( isUnread ) {
- self.setUpUnread( $(this) )
- } else {
- self.setUpRead( $(this) )
- }
- }
- });
- if ( self.notificationArea ) {
- self.notificationArea.find('.read,.unread').each(function(index) {
- if ( $(this).data("guid") == itemID ) {
- if ( isUnread ) {
- self.setUpUnread( $(this) )
- } else {
- self.setUpRead( $(this) )
- }
- }
- });
- }
- };
- this.showNotification = function(notification) {
- $(notification.html).prependTo(this.notificationMenu)
- .fadeIn(200)
- .delay(8000)
- .fadeOut(200, function() {
- $(this).detach();
- });
-
- if(typeof notification.incrementCount === "undefined" || notification.incrementCount) {
- this.incrementCount();
- }
- };
-
- this.changeNotificationCount = function(change) {
- self.count = Math.max( self.count + change, 0 )
- self.badge.text(self.count);
- if ( self.notificationArea )
- self.notificationArea.find( ".notification_count" ).text(self.count);
-
- if(self.count === 0) {
- self.badge.addClass("hidden");
- if ( self.notificationArea )
- self.notificationArea.find( ".notification_count" ).removeClass("unread");
- }
- else if(self.count === 1) {
- self.badge.removeClass("hidden");
- if ( self.notificationArea )
- self.notificationArea.find( ".notification_count" ).addClass("unread");
- }
- };
- this.resetCount = function(change) {
- self.count = 0;
- this.changeNotificationCount(0);
- };
-
- this.decrementCount = function() {
- self.changeNotificationCount(-1);
- };
-
- this.incrementCount = function() {
- self.changeNotificationCount(1);
- };
- };
-
- Diaspora.Widgets.Notifications = Notifications;
-})();
diff --git a/public/javascripts/widgets/search.js b/public/javascripts/widgets/search.js
deleted file mode 100644
index 4648cdf45..000000000
--- a/public/javascripts/widgets/search.js
+++ /dev/null
@@ -1,70 +0,0 @@
-(function() {
- var Search = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, searchForm) {
- $.extend(self, {
- searchForm: searchForm,
- searchFormAction: searchForm.attr("action"),
- searchInput: searchForm.find("input[type='search']"),
- searchInputName: searchForm.find("input[type='search']").attr("name"),
- options: {
- cacheLength : 15,
- delay : 800,
- extraParams : {limit : 4},
- formatItem : self.formatItem,
- formatResult : self.formatResult,
- max : 5,
- minChars : 2,
- onSelect: self.selectItemCallback,
- parse : self.parse,
- scroll : false
- }
- });
-
- self.searchInput.autocomplete(self.searchFormAction + ".json", $.extend(self.options, {
- element: self.searchInput
- }));
- });
-
- this.formatItem = function(row) {
- if (typeof row.search !== "undefined") {
- return Diaspora.I18n.t("search_for", row);
- } else {
- return "<img src='"+ row.avatar +"' class='avatar'/>" + row.name;
- }
- };
-
- this.formatResult = function(row) {
- return row.name;
- };
-
- this.parse = function(data) {
- var results = data.map(function(person){
- return {data : person, value : person['name']}
- });
-
- results.push({
- data: {
- name: self.searchInput.val(),
- url: self.searchFormAction + "?" + self.searchInputName + "=" + self.searchInput.val(),
- search: true
- },
- value: self.searchInput.val()
- });
-
- return results;
- };
-
- this.selectItemCallback = function(evt, data, formatted) {
- if (data['search'] === true) { // The placeholder "search for" result
- window.location = self.searchFormAction + '?' + self.searchInputName + '=' + data['name'];
- } else { // The actual result
- self.options.element.val(formatted);
- window.location = data['url'];
- }
- };
- };
-
- Diaspora.Widgets.Search = Search;
-})();
diff --git a/public/javascripts/widgets/stream.js b/public/javascripts/widgets/stream.js
deleted file mode 100644
index c21025aff..000000000
--- a/public/javascripts/widgets/stream.js
+++ /dev/null
@@ -1,32 +0,0 @@
-(function() {
- var Stream = function() {
- var self = this;
-
- this.subscribe("widget/ready", function(evt, stream) {
- if( Diaspora.backboneEnabled() ){ return }
-
- $.extend(self, {
- stream: $(stream),
- mainStream: $(stream).find('#main_stream'),
- headerTitle: $(stream).find('#aspect_stream_header > h3')
- });
- });
-
- this.globalSubscribe("stream/reloaded stream/scrolled", function() {
- self.publish("widget/ready", self.stream);
- });
-
- this.empty = function() {
- self.mainStream.empty();
- self.headerTitle.text(Diaspora.I18n.t('stream.no_aspects'));
- };
-
- this.setHeaderTitle = function(newTitle) {
- self.headerTitle.text(newTitle);
- };
- };
-
- if(!Diaspora.backboneEnabled()) {
- Diaspora.Widgets.Stream = Stream;
- }
-})();
diff --git a/public/javascripts/widgets/timeago.js b/public/javascripts/widgets/timeago.js
deleted file mode 100644
index c29853267..000000000
--- a/public/javascripts/widgets/timeago.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Copyright (c) 2010-2011, Diaspora Inc. This file is
- * licensed under the Affero General Public License version 3 or later. See
- * the COPYRIGHT file.
- */
-(function() {
- Diaspora.Widgets.TimeAgo = function() {
- var self = this;
-
- this.subscribe("widget/ready", function() {
- if(Diaspora.I18n.language !== "en") {
- $.each($.timeago.settings.strings, function(index) {
- $.timeago.settings.strings[index] = Diaspora.I18n.t("timeago." + index);
- });
- }
- });
- };
-})();