zen 0.1a
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/MANIFEST +337 -0
- data/README.textile +42 -0
- data/Rakefile +6 -0
- data/bin/zen +9 -0
- data/doc/Categories.html +93 -0
- data/doc/Categories/Controllers.html +93 -0
- data/doc/Categories/Controllers/Categories.html +995 -0
- data/doc/Categories/Controllers/CategoryGroups.html +878 -0
- data/doc/Categories/Models.html +97 -0
- data/doc/Categories/Models/Category.html +269 -0
- data/doc/Categories/Models/CategoryGroup.html +231 -0
- data/doc/Comments.html +93 -0
- data/doc/Comments/Controllers.html +93 -0
- data/doc/Comments/Controllers/Comments.html +797 -0
- data/doc/Comments/Controllers/CommentsForm.html +487 -0
- data/doc/Comments/Liquid.html +93 -0
- data/doc/Comments/Liquid/CommentForm.html +522 -0
- data/doc/Comments/Liquid/Comments.html +543 -0
- data/doc/Comments/Models.html +95 -0
- data/doc/Comments/Models/Comment.html +260 -0
- data/doc/CustomFields.html +93 -0
- data/doc/CustomFields/Controllers.html +93 -0
- data/doc/CustomFields/Controllers/CustomFieldGroups.html +902 -0
- data/doc/CustomFields/Controllers/CustomFields.html +974 -0
- data/doc/CustomFields/Models.html +97 -0
- data/doc/CustomFields/Models/CustomField.html +272 -0
- data/doc/CustomFields/Models/CustomFieldGroup.html +259 -0
- data/doc/CustomFields/Models/CustomFieldValue.html +154 -0
- data/doc/Ramaze.html +93 -0
- data/doc/Ramaze/Helper.html +93 -0
- data/doc/Ramaze/Helper/ACL.html +531 -0
- data/doc/Ramaze/Helper/Asset.html +617 -0
- data/doc/Ramaze/Helper/Breadcrumb.html +411 -0
- data/doc/Ramaze/Helper/Common.html +738 -0
- data/doc/Sections.html +93 -0
- data/doc/Sections/Controllers.html +93 -0
- data/doc/Sections/Controllers/SectionEntries.html +1100 -0
- data/doc/Sections/Controllers/Sections.html +953 -0
- data/doc/Sections/Liquid.html +93 -0
- data/doc/Sections/Liquid/SectionEntries.html +674 -0
- data/doc/Sections/Liquid/Sections.html +494 -0
- data/doc/Sections/Models.html +97 -0
- data/doc/Sections/Models/Section.html +272 -0
- data/doc/Sections/Models/SectionEntry.html +264 -0
- data/doc/Sequel.html +91 -0
- data/doc/Sequel/Model.html +243 -0
- data/doc/Settings.html +93 -0
- data/doc/Settings/Controllers.html +91 -0
- data/doc/Settings/Controllers/Settings.html +565 -0
- data/doc/Settings/Liquid.html +91 -0
- data/doc/Settings/Liquid/Setting.html +426 -0
- data/doc/Settings/Models.html +95 -0
- data/doc/Settings/Models/Setting.html +293 -0
- data/doc/Users.html +93 -0
- data/doc/Users/Controllers.html +93 -0
- data/doc/Users/Controllers/AccessRules.html +904 -0
- data/doc/Users/Controllers/UserGroups.html +879 -0
- data/doc/Users/Controllers/Users.html +1124 -0
- data/doc/Users/Liquid.html +93 -0
- data/doc/Users/Liquid/User.html +480 -0
- data/doc/Users/Liquid/Users.html +495 -0
- data/doc/Users/Models.html +97 -0
- data/doc/Users/Models/AccessRule.html +257 -0
- data/doc/Users/Models/User.html +649 -0
- data/doc/Users/Models/UserGroup.html +267 -0
- data/doc/Zen.html +391 -0
- data/doc/Zen/Bin.html +113 -0
- data/doc/Zen/Bin/Base.html +727 -0
- data/doc/Zen/Controllers.html +115 -0
- data/doc/Zen/Controllers/AdminController.html +298 -0
- data/doc/Zen/Controllers/BaseController.html +272 -0
- data/doc/Zen/Controllers/FrontendController.html +164 -0
- data/doc/Zen/Controllers/MainController.html +421 -0
- data/doc/Zen/Database.html +498 -0
- data/doc/Zen/Language.html +660 -0
- data/doc/Zen/Liquid.html +117 -0
- data/doc/Zen/Liquid/ControllerBehavior.html +448 -0
- data/doc/Zen/Liquid/General.html +444 -0
- data/doc/Zen/Liquid/Redirect.html +435 -0
- data/doc/Zen/Liquid/Strip.html +447 -0
- data/doc/Zen/Logger.html +393 -0
- data/doc/Zen/Package.html +909 -0
- data/doc/_index.html +724 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +310 -0
- data/doc/file.README.html +86 -0
- data/doc/file_list.html +38 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +86 -0
- data/doc/js/app.js +203 -0
- data/doc/js/full_list.js +149 -0
- data/doc/js/jquery.js +154 -0
- data/doc/method_list.html +1139 -0
- data/doc/top-level-namespace.html +88 -0
- data/lib/zen.rb +77 -0
- data/lib/zen/base/database.rb +105 -0
- data/lib/zen/base/language.rb +132 -0
- data/lib/zen/base/logger.rb +54 -0
- data/lib/zen/base/package.rb +233 -0
- data/lib/zen/base/version.rb +11 -0
- data/lib/zen/bin/zen_binary.rb +173 -0
- data/lib/zen/controller/admin_controller.rb +60 -0
- data/lib/zen/controller/base_controller.rb +39 -0
- data/lib/zen/controller/frontend_controller.rb +16 -0
- data/lib/zen/controller/main_controller.rb +93 -0
- data/lib/zen/helper/acl.rb +124 -0
- data/lib/zen/helper/asset.rb +104 -0
- data/lib/zen/helper/breadcrumb.rb +71 -0
- data/lib/zen/helper/common.rb +157 -0
- data/lib/zen/language/en/zen_general.rb +21 -0
- data/lib/zen/language/en/zen_models.rb +39 -0
- data/lib/zen/layout/admin.xhtml +72 -0
- data/lib/zen/layout/login.xhtml +44 -0
- data/lib/zen/liquid/controller_behavior.rb +55 -0
- data/lib/zen/liquid/general.rb +69 -0
- data/lib/zen/liquid/redirect.rb +47 -0
- data/lib/zen/liquid/strip.rb +58 -0
- data/lib/zen/model/methods.rb +26 -0
- data/lib/zen/model/settings.rb +27 -0
- data/lib/zen/packages/categories/LICENSE +19 -0
- data/lib/zen/packages/categories/README.textile +0 -0
- data/lib/zen/packages/categories/lib/categories.rb +24 -0
- data/lib/zen/packages/categories/lib/categories/controller/categories.rb +202 -0
- data/lib/zen/packages/categories/lib/categories/controller/category_groups.rb +173 -0
- data/lib/zen/packages/categories/lib/categories/language/en/categories.rb +38 -0
- data/lib/zen/packages/categories/lib/categories/language/en/category_groups.rb +37 -0
- data/lib/zen/packages/categories/lib/categories/model/category.rb +42 -0
- data/lib/zen/packages/categories/lib/categories/model/category_group.rb +29 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/categories/edit.xhtml +7 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/categories/form.xhtml +36 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/categories/index.xhtml +70 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/categories/new.xhtml +7 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/category_groups/edit.xhtml +7 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/category_groups/form.xhtml +18 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/category_groups/index.xhtml +72 -0
- data/lib/zen/packages/categories/lib/categories/view/admin/category_groups/new.xhtml +7 -0
- data/lib/zen/packages/categories/migrations/.gitkeep +0 -0
- data/lib/zen/packages/categories/migrations/1295282303_create_schema.rb +40 -0
- data/lib/zen/packages/comments/LICENSE +19 -0
- data/lib/zen/packages/comments/README.textile +0 -0
- data/lib/zen/packages/comments/lib/comments.rb +26 -0
- data/lib/zen/packages/comments/lib/comments/controller/comments.rb +157 -0
- data/lib/zen/packages/comments/lib/comments/controller/comments_form.rb +135 -0
- data/lib/zen/packages/comments/lib/comments/language/en/comments.rb +52 -0
- data/lib/zen/packages/comments/lib/comments/liquid/comment_form.rb +97 -0
- data/lib/zen/packages/comments/lib/comments/liquid/comments.rb +115 -0
- data/lib/zen/packages/comments/lib/comments/model/comment.rb +34 -0
- data/lib/zen/packages/comments/lib/comments/view/admin/comments/edit.xhtml +7 -0
- data/lib/zen/packages/comments/lib/comments/view/admin/comments/form.xhtml +31 -0
- data/lib/zen/packages/comments/lib/comments/view/admin/comments/index.xhtml +74 -0
- data/lib/zen/packages/comments/migrations/.gitkeep +0 -0
- data/lib/zen/packages/comments/migrations/1295282202_create_schema.rb +24 -0
- data/lib/zen/packages/comments/migrations/1296949631_add_defensio_signature.rb +11 -0
- data/lib/zen/packages/custom_fields/LICENSE +19 -0
- data/lib/zen/packages/custom_fields/README.textile +0 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields.rb +24 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/controller/custom_field_groups.rb +179 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/controller/custom_fields.rb +194 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/language/en/custom_field_groups.rb +45 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/language/en/custom_fields.rb +64 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/model/custom_field.rb +41 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/model/custom_field_group.rb +32 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/model/custom_field_value.rb +20 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_field_groups/edit.xhtml +7 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_field_groups/form.xhtml +18 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_field_groups/index.xhtml +88 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_field_groups/new.xhtml +7 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_fields/edit.xhtml +7 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_fields/form.xhtml +50 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_fields/index.xhtml +75 -0
- data/lib/zen/packages/custom_fields/lib/custom_fields/view/admin/custom_fields/new.xhtml +7 -0
- data/lib/zen/packages/custom_fields/migrations/.gitkeep +0 -0
- data/lib/zen/packages/custom_fields/migrations/1295255665_create_schema.rb +53 -0
- data/lib/zen/packages/sections/LICENSE +19 -0
- data/lib/zen/packages/sections/README.textile +43 -0
- data/lib/zen/packages/sections/lib/sections.rb +33 -0
- data/lib/zen/packages/sections/lib/sections/controller/section_entries.rb +251 -0
- data/lib/zen/packages/sections/lib/sections/controller/sections.rb +205 -0
- data/lib/zen/packages/sections/lib/sections/language/en/section_entries.rb +58 -0
- data/lib/zen/packages/sections/lib/sections/language/en/sections.rb +63 -0
- data/lib/zen/packages/sections/lib/sections/liquid/section_entries.rb +209 -0
- data/lib/zen/packages/sections/lib/sections/liquid/sections.rb +76 -0
- data/lib/zen/packages/sections/lib/sections/model/section.rb +43 -0
- data/lib/zen/packages/sections/lib/sections/model/section_entry.rb +43 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/edit.xhtml +7 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/form.xhtml +54 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/index.xhtml +77 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/new.xhtml +7 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/section_entries/edit.xhtml +7 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/section_entries/form.xhtml +147 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/section_entries/index.xhtml +74 -0
- data/lib/zen/packages/sections/lib/sections/view/admin/section_entries/new.xhtml +7 -0
- data/lib/zen/packages/sections/migrations/.gitkeep +0 -0
- data/lib/zen/packages/sections/migrations/1295251836_create_schema.rb +35 -0
- data/lib/zen/packages/sections/migrations/1296335671_userdata_section_entries.rb +18 -0
- data/lib/zen/packages/sections/migrations/1296936110_drop_comment_antispam.rb +11 -0
- data/lib/zen/packages/settings/LICENSE +0 -0
- data/lib/zen/packages/settings/README.textile +0 -0
- data/lib/zen/packages/settings/lib/settings.rb +22 -0
- data/lib/zen/packages/settings/lib/settings/controller/settings.rb +113 -0
- data/lib/zen/packages/settings/lib/settings/language/en/settings.rb +56 -0
- data/lib/zen/packages/settings/lib/settings/liquid/setting.rb +56 -0
- data/lib/zen/packages/settings/lib/settings/model/setting.rb +38 -0
- data/lib/zen/packages/settings/lib/settings/view/admin/settings/index.xhtml +79 -0
- data/lib/zen/packages/settings/migrations/.gitkeep +0 -0
- data/lib/zen/packages/settings/migrations/1295597111_create_schema.rb +31 -0
- data/lib/zen/packages/users/LICENSE +19 -0
- data/lib/zen/packages/users/README.textile +0 -0
- data/lib/zen/packages/users/lib/users.rb +35 -0
- data/lib/zen/packages/users/lib/users/controller/access_rules.rb +186 -0
- data/lib/zen/packages/users/lib/users/controller/user_groups.rb +171 -0
- data/lib/zen/packages/users/lib/users/controller/users.rb +240 -0
- data/lib/zen/packages/users/lib/users/language/en/access_rules.rb +49 -0
- data/lib/zen/packages/users/lib/users/language/en/user_groups.rb +42 -0
- data/lib/zen/packages/users/lib/users/language/en/users.rb +63 -0
- data/lib/zen/packages/users/lib/users/liquid/user.rb +75 -0
- data/lib/zen/packages/users/lib/users/liquid/users.rb +80 -0
- data/lib/zen/packages/users/lib/users/model/access_rule.rb +29 -0
- data/lib/zen/packages/users/lib/users/model/user.rb +96 -0
- data/lib/zen/packages/users/lib/users/model/user_group.rb +38 -0
- data/lib/zen/packages/users/lib/users/public/admin/js/users/access_rules.js +43 -0
- data/lib/zen/packages/users/lib/users/view/admin/access_rules/edit.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/access_rules/form.xhtml +68 -0
- data/lib/zen/packages/users/lib/users/view/admin/access_rules/index.xhtml +85 -0
- data/lib/zen/packages/users/lib/users/view/admin/access_rules/new.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/user_groups/edit.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/user_groups/form.xhtml +19 -0
- data/lib/zen/packages/users/lib/users/view/admin/user_groups/index.xhtml +69 -0
- data/lib/zen/packages/users/lib/users/view/admin/user_groups/new.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/edit.xhtml +7 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/form.xhtml +25 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/index.xhtml +73 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/login.xhtml +22 -0
- data/lib/zen/packages/users/lib/users/view/admin/users/new.xhtml +7 -0
- data/lib/zen/packages/users/migrations/.gitkeep +0 -0
- data/lib/zen/packages/users/migrations/1295281013_create_schema.rb +54 -0
- data/lib/zen/public/admin/css/boilerplate.css +174 -0
- data/lib/zen/public/admin/css/general.css +485 -0
- data/lib/zen/public/admin/css/grid.css +119 -0
- data/lib/zen/public/admin/css/layout.css +111 -0
- data/lib/zen/public/admin/images/general/noise.jpg +0 -0
- data/lib/zen/public/admin/images/icons/accept.png +0 -0
- data/lib/zen/public/admin/images/icons/add.png +0 -0
- data/lib/zen/public/admin/images/icons/back.png +0 -0
- data/lib/zen/public/admin/images/icons/bold.png +0 -0
- data/lib/zen/public/admin/images/icons/close.png +0 -0
- data/lib/zen/public/admin/images/icons/delete.png +0 -0
- data/lib/zen/public/admin/images/icons/edit.png +0 -0
- data/lib/zen/public/admin/images/icons/error.png +0 -0
- data/lib/zen/public/admin/images/icons/help.png +0 -0
- data/lib/zen/public/admin/images/icons/info.png +0 -0
- data/lib/zen/public/admin/images/icons/italic.png +0 -0
- data/lib/zen/public/admin/images/icons/large/error.png +0 -0
- data/lib/zen/public/admin/images/icons/large/notice.png +0 -0
- data/lib/zen/public/admin/images/icons/large/success.png +0 -0
- data/lib/zen/public/admin/images/icons/link.png +0 -0
- data/lib/zen/public/admin/images/icons/logout.png +0 -0
- data/lib/zen/public/admin/images/icons/ol.png +0 -0
- data/lib/zen/public/admin/images/icons/pdf.png +0 -0
- data/lib/zen/public/admin/images/icons/ul.png +0 -0
- data/lib/zen/public/admin/images/icons/user.png +0 -0
- data/lib/zen/public/admin/images/icons/view.png +0 -0
- data/lib/zen/public/admin/js/mootools/core.js +436 -0
- data/lib/zen/public/admin/js/mootools/more.js +288 -0
- data/lib/zen/public/admin/js/zen/editor/base.js +265 -0
- data/lib/zen/public/admin/js/zen/editor/drivers/html.js +104 -0
- data/lib/zen/public/admin/js/zen/editor/drivers/markdown.js +102 -0
- data/lib/zen/public/admin/js/zen/editor/drivers/textile.js +102 -0
- data/lib/zen/public/admin/js/zen/init.js +57 -0
- data/lib/zen/public/admin/js/zen/modal.js +159 -0
- data/lib/zen/public/admin/js/zen/notification.js +213 -0
- data/lib/zen/public/admin/js/zen/tabs.js +263 -0
- data/lib/zen/tasks.rb +6 -0
- data/pkg/.gitkeep +0 -0
- data/proto/app/Rakefile +2 -0
- data/proto/app/app.rb +20 -0
- data/proto/app/config.ru +18 -0
- data/proto/app/config/config.rb +17 -0
- data/proto/app/config/database.rb +18 -0
- data/proto/app/config/middlewares.rb +23 -0
- data/proto/app/config/requires.rb +8 -0
- data/proto/app/logs/.gitkeep +0 -0
- data/proto/app/public/.gitkeep +0 -0
- data/proto/app/start.rb +22 -0
- data/proto/app/vendor/.gitkeep +0 -0
- data/proto/app/vendor/themes/.gitkeep +0 -0
- data/proto/migration.rb +11 -0
- data/proto/module/LICENSE +0 -0
- data/proto/module/README.textile +0 -0
- data/proto/module/lib/module.rb +15 -0
- data/proto/module/lib/module/controller/controllers.rb +86 -0
- data/proto/module/lib/module/language/en/languages.rb +3 -0
- data/proto/module/lib/module/model/model.rb +12 -0
- data/proto/module/lib/module/view/admin/edit.xhtml +0 -0
- data/proto/module/lib/module/view/admin/form.xhtml +0 -0
- data/proto/module/lib/module/view/admin/index.xhtml +0 -0
- data/proto/module/lib/module/view/admin/new.xhtml +0 -0
- data/proto/module/migrations/.gitkeep +0 -0
- data/spec/javascript/css/base.css +177 -0
- data/spec/javascript/css/style.css +204 -0
- data/spec/javascript/css/typography.css +70 -0
- data/spec/javascript/editor/index.html +65 -0
- data/spec/javascript/images/close.png +0 -0
- data/spec/javascript/images/info.png +0 -0
- data/spec/javascript/js/editor.js +16 -0
- data/spec/javascript/js/modal.js +12 -0
- data/spec/javascript/js/namespace.js +2 -0
- data/spec/javascript/js/notification.js +43 -0
- data/spec/javascript/js/tabs.js +8 -0
- data/spec/javascript/modal/index.html +45 -0
- data/spec/javascript/notification/index.html +48 -0
- data/spec/javascript/tabs/index.html +73 -0
- data/spec/javascript/tabs/tab_1.html +1 -0
- data/spec/javascript/tabs/tab_2.html +1 -0
- data/spec/zen/base/language.rb +31 -0
- data/spec/zen/base/logger.rb +34 -0
- data/spec/zen/base/package.rb +47 -0
- data/spec/zen/config/database.rb +8 -0
- data/spec/zen/helper/asset.rb +26 -0
- data/spec/zen/helper/breadcrumb.rb +24 -0
- data/spec/zen/language/en/general.rb +4 -0
- data/spec/zen/language/nl/general.rb +4 -0
- data/spec/zen/liquid/general.rb +42 -0
- data/spec/zen/logs/.gitkeep +0 -0
- data/spec/zen/spec.rb +9 -0
- data/spec/zen/spec_database.db +0 -0
- data/tasks/bacon.rake +99 -0
- data/tasks/build.rake +72 -0
- data/tasks/clean.rake +18 -0
- data/tasks/db.rake +81 -0
- data/tasks/doc.rake +5 -0
- data/tasks/extension.rake +65 -0
- data/tasks/proto.rake +37 -0
- data/tasks/theme.rake +63 -0
- metadata +512 -0
@@ -0,0 +1,288 @@
|
|
1
|
+
// MooTools: the javascript framework.
|
2
|
+
// Load this file's selection again by visiting: http://mootools.net/more/9d732e5caf762379301476b383fd95f6
|
3
|
+
// Or build this file again with packager using: packager build More/More More/Events.Pseudos More/Class.Refactor More/Class.Binds More/Array.Extras More/Date More/Date.Extras More/Number.Format More/String.Extras More/Hash More/Hash.Extras More/Element.Forms More/Elements.From More/Element.Event.Pseudos More/Element.Event.Pseudos.Keys More/Element.Delegation More/Element.Measure More/Form.Request More/Request.Periodical More/Assets More/Color More/Keyboard More/Keyboard.Extras More/Tips
|
4
|
+
/*
|
5
|
+
---
|
6
|
+
copyrights:
|
7
|
+
- [MooTools](http://mootools.net)
|
8
|
+
|
9
|
+
licenses:
|
10
|
+
- [MIT License](http://mootools.net/license.txt)
|
11
|
+
...
|
12
|
+
*/
|
13
|
+
MooTools.More={version:"1.3.0.1",build:"6dce99bed2792dffcbbbb4ddc15a1fb9a41994b5"};Events.Pseudos=function(f,c,d){var b="monitorEvents:";var a=function(g){return{store:g.store?function(h,i){g.store(b+h,i);
|
14
|
+
}:function(h,i){(g.$monitorEvents||(g.$monitorEvents={}))[h]=i;},retrieve:g.retrieve?function(h,i){return g.retrieve(b+h,i);}:function(h,i){if(!g.$monitorEvents){return i;
|
15
|
+
}return g.$monitorEvents[h]||i;}};};var e=function(h){if(h.indexOf(":")==-1){return null;}var g=Slick.parse(h).expressions[0][0],i=g.pseudos;return(f&&f[i[0].key])?{event:g.tag,value:i[0].value,pseudo:i[0].key,original:h}:null;
|
16
|
+
};return{addEvent:function(l,n,i){var m=e(l);if(!m){return c.call(this,l,n,i);}var j=a(this),q=j.retrieve(l,[]),g=Array.from(f[m.pseudo]),k=g[1];var p=this;
|
17
|
+
var o=function(){g[0].call(p,m,n,arguments,k);};q.include({event:n,monitor:o});j.store(l,q);var h=m.event;if(k&&k[h]){h=k[h].base;}c.call(this,l,n,i);return c.call(this,h,o,i);
|
18
|
+
},removeEvent:function(m,l){var k=e(m);if(!k){return d.call(this,m,l);}var n=a(this),j=n.retrieve(m),i=Array.from(f[k.pseudo]),h=i[1];if(!j){return this;
|
19
|
+
}var g=k.event;if(h&&h[g]){g=h[g].base;}d.call(this,m,l);j.each(function(o,p){if(!l||o.event==l){d.call(this,g,o.monitor);}delete j[p];},this);n.store(m,j);
|
20
|
+
return this;}};};(function(){var b={once:function(d,e,c){e.apply(this,c);this.removeEvent(d.original,e);}};Events.definePseudo=function(c,d){b[c]=d;};var a=Events.prototype;
|
21
|
+
Events.implement(Events.Pseudos(b,a.addEvent,a.removeEvent));})();Class.refactor=function(b,a){Object.each(a,function(e,d){var c=b.prototype[d];if(c&&c.$origin){c=c.$origin;
|
22
|
+
}if(c&&typeof e=="function"){b.implement(d,function(){var f=this.previous;this.previous=c;var g=e.apply(this,arguments);this.previous=f;return g;});}else{b.implement(d,e);
|
23
|
+
}});return b;};Class.Mutators.Binds=function(a){return a;};Class.Mutators.initialize=function(a){return function(){Array.from(this.Binds).each(function(b){var c=this[b];
|
24
|
+
if(c){this[b]=c.bind(this);}},this);return a.apply(this,arguments);};};Array.implement({min:function(){return Math.min.apply(null,this);},max:function(){return Math.max.apply(null,this);
|
25
|
+
},average:function(){return this.length?this.sum()/this.length:0;},sum:function(){var a=0,b=this.length;if(b){while(b--){a+=this[b];}}return a;},unique:function(){return[].combine(this);
|
26
|
+
},shuffle:function(){for(var b=this.length;b&&--b;){var a=this[b],c=Math.floor(Math.random()*(b+1));this[b]=this[c];this[c]=a;}return this;},reduce:function(c,d){var e;
|
27
|
+
for(var b=0,a=this.length;b<a;b++){if(b in this){d=d===e?this[b]:c.call(null,d,this[b],b,this);}}return d;},reduceRight:function(b,c){var a=this.length,d;
|
28
|
+
while(a--){if(a in this){c=c===d?this[a]:b.call(null,c,this[a],a,this);}}return c;}});(function(){var a=function(b){return b!=null;};Object.extend({getFromPath:function(e,d){var f=d.split(".");
|
29
|
+
for(var c=0,b=f.length;c<b;c++){if(e.hasOwnProperty(f[c])){e=e[f[c]];}else{return null;}}return e;},cleanValues:function(b,c){c=c||a;for(key in b){if(!c(b[key])){delete b[key];
|
30
|
+
}}return b;},erase:function(b,c){if(b.hasOwnProperty(c)){delete b[c];}return b;},run:function(c){var b=Array.slice(arguments,1);for(key in c){if(c[key].apply){c[key].apply(c,b);
|
31
|
+
}}return c;}});})();(function(){var b=null,a={},d={};var c=function(f){if(instanceOf(f,e.Set)){return f;}else{return a[f];}};var e=this.Locale={define:function(f,j,h,i){var g;
|
32
|
+
if(instanceOf(f,e.Set)){g=f.name;if(g){a[g]=f;}}else{g=f;if(!a[g]){a[g]=new e.Set(g);}f=a[g];}if(j){f.define(j,h,i);}if(!b){b=f;}return f;},use:function(f){f=c(f);
|
33
|
+
if(f){b=f;this.fireEvent("change",f);}return this;},getCurrent:function(){return b;},get:function(g,f){return(b)?b.get(g,f):"";},inherit:function(f,g,h){f=c(f);
|
34
|
+
if(f){f.inherit(g,h);}return this;},list:function(){return Object.keys(a);}};Object.append(e,new Events);e.Set=new Class({sets:{},inherits:{locales:[],sets:{}},initialize:function(f){this.name=f||"";
|
35
|
+
},define:function(i,g,h){var f=this.sets[i];if(!f){f={};}if(g){if(typeOf(g)=="object"){f=Object.merge(f,g);}else{f[g]=h;}}this.sets[i]=f;return this;},get:function(r,j,q){var p=Object.getFromPath(this.sets,r);
|
36
|
+
if(p!=null){var m=typeOf(p);if(m=="function"){p=p.apply(null,Array.from(j));}else{if(m=="object"){p=Object.clone(p);}}return p;}var h=r.indexOf("."),o=h<0?r:r.substr(0,h),k=(this.inherits.sets[o]||[]).combine(this.inherits.locales).include("en-US");
|
37
|
+
if(!q){q=[];}for(var g=0,f=k.length;g<f;g++){if(q.contains(k[g])){continue;}q.include(k[g]);var n=a[k[g]];if(!n){continue;}p=n.get(r,j,q);if(p!=null){return p;
|
38
|
+
}}return"";},inherit:function(g,h){g=Array.from(g);if(h&&!this.inherits.sets[h]){this.inherits.sets[h]=[];}var f=g.length;while(f--){(h?this.inherits.sets[h]:this.inherits.locales).unshift(g[f]);
|
39
|
+
}return this;}});})();Locale.define("en-US","Date",{months:["January","February","March","April","May","June","July","August","September","October","November","December"],months_abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],days_abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dateOrder:["month","date","year"],shortDate:"%m/%d/%Y",shortTime:"%I:%M%p",AM:"AM",PM:"PM",ordinal:function(a){return(a>3&&a<21)?"th":["th","st","nd","rd","th"][Math.min(a%10,4)];
|
40
|
+
},lessThanMinuteAgo:"less than a minute ago",minuteAgo:"about a minute ago",minutesAgo:"{delta} minutes ago",hourAgo:"about an hour ago",hoursAgo:"about {delta} hours ago",dayAgo:"1 day ago",daysAgo:"{delta} days ago",weekAgo:"1 week ago",weeksAgo:"{delta} weeks ago",monthAgo:"1 month ago",monthsAgo:"{delta} months ago",yearAgo:"1 year ago",yearsAgo:"{delta} years ago",lessThanMinuteUntil:"less than a minute from now",minuteUntil:"about a minute from now",minutesUntil:"{delta} minutes from now",hourUntil:"about an hour from now",hoursUntil:"about {delta} hours from now",dayUntil:"1 day from now",daysUntil:"{delta} days from now",weekUntil:"1 week from now",weeksUntil:"{delta} weeks from now",monthUntil:"1 month from now",monthsUntil:"{delta} months from now",yearUntil:"1 year from now",yearsUntil:"{delta} years from now"});
|
41
|
+
(function(){var i=this.Date;i.Methods={ms:"Milliseconds",year:"FullYear",min:"Minutes",mo:"Month",sec:"Seconds",hr:"Hours"};["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds","Time","TimezoneOffset","Week","Timezone","GMTOffset","DayOfYear","LastMonth","LastDayOfMonth","UTCDate","UTCDay","UTCFullYear","AMPM","Ordinal","UTCHours","UTCMilliseconds","UTCMinutes","UTCMonth","UTCSeconds","UTCMilliseconds"].each(function(p){i.Methods[p.toLowerCase()]=p;
|
42
|
+
});var d=function(r,q,p){if(!p){p="0";}return new Array(q-String(r).length+1).join(p)+r;};i.implement({set:function(r,q){r=r.toLowerCase();var p=i.Methods;
|
43
|
+
if(p[r]){this["set"+p[r]](q);}return this;}.overloadSetter(),get:function(q){q=q.toLowerCase();var p=i.Methods;if(p[q]){return this["get"+p[q]]();}return null;
|
44
|
+
},clone:function(){return new i(this.get("time"));},increment:function(p,r){p=p||"day";r=r!=null?r:1;switch(p){case"year":return this.increment("month",r*12);
|
45
|
+
case"month":var q=this.get("date");this.set("date",1).set("mo",this.get("mo")+r);return this.set("date",q.min(this.get("lastdayofmonth")));case"week":return this.increment("day",r*7);
|
46
|
+
case"day":return this.set("date",this.get("date")+r);}if(!i.units[p]){throw new Error(p+" is not a supported interval");}return this.set("time",this.get("time")+r*i.units[p]());
|
47
|
+
},decrement:function(p,q){return this.increment(p,-1*(q!=null?q:1));},isLeapYear:function(){return i.isLeapYear(this.get("year"));},clearTime:function(){return this.set({hr:0,min:0,sec:0,ms:0});
|
48
|
+
},diff:function(q,p){if(typeOf(q)=="string"){q=i.parse(q);}return((q-this)/i.units[p||"day"](3,3)).round();},getLastDayOfMonth:function(){return i.daysInMonth(this.get("mo"),this.get("year"));
|
49
|
+
},getDayOfYear:function(){return(i.UTC(this.get("year"),this.get("mo"),this.get("date")+1)-i.UTC(this.get("year"),0,1))/i.units.day();},getWeek:function(){return(this.get("dayofyear")/7).ceil();
|
50
|
+
},getOrdinal:function(p){return i.getMsg("ordinal",p||this.get("date"));},getTimezone:function(){return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");
|
51
|
+
},getGMTOffset:function(){var p=this.get("timezoneOffset");return((p>0)?"-":"+")+d((p.abs()/60).floor(),2)+d(p%60,2);},setAMPM:function(p){p=p.toUpperCase();
|
52
|
+
var q=this.get("hr");if(q>11&&p=="AM"){return this.decrement("hour",12);}else{if(q<12&&p=="PM"){return this.increment("hour",12);}}return this;},getAMPM:function(){return(this.get("hr")<12)?"AM":"PM";
|
53
|
+
},parse:function(p){this.set("time",i.parse(p));return this;},isValid:function(p){return !isNaN((p||this).valueOf());},format:function(p){if(!this.isValid()){return"invalid date";
|
54
|
+
}p=p||"%x %X";p=k[p.toLowerCase()]||p;var q=this;return p.replace(/%([a-z%])/gi,function(s,r){switch(r){case"a":return i.getMsg("days_abbr")[q.get("day")];
|
55
|
+
case"A":return i.getMsg("days")[q.get("day")];case"b":return i.getMsg("months_abbr")[q.get("month")];case"B":return i.getMsg("months")[q.get("month")];
|
56
|
+
case"c":return q.format("%a %b %d %H:%m:%S %Y");case"d":return d(q.get("date"),2);case"e":return d(q.get("date"),2," ");case"H":return d(q.get("hr"),2);
|
57
|
+
case"I":return d((q.get("hr")%12)||12,2);case"j":return d(q.get("dayofyear"),3);case"k":return d(q.get("hr"),2," ");case"l":return d((q.get("hr")%12)||12,2," ");
|
58
|
+
case"L":return d(q.get("ms"),3);case"m":return d((q.get("mo")+1),2);case"M":return d(q.get("min"),2);case"o":return q.get("ordinal");case"p":return i.getMsg(q.get("ampm"));
|
59
|
+
case"s":return Math.round(q/1000);case"S":return d(q.get("seconds"),2);case"U":return d(q.get("week"),2);case"w":return q.get("day");case"x":return q.format(i.getMsg("shortDate"));
|
60
|
+
case"X":return q.format(i.getMsg("shortTime"));case"y":return q.get("year").toString().substr(2);case"Y":return q.get("year");case"z":return q.get("GMTOffset");
|
61
|
+
case"Z":return q.get("Timezone");}return r;});},toISOString:function(){return this.format("iso8601");}});i.alias("toJSON","toISOString");i.alias("compare","diff");
|
62
|
+
i.alias("strftime","format");var k={db:"%Y-%m-%d %H:%M:%S",compact:"%Y%m%dT%H%M%S",iso8601:"%Y-%m-%dT%H:%M:%S%T",rfc822:"%a, %d %b %Y %H:%M:%S %Z","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M"};
|
63
|
+
var g=[];var e=i.parse;var n=function(s,u,r){var q=-1;var t=i.getMsg(s+"s");switch(typeOf(u)){case"object":q=t[u.get(s)];break;case"number":q=t[u];if(!q){throw new Error("Invalid "+s+" index: "+u);
|
64
|
+
}break;case"string":var p=t.filter(function(v){return this.test(v);},new RegExp("^"+u,"i"));if(!p.length){throw new Error("Invalid "+s+" string");}if(p.length>1){throw new Error("Ambiguous "+s);
|
65
|
+
}q=p[0];}return(r)?t.indexOf(q):q;};i.extend({getMsg:function(q,p){return Locale.get("Date."+q,p);},units:{ms:Function.from(1),second:Function.from(1000),minute:Function.from(60000),hour:Function.from(3600000),day:Function.from(86400000),week:Function.from(608400000),month:function(q,p){var r=new i;
|
66
|
+
return i.daysInMonth(q!=null?q:r.get("mo"),p!=null?p:r.get("year"))*86400000;},year:function(p){p=p||new i().get("year");return i.isLeapYear(p)?31622400000:31536000000;
|
67
|
+
}},daysInMonth:function(q,p){return[31,i.isLeapYear(p)?29:28,31,30,31,30,31,31,30,31,30,31][q];},isLeapYear:function(p){return((p%4===0)&&(p%100!==0))||(p%400===0);
|
68
|
+
},parse:function(r){var q=typeOf(r);if(q=="number"){return new i(r);}if(q!="string"){return r;}r=r.clean();if(!r.length){return null;}var p;g.some(function(t){var s=t.re.exec(r);
|
69
|
+
return(s)?(p=t.handler(s)):false;});return p||new i(e(r));},parseDay:function(p,q){return n("day",p,q);},parseMonth:function(q,p){return n("month",q,p);
|
70
|
+
},parseUTC:function(q){var p=new i(q);var r=i.UTC(p.get("year"),p.get("mo"),p.get("date"),p.get("hr"),p.get("min"),p.get("sec"),p.get("ms"));return new i(r);
|
71
|
+
},orderIndex:function(p){return i.getMsg("dateOrder").indexOf(p)+1;},defineFormat:function(p,q){k[p]=q;},defineFormats:function(p){for(var q in p){i.defineFormat(q,p[q]);
|
72
|
+
}},defineParser:function(p){g.push((p.re&&p.handler)?p:l(p));},defineParsers:function(){Array.flatten(arguments).each(i.defineParser);},define2DigitYearStart:function(p){h=p%100;
|
73
|
+
m=p-h;}});var m=1900;var h=70;var j=function(p){return new RegExp("(?:"+i.getMsg(p).map(function(q){return q.substr(0,3);}).join("|")+")[a-z]*");};var a=function(p){switch(p){case"x":return((i.orderIndex("month")==1)?"%m[-./]%d":"%d[-./]%m")+"([-./]%y)?";
|
74
|
+
case"X":return"%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%T?";}return null;};var o={d:/[0-2]?[0-9]|3[01]/,H:/[01]?[0-9]|2[0-3]/,I:/0?[1-9]|1[0-2]/,M:/[0-5]?\d/,s:/\d+/,o:/[a-z]*/,p:/[ap]\.?m\.?/,y:/\d{2}|\d{4}/,Y:/\d{4}/,T:/Z|[+-]\d{2}(?::?\d{2})?/};
|
75
|
+
o.m=o.I;o.S=o.M;var c;var b=function(p){c=p;o.a=o.A=j("days");o.b=o.B=j("months");g.each(function(r,q){if(r.format){g[q]=l(r.format);}});};var l=function(r){if(!c){return{format:r};
|
76
|
+
}var p=[];var q=(r.source||r).replace(/%([a-z])/gi,function(t,s){return a(s)||t;}).replace(/\((?!\?)/g,"(?:").replace(/ (?!\?|\*)/g,",? ").replace(/%([a-z%])/gi,function(t,s){var u=o[s];
|
77
|
+
if(!u){return s;}p.push(s);return"("+u.source+")";}).replace(/\[a-z\]/gi,"[a-z\\u00c0-\\uffff;&]");return{format:r,re:new RegExp("^"+q+"$","i"),handler:function(v){v=v.slice(1).associate(p);
|
78
|
+
var s=new i().clearTime(),u=v.y||v.Y;if(u!=null){f.call(s,"y",u);}if("d" in v){f.call(s,"d",1);}if("m" in v||"b" in v||"B" in v){f.call(s,"m",1);}for(var t in v){f.call(s,t,v[t]);
|
79
|
+
}return s;}};};var f=function(p,q){if(!q){return this;}switch(p){case"a":case"A":return this.set("day",i.parseDay(q,true));case"b":case"B":return this.set("mo",i.parseMonth(q,true));
|
80
|
+
case"d":return this.set("date",q);case"H":case"I":return this.set("hr",q);case"m":return this.set("mo",q-1);case"M":return this.set("min",q);case"p":return this.set("ampm",q.replace(/\./g,""));
|
81
|
+
case"S":return this.set("sec",q);case"s":return this.set("ms",("0."+q)*1000);case"w":return this.set("day",q);case"Y":return this.set("year",q);case"y":q=+q;
|
82
|
+
if(q<100){q+=m+(q<h?100:0);}return this.set("year",q);case"T":if(q=="Z"){q="+00";}var r=q.match(/([+-])(\d{2}):?(\d{2})?/);r=(r[1]+"1")*(r[2]*60+(+r[3]||0))+this.getTimezoneOffset();
|
83
|
+
return this.set("time",this-r*60000);}return this;};i.defineParsers("%Y([-./]%m([-./]%d((T| )%X)?)?)?","%Y%m%d(T%H(%M%S?)?)?","%x( %X)?","%d%o( %b( %Y)?)?( %X)?","%b( %d%o)?( %Y)?( %X)?","%Y %b( %d%o( %X)?)?","%o %b %d %X %T %Y");
|
84
|
+
Locale.addEvent("change",function(p){if(Locale.get("Date")){b(p);}}).fireEvent("change",Locale.getCurrent());})();Date.implement({timeDiffInWords:function(a){return Date.distanceOfTimeInWords(this,a||new Date);
|
85
|
+
},timeDiff:function(g,b){if(g==null){g=new Date;}var f=((g-this)/1000).toInt();if(!f){return"0s";}var a={s:60,m:60,h:24,d:365,y:0};var e,d=[];for(var c in a){if(!f){break;
|
86
|
+
}if((e=a[c])){d.unshift((f%e)+c);f=(f/e).toInt();}else{d.unshift(f+c);}}return d.join(b||":");}});Date.alias("timeAgoInWords","timeDiffInWords");Date.extend({distanceOfTimeInWords:function(b,a){return Date.getTimePhrase(((a-b)/1000).toInt());
|
87
|
+
},getTimePhrase:function(f){var d=(f<0)?"Until":"Ago";if(f<0){f*=-1;}var b={minute:60,hour:60,day:24,week:7,month:52/12,year:12,eon:Infinity};var e="lessThanMinute";
|
88
|
+
for(var c in b){var a=b[c];if(f<1.5*a){if(f>0.75*a){e=c;}break;}f/=a;e=c+"s";}f=f.round();return Date.getMsg(e+d,f).substitute({delta:f});}});Date.defineParsers({re:/^(?:tod|tom|yes)/i,handler:function(a){var b=new Date().clearTime();
|
89
|
+
switch(a[0]){case"tom":return b.increment();case"yes":return b.decrement();default:return b;}}},{re:/^(next|last) ([a-z]+)$/i,handler:function(e){var f=new Date().clearTime();
|
90
|
+
var b=f.getDay();var c=Date.parseDay(e[2],true);var a=c-b;if(c<=b){a+=7;}if(e[1]=="last"){a-=7;}return f.set("date",f.getDate()+a);}});Locale.define("en-US","Number",{decimal:".",group:",",currency:{prefix:"$ "}});
|
91
|
+
Number.implement({format:function(q){var n=this;if(!q){q={};}var a=function(i){if(q[i]!=null){return q[i];}return Locale.get("Number."+i);};var f=n<0,h=a("decimal"),k=a("precision"),o=a("group"),c=a("decimals");
|
92
|
+
if(f){var e=Locale.get("Number.negative")||{};if(e.prefix==null&&e.suffix==null){e.prefix="-";}Object.each(e,function(r,i){q[i]=(i=="prefix"||i=="suffix")?(a(i)+r):r;
|
93
|
+
});n=-n;}var l=a("prefix"),p=a("suffix");if(c>0&&c<=20){n=n.toFixed(c);}if(k>=1&&k<=21){n=n.toPrecision(k);}n+="";if(a("scientific")===false&&n.indexOf("e")>-1){var j=n.split("e"),m,b=+j[1];
|
94
|
+
n=j[0].replace(".","");if(b<0){b=-b-1;m=j[0].indexOf(".");if(m>-1){b-=m-1;}while(b--){n="0"+n;}n="0."+n;}else{m=j[0].lastIndexOf(".");if(m>-1){b-=j[0].length-m-1;
|
95
|
+
}while(b--){n+="0";}}}if(h!="."){n=n.replace(".",h);}if(o){m=n.lastIndexOf(h);m=(m>-1)?m:n.length;var d=n.substring(m),g=m;while(g--){if((m-g-1)%3==0&&g!=(m-1)){d=o+d;
|
96
|
+
}d=n.charAt(g)+d;}n=d;}if(l){n=l+n;}if(p){n+=p;}return n;},formatCurrency:function(){var a=Locale.get("Number.currency")||{};if(a.scientific==null){a.scientific=false;
|
97
|
+
}if(a.decimals==null){a.decimals=2;}return this.format(a);},formatPercentage:function(){var a=Locale.get("Number.percentage")||{};if(a.suffix==null){a.suffix="%";
|
98
|
+
}if(a.decimals==null){a.decimals=2;}return this.format(a);}});(function(){var c={a:/[àáâãäåăą]/g,A:/[ÀÁÂÃÄÅĂĄ]/g,c:/[ćčç]/g,C:/[ĆČÇ]/g,d:/[ďđ]/g,D:/[ĎÐ]/g,e:/[èéêëěę]/g,E:/[ÈÉÊËĚĘ]/g,g:/[ğ]/g,G:/[Ğ]/g,i:/[ìíîï]/g,I:/[ÌÍÎÏ]/g,l:/[ĺľł]/g,L:/[ĹĽŁ]/g,n:/[ñňń]/g,N:/[ÑŇŃ]/g,o:/[òóôõöøő]/g,O:/[ÒÓÔÕÖØ]/g,r:/[řŕ]/g,R:/[ŘŔ]/g,s:/[ššş]/g,S:/[ŠŞŚ]/g,t:/[ťţ]/g,T:/[ŤŢ]/g,ue:/[ü]/g,UE:/[Ü]/g,u:/[ùúûůµ]/g,U:/[ÙÚÛŮ]/g,y:/[ÿý]/g,Y:/[ŸÝ]/g,z:/[žźż]/g,Z:/[ŽŹŻ]/g,th:/[þ]/g,TH:/[Þ]/g,dh:/[ð]/g,DH:/[Ð]/g,ss:/[ß]/g,oe:/[œ]/g,OE:/[Œ]/g,ae:/[æ]/g,AE:/[Æ]/g},b={" ":/[\xa0\u2002\u2003\u2009]/g,"*":/[\xb7]/g,"'":/[\u2018\u2019]/g,'"':/[\u201c\u201d]/g,"...":/[\u2026]/g,"-":/[\u2013]/g,"»":/[\uFFFD]/g};
|
99
|
+
var a=function(f,g){var e=f;for(key in g){e=e.replace(g[key],key);}return e;};var d=function(e,f){e=e||"";var g=f?"<"+e+"(?!\\w)[^>]*>([\\s\\S]*?)</"+e+"(?!\\w)>":"</?"+e+"([^>]+)?>";
|
100
|
+
reg=new RegExp(g,"gi");return reg;};String.implement({standardize:function(){return a(this,c);},repeat:function(e){return new Array(e+1).join(this);},pad:function(e,h,g){if(this.length>=e){return this;
|
101
|
+
}var f=(h==null?" ":""+h).repeat(e-this.length).substr(0,e-this.length);if(!g||g=="right"){return this+f;}if(g=="left"){return f+this;}return f.substr(0,(f.length/2).floor())+this+f.substr(0,(f.length/2).ceil());
|
102
|
+
},getTags:function(e,f){return this.match(d(e,f))||[];},stripTags:function(e,f){return this.replace(d(e,f),"");},tidy:function(){return a(this,b);}});})();
|
103
|
+
(function(){if(this.Hash){return;}var a=this.Hash=new Type("Hash",function(b){if(typeOf(b)=="hash"){b=Object.clone(b.getClean());}for(var c in b){this[c]=b[c];
|
104
|
+
}return this;});this.$H=function(b){return new a(b);};a.implement({forEach:function(b,c){Object.forEach(this,b,c);},getClean:function(){var c={};for(var b in this){if(this.hasOwnProperty(b)){c[b]=this[b];
|
105
|
+
}}return c;},getLength:function(){var c=0;for(var b in this){if(this.hasOwnProperty(b)){c++;}}return c;}});a.alias("each","forEach");a.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){return Object.keyOf(this,b);
|
106
|
+
},hasValue:function(b){return Object.contains(this,b);},extend:function(b){a.each(b||{},function(d,c){a.set(this,c,d);},this);return this;},combine:function(b){a.each(b||{},function(d,c){a.include(this,c,d);
|
107
|
+
},this);return this;},erase:function(b){if(this.hasOwnProperty(b)){delete this[b];}return this;},get:function(b){return(this.hasOwnProperty(b))?this[b]:null;
|
108
|
+
},set:function(b,c){if(!this[b]||this.hasOwnProperty(b)){this[b]=c;}return this;},empty:function(){a.each(this,function(c,b){delete this[b];},this);return this;
|
109
|
+
},include:function(b,c){if(this[b]==undefined){this[b]=c;}return this;},map:function(b,c){return new a(Object.map(this,b,c));},filter:function(b,c){return new a(Object.filter(this,b,c));
|
110
|
+
},every:function(b,c){return Object.every(this,b,c);},some:function(b,c){return Object.some(this,b,c);},getKeys:function(){return Object.keys(this);},getValues:function(){return Object.values(this);
|
111
|
+
},toQueryString:function(b){return Object.toQueryString(this,b);}});a.alias({indexOf:"keyOf",contains:"hasValue"});})();Hash.implement({getFromPath:function(a){return Object.getFromPath(this,a);
|
112
|
+
},cleanValues:function(a){return new Hash(Object.cleanValues(this,a));},run:function(){Object.run(arguments);}});Element.implement({tidy:function(){this.set("value",this.get("value").tidy());
|
113
|
+
},getTextInRange:function(b,a){return this.get("value").substring(b,a);},getSelectedText:function(){if(this.setSelectionRange){return this.getTextInRange(this.getSelectionStart(),this.getSelectionEnd());
|
114
|
+
}return document.selection.createRange().text;},getSelectedRange:function(){if(this.selectionStart!=null){return{start:this.selectionStart,end:this.selectionEnd};
|
115
|
+
}var e={start:0,end:0};var a=this.getDocument().selection.createRange();if(!a||a.parentElement()!=this){return e;}var c=a.duplicate();if(this.type=="text"){e.start=0-c.moveStart("character",-100000);
|
116
|
+
e.end=e.start+a.text.length;}else{var b=this.get("value");var d=b.length;c.moveToElementText(this);c.setEndPoint("StartToEnd",a);if(c.text.length){d-=b.match(/[\n\r]*$/)[0].length;
|
117
|
+
}e.end=d-c.text.length;c.setEndPoint("StartToStart",a);e.start=d-c.text.length;}return e;},getSelectionStart:function(){return this.getSelectedRange().start;
|
118
|
+
},getSelectionEnd:function(){return this.getSelectedRange().end;},setCaretPosition:function(a){if(a=="end"){a=this.get("value").length;}this.selectRange(a,a);
|
119
|
+
return this;},getCaretPosition:function(){return this.getSelectedRange().start;},selectRange:function(e,a){if(this.setSelectionRange){this.focus();this.setSelectionRange(e,a);
|
120
|
+
}else{var c=this.get("value");var d=c.substr(e,a-e).replace(/\r/g,"").length;e=c.substr(0,e).replace(/\r/g,"").length;var b=this.createTextRange();b.collapse(true);
|
121
|
+
b.moveEnd("character",e+d);b.moveStart("character",e);b.select();}return this;},insertAtCursor:function(b,a){var d=this.getSelectedRange();var c=this.get("value");
|
122
|
+
this.set("value",c.substring(0,d.start)+b+c.substring(d.end,c.length));if(a!==false){this.selectRange(d.start,d.start+b.length);}else{this.setCaretPosition(d.start+b.length);
|
123
|
+
}return this;},insertAroundCursor:function(b,a){b=Object.append({before:"",defaultMiddle:"",after:""},b);var c=this.getSelectedText()||b.defaultMiddle;
|
124
|
+
var g=this.getSelectedRange();var f=this.get("value");if(g.start==g.end){this.set("value",f.substring(0,g.start)+b.before+c+b.after+f.substring(g.end,f.length));
|
125
|
+
this.selectRange(g.start+b.before.length,g.end+b.before.length+c.length);}else{var d=f.substring(g.start,g.end);this.set("value",f.substring(0,g.start)+b.before+d+b.after+f.substring(g.end,f.length));
|
126
|
+
var e=g.start+b.before.length;if(a!==false){this.selectRange(e,e+d.length);}else{this.setCaretPosition(e+f.length);}}return this;}});Elements.from=function(e,d){if(d||d==null){e=e.stripScripts();
|
127
|
+
}var b,c=e.match(/^\s*<(t[dhr]|tbody|tfoot|thead)/i);if(c){b=new Element("table");var a=c[1].toLowerCase();if(["td","th","tr"].contains(a)){b=new Element("tbody").inject(b);
|
128
|
+
if(a!="tr"){b=new Element("tr").inject(b);}}}return(b||new Element("div")).set("html",e).getChildren();};(function(){var b={once:function(d,e,c){e.apply(this,c);
|
129
|
+
this.removeEvent(d.original,e);}};Event.definePseudo=function(d,e,c){b[d]=[e,c];};var a=Element.prototype;[Element,Window,Document].invoke("implement",Events.Pseudos(b,a.addEvent,a.removeEvent));
|
130
|
+
})();(function(){var a="$moo:keys-pressed",b="$moo:keys-keyup";Event.definePseudo("keys",function(d,e,c){var g=c[0],f=[],h=this.retrieve(a,[]);f.append(d.value.replace("++",function(){f.push("+");
|
131
|
+
return"";}).split("+"));h.include(g.key);if(f.every(function(j){return h.contains(j);})){e.apply(this,c);}this.store(a,h);if(!this.retrieve(b)){var i=function(j){(function(){h=this.retrieve(a,[]).erase(j.key);
|
132
|
+
this.store(a,h);}).delay(0,this);};this.store(b,i).addEvent("keyup",i);}});Object.append(Event.Keys,{shift:16,control:17,alt:18,capslock:20,pageup:33,pagedown:34,end:35,home:36,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":Browser.firefox?109:189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222,"+":107});
|
133
|
+
})();Event.definePseudo("relay",function(d,e,b,c){var f=b[0];var a=c?c.condition:null;for(var h=f.target;h&&h!=this;h=h.parentNode){var g=document.id(h);
|
134
|
+
if(Slick.match(h,d.value)&&(!a||a.call(g,f))){if(g){e.call(g,f,g);}return;}}},{mouseenter:{base:"mouseover",condition:Element.Events.mouseenter.condition},mouseleave:{base:"mouseout",condition:Element.Events.mouseleave.condition}});
|
135
|
+
(function(){var a=function(d,c){var e=[];Object.each(c,function(f){Object.each(f,function(g){d.each(function(h){e.push(h+"-"+g+(h=="border"?"-width":""));
|
136
|
+
});});});return e;};var b=function(e,d){var c=0;Object.each(d,function(g,f){if(f.test(e)){c=c+g.toInt();}});return c;};Element.implement({measure:function(h){var d=function(j){return !!(!j||j.offsetHeight||j.offsetWidth);
|
137
|
+
};if(d(this)){return h.apply(this);}var g=this.getParent(),i=[],e=[];while(!d(g)&&g!=document.body){e.push(g.expose());g=g.getParent();}var f=this.expose();
|
138
|
+
var c=h.apply(this);f();e.each(function(j){j();});return c;},expose:function(){if(this.getStyle("display")!="none"){return function(){};}var c=this.style.cssText;
|
139
|
+
this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=c;}.bind(this);},getDimensions:function(c){c=Object.merge({computeSize:false},c);
|
140
|
+
var h={x:0,y:0};var g=function(i,e){return(e.computeSize)?i.getComputedSize(e):i.getSize();};var d=this.getParent("body");if(d&&this.getStyle("display")=="none"){h=this.measure(function(){return g(this,c);
|
141
|
+
});}else{if(d){try{h=g(this,c);}catch(f){}}}return Object.append(h,(h.x||h.x===0)?{width:h.x,height:h.y}:{x:h.width,y:h.height});},getComputedSize:function(c){c=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},c);
|
142
|
+
var e={},d={width:0,height:0};if(c.mode=="vertical"){delete d.width;delete c.planes.width;}else{if(c.mode=="horizontal"){delete d.height;delete c.planes.height;
|
143
|
+
}}a(c.styles,c.planes).each(function(f){e[f]=this.getStyle(f).toInt();},this);Object.each(c.planes,function(g,f){var h=f.capitalize();e[f]=this.getStyle(f).toInt();
|
144
|
+
d["total"+h]=e[f];g.each(function(j){var i=b(j,e);d["computed"+j.capitalize()]=i;d["total"+h]+=i;});},this);return Object.append(d,e);}});})();Class.Occlude=new Class({occlude:function(c,b){b=document.id(b||this.element);
|
145
|
+
var a=b.retrieve(c||this.property);if(a&&this.occluded!=null){return this.occluded=a;}this.occluded=false;b.store(c||this.property,this);return this.occluded;
|
146
|
+
}});(function(){var a=Element.prototype.position;Element.implement({position:function(g){if(g&&(g.x!=null||g.y!=null)){return a?a.apply(this,arguments):this;
|
147
|
+
}Object.each(g||{},function(u,t){if(u==null){delete g[t];}});g=Object.merge({relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},g);
|
148
|
+
var r={x:0,y:0},e=false;var c=this.measure(function(){return document.id(this.getOffsetParent());});if(c&&c!=this.getDocument().body){r=c.measure(function(){return this.getPosition();
|
149
|
+
});e=c!=document.id(g.relativeTo);g.offset.x=g.offset.x-r.x;g.offset.y=g.offset.y-r.y;}var s=function(t){if(typeOf(t)!="string"){return t;}t=t.toLowerCase();
|
150
|
+
var u={};if(t.test("left")){u.x="left";}else{if(t.test("right")){u.x="right";}else{u.x="center";}}if(t.test("upper")||t.test("top")){u.y="top";}else{if(t.test("bottom")){u.y="bottom";
|
151
|
+
}else{u.y="center";}}return u;};g.edge=s(g.edge);g.position=s(g.position);if(!g.edge){if(g.position.x=="center"&&g.position.y=="center"){g.edge={x:"center",y:"center"};
|
152
|
+
}else{g.edge={x:"left",y:"top"};}}this.setStyle("position","absolute");var f=document.id(g.relativeTo)||document.body,d=f==document.body?window.getScroll():f.getPosition(),l=d.y,h=d.x;
|
153
|
+
var n=this.getDimensions({computeSize:true,styles:["padding","border","margin"]});var j={},o=g.offset.y,q=g.offset.x,k=window.getSize();switch(g.position.x){case"left":j.x=h+q;
|
154
|
+
break;case"right":j.x=h+q+f.offsetWidth;break;default:j.x=h+((f==document.body?k.x:f.offsetWidth)/2)+q;break;}switch(g.position.y){case"top":j.y=l+o;break;
|
155
|
+
case"bottom":j.y=l+o+f.offsetHeight;break;default:j.y=l+((f==document.body?k.y:f.offsetHeight)/2)+o;break;}if(g.edge){var b={};switch(g.edge.x){case"left":b.x=0;
|
156
|
+
break;case"right":b.x=-n.x-n.computedRight-n.computedLeft;break;default:b.x=-(n.totalWidth/2);break;}switch(g.edge.y){case"top":b.y=0;break;case"bottom":b.y=-n.y-n.computedTop-n.computedBottom;
|
157
|
+
break;default:b.y=-(n.totalHeight/2);break;}j.x+=b.x;j.y+=b.y;}j={left:((j.x>=0||e||g.allowNegative)?j.x:0).toInt(),top:((j.y>=0||e||g.allowNegative)?j.y:0).toInt()};
|
158
|
+
var i={left:"x",top:"y"};["minimum","maximum"].each(function(t){["left","top"].each(function(u){var v=g[t]?g[t][i[u]]:null;if(v!=null&&((t=="minimum")?j[u]<v:j[u]>v)){j[u]=v;
|
159
|
+
}});});if(f.getStyle("position")=="fixed"||g.relFixedPosition){var m=window.getScroll();j.top+=m.y;j.left+=m.x;}if(g.ignoreScroll){var p=f.getScroll();
|
160
|
+
j.top-=p.y;j.left-=p.x;}if(g.ignoreMargins){j.left+=(g.edge.x=="right"?n["margin-right"]:g.edge.x=="center"?-n["margin-left"]+((n["margin-right"]+n["margin-left"])/2):-n["margin-left"]);
|
161
|
+
j.top+=(g.edge.y=="bottom"?n["margin-bottom"]:g.edge.y=="center"?-n["margin-top"]+((n["margin-bottom"]+n["margin-top"])/2):-n["margin-top"]);}j.left=Math.ceil(j.left);
|
162
|
+
j.top=Math.ceil(j.top);if(g.returnPos){return j;}else{this.setStyles(j);}return this;}});})();var IframeShim=new Class({Implements:[Options,Events,Class.Occlude],options:{className:"iframeShim",src:'javascript:false;document.write("");',display:false,zIndex:null,margin:0,offset:{x:0,y:0},browsers:((Browser.ie&&Browser.version==6)||(Browser.firefox&&Browser.version<3&&Browser.Platform.mac))},property:"IframeShim",initialize:function(b,a){this.element=document.id(b);
|
163
|
+
if(this.occlude()){return this.occluded;}this.setOptions(a);this.makeShim();return this;},makeShim:function(){if(this.options.browsers){var c=this.element.getStyle("zIndex").toInt();
|
164
|
+
if(!c){c=1;var b=this.element.getStyle("position");if(b=="static"||!b){this.element.setStyle("position","relative");}this.element.setStyle("zIndex",c);
|
165
|
+
}c=((this.options.zIndex!=null||this.options.zIndex===0)&&c>this.options.zIndex)?this.options.zIndex:c-1;if(c<0){c=1;}this.shim=new Element("iframe",{src:this.options.src,scrolling:"no",frameborder:0,styles:{zIndex:c,position:"absolute",border:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"},"class":this.options.className}).store("IframeShim",this);
|
166
|
+
var a=(function(){this.shim.inject(this.element,"after");this[this.options.display?"show":"hide"]();this.fireEvent("inject");}).bind(this);if(!IframeShim.ready){window.addEvent("load",a);
|
167
|
+
}else{a();}}else{this.position=this.hide=this.show=this.dispose=Function.from(this);}},position:function(){if(!IframeShim.ready||!this.shim){return this;
|
168
|
+
}var a=this.element.measure(function(){return this.getSize();});if(this.options.margin!=undefined){a.x=a.x-(this.options.margin*2);a.y=a.y-(this.options.margin*2);
|
169
|
+
this.options.offset.x+=this.options.margin;this.options.offset.y+=this.options.margin;}this.shim.set({width:a.x,height:a.y}).position({relativeTo:this.element,offset:this.options.offset});
|
170
|
+
return this;},hide:function(){if(this.shim){this.shim.setStyle("display","none");}return this;},show:function(){if(this.shim){this.shim.setStyle("display","block");
|
171
|
+
}return this.position();},dispose:function(){if(this.shim){this.shim.dispose();}return this;},destroy:function(){if(this.shim){this.shim.destroy();}return this;
|
172
|
+
}});window.addEvent("load",function(){IframeShim.ready=true;});var Mask=new Class({Implements:[Options,Events],Binds:["position"],options:{style:{},"class":"mask",maskMargins:false,useIframeShim:true,iframeShimOptions:{}},initialize:function(b,a){this.target=document.id(b)||document.id(document.body);
|
173
|
+
this.target.store("mask",this);this.setOptions(a);this.render();this.inject();},render:function(){this.element=new Element("div",{"class":this.options["class"],id:this.options.id||"mask-"+String.uniqueID(),styles:Object.merge(this.options.style,{display:"none"}),events:{click:function(){this.fireEvent("click");
|
174
|
+
if(this.options.hideOnClick){this.hide();}}.bind(this)}});this.hidden=true;},toElement:function(){return this.element;},inject:function(b,a){a=a||(this.options.inject?this.options.inject.where:"")||this.target==document.body?"inside":"after";
|
175
|
+
b=b||(this.options.inject?this.options.inject.target:"")||this.target;this.element.inject(b,a);if(this.options.useIframeShim){this.shim=new IframeShim(this.element,this.options.iframeShimOptions);
|
176
|
+
this.addEvents({show:this.shim.show.bind(this.shim),hide:this.shim.hide.bind(this.shim),destroy:this.shim.destroy.bind(this.shim)});}},position:function(){this.resize(this.options.width,this.options.height);
|
177
|
+
this.element.position({relativeTo:this.target,position:"topLeft",ignoreMargins:!this.options.maskMargins,ignoreScroll:this.target==document.body});return this;
|
178
|
+
},resize:function(a,e){var b={styles:["padding","border"]};if(this.options.maskMargins){b.styles.push("margin");}var d=this.target.getComputedSize(b);if(this.target==document.body){var c=window.getScrollSize();
|
179
|
+
if(d.totalHeight<c.y){d.totalHeight=c.y;}if(d.totalWidth<c.x){d.totalWidth=c.x;}}this.element.setStyles({width:Array.pick([a,d.totalWidth,d.x]),height:Array.pick([e,d.totalHeight,d.y])});
|
180
|
+
return this;},show:function(){if(!this.hidden){return this;}window.addEvent("resize",this.position);this.position();this.showMask.apply(this,arguments);
|
181
|
+
return this;},showMask:function(){this.element.setStyle("display","block");this.hidden=false;this.fireEvent("show");},hide:function(){if(this.hidden){return this;
|
182
|
+
}window.removeEvent("resize",this.position);this.hideMask.apply(this,arguments);if(this.options.destroyOnHide){return this.destroy();}return this;},hideMask:function(){this.element.setStyle("display","none");
|
183
|
+
this.hidden=true;this.fireEvent("hide");},toggle:function(){this[this.hidden?"show":"hide"]();},destroy:function(){this.hide();this.element.destroy();this.fireEvent("destroy");
|
184
|
+
this.target.eliminate("mask");}});Element.Properties.mask={set:function(b){var a=this.retrieve("mask");if(a){a.destroy();}return this.eliminate("mask").store("mask:options",b);
|
185
|
+
},get:function(){var a=this.retrieve("mask");if(!a){a=new Mask(this,this.retrieve("mask:options"));this.store("mask",a);}return a;}};Element.implement({mask:function(a){if(a){this.set("mask",a);
|
186
|
+
}this.get("mask").show();return this;},unmask:function(){this.get("mask").hide();return this;}});var Spinner=new Class({Extends:Mask,Implements:Chain,options:{"class":"spinner",containerPosition:{},content:{"class":"spinner-content"},messageContainer:{"class":"spinner-msg"},img:{"class":"spinner-img"},fxOptions:{link:"chain"}},initialize:function(c,a){this.target=document.id(c)||document.id(document.body);
|
187
|
+
this.target.store("spinner",this);this.setOptions(a);this.render();this.inject();var b=function(){this.active=false;}.bind(this);this.addEvents({hide:b,show:b});
|
188
|
+
},render:function(){this.parent();this.element.set("id",this.options.id||"spinner-"+String.uniqueID());this.content=document.id(this.options.content)||new Element("div",this.options.content);
|
189
|
+
this.content.inject(this.element);if(this.options.message){this.msg=document.id(this.options.message)||new Element("p",this.options.messageContainer).appendText(this.options.message);
|
190
|
+
this.msg.inject(this.content);}if(this.options.img){this.img=document.id(this.options.img)||new Element("div",this.options.img);this.img.inject(this.content);
|
191
|
+
}this.element.set("tween",this.options.fxOptions);},show:function(a){if(this.active){return this.chain(this.show.bind(this));}if(!this.hidden){this.callChain.delay(20,this);
|
192
|
+
return this;}this.active=true;return this.parent(a);},showMask:function(a){var b=function(){this.content.position(Object.merge({relativeTo:this.element},this.options.containerPosition));
|
193
|
+
}.bind(this);if(a){this.parent();b();}else{if(!this.options.style.opacity){this.options.style.opacity=this.element.getStyle("opacity").toFloat();}this.element.setStyles({display:"block",opacity:0}).tween("opacity",this.options.style.opacity);
|
194
|
+
b();this.hidden=false;this.fireEvent("show");this.callChain();}},hide:function(a){if(this.active){return this.chain(this.hide.bind(this));}if(this.hidden){this.callChain.delay(20,this);
|
195
|
+
return this;}this.active=true;return this.parent(a);},hideMask:function(a){if(a){return this.parent();}this.element.tween("opacity",0).get("tween").chain(function(){this.element.setStyle("display","none");
|
196
|
+
this.hidden=true;this.fireEvent("hide");this.callChain();}.bind(this));},destroy:function(){this.content.destroy();this.parent();this.target.eliminate("spinner");
|
197
|
+
}});Request=Class.refactor(Request,{options:{useSpinner:false,spinnerOptions:{},spinnerTarget:false},initialize:function(a){this._send=this.send;this.send=function(b){var c=this.getSpinner();
|
198
|
+
if(c){c.chain(this._send.pass(b,this)).show();}else{this._send(b);}return this;};this.previous(a);},getSpinner:function(){if(!this.spinner){var b=document.id(this.options.spinnerTarget)||document.id(this.options.update);
|
199
|
+
if(this.options.useSpinner&&b){b.set("spinner",this.options.spinnerOptions);var a=this.spinner=b.get("spinner");["complete","exception","cancel"].each(function(c){this.addEvent(c,a.hide.bind(a));
|
200
|
+
},this);}}return this.spinner;}});Element.Properties.spinner={set:function(a){var b=this.retrieve("spinner");if(b){b.destroy();}return this.eliminate("spinner").store("spinner:options",a);
|
201
|
+
},get:function(){var a=this.retrieve("spinner");if(!a){a=new Spinner(this,this.retrieve("spinner:options"));this.store("spinner",a);}return a;}};Element.implement({spin:function(a){if(a){this.set("spinner",a);
|
202
|
+
}this.get("spinner").show();return this;},unspin:function(){this.get("spinner").hide();return this;}});String.implement({parseQueryString:function(d,a){if(d==null){d=true;
|
203
|
+
}if(a==null){a=true;}var c=this.split(/[&;]/),b={};if(!c.length){return b;}c.each(function(i){var e=i.indexOf("="),g=i.substr(e+1),f=e<0?[""]:i.substr(0,e).match(/([^\]\[]+|(\B)(?=\]))/g),h=b;
|
204
|
+
if(a){g=decodeURIComponent(g);}f.each(function(k,j){if(d){k=decodeURIComponent(k);}var l=h[k];if(j<f.length-1){h=h[k]=l||{};}else{if(typeOf(l)=="array"){l.push(g);
|
205
|
+
}else{h[k]=l!=null?[l,g]:g;}}});});return b;},cleanQueryString:function(a){return this.split("&").filter(function(e){var b=e.indexOf("="),c=b<0?"":e.substr(0,b),d=e.substr(b+1);
|
206
|
+
return a?a.call(null,c,d):(d||d===0);}).join("&");}});if(!window.Form){window.Form={};}(function(){Form.Request=new Class({Binds:["onSubmit","onFormValidate"],Implements:[Options,Events,Class.Occlude],options:{requestOptions:{evalScripts:true,useSpinner:true,emulation:false,link:"ignore"},sendButtonClicked:true,extraData:{},resetForm:true},property:"form.request",initialize:function(b,c,a){this.element=document.id(b);
|
207
|
+
if(this.occlude()){return this.occluded;}this.update=document.id(c);this.setOptions(a);this.makeRequest();if(this.options.resetForm){this.request.addEvent("success",function(){Function.attempt(function(){this.element.reset();
|
208
|
+
}.bind(this));if(window.OverText){OverText.update();}}.bind(this));}this.attach();},toElement:function(){return this.element;},makeRequest:function(){this.request=new Request.HTML(Object.merge({update:this.update,emulation:false,spinnerTarget:this.element,method:this.element.get("method")||"post"},this.options.requestOptions)).addEvents({success:function(b,d,c,a){["complete","success"].each(function(e){this.fireEvent(e,[this.update,b,d,c,a]);
|
209
|
+
},this);}.bind(this),failure:function(){this.fireEvent("complete",arguments).fireEvent("failure",arguments);}.bind(this),exception:function(){this.fireEvent("failure",arguments);
|
210
|
+
}.bind(this)});},attach:function(a){a=a!=null?a:true;method=a?"addEvent":"removeEvent";this.element[method]("click:relay(button, input[type=submit])",this.saveClickedButton.bind(this));
|
211
|
+
var b=this.element.retrieve("validator");if(b){b[method]("onFormValidate",this.onFormValidate);}else{this.element[method]("submit",this.onSubmit);}},detach:function(){this.attach(false);
|
212
|
+
return this;},enable:function(){this.attach();return this;},disable:function(){this.detach();return this;},onFormValidate:function(b,a,d){if(!d){return;
|
213
|
+
}var c=this.element.retrieve("validator");if(b||(c&&!c.options.stopOnFailure)){if(d&&d.stop){d.stop();}this.send();}},onSubmit:function(b){var a=this.element.retrieve("validator");
|
214
|
+
if(a){this.element.removeEvent("submit",this.onSubmit);a.addEvent("onFormValidate",this.onFormValidate);this.element.validate();return;}if(b){b.stop();
|
215
|
+
}this.send();},saveClickedButton:function(a,b){if(!this.options.sendButtonClicked){return;}if(!b.get("name")){return;}this.options.extraData[b.get("name")]=b.get("value")||true;
|
216
|
+
this.clickedCleaner=function(){delete this.options.extraData[b.get("name")];this.clickedCleaner=function(){};}.bind(this);},clickedCleaner:function(){},send:function(){var b=this.element.toQueryString().trim();
|
217
|
+
var a=Object.toQueryString(this.options.extraData);if(b){b+="&"+a;}else{b=a;}this.fireEvent("send",[this.element,b.parseQueryString()]);this.request.send({data:b,url:this.element.get("action")});
|
218
|
+
this.clickedCleaner();return this;}});Element.Properties.formRequest={set:function(){var a=Array.link(arguments,{options:Type.isObject,update:Type.isElement,updateId:Type.isString});
|
219
|
+
var c=a.update||a.updateId;var b=this.retrieve("form.request");if(c){if(b){b.update=document.id(c);}this.store("form.request:update",c);}if(a.options){if(b){b.setOptions(a.options);
|
220
|
+
}this.store("form.request:options",a.options);}return this;},get:function(){var a=Array.link(arguments,{options:Type.isObject,update:Type.isElement,updateId:Type.isString});
|
221
|
+
var b=a.update||a.updateId;if(a.options||b||!this.retrieve("form.request")){if(a.options||!this.retrieve("form.request:options")){this.set("form.request",a.options);
|
222
|
+
}if(b){this.set("form.request",b);}this.store("form.request",new Form.Request(this,this.retrieve("form.request:update"),this.retrieve("form.request:options")));
|
223
|
+
}return this.retrieve("form.request");}};Element.implement({formUpdate:function(b,a){this.get("formRequest",b,a).send();return this;}});})();Request.implement({options:{initialDelay:5000,delay:5000,limit:60000},startTimer:function(b){var a=function(){if(!this.running){this.send({data:b});
|
224
|
+
}};this.lastDelay=this.options.initialDelay;this.timer=a.delay(this.lastDelay,this);this.completeCheck=function(c){clearTimeout(this.timer);this.lastDelay=(c)?this.options.delay:(this.lastDelay+this.options.delay).min(this.options.limit);
|
225
|
+
this.timer=a.delay(this.lastDelay,this);};return this.addEvent("complete",this.completeCheck);},stopTimer:function(){clearTimeout(this.timer);return this.removeEvent("complete",this.completeCheck);
|
226
|
+
}});var Asset={javascript:function(d,b){b=Object.append({document:document},b);if(b.onLoad){b.onload=b.onLoad;delete b.onLoad;}var a=new Element("script",{src:d,type:"text/javascript"});
|
227
|
+
var c=b.onload||function(){},e=b.document;delete b.onload;delete b.document;return a.addEvents({load:c,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){c.call(this);
|
228
|
+
}}}).set(b).inject(e.head);},css:function(b,a){a=a||{};var c=a.onload||a.onLoad;if(c){a.events=a.events||{};a.events.load=c;delete a.onload;delete a.onLoad;
|
229
|
+
}return new Element("link",Object.merge({rel:"stylesheet",media:"screen",type:"text/css",href:b},a)).inject(document.head);},image:function(c,b){b=Object.merge({onload:function(){},onabort:function(){},onerror:function(){}},b);
|
230
|
+
var d=new Image();var a=document.id(d)||new Element("img");["load","abort","error"].each(function(e){var g="on"+e;var f=e.capitalize();if(b["on"+f]){b[g]=b["on"+f];
|
231
|
+
delete b["on"+f];}var h=b[g];delete b[g];d[g]=function(){if(!d){return;}if(!a.parentNode){a.width=d.width;a.height=d.height;}d=d.onload=d.onabort=d.onerror=null;
|
232
|
+
h.delay(1,a,a);a.fireEvent(e,a,1);};});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1);}return a.set(b);},images:function(c,b){b=Object.merge({onComplete:function(){},onProgress:function(){},onError:function(){},properties:{}},b);
|
233
|
+
c=Array.from(c);var a=0;return new Elements(c.map(function(e,d){return Asset.image(e,Object.append(b.properties,{onload:function(){a++;b.onProgress.call(this,a,d,e);
|
234
|
+
if(a==c.length){b.onComplete();}},onerror:function(){a++;b.onError.call(this,a,d,e);if(a==c.length){b.onComplete();}}}));}));}};(function(){var d=this.Color=new Type("Color",function(f,g){if(arguments.length>=3){g="rgb";
|
235
|
+
f=Array.slice(arguments,0,3);}else{if(typeof f=="string"){if(f.match(/rgb/)){f=f.rgbToHex().hexToRgb(true);}else{if(f.match(/hsb/)){f=f.hsbToRgb();}else{f=f.hexToRgb(true);
|
236
|
+
}}}}g=g||"rgb";switch(g){case"hsb":var e=f;f=f.hsbToRgb();f.hsb=e;break;case"hex":f=f.hexToRgb(true);break;}f.rgb=f.slice(0,3);f.hsb=f.hsb||f.rgbToHsb();
|
237
|
+
f.hex=f.rgbToHex();return Object.append(f,this);});d.implement({mix:function(){var e=Array.slice(arguments);var g=(typeOf(e.getLast())=="number")?e.pop():50;
|
238
|
+
var f=this.slice();e.each(function(h){h=new d(h);for(var j=0;j<3;j++){f[j]=Math.round((f[j]/100*(100-g))+(h[j]/100*g));}});return new d(f,"rgb");},invert:function(){return new d(this.map(function(e){return 255-e;
|
239
|
+
}));},setHue:function(e){return new d([e,this.hsb[1],this.hsb[2]],"hsb");},setSaturation:function(e){return new d([this.hsb[0],e,this.hsb[2]],"hsb");},setBrightness:function(e){return new d([this.hsb[0],this.hsb[1],e],"hsb");
|
240
|
+
}});var b=function(h,f,e){return new d([h,f,e],"rgb");};var a=function(g,f,e){return new d([g,f,e],"hsb");};var c=function(e){return new d(e,"hex");};Array.implement({rgbToHsb:function(){var f=this[0],g=this[1],n=this[2],k=0;
|
241
|
+
var m=Math.max(f,g,n),i=Math.min(f,g,n);var o=m-i;var l=m/255,j=(m!=0)?o/m:0;if(j!=0){var h=(m-f)/o;var e=(m-g)/o;var p=(m-n)/o;if(f==m){k=p-e;}else{if(g==m){k=2+h-p;
|
242
|
+
}else{k=4+e-h;}}k/=6;if(k<0){k++;}}return[Math.round(k*360),Math.round(j*100),Math.round(l*100)];},hsbToRgb:function(){var h=Math.round(this[2]/100*255);
|
243
|
+
if(this[1]==0){return[h,h,h];}else{var e=this[0]%360;var j=e%60;var k=Math.round((this[2]*(100-this[1]))/10000*255);var i=Math.round((this[2]*(6000-this[1]*j))/600000*255);
|
244
|
+
var g=Math.round((this[2]*(6000-this[1]*(60-j)))/600000*255);switch(Math.floor(e/60)){case 0:return[h,g,k];case 1:return[i,h,k];case 2:return[k,h,g];case 3:return[k,i,h];
|
245
|
+
case 4:return[g,k,h];case 5:return[h,k,i];}}return false;}});String.implement({rgbToHsb:function(){var e=this.match(/\d{1,3}/g);return(e)?e.rgbToHsb():null;
|
246
|
+
},hsbToRgb:function(){var e=this.match(/\d{1,3}/g);return(e)?e.hsbToRgb():null;}});})();(function(){var a=this.Keyboard=new Class({Extends:Events,Implements:[Options],options:{defaultEventType:"keydown",active:false,manager:null,events:{},nonParsedEvents:["activate","deactivate","onactivate","ondeactivate","changed","onchanged"]},initialize:function(f){if(f&&f.manager){this.manager=f.manager;
|
247
|
+
delete f.manager;}this.setOptions(f);this.setup();},setup:function(){this.addEvents(this.options.events);if(a.manager&&!this.manager){a.manager.manage(this);
|
248
|
+
}if(this.options.active){this.activate();}},handle:function(h,g){if(h.preventKeyboardPropagation){return;}var f=!!this.manager;if(f&&this.activeKB){this.activeKB.handle(h,g);
|
249
|
+
if(h.preventKeyboardPropagation){return;}}this.fireEvent(g,h);if(!f&&this.activeKB){this.activeKB.handle(h,g);}},addEvent:function(h,g,f){return this.parent(a.parse(h,this.options.defaultEventType,this.options.nonParsedEvents),g,f);
|
250
|
+
},removeEvent:function(g,f){return this.parent(a.parse(g,this.options.defaultEventType,this.options.nonParsedEvents),f);},toggleActive:function(){return this[this.isActive()?"deactivate":"activate"]();
|
251
|
+
},activate:function(f){if(f){if(f.isActive()){return this;}if(this.activeKB&&f!=this.activeKB){this.previous=this.activeKB;this.previous.fireEvent("deactivate");
|
252
|
+
}this.activeKB=f.fireEvent("activate");a.manager.fireEvent("changed");}else{if(this.manager){this.manager.activate(this);}}return this;},isActive:function(){return this.manager?(this.manager.activeKB==this):(a.manager==this);
|
253
|
+
},deactivate:function(f){if(f){if(f===this.activeKB){this.activeKB=null;f.fireEvent("deactivate");a.manager.fireEvent("changed");}}else{if(this.manager){this.manager.deactivate(this);
|
254
|
+
}}return this;},relinquish:function(){if(this.isActive()&&this.manager&&this.manager.previous){this.manager.activate(this.manager.previous);}},manage:function(f){if(f.manager&&f.manager!=a.manager&&this!=a.manager){f.manager.drop(f);
|
255
|
+
}this.instances.push(f);f.manager=this;if(!this.activeKB){this.activate(f);}},_disable:function(f){if(this.activeKB==f){this.activeKB=null;}},drop:function(f){this._disable(f);
|
256
|
+
this.instances.erase(f);a.manager.manage(f);if(this.activeKB==f&&this.previous&&this.instances.contains(this.previous)){this.activate(this.previous);}},instances:[],trace:function(){a.trace(this);
|
257
|
+
},each:function(f){a.each(this,f);}});var b={};var c=["shift","control","alt","meta"];var e=/^(?:shift|control|ctrl|alt|meta)$/;a.parse=function(h,g,k){if(k&&k.contains(h.toLowerCase())){return h;
|
258
|
+
}h=h.toLowerCase().replace(/^(keyup|keydown):/,function(m,l){g=l;return"";});if(!b[h]){var f,j={};h.split("+").each(function(l){if(e.test(l)){j[l]=true;
|
259
|
+
}else{f=l;}});j.control=j.control||j.ctrl;var i=[];c.each(function(l){if(j[l]){i.push(l);}});if(f){i.push(f);}b[h]=i.join("+");}return g+":keys("+b[h]+")";
|
260
|
+
};a.each=function(f,g){var h=f||a.manager;while(h){g.run(h);h=h.activeKB;}};a.stop=function(f){f.preventKeyboardPropagation=true;};a.manager=new a({active:true});
|
261
|
+
a.trace=function(f){f=f||a.manager;var g=window.console&&console.log;if(g){console.log("the following items have focus: ");}a.each(f,function(h){if(g){console.log(document.id(h.widget)||h.wiget||h);
|
262
|
+
}});};var d=function(g){var f=[];c.each(function(h){if(g[h]){f.push(h);}});if(!e.test(g.key)){f.push(g.key);}a.manager.handle(g,g.type+":keys("+f.join("+")+")");
|
263
|
+
};document.addEvents({keyup:d,keydown:d});})();Keyboard.prototype.options.nonParsedEvents.combine(["rebound","onrebound"]);Keyboard.implement({addShortcut:function(b,a){this.shortcuts=this.shortcuts||[];
|
264
|
+
this.shortcutIndex=this.shortcutIndex||{};a.getKeyboard=Function.from(this);a.name=b;this.shortcutIndex[b]=a;this.shortcuts.push(a);if(a.keys){this.addEvent(a.keys,a.handler);
|
265
|
+
}return this;},addShortcuts:function(b){for(var a in b){this.addShortcut(a,b[a]);}return this;},removeShortcut:function(b){var a=this.getShortcut(b);if(a&&a.keys){this.removeEvent(a.keys,a.handler);
|
266
|
+
delete this.shortcutIndex[b];this.shortcuts.erase(a);}return this;},removeShortcuts:function(a){a.each(this.removeShortcut,this);return this;},getShortcuts:function(){return this.shortcuts||[];
|
267
|
+
},getShortcut:function(a){return(this.shortcutIndex||{})[a];}});Keyboard.rebind=function(b,a){Array.from(a).each(function(c){c.getKeyboard().removeEvent(c.keys,c.handler);
|
268
|
+
c.getKeyboard().addEvent(b,c.handler);c.keys=b;c.getKeyboard().fireEvent("rebound");});};Keyboard.getActiveShortcuts=function(b){var a=[],c=[];Keyboard.each(b,[].push.bind(a));
|
269
|
+
a.each(function(d){c.extend(d.getShortcuts());});return c;};Keyboard.getShortcut=function(c,b,d){d=d||{};var a=d.many?[]:null,e=d.many?function(g){var f=g.getShortcut(c);
|
270
|
+
if(f){a.push(f);}}:function(f){if(!a){a=f.getShortcut(c);}};Keyboard.each(b,e);return a;};Keyboard.getShortcuts=function(b,a){return Keyboard.getShortcut(b,a,{many:true});
|
271
|
+
};(function(){var a=function(c,b){return(c)?(typeOf(c)=="function"?c(b):b.get(c)):"";};this.Tips=new Class({Implements:[Events,Options],options:{onShow:function(){this.tip.setStyle("display","block");
|
272
|
+
},onHide:function(){this.tip.setStyle("display","none");},title:"title",text:function(b){return b.get("rel")||b.get("href");},showDelay:100,hideDelay:100,className:"tip-wrap",offset:{x:16,y:16},windowPadding:{x:0,y:0},fixed:false},initialize:function(){var b=Array.link(arguments,{options:Type.isObject,elements:function(c){return c!=null;
|
273
|
+
}});this.setOptions(b.options);if(b.elements){this.attach(b.elements);}this.container=new Element("div",{"class":"tip"});},toElement:function(){if(this.tip){return this.tip;
|
274
|
+
}this.tip=new Element("div",{"class":this.options.className,styles:{position:"absolute",top:0,left:0}}).adopt(new Element("div",{"class":"tip-top"}),this.container,new Element("div",{"class":"tip-bottom"}));
|
275
|
+
return this.tip;},attach:function(b){$$(b).each(function(d){var f=a(this.options.title,d),e=a(this.options.text,d);d.set("title","").store("tip:native",f).retrieve("tip:title",f);
|
276
|
+
d.retrieve("tip:text",e);this.fireEvent("attach",[d]);var c=["enter","leave"];if(!this.options.fixed){c.push("move");}c.each(function(h){var g=d.retrieve("tip:"+h);
|
277
|
+
if(!g){g=function(i){this["element"+h.capitalize()].apply(this,[i,d]);}.bind(this);}d.store("tip:"+h,g).addEvent("mouse"+h,g);},this);},this);return this;
|
278
|
+
},detach:function(b){$$(b).each(function(d){["enter","leave","move"].each(function(e){d.removeEvent("mouse"+e,d.retrieve("tip:"+e)).eliminate("tip:"+e);
|
279
|
+
});this.fireEvent("detach",[d]);if(this.options.title=="title"){var c=d.retrieve("tip:native");if(c){d.set("title",c);}}},this);return this;},elementEnter:function(c,b){this.container.empty();
|
280
|
+
["title","text"].each(function(e){var d=b.retrieve("tip:"+e);if(d){this.fill(new Element("div",{"class":"tip-"+e}).inject(this.container),d);}},this);clearTimeout(this.timer);
|
281
|
+
this.timer=(function(){this.show(b);this.position((this.options.fixed)?{page:b.getPosition()}:c);}).delay(this.options.showDelay,this);},elementLeave:function(c,b){clearTimeout(this.timer);
|
282
|
+
this.timer=this.hide.delay(this.options.hideDelay,this,b);this.fireForParent(c,b);},fireForParent:function(c,b){b=b.getParent();if(!b||b==document.body){return;
|
283
|
+
}if(b.retrieve("tip:enter")){b.fireEvent("mouseenter",c);}else{this.fireForParent(c,b);}},elementMove:function(c,b){this.position(c);},position:function(f){if(!this.tip){document.id(this);
|
284
|
+
}var c=window.getSize(),b=window.getScroll(),g={x:this.tip.offsetWidth,y:this.tip.offsetHeight},d={x:"left",y:"top"},e={y:false,x2:false,y2:false,x:false},h={};
|
285
|
+
for(var i in d){h[d[i]]=f.page[i]+this.options.offset[i];if(h[d[i]]<0){e[i]=true;}if((h[d[i]]+g[i]-b[i])>c[i]-this.options.windowPadding[i]){h[d[i]]=f.page[i]-this.options.offset[i]-g[i];
|
286
|
+
e[i+"2"]=true;}}this.fireEvent("bound",e);this.tip.setStyles(h);},fill:function(b,c){if(typeof c=="string"){b.set("html",c);}else{b.adopt(c);}},show:function(b){if(!this.tip){document.id(this);
|
287
|
+
}if(!this.tip.getParent()){this.tip.inject(document.body);}this.fireEvent("show",[this.tip,b]);},hide:function(b){if(!this.tip){document.id(this);}this.fireEvent("hide",[this.tip,b]);
|
288
|
+
}});})();
|
@@ -0,0 +1,265 @@
|
|
1
|
+
Zen.Editor = {}
|
2
|
+
|
3
|
+
/**
|
4
|
+
* The Editor class can be used to create simple text editors that support HTML,
|
5
|
+
* Textile and Markdown (more might be supported in the future). The generated
|
6
|
+
* output is very simple and very easy to style (the class doesn't inject any CSS).
|
7
|
+
*
|
8
|
+
* h2. Usage
|
9
|
+
*
|
10
|
+
* Adding an editor requires 2 steps. First you'll need to create a new instance
|
11
|
+
* of the editor:
|
12
|
+
*
|
13
|
+
* bc. editor = new Zen.Editor.Base('css selector');
|
14
|
+
*
|
15
|
+
* Once the instance is created you can call the display() method to show the editor:
|
16
|
+
*
|
17
|
+
* bc. editor.display();
|
18
|
+
*
|
19
|
+
* This will render the editor using the default format, HTML.
|
20
|
+
*
|
21
|
+
* h2. Customizing
|
22
|
+
*
|
23
|
+
* By default the editor will generate HTML tags but this can be changed by passing
|
24
|
+
* a JSON object as the second argument of the constructor method:
|
25
|
+
*
|
26
|
+
* bc. editor = new Zen.Editor.Base('css selector', {format: '...'});
|
27
|
+
*
|
28
|
+
* The second argument accepts the following 2 options:
|
29
|
+
*
|
30
|
+
* format: the formatting engine to use. You can choose from "html" (default),
|
31
|
+
* "textile" and "markdown". You can also create your own driver as long as you make
|
32
|
+
* sure the class is loaded and defined under Zen.Editor.DriverName, where DriverName
|
33
|
+
* is the PascalCased version of the driver name.
|
34
|
+
*
|
35
|
+
* buttons: an array of default buttons. Note that in most cased you'd want to use the
|
36
|
+
* addButtons() method as specifying an array of buttons in the constructor will prevent
|
37
|
+
* the default buttons from being added.
|
38
|
+
*
|
39
|
+
* h2. Adding Buttons
|
40
|
+
*
|
41
|
+
* The recommended way of adding buttons is using the addButtons method. This method takes
|
42
|
+
* a single argument which is an array of JSON objects. Each JSON object should contain the
|
43
|
+
* following keys:
|
44
|
+
*
|
45
|
+
* * name: the name of the button, used to generate the CSS class
|
46
|
+
* * html: the content of the button (text, html, etc)
|
47
|
+
* * callback: the function/method called whenever the button is clicked.
|
48
|
+
*
|
49
|
+
* Example:
|
50
|
+
*
|
51
|
+
* bc. editor.addButtons(
|
52
|
+
* [
|
53
|
+
* {name: 'hello', html: 'Hello', callback: function() { alert('Hello!'); }}
|
54
|
+
* ]);
|
55
|
+
*
|
56
|
+
* When the callback is invoked the instance of the editor to which the button belongs will
|
57
|
+
* be sent to the callback.
|
58
|
+
*
|
59
|
+
* h2. Drivers
|
60
|
+
*
|
61
|
+
* The Base class relies on so called "drivers": small classes that handle actions
|
62
|
+
* whenever a button is clicked. By default there are 3 drivers, HTML, Textile and Markdown.
|
63
|
+
* In order to use your own driver while still supporting the default buttons (bold, italic, etc)
|
64
|
+
* your class has to implement the following methods:
|
65
|
+
*
|
66
|
+
* * bold
|
67
|
+
* * italic
|
68
|
+
* * link
|
69
|
+
* * ol
|
70
|
+
* * ul
|
71
|
+
*
|
72
|
+
* When creating a method for a driver they should accept a single parameter, the instance
|
73
|
+
* of the editor to which the button belongs. Say your button wraps the currently selected
|
74
|
+
* text in an element you'd do something like the following:
|
75
|
+
*
|
76
|
+
* bc. my_method: function(editor)
|
77
|
+
* {
|
78
|
+
* editor.insertAroundCursor({before: '<', after: '>'})
|
79
|
+
* }
|
80
|
+
*
|
81
|
+
* Also keep in mind that you don't have to create an entire class, you can also specify
|
82
|
+
* a closure in the "callback" key when adding a button.
|
83
|
+
*
|
84
|
+
* h2. Markup
|
85
|
+
*
|
86
|
+
* The Editor class generates the following markup:
|
87
|
+
*
|
88
|
+
* bc. <div class="editor_container">
|
89
|
+
* <div class="editor_toolbar">
|
90
|
+
* <ul>
|
91
|
+
* <li class="button name">button HTML</li>
|
92
|
+
* </ul>
|
93
|
+
* </div>
|
94
|
+
*
|
95
|
+
* <textarea></textarea>
|
96
|
+
* </div>
|
97
|
+
*
|
98
|
+
* As you can see the markup is very simple and no CSS rules are injected. This does however
|
99
|
+
* mean you generally spend a bit more time styling the editor but it also gives
|
100
|
+
* you much more flexibility and less trouble.
|
101
|
+
*
|
102
|
+
* @author Yorick Peterse
|
103
|
+
* @link http://yorickpeterse.com/
|
104
|
+
* @license MIT License
|
105
|
+
* @package Zen
|
106
|
+
* @since 0.1
|
107
|
+
*
|
108
|
+
* Copyright (c) 2011, Yorick Peterse
|
109
|
+
*
|
110
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
111
|
+
* of this software and associated documentation files (the "Software"), to deal
|
112
|
+
* in the Software without restriction, including without limitation the rights
|
113
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
114
|
+
* copies of the Software, and to permit persons to whom the Software is
|
115
|
+
* furnished to do so, subject to the following conditions:
|
116
|
+
*
|
117
|
+
* The above copyright notice and this permission notice shall be included in
|
118
|
+
* all copies or substantial portions of the Software.
|
119
|
+
*
|
120
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
121
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
122
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
123
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
124
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
125
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
126
|
+
* THE SOFTWARE.
|
127
|
+
*/
|
128
|
+
Zen.Editor.Base = new Class(
|
129
|
+
{
|
130
|
+
Implements: Options,
|
131
|
+
|
132
|
+
/**
|
133
|
+
* JSON object with all default options.
|
134
|
+
* The following options are available:
|
135
|
+
*
|
136
|
+
* * format: the text format (textile, markdown, etc)
|
137
|
+
* * buttons: Array of all buttons and their callbacks.
|
138
|
+
* Note that by default this object is empty, all buttons will be
|
139
|
+
* added by the initialize() method as the callbacks won't be available
|
140
|
+
* until the drivers have been loaded.
|
141
|
+
*
|
142
|
+
* @type [Object]
|
143
|
+
*/
|
144
|
+
options:
|
145
|
+
{
|
146
|
+
format: 'html',
|
147
|
+
buttons: []
|
148
|
+
},
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Collection of objects for the CSS selector specified
|
152
|
+
* when initializing this class.
|
153
|
+
*
|
154
|
+
* @type [Array]
|
155
|
+
*/
|
156
|
+
elements: [],
|
157
|
+
|
158
|
+
/**
|
159
|
+
* New instance of the driver for the current editor.
|
160
|
+
*
|
161
|
+
* @type [Object]
|
162
|
+
*/
|
163
|
+
driver: {},
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Initializes a new instance of the visual editor. The first
|
167
|
+
* argument is the CSS selector and the second a JSON object
|
168
|
+
* with additional options.
|
169
|
+
*
|
170
|
+
* @author Yorick Peterse
|
171
|
+
* @param [String] css_selector The CSS selector for the editor.
|
172
|
+
* @param [Ojbect] options JSON object with additional options.
|
173
|
+
* @return [Object]
|
174
|
+
* @since 0.1
|
175
|
+
*/
|
176
|
+
initialize: function(css_selector, options)
|
177
|
+
{
|
178
|
+
this.setOptions(options);
|
179
|
+
|
180
|
+
this.elements = $$(css_selector);
|
181
|
+
|
182
|
+
// Load our driver
|
183
|
+
var driver = this.options.format.capitalize().camelCase();
|
184
|
+
this.driver = new Zen.Editor[driver]();
|
185
|
+
|
186
|
+
// Add our buttons
|
187
|
+
if ( this.options.buttons.length <= 0 )
|
188
|
+
{
|
189
|
+
this.options.buttons = [
|
190
|
+
{name: 'bold' , html: 'Bold' , callback: this.driver.bold},
|
191
|
+
{name: 'italic' , html: 'Italic' , callback: this.driver.italic},
|
192
|
+
{name: 'link' , html: 'Link' , callback: this.driver.link},
|
193
|
+
{name: 'ol' , html: 'Ordered list' , callback: this.driver.ol},
|
194
|
+
{name: 'ul' , html: 'Unordered list', callback: this.driver.ul}
|
195
|
+
];
|
196
|
+
}
|
197
|
+
},
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Generates the required markup for the editor along
|
201
|
+
* with binding all events for all the available buttons.
|
202
|
+
*
|
203
|
+
* @author Yorick Peterse
|
204
|
+
* @return [Void]
|
205
|
+
*/
|
206
|
+
display: function()
|
207
|
+
{
|
208
|
+
// Ignore the entire process if no elements have been found
|
209
|
+
if ( this.elements.length == 0 ) { return; }
|
210
|
+
|
211
|
+
// Generate our markup
|
212
|
+
var toolbar = new Element('div', {'class': 'editor_toolbar'});
|
213
|
+
var ul = new Element('ul');
|
214
|
+
|
215
|
+
// Generate all the buttons
|
216
|
+
this.options.buttons.each(function(btn)
|
217
|
+
{
|
218
|
+
var li = new Element('li', {'class': btn.name});
|
219
|
+
|
220
|
+
// Add the html?
|
221
|
+
if ( btn.html ) { li.set('html', btn.html); }
|
222
|
+
|
223
|
+
li.addEvent('click', function()
|
224
|
+
{
|
225
|
+
// Get the editor closest to this button
|
226
|
+
var current_editor = this.getParent('.editor_container');
|
227
|
+
current_editor = current_editor.getElement('textarea');
|
228
|
+
|
229
|
+
btn.callback(current_editor);
|
230
|
+
});
|
231
|
+
|
232
|
+
li.inject(ul);
|
233
|
+
});
|
234
|
+
|
235
|
+
this.elements.each(function(element)
|
236
|
+
{
|
237
|
+
var container = new Element('div', {'class': 'editor_container'});
|
238
|
+
|
239
|
+
// Replace the text area with all our elements
|
240
|
+
ul.inject(toolbar);
|
241
|
+
toolbar.inject(container);
|
242
|
+
container.inject(element, 'before');
|
243
|
+
element.inject(container);
|
244
|
+
});
|
245
|
+
},
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Adds the specified buttons to this.options.buttons.
|
249
|
+
* Buttons can also be added by directly setting them in the construct
|
250
|
+
* but that will prevent the default buttons from getting added.
|
251
|
+
*
|
252
|
+
* @author Yorick Peterse
|
253
|
+
* @param [Array] buttons An array of the buttons to add
|
254
|
+
* @return [Void]
|
255
|
+
*/
|
256
|
+
addButtons: function(buttons)
|
257
|
+
{
|
258
|
+
var self = this;
|
259
|
+
|
260
|
+
buttons.each(function(button)
|
261
|
+
{
|
262
|
+
self.options.buttons.push(button);
|
263
|
+
});
|
264
|
+
}
|
265
|
+
});
|