refinerycms-core 0.9.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/base_controller.rb +10 -0
- data/app/controllers/admin/dialogs_controller.rb +26 -0
- data/app/controllers/admin/refinery_core_controller.rb +12 -0
- data/app/controllers/application_controller.rb +6 -0
- data/app/controllers/refinery/fast_controller.rb +9 -0
- data/app/controllers/sitemap_controller.rb +14 -0
- data/app/helpers/application_helper.rb +5 -0
- data/app/views/admin/_head.html.erb +43 -0
- data/app/views/admin/_javascripts.html.erb +32 -0
- data/app/views/admin/_menu.html.erb +17 -0
- data/app/views/admin/dialogs/show.html.erb +19 -0
- data/app/views/layouts/admin.html.erb +24 -0
- data/app/views/layouts/admin_dialog.html.erb +14 -0
- data/app/views/layouts/application.html.erb +21 -0
- data/app/views/shared/_content_page.html.erb +63 -0
- data/app/views/shared/_draft_page_message.html.erb +3 -0
- data/app/views/shared/_footer.html.erb +4 -0
- data/app/views/shared/_google_analytics.html.erb +8 -0
- data/app/views/shared/_head.html.erb +42 -0
- data/app/views/shared/_header.html.erb +8 -0
- data/app/views/shared/_html_tag.html.erb +6 -0
- data/app/views/shared/_ie6check.html.erb +63 -0
- data/app/views/shared/_javascripts.html.erb +10 -0
- data/app/views/shared/_menu.html.erb +30 -0
- data/app/views/shared/_menu_branch.html.erb +26 -0
- data/app/views/shared/_message.html.erb +10 -0
- data/app/views/shared/_no_script.html.erb +9 -0
- data/app/views/shared/_site_bar.html.erb +25 -0
- data/app/views/shared/admin/_continue_editing.html.erb +3 -0
- data/app/views/shared/admin/_error_messages.html.erb +16 -0
- data/app/views/shared/admin/_form_actions.html.erb +75 -0
- data/app/views/shared/admin/_image_picker.html.erb +60 -0
- data/app/views/shared/admin/_make_sortable.html.erb +13 -0
- data/app/views/shared/admin/_resource_picker.html.erb +66 -0
- data/app/views/shared/admin/_search.html.erb +6 -0
- data/app/views/shared/admin/_sortable_list.html.erb +7 -0
- data/app/views/shared/admin/_tabbed_fields.html.erb +42 -0
- data/app/views/welcome.html.erb +17 -0
- data/app/views/wymiframe.html.erb +15 -0
- data/config/locales/cs.yml +77 -0
- data/config/locales/da.yml +75 -0
- data/config/locales/de.yml +75 -0
- data/config/locales/el.yml +75 -0
- data/config/locales/en.yml +75 -0
- data/config/locales/es.yml +68 -0
- data/config/locales/fr.yml +72 -0
- data/config/locales/it.yml +96 -0
- data/config/locales/lolcat.yml +68 -0
- data/config/locales/lt.yml +75 -0
- data/config/locales/lv.yml +72 -0
- data/config/locales/nb.yml +75 -0
- data/config/locales/nl.yml +75 -0
- data/config/locales/pl.yml +75 -0
- data/config/locales/pt-BR.yml +72 -0
- data/config/locales/rs.yml +76 -0
- data/config/locales/ru.yml +71 -0
- data/config/locales/sl.yml +72 -0
- data/config/locales/sv.yml +75 -0
- data/config/locales/vi.yml +75 -0
- data/config/locales/zh-CN.yml +75 -0
- data/config/locales/zh-TW.yml +75 -0
- data/config/routes.rb +19 -0
- data/crud.md +197 -0
- data/doc/included-jquery-ui-packages.jpg +0 -0
- data/engines.md +179 -0
- data/features/search.feature +55 -0
- data/features/site_bar.feature +24 -0
- data/features/step_definitions/core_steps.rb +61 -0
- data/features/support/paths.rb +14 -0
- data/features/uploads/beach.jpeg +0 -0
- data/features/uploads/refinery_is_awesome.txt +1 -0
- data/lib/gemspec.rb +43 -0
- data/lib/generators/refinerycms_generator.rb +110 -0
- data/lib/generators/templates/.gitignore +83 -0
- data/lib/generators/templates/app/views/sitemap/index.xml.builder +22 -0
- data/lib/generators/templates/autotest/autotest.rb +17 -0
- data/lib/generators/templates/autotest/discover.rb +2 -0
- data/lib/generators/templates/config/database.yml.mysql +20 -0
- data/lib/generators/templates/config/database.yml.postgresql +57 -0
- data/lib/generators/templates/config/database.yml.sqlite3 +26 -0
- data/lib/generators/templates/config/i18n-js.yml +6 -0
- data/lib/generators/templates/config/initializers/devise.rb +142 -0
- data/lib/generators/templates/config/settings.rb +2 -0
- data/lib/generators/templates/db/seeds.rb +5 -0
- data/lib/refinery/activity.rb +45 -0
- data/lib/refinery/admin/base_controller.rb +111 -0
- data/lib/refinery/admin_base_controller.rb +5 -0
- data/lib/refinery/application.rb +48 -0
- data/lib/refinery/application_controller.rb +120 -0
- data/lib/refinery/application_helper.rb +19 -0
- data/lib/refinery/base_presenter.rb +27 -0
- data/lib/refinery/catch_all_routes.rb +11 -0
- data/lib/refinery/crud.rb +295 -0
- data/lib/refinery/helpers/form_helper.rb +66 -0
- data/lib/refinery/helpers/head_helper.rb +17 -0
- data/lib/refinery/helpers/html_truncation_helper.rb +25 -0
- data/lib/refinery/helpers/image_helper.rb +49 -0
- data/lib/refinery/helpers/menu_helper.rb +68 -0
- data/lib/refinery/helpers/meta_helper.rb +67 -0
- data/lib/refinery/helpers/pagination_helper.rb +16 -0
- data/lib/refinery/helpers/script_helper.rb +36 -0
- data/lib/refinery/helpers/site_bar_helper.rb +24 -0
- data/lib/refinery/helpers/tag_helper.rb +21 -0
- data/lib/refinery/helpers/translation_helper.rb +17 -0
- data/lib/refinery/link_renderer.rb +55 -0
- data/lib/refinery/plugin.rb +106 -0
- data/lib/refinery/plugins.rb +75 -0
- data/lib/refinerycms-core.rb +156 -0
- data/lib/tasks/doc.rake +29 -0
- data/lib/tasks/refinery.rake +231 -0
- data/lib/tasks/yard.rake +30 -0
- data/license.md +21 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/images/refinery/add.png +0 -0
- data/public/images/refinery/admin_bg.png +0 -0
- data/public/images/refinery/ajax-loader.gif +0 -0
- data/public/images/refinery/branch-end.gif +0 -0
- data/public/images/refinery/branch-start.gif +0 -0
- data/public/images/refinery/branch.gif +0 -0
- data/public/images/refinery/carousel-left.png +0 -0
- data/public/images/refinery/carousel-right.png +0 -0
- data/public/images/refinery/cross.png +0 -0
- data/public/images/refinery/dialogLoadingAnimation.gif +0 -0
- data/public/images/refinery/header_background.png +0 -0
- data/public/images/refinery/hover-gradient.jpg +0 -0
- data/public/images/refinery/icons/accept.png +0 -0
- data/public/images/refinery/icons/add.png +0 -0
- data/public/images/refinery/icons/ajax-loader.gif +0 -0
- data/public/images/refinery/icons/application_edit.png +0 -0
- data/public/images/refinery/icons/application_go.png +0 -0
- data/public/images/refinery/icons/arrow_left.png +0 -0
- data/public/images/refinery/icons/arrow_switch.png +0 -0
- data/public/images/refinery/icons/arrow_up.png +0 -0
- data/public/images/refinery/icons/bin.png +0 -0
- data/public/images/refinery/icons/bin_closed.png +0 -0
- data/public/images/refinery/icons/cancel.png +0 -0
- data/public/images/refinery/icons/cog_add.png +0 -0
- data/public/images/refinery/icons/cog_edit.png +0 -0
- data/public/images/refinery/icons/cross.png +0 -0
- data/public/images/refinery/icons/delete.png +0 -0
- data/public/images/refinery/icons/doc.png +0 -0
- data/public/images/refinery/icons/down.gif +0 -0
- data/public/images/refinery/icons/edit.png +0 -0
- data/public/images/refinery/icons/email.png +0 -0
- data/public/images/refinery/icons/email_edit.png +0 -0
- data/public/images/refinery/icons/email_go.png +0 -0
- data/public/images/refinery/icons/email_open.png +0 -0
- data/public/images/refinery/icons/eye.png +0 -0
- data/public/images/refinery/icons/folder_page_white.png +0 -0
- data/public/images/refinery/icons/image_add.png +0 -0
- data/public/images/refinery/icons/image_edit.png +0 -0
- data/public/images/refinery/icons/img.png +0 -0
- data/public/images/refinery/icons/information.png +0 -0
- data/public/images/refinery/icons/layout_add.png +0 -0
- data/public/images/refinery/icons/layout_edit.png +0 -0
- data/public/images/refinery/icons/music.png +0 -0
- data/public/images/refinery/icons/page_add.png +0 -0
- data/public/images/refinery/icons/page_edit.png +0 -0
- data/public/images/refinery/icons/page_white_edit.png +0 -0
- data/public/images/refinery/icons/page_white_gear.png +0 -0
- data/public/images/refinery/icons/page_white_put.png +0 -0
- data/public/images/refinery/icons/pdf.png +0 -0
- data/public/images/refinery/icons/ppt.png +0 -0
- data/public/images/refinery/icons/star.png +0 -0
- data/public/images/refinery/icons/tick.png +0 -0
- data/public/images/refinery/icons/up.gif +0 -0
- data/public/images/refinery/icons/user_add.png +0 -0
- data/public/images/refinery/icons/user_comment.png +0 -0
- data/public/images/refinery/icons/user_edit.png +0 -0
- data/public/images/refinery/icons/xls.png +0 -0
- data/public/images/refinery/icons/zip.png +0 -0
- data/public/images/refinery/icons/zoom.png +0 -0
- data/public/images/refinery/logo-large.png +0 -0
- data/public/images/refinery/logo-medium.png +0 -0
- data/public/images/refinery/logo-site-bar.png +0 -0
- data/public/images/refinery/logo-small-medium.png +0 -0
- data/public/images/refinery/logo-small.png +0 -0
- data/public/images/refinery/logo-tiny.png +0 -0
- data/public/images/refinery/logo.png +0 -0
- data/public/images/refinery/nav-3-background.gif +0 -0
- data/public/images/refinery/nav_inactive_background.png +0 -0
- data/public/images/refinery/orange_button.png +0 -0
- data/public/images/refinery/page_bg.png +0 -0
- data/public/images/refinery/resolve_digital_footer_logo.png +0 -0
- data/public/images/refinery/text_field_background.png +0 -0
- data/public/images/refinery/tooltip-nib.gif +0 -0
- data/public/images/refinery/tooltip-nib.png +0 -0
- data/public/images/wymeditor/skins/refinery/arrow_redo.png +0 -0
- data/public/images/wymeditor/skins/refinery/arrow_undo.png +0 -0
- data/public/images/wymeditor/skins/refinery/eye.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
- data/public/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
- data/public/images/wymeditor/skins/refinery/link_add.png +0 -0
- data/public/images/wymeditor/skins/refinery/link_break.png +0 -0
- data/public/images/wymeditor/skins/refinery/page_code.png +0 -0
- data/public/images/wymeditor/skins/refinery/page_paste.png +0 -0
- data/public/images/wymeditor/skins/refinery/photo_add.png +0 -0
- data/public/images/wymeditor/skins/refinery/right.png +0 -0
- data/public/images/wymeditor/skins/refinery/style.png +0 -0
- data/public/images/wymeditor/skins/refinery/table_add.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_align_center.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_align_justify.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_align_left.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_align_right.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_bold.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_heading_1.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_heading_2.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_heading_3.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_heading_4.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_heading_5.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_heading_6.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_indent.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_indent_remove.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_italic.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_list_bullets.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_list_numbers.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_paragraph.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_strikethrough.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_subscript.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_superscript.png +0 -0
- data/public/images/wymeditor/skins/refinery/text_underline.png +0 -0
- data/public/images/wymeditor/skins/wymeditor_icon.png +0 -0
- data/public/javascripts/admin.js +7 -0
- data/public/javascripts/application.js +1 -0
- data/public/javascripts/dd_belatedpng.js +13 -0
- data/public/javascripts/i18n-messages.js +2 -0
- data/public/javascripts/jquery-min.js +16 -0
- data/public/javascripts/jquery-ui-custom-min.js +251 -0
- data/public/javascripts/jquery.js +8176 -0
- data/public/javascripts/jquery/GPL-LICENSE.txt +278 -0
- data/public/javascripts/jquery/MIT-LICENSE.txt +20 -0
- data/public/javascripts/jquery/jquery.corner.js +345 -0
- data/public/javascripts/jquery/jquery.html5-placeholder-shim.js +88 -0
- data/public/javascripts/jquery/jquery.jcarousel.js +900 -0
- data/public/javascripts/jquery/jquery.textTruncate.js +174 -0
- data/public/javascripts/jquery/jquery.timers.js +138 -0
- data/public/javascripts/modernizr-min.js +30 -0
- data/public/javascripts/rails.js +175 -0
- data/public/javascripts/refinery/admin.js +1114 -0
- data/public/javascripts/refinery/boot_wym.js +285 -0
- data/public/javascripts/refinery/core.js +18 -0
- data/public/javascripts/refinery/i18n.js +340 -0
- data/public/javascripts/refinery/nestedsortables.js +164 -0
- data/public/javascripts/refinery/serializelist.js +66 -0
- data/public/javascripts/refinery/site_bar.js +16 -0
- data/public/javascripts/refinery/submenu.js +49 -0
- data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +5156 -0
- data/public/javascripts/wymeditor/lang/ca.js +45 -0
- data/public/javascripts/wymeditor/lang/cs.js +45 -0
- data/public/javascripts/wymeditor/lang/da.js +48 -0
- data/public/javascripts/wymeditor/lang/de.js +45 -0
- data/public/javascripts/wymeditor/lang/en.js +47 -0
- data/public/javascripts/wymeditor/lang/es.js +48 -0
- data/public/javascripts/wymeditor/lang/fa.js +46 -0
- data/public/javascripts/wymeditor/lang/fr.js +45 -0
- data/public/javascripts/wymeditor/lang/he.js +45 -0
- data/public/javascripts/wymeditor/lang/hu.js +45 -0
- data/public/javascripts/wymeditor/lang/it.js +48 -0
- data/public/javascripts/wymeditor/lang/lv.js +47 -0
- data/public/javascripts/wymeditor/lang/nb.js +48 -0
- data/public/javascripts/wymeditor/lang/nl.js +47 -0
- data/public/javascripts/wymeditor/lang/nn.js +45 -0
- data/public/javascripts/wymeditor/lang/pl.js +45 -0
- data/public/javascripts/wymeditor/lang/pt-BR.js +47 -0
- data/public/javascripts/wymeditor/lang/pt.js +45 -0
- data/public/javascripts/wymeditor/lang/rs.js +47 -0
- data/public/javascripts/wymeditor/lang/ru.js +45 -0
- data/public/javascripts/wymeditor/lang/sl.js +47 -0
- data/public/javascripts/wymeditor/lang/sv.js +45 -0
- data/public/javascripts/wymeditor/lang/tr.js +45 -0
- data/public/javascripts/wymeditor/lang/vi.js +47 -0
- data/public/javascripts/wymeditor/lang/zh_cn.js +47 -0
- data/public/javascripts/wymeditor/skins/refinery/skin.js +48 -0
- data/public/robots.txt +3 -0
- data/public/stylesheets/application.css +4 -0
- data/public/stylesheets/formatting.css +4 -0
- data/public/stylesheets/home.css +4 -0
- data/public/stylesheets/refinery/application.css +72 -0
- data/public/stylesheets/refinery/formatting.css +57 -0
- data/public/stylesheets/refinery/home.css +0 -0
- data/public/stylesheets/refinery/refinery.css +1579 -0
- data/public/stylesheets/refinery/site_bar.css +87 -0
- data/public/stylesheets/refinery/submenu.css +22 -0
- data/public/stylesheets/refinery/theme.css +36 -0
- data/public/stylesheets/refinery/tooltips.css +34 -0
- data/public/stylesheets/refinery/ui.css +107 -0
- data/public/stylesheets/theme.css +4 -0
- data/public/stylesheets/wymeditor/skins/refinery/skin.css +528 -0
- data/public/stylesheets/wymeditor/skins/refinery/wymiframe.css +96 -0
- data/public/wymeditor/GPL-license.txt +278 -0
- data/public/wymeditor/MIT-license.txt +20 -0
- data/public/wymeditor/README +35 -0
- data/refinerycms-core.gemspec +391 -0
- data/spec/lib/refinery/plugins_spec.rb +90 -0
- metadata +482 -0
@@ -0,0 +1,1114 @@
|
|
1
|
+
var shiftHeld = false;
|
2
|
+
var initialLoad = true;
|
3
|
+
$(document).ready(function(){
|
4
|
+
init_interface();
|
5
|
+
init_sortable_menu();
|
6
|
+
init_submit_continue();
|
7
|
+
init_modal_dialogs();
|
8
|
+
init_tooltips();
|
9
|
+
init_ajaxy_pagination();
|
10
|
+
});
|
11
|
+
|
12
|
+
if(typeof(window.onpopstate) == "object"){
|
13
|
+
$(window).bind('popstate', function(e) {
|
14
|
+
// this fires on initial page load too which we don't need.
|
15
|
+
if(!initialLoad) {
|
16
|
+
$.get(location.href, function(data) {
|
17
|
+
$('.pagination_container').slideTo(data);
|
18
|
+
});
|
19
|
+
}
|
20
|
+
initialLoad = false;
|
21
|
+
});
|
22
|
+
}
|
23
|
+
|
24
|
+
$.fn.slideTo = function(response) {
|
25
|
+
$(this).html(response);
|
26
|
+
$(this).applyMinimumHeightFromChildren();
|
27
|
+
$(this).find('.pagination_frame').removeClass('frame_right').addClass('frame_center');
|
28
|
+
init_modal_dialogs();
|
29
|
+
init_tooltips();
|
30
|
+
return $(this);
|
31
|
+
}
|
32
|
+
|
33
|
+
$.fn.applyMinimumHeightFromChildren = function() {
|
34
|
+
child_heights = 0;
|
35
|
+
$(this).children().each(function(i, child){
|
36
|
+
child_heights += $(child).height();
|
37
|
+
$.each(['marginTop', 'marginBottom', 'paddingTop', 'paddingBottom'], function(i, attr) {
|
38
|
+
child_heights += (parseInt($(child).css(attr)) || 0);
|
39
|
+
});
|
40
|
+
});
|
41
|
+
$(this).css('min-height', child_heights);
|
42
|
+
return $(this);
|
43
|
+
}
|
44
|
+
|
45
|
+
init_ajaxy_pagination = function(){
|
46
|
+
if(typeof(window.history.pushState) == 'function' && $('.pagination_container').length > 0){
|
47
|
+
var pagination_pages = $('.pagination_container .pagination a');
|
48
|
+
pagination_pages.live('click',function(e) {
|
49
|
+
this.href = (this.href.replace(/(\&(amp\;)?)?from_page\=\d+/, '')
|
50
|
+
+ '&from_page=' + $(this).parent().find('em').text()).replace('?&', '?');
|
51
|
+
history.pushState({ path: this.path }, '', this.href);
|
52
|
+
$.get(this.href, function(data) {
|
53
|
+
$('.pagination_container').slideTo(data)
|
54
|
+
})
|
55
|
+
e.preventDefault();
|
56
|
+
});
|
57
|
+
}
|
58
|
+
$('.pagination_container').applyMinimumHeightFromChildren();
|
59
|
+
if ($('.pagination_container').find('.pagination').length == 0) {
|
60
|
+
$('.pagination_frame').css('top', '0px');
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
init_interface = function() {
|
65
|
+
if (parent && parent.document.location.href != document.location.href) {
|
66
|
+
$('body#dialog_container.dialog').addClass('iframed');
|
67
|
+
}
|
68
|
+
$('input:submit:not(.button)').addClass('button');
|
69
|
+
|
70
|
+
if (!$.browser.msie) {
|
71
|
+
$('#page_container, .wym_box').corner('5px bottom');
|
72
|
+
$('.wym_box').corner('5px tr');
|
73
|
+
$('.field > .wym_box').corner('5px tl');
|
74
|
+
$('.wym_iframe iframe').corner('2px');
|
75
|
+
$('.form-actions:not(".form-actions-dialog")').corner('5px');
|
76
|
+
}
|
77
|
+
$('#recent_activity li a, #recent_inquiries li a').each(function(i, a) {
|
78
|
+
$(this).textTruncate({
|
79
|
+
width: $(this).width()
|
80
|
+
, tooltip: false
|
81
|
+
});
|
82
|
+
});
|
83
|
+
|
84
|
+
// make sure that users can tab to wymeditor fields and add an overlay while loading.
|
85
|
+
$('textarea.wymeditor').each(function() {
|
86
|
+
textarea = $(this);
|
87
|
+
if ((instance = WYMeditor.INSTANCES[$((textarea.next('.wym_box').find('iframe').attr('id')||'').split('_')).last().get(0)]) != null) {
|
88
|
+
if ((next = textarea.parent().next()) != null && next.length > 0) {
|
89
|
+
next.find('input, textarea').keydown($.proxy(function(e) {
|
90
|
+
shiftHeld = e.shiftKey;
|
91
|
+
if (shiftHeld && e.keyCode == $.ui.keyCode.TAB) {
|
92
|
+
this._iframe.contentWindow.focus();
|
93
|
+
e.preventDefault();
|
94
|
+
}
|
95
|
+
}, instance)).keyup(function(e) {
|
96
|
+
shiftHeld = false;
|
97
|
+
});
|
98
|
+
}
|
99
|
+
if ((prev = textarea.parent().prev()) != null && prev.length > 0) {
|
100
|
+
prev.find('input, textarea').keydown($.proxy(function(e) {
|
101
|
+
if (e.keyCode == $.ui.keyCode.TAB) {
|
102
|
+
this._iframe.contentWindow.focus();
|
103
|
+
e.preventDefault();
|
104
|
+
}
|
105
|
+
}, instance));
|
106
|
+
}
|
107
|
+
}
|
108
|
+
});
|
109
|
+
|
110
|
+
// ensure that the menu isn't wider than the page_container or else it looks silly to round that corner.
|
111
|
+
if (($menu = $('#menu')).length > 0) {
|
112
|
+
$menu.jcarousel({
|
113
|
+
vertical: false
|
114
|
+
, scroll: 1
|
115
|
+
, buttonNextHTML: "<img src='/images/refinery/carousel-right.png' alt='down' height='15' width='10' />"
|
116
|
+
, buttonPrevHTML: "<img src='/images/refinery/carousel-left.png' alt='up' height='15' width='10' />"
|
117
|
+
, listTag: $menu.get(0).tagName.toLowerCase()
|
118
|
+
, itemTag: $menu.children(':first').get(0).tagName.toLowerCase()
|
119
|
+
});
|
120
|
+
|
121
|
+
if ($menu.outerWidth() < $('#page_container').outerWidth()) {
|
122
|
+
$("#page_container:not('.login #page_container')").corner('5px tr');
|
123
|
+
} else {
|
124
|
+
$("#page_container:not('.login #page_container')").uncorner();
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
$('#current_locale li a').click(function(e) {
|
129
|
+
$('#current_locale li a span').each(function(span){
|
130
|
+
$(this).css('display', $(this).css('display') == 'none' ? '' : 'none');
|
131
|
+
});
|
132
|
+
$('#other_locales').animate({opacity: 'toggle', height: 'toggle'}, 250);
|
133
|
+
$('html,body').animate({
|
134
|
+
scrollTop: $('#other_locales').parent().offset().top
|
135
|
+
}, 250);
|
136
|
+
e.preventDefault();
|
137
|
+
});
|
138
|
+
|
139
|
+
$('#existing_image img').load(function(){
|
140
|
+
$('form.edit_image .form-actions').css({
|
141
|
+
'margin-top': ($('#existing_image').height() - $('form.edit_image').height() + 8)
|
142
|
+
});
|
143
|
+
});
|
144
|
+
|
145
|
+
$('.form-actions .form-actions-left input:submit#submit_button').click(function(e) {
|
146
|
+
$("<img src='/images/refinery/icons/ajax-loader.gif' width='16' height='16' class='save-loader' />").appendTo($(this).parent());
|
147
|
+
});
|
148
|
+
|
149
|
+
$('a.suppress').live('click', function(e){
|
150
|
+
e.preventDefault();
|
151
|
+
});
|
152
|
+
};
|
153
|
+
|
154
|
+
init_modal_dialogs = function(){
|
155
|
+
$('a[href*="dialog=true"]').not('#dialog_container a').each(function(i, anchor) {
|
156
|
+
$(anchor).data({
|
157
|
+
'dialog-width': parseInt($($(anchor).attr('href').match("width=([0-9]*)")).last().get(0), 10)||928
|
158
|
+
, 'dialog-height': parseInt($($(anchor).attr('href').match("height=([0-9]*)")).last().get(0), 10)||473
|
159
|
+
, 'dialog-title': ($(anchor).attr('title') || $(anchor).attr('name') || $(anchor).html() || null)
|
160
|
+
}).attr('href', $(anchor).attr('href').replace(/(\&(amp\;)?)?dialog\=true/, '')
|
161
|
+
.replace(/(\&(amp\;)?)?width\=\d+/, '')
|
162
|
+
.replace(/(\&(amp\;)?)?height\=\d+/, '')
|
163
|
+
.replace(/(\?&(amp\;)?)/, '?')
|
164
|
+
.replace(/\?$/, ''))
|
165
|
+
.click(function(e){
|
166
|
+
$anchor = $(this);
|
167
|
+
iframe_src = (iframe_src = $anchor.attr('href'))
|
168
|
+
+ (iframe_src.indexOf('?') > -1 ? '&' : '?')
|
169
|
+
+ 'app_dialog=true&dialog=true';
|
170
|
+
|
171
|
+
iframe = $("<iframe id='dialog_iframe' frameborder='0' marginheight='0' marginwidth='0' border='0'></iframe>");
|
172
|
+
if(!$.browser.msie) { iframe.corner('8px'); }
|
173
|
+
iframe.dialog({
|
174
|
+
title: $anchor.data('dialog-title')
|
175
|
+
, modal: true
|
176
|
+
, resizable: false
|
177
|
+
, autoOpen: true
|
178
|
+
, width: $anchor.data('dialog-width')
|
179
|
+
, height: $anchor.data('dialog-height')
|
180
|
+
, open: onOpenDialog
|
181
|
+
, close: onCloseDialog
|
182
|
+
});
|
183
|
+
|
184
|
+
iframe.attr('src', iframe_src);
|
185
|
+
e.preventDefault();
|
186
|
+
});
|
187
|
+
});
|
188
|
+
};
|
189
|
+
|
190
|
+
init_sortable_menu = function(){
|
191
|
+
var $menu = $('#menu');
|
192
|
+
|
193
|
+
if($menu.length === 0){return;}
|
194
|
+
|
195
|
+
$menu.sortable({
|
196
|
+
axis: 'x',
|
197
|
+
cursor: 'crosshair',
|
198
|
+
connectWith: '.nested',
|
199
|
+
update: function(){
|
200
|
+
$.post('/refinery/update_menu_positions', $menu.sortable('serialize', {
|
201
|
+
key: 'menu[]'
|
202
|
+
, expression: /plugin_([\w]*)$/
|
203
|
+
}));
|
204
|
+
}
|
205
|
+
}).tabs();
|
206
|
+
//Initial status disabled
|
207
|
+
$menu.sortable('disable');
|
208
|
+
|
209
|
+
$menu.find('#menu_reorder').click(function(e){
|
210
|
+
trigger_reordering(e, true);
|
211
|
+
});
|
212
|
+
|
213
|
+
$menu.find('#menu_reorder_done').click(function(e){
|
214
|
+
trigger_reordering(e, false);
|
215
|
+
});
|
216
|
+
|
217
|
+
$menu.find('> a').corner('top 5px');
|
218
|
+
};
|
219
|
+
|
220
|
+
trigger_reordering = function(e, enable) {
|
221
|
+
e.preventDefault();
|
222
|
+
$('#menu_reorder, #menu_reorder_done').toggle();
|
223
|
+
$('#site_bar, #content').fadeTo(500, enable ? 0.35 : 1);
|
224
|
+
|
225
|
+
if(enable) {
|
226
|
+
$menu.find('.tab a').click(function(ev){
|
227
|
+
ev.preventDefault();
|
228
|
+
});
|
229
|
+
} else {
|
230
|
+
$menu.find('.tab a').unbind('click');
|
231
|
+
}
|
232
|
+
|
233
|
+
$menu.sortable(enable ? 'enable' : 'disable');
|
234
|
+
};
|
235
|
+
|
236
|
+
init_submit_continue = function(){
|
237
|
+
$('#submit_continue_button').click(submit_and_continue);
|
238
|
+
|
239
|
+
$('form').change(function(e) {
|
240
|
+
$(this).attr('data-changes-made', true);
|
241
|
+
});
|
242
|
+
|
243
|
+
if ((continue_editing_button = $('#continue_editing')).length > 0 && continue_editing_button.attr('rel') != 'no-prompt') {
|
244
|
+
$('#editor_switch a').click(function(e) {
|
245
|
+
if ($('form[data-changes-made]').length > 0) {
|
246
|
+
if (!confirm("Any changes you've made will be lost. Are you sure you want to continue without saving?")) {
|
247
|
+
e.preventDefault();
|
248
|
+
}
|
249
|
+
}
|
250
|
+
});
|
251
|
+
}
|
252
|
+
};
|
253
|
+
|
254
|
+
submit_and_continue = function(e, redirect_to) {
|
255
|
+
// ensure wymeditors are up to date.
|
256
|
+
if ($(this).hasClass('wymupdate')) {
|
257
|
+
$.each(WYMeditor.INSTANCES, function(index, wym)
|
258
|
+
{
|
259
|
+
wym.update();
|
260
|
+
});
|
261
|
+
}
|
262
|
+
|
263
|
+
$('#continue_editing').val(true);
|
264
|
+
$('#flash').fadeOut(250);
|
265
|
+
|
266
|
+
$('.fieldWithErrors').removeClass('fieldWithErrors').addClass('field');
|
267
|
+
$('#flash_container .errorExplanation').remove();
|
268
|
+
|
269
|
+
$.post($('#continue_editing').get(0).form.action, $($('#continue_editing').get(0).form).serialize(), function(data) {
|
270
|
+
if (($flash_container = $('#flash_container')).length > 0) {
|
271
|
+
$flash_container.html(data);
|
272
|
+
|
273
|
+
$('#flash').css({'width': 'auto', 'visibility': null}).fadeIn(550);
|
274
|
+
|
275
|
+
$('.errorExplanation').not($('#flash_container .errorExplanation')).remove();
|
276
|
+
|
277
|
+
if ((error_fields = $('#fieldsWithErrors').val()) != null) {
|
278
|
+
$.each(error_fields.split(','), function() {
|
279
|
+
$("#" + this).wrap("<div class='fieldWithErrors' />");
|
280
|
+
});
|
281
|
+
} else if (redirect_to) {
|
282
|
+
window.location = redirect_to;
|
283
|
+
}
|
284
|
+
|
285
|
+
$('.fieldWithErrors:first :input:first').focus();
|
286
|
+
|
287
|
+
$('#continue_editing').val(false);
|
288
|
+
|
289
|
+
init_flash_messages();
|
290
|
+
}
|
291
|
+
});
|
292
|
+
|
293
|
+
e.preventDefault();
|
294
|
+
};
|
295
|
+
|
296
|
+
init_tooltips = function(args){
|
297
|
+
$($(args != null ? args : 'a[title], span[title], #image_grid img[title], *[tooltip]')).not('.no-tooltip').each(function(index, element)
|
298
|
+
{
|
299
|
+
// create tooltip on hover and destroy it on hoveroff.
|
300
|
+
$(element).hover(function(e) {
|
301
|
+
if (e.type == 'mouseenter' || e.type == 'mouseover') {
|
302
|
+
$(this).oneTime(350, 'tooltip', $.proxy(function() {
|
303
|
+
$('.tooltip').remove();
|
304
|
+
tooltip = $("<div class='tooltip'><div><span></span></div></div>").appendTo('#tooltip_container');
|
305
|
+
tooltip.find("span").html($(this).attr('tooltip'));
|
306
|
+
if(!$.browser.msie) {
|
307
|
+
tooltip.corner('6px').find('span').corner('6px');
|
308
|
+
}
|
309
|
+
|
310
|
+
tooltip_nib_image = $.browser.msie ? 'tooltip-nib.gif' : 'tooltip-nib.png';
|
311
|
+
nib = $("<img src='/images/refinery/"+tooltip_nib_image+"' class='tooltip-nib'/>").appendTo('#tooltip_container');
|
312
|
+
|
313
|
+
tooltip.css({
|
314
|
+
'opacity': 0
|
315
|
+
, 'maxWidth': '300px'
|
316
|
+
});
|
317
|
+
required_left_offset = $(this).offset().left - (tooltip.outerWidth() / 2) + ($(this).outerWidth() / 2);
|
318
|
+
tooltip.css('left', (required_left_offset > 0 ? required_left_offset : 0));
|
319
|
+
|
320
|
+
var tooltip_offset = tooltip.offset();
|
321
|
+
var tooltip_outer_width = tooltip.outerWidth();
|
322
|
+
if (tooltip_offset && (tooltip_offset.left + tooltip_outer_width) > (window_width = $(window).width())) {
|
323
|
+
tooltip.css('left', window_width - tooltip_outer_width);
|
324
|
+
}
|
325
|
+
|
326
|
+
tooltip.css({
|
327
|
+
'top': $(this).offset().top - tooltip.outerHeight() - 2
|
328
|
+
});
|
329
|
+
|
330
|
+
nib.css({
|
331
|
+
'opacity': 0
|
332
|
+
});
|
333
|
+
|
334
|
+
if (tooltip_offset = tooltip.offset()) {
|
335
|
+
nib.css({
|
336
|
+
'left': $(this).offset().left + ($(this).outerWidth() / 2) - 5
|
337
|
+
, 'top': tooltip_offset.top + tooltip.height()
|
338
|
+
});
|
339
|
+
}
|
340
|
+
|
341
|
+
try {
|
342
|
+
tooltip.animate({
|
343
|
+
top: tooltip_offset.top - 10
|
344
|
+
, opacity: 1
|
345
|
+
}, 200, 'swing');
|
346
|
+
nib.animate({
|
347
|
+
top: nib.offset().top - 10
|
348
|
+
, opacity: 1
|
349
|
+
}, 200);
|
350
|
+
} catch(e) {
|
351
|
+
tooltip.show();
|
352
|
+
nib.show();
|
353
|
+
}
|
354
|
+
}, $(this)));
|
355
|
+
} else if (e.type == 'mouseleave' || e.type == 'mouseout') {
|
356
|
+
$(this).stopTime('tooltip');
|
357
|
+
if ((tt_offset = (tooltip = $('.tooltip')).css('z-index', '-1').offset()) == null) {
|
358
|
+
tt_offset = {'top':0,'left':0};
|
359
|
+
}
|
360
|
+
tooltip.animate({
|
361
|
+
top: tt_offset.top - 20
|
362
|
+
, opacity: 0
|
363
|
+
}, 125, 'swing', function(){
|
364
|
+
$(this).remove();
|
365
|
+
});
|
366
|
+
if ((nib_offset = (nib = $('.tooltip-nib')).offset()) == null) {
|
367
|
+
nib_offset = {'top':0,'left':0};
|
368
|
+
}
|
369
|
+
nib.animate({
|
370
|
+
top: nib_offset.top - 20
|
371
|
+
, opacity: 0
|
372
|
+
}, 125, 'swing', function(){
|
373
|
+
$(this).remove();
|
374
|
+
});
|
375
|
+
}
|
376
|
+
}).click(function(e) {
|
377
|
+
$(this).stopTime('tooltip');
|
378
|
+
});
|
379
|
+
|
380
|
+
if ($(element).attr('tooltip') == null) {
|
381
|
+
$(element).attr('tooltip', $(element).attr('title'));
|
382
|
+
}
|
383
|
+
// wipe clean the title on any children too.
|
384
|
+
$elements = $(element).add($(element).children('img')).removeAttr('title');
|
385
|
+
// if we're unlucky and in Internet Explorer then we have to say goodbye to 'alt', too.
|
386
|
+
if ($.browser.msie){$elements.removeAttr('alt');}
|
387
|
+
});
|
388
|
+
};
|
389
|
+
|
390
|
+
var link_tester = {
|
391
|
+
initialised: false
|
392
|
+
, init: function(test_url, test_email) {
|
393
|
+
this.test_url = test_url;
|
394
|
+
this.test_email = test_email;
|
395
|
+
this.initialised = true;
|
396
|
+
},
|
397
|
+
|
398
|
+
email: function(value, callback) {
|
399
|
+
$.getJSON(link_tester.test_email, {email: value}, function(data){
|
400
|
+
callback(data.result == 'success');
|
401
|
+
});
|
402
|
+
},
|
403
|
+
|
404
|
+
url: function(value, callback) {
|
405
|
+
$.getJSON(link_tester.test_url, {'url': value}, function(data){
|
406
|
+
callback(data.result == 'success');
|
407
|
+
});
|
408
|
+
},
|
409
|
+
|
410
|
+
validate_textbox: function(validation_method, textbox_id, callback) {
|
411
|
+
var icon = '';
|
412
|
+
var loader_img = $("<img id='" + textbox_id.replace('#','') + "_test_loader' src='/images/refinery/ajax-loader.gif' alt='Testing...' style='display: none;'/>");
|
413
|
+
var result_span = $("<span id='" + textbox_id.replace('#','') + "_test_result'></span>");
|
414
|
+
|
415
|
+
loader_img.insertAfter($(textbox_id));
|
416
|
+
result_span.insertAfter(loader_img);
|
417
|
+
|
418
|
+
$(textbox_id).bind('paste keypress',function(){
|
419
|
+
$(textbox_id).stop(true); // Clear the current queue; if we weren't checking yet, cancel it.
|
420
|
+
$(textbox_id + '_test_loader').hide();
|
421
|
+
$(textbox_id + '_test_result').hide();
|
422
|
+
$(textbox_id + '_test_result').removeClass('success_icon').removeClass('failure_icon');
|
423
|
+
|
424
|
+
// Wait one second before checking.
|
425
|
+
$(textbox_id).delay(1000).queue(function () {
|
426
|
+
$(textbox_id + '_test_loader').show();
|
427
|
+
$(textbox_id + '_test_result').hide();
|
428
|
+
$(textbox_id + '_test_result').removeClass('success_icon').removeClass('failure_icon');
|
429
|
+
|
430
|
+
validation_method(this.value, function (success) {
|
431
|
+
if (success) {
|
432
|
+
icon = 'success_icon';
|
433
|
+
}else{
|
434
|
+
icon = 'failure_icon';
|
435
|
+
}
|
436
|
+
$(textbox_id + '_test_result').addClass(icon).show();
|
437
|
+
$(textbox_id + '_test_loader').hide();
|
438
|
+
});
|
439
|
+
|
440
|
+
if (callback) { callback($(textbox_id)); }
|
441
|
+
|
442
|
+
$(this).dequeue();
|
443
|
+
}); // queue
|
444
|
+
}); // bind
|
445
|
+
},
|
446
|
+
|
447
|
+
validate_url_textbox: function(textbox_id, callback) {
|
448
|
+
link_tester.validate_textbox(link_tester.url, textbox_id, callback);
|
449
|
+
},
|
450
|
+
|
451
|
+
validate_email_textbox: function(textbox_id, callback) {
|
452
|
+
link_tester.validate_textbox(link_tester.email, textbox_id, callback);
|
453
|
+
}
|
454
|
+
|
455
|
+
};
|
456
|
+
|
457
|
+
var link_dialog = {
|
458
|
+
initialised: false
|
459
|
+
, init: function(){
|
460
|
+
this.init_tabs();
|
461
|
+
this.init_resources_submit();
|
462
|
+
this.init_close();
|
463
|
+
this.page_tab();
|
464
|
+
this.web_tab();
|
465
|
+
this.email_tab();
|
466
|
+
this.initialised = true;
|
467
|
+
},
|
468
|
+
|
469
|
+
init_tabs: function(){
|
470
|
+
var radios = $('#dialog_menu_left input:radio');
|
471
|
+
var selected = radios.parent().filter(".selected_radio").find('input:radio').first() || radios.first();
|
472
|
+
|
473
|
+
radios.click(function(){
|
474
|
+
link_dialog.switch_area($(this));
|
475
|
+
});
|
476
|
+
|
477
|
+
selected.attr('checked', 'true');
|
478
|
+
link_dialog.switch_area(selected);
|
479
|
+
},
|
480
|
+
|
481
|
+
init_resources_submit: function(){
|
482
|
+
$('#existing_resource_area .form-actions-dialog #submit_button').click(function(e){
|
483
|
+
e.preventDefault();
|
484
|
+
if((resource_selected = $('#existing_resource_area_content ul li.linked a')).length > 0) {
|
485
|
+
resourceUrl = parseURL(resource_selected.attr('href'));
|
486
|
+
relevant_href = resourceUrl.pathname;
|
487
|
+
|
488
|
+
// Add any alternate resource stores that need a absolute URL in the regex below
|
489
|
+
if(resourceUrl.hostname.match(/s3.amazonaws.com/)) {
|
490
|
+
relevant_href = resourceUrl.protocol + '//' + resourceUrl.host + relevant_href;
|
491
|
+
}
|
492
|
+
|
493
|
+
if (typeof(resource_picker.callback) == "function") {
|
494
|
+
resource_picker.callback({
|
495
|
+
id: resource_selected.attr('id').replace("resource_", "")
|
496
|
+
, href: relevant_href
|
497
|
+
, html: resource_selected.html()
|
498
|
+
});
|
499
|
+
}
|
500
|
+
}
|
501
|
+
});
|
502
|
+
|
503
|
+
$('.form-actions-dialog #cancel_button').trigger('click');
|
504
|
+
},
|
505
|
+
|
506
|
+
init_close: function(){
|
507
|
+
$('.form-actions-dialog #cancel_button').not('.wym_iframe_body .form-actions-dialog #cancel_button').click(close_dialog);
|
508
|
+
|
509
|
+
if (parent
|
510
|
+
&& parent.document.location.href != document.location.href
|
511
|
+
&& parent.document.getElementById('wym_dialog_submit') != null) {
|
512
|
+
$('#dialog_container .form-actions input#submit_button').click(function(e) {
|
513
|
+
e.preventDefault();
|
514
|
+
$(parent.document.getElementById('wym_dialog_submit')).click();
|
515
|
+
});
|
516
|
+
$('#dialog_container .form-actions a.close_dialog').click(close_dialog);
|
517
|
+
}
|
518
|
+
},
|
519
|
+
|
520
|
+
switch_area: function(area){
|
521
|
+
$('#dialog_menu_left .selected_radio').removeClass('selected_radio');
|
522
|
+
$(area).parent().addClass('selected_radio');
|
523
|
+
$('#dialog_main .dialog_area').hide();
|
524
|
+
$('#' + $(area).val() + '_area').show();
|
525
|
+
},
|
526
|
+
|
527
|
+
//Same for resources tab
|
528
|
+
page_tab: function(){
|
529
|
+
$('.link_list li').click(function(e){
|
530
|
+
e.preventDefault();
|
531
|
+
|
532
|
+
$('.link_list li.linked').removeClass('linked');
|
533
|
+
$(this).addClass('linked');
|
534
|
+
|
535
|
+
var link = $(this).children('a.page_link').get(0);
|
536
|
+
var port = (window.location.port.length > 0 ? (":" + window.location.port) : "");
|
537
|
+
var url = link.href.replace(window.location.protocol + "//" + window.location.hostname + port, "");
|
538
|
+
|
539
|
+
link_dialog.update_parent(url, link.rel.replace(/\ ?<em>.+?<\/em>/, ''));
|
540
|
+
});
|
541
|
+
},
|
542
|
+
|
543
|
+
web_tab: function(){
|
544
|
+
link_tester.validate_url_textbox("#web_address_text", function() {
|
545
|
+
link_dialog.update_parent( $('#web_address_text').val(),
|
546
|
+
$('#web_address_text').val(),
|
547
|
+
($('#web_address_target_blank').checked ? "_blank" : "")
|
548
|
+
);
|
549
|
+
});
|
550
|
+
|
551
|
+
$('#web_address_target_blank').click(function(){
|
552
|
+
parent.document.getElementById('wym_target').value = this.checked ? "_blank" : "";
|
553
|
+
});
|
554
|
+
},
|
555
|
+
|
556
|
+
email_tab: function() {
|
557
|
+
$('#email_address_text, #email_default_subject_text, #email_default_body_text').change(function(e){
|
558
|
+
var default_subject = $('#email_default_subject_text').val(),
|
559
|
+
default_body = $('#email_default_body_text').val(),
|
560
|
+
mailto = "mailto:" + $('#email_address_text').val(),
|
561
|
+
modifier = "?",
|
562
|
+
icon = '';
|
563
|
+
|
564
|
+
$('#email_address_test_loader').show();
|
565
|
+
$('#email_address_test_result').hide();
|
566
|
+
$('#email_address_test_result').removeClass('success_icon').removeClass('failure_icon');
|
567
|
+
|
568
|
+
|
569
|
+
link_tester.email(mailto, function (success) {
|
570
|
+
if (success) {
|
571
|
+
icon = 'success_icon';
|
572
|
+
}else{
|
573
|
+
icon = 'failure_icon';
|
574
|
+
}
|
575
|
+
$('#email_address_test_result').addClass(icon).show();
|
576
|
+
$('#email_address_test_loader').hide();
|
577
|
+
});
|
578
|
+
|
579
|
+
if(default_subject.length > 0){
|
580
|
+
mailto += modifier + "subject=" + default_subject;
|
581
|
+
modifier = "&";
|
582
|
+
}
|
583
|
+
|
584
|
+
if(default_body.length > 0){
|
585
|
+
mailto += modifier + "body=" + default_body;
|
586
|
+
modifier = "&";
|
587
|
+
}
|
588
|
+
|
589
|
+
link_dialog.update_parent(mailto, mailto.replace('mailto:', ''));
|
590
|
+
});
|
591
|
+
},
|
592
|
+
|
593
|
+
update_parent: function(url, title, target) {
|
594
|
+
if (parent != null) {
|
595
|
+
if ((wym_href = parent.document.getElementById('wym_href')) != null) {
|
596
|
+
wym_href.value = url;
|
597
|
+
}
|
598
|
+
if ((wym_title = parent.document.getElementById('wym_title')) != null) {
|
599
|
+
wym_title.value = title;
|
600
|
+
}
|
601
|
+
if ((wym_target = parent.document.getElementById('wym_target')) != null) {
|
602
|
+
wym_target.value = target || "";
|
603
|
+
}
|
604
|
+
}
|
605
|
+
}
|
606
|
+
};
|
607
|
+
|
608
|
+
var page_options = {
|
609
|
+
initialised: false
|
610
|
+
, init: function(enable_parts, new_part_url, del_part_url){
|
611
|
+
// set the page tabs up, but ensure that all tabs are shown so that when wymeditor loads it has a proper height.
|
612
|
+
page_options.tabs = $('#page-tabs');
|
613
|
+
page_options.tabs.tabs({tabTemplate: '<li><a href="#{href}">#{label}</a></li>'});
|
614
|
+
page_options.tabs.find(' > ul li a').corner('top 5px');
|
615
|
+
|
616
|
+
part_shown = $('#page-tabs .page_part.field').not('.ui-tabs-hide');
|
617
|
+
$('#page-tabs .page_part.field').removeClass('ui-tabs-hide');
|
618
|
+
|
619
|
+
this.enable_parts = enable_parts;
|
620
|
+
this.new_part_url = new_part_url;
|
621
|
+
this.del_part_url = del_part_url;
|
622
|
+
this.show_options();
|
623
|
+
this.title_type();
|
624
|
+
|
625
|
+
$(document).ready($.proxy(function(){
|
626
|
+
// hide the tabs that are supposed to be hidden.
|
627
|
+
$('#page-tabs .page_part.field').not(this).addClass('ui-tabs-hide');
|
628
|
+
$('#page-tabs > ul li a').corner('top 5px');
|
629
|
+
}, part_shown));
|
630
|
+
|
631
|
+
if(this.enable_parts){
|
632
|
+
this.page_part_dialog();
|
633
|
+
}
|
634
|
+
this.initialised = true;
|
635
|
+
},
|
636
|
+
|
637
|
+
show_options: function(){
|
638
|
+
$('#toggle_advanced_options').click(function(e){
|
639
|
+
e.preventDefault();
|
640
|
+
$('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250);
|
641
|
+
|
642
|
+
$('html,body').animate({
|
643
|
+
scrollTop: $('#toggle_advanced_options').parent().offset().top
|
644
|
+
}, 250);
|
645
|
+
});
|
646
|
+
},
|
647
|
+
|
648
|
+
title_type: function(){
|
649
|
+
$('input#page_custom_title').parents('.field').find('input:radio').change(function(){
|
650
|
+
$('#custom_title_text, #custom_title_image').hide();
|
651
|
+
$('#custom_title_' + this.value).show();
|
652
|
+
});
|
653
|
+
},
|
654
|
+
|
655
|
+
page_part_dialog: function(){
|
656
|
+
$('#new_page_part_dialog').dialog({
|
657
|
+
title: 'Create Content Section',
|
658
|
+
modal: true,
|
659
|
+
resizable: false,
|
660
|
+
autoOpen: false,
|
661
|
+
width: 600,
|
662
|
+
height: 200
|
663
|
+
});
|
664
|
+
|
665
|
+
$('#add_page_part').click(function(e){
|
666
|
+
e.preventDefault();
|
667
|
+
$('#new_page_part_dialog').dialog('open');
|
668
|
+
});
|
669
|
+
|
670
|
+
$('#new_page_part_save').click(function(e){
|
671
|
+
e.preventDefault();
|
672
|
+
|
673
|
+
var part_title = $('#new_page_part_title').val();
|
674
|
+
|
675
|
+
if(part_title.length > 0){
|
676
|
+
var tab_title = part_title.toLowerCase().replace(" ", "_");
|
677
|
+
|
678
|
+
if ($('#part_' + tab_title).size() === 0) {
|
679
|
+
$.get(page_options.new_part_url,
|
680
|
+
{
|
681
|
+
title: part_title
|
682
|
+
, part_index: $('#new_page_part_index').val()
|
683
|
+
, body: ''
|
684
|
+
}
|
685
|
+
, function(data, status){
|
686
|
+
$('#submit_continue_button').remove();
|
687
|
+
// Add a new tab for the new content section.
|
688
|
+
$(data).appendTo('#page_part_editors');
|
689
|
+
page_options.tabs.tabs('add', '#page_part_new_' + $('#new_page_part_index').val(), part_title);
|
690
|
+
page_options.tabs.tabs('select', $('#new_page_part_index').val());
|
691
|
+
|
692
|
+
// turn the new textarea into a wymeditor.
|
693
|
+
$('#page_parts_attributes_' + $('#new_page_part_index').val() + "_body").wymeditor(wymeditor_boot_options);
|
694
|
+
|
695
|
+
// hook into wymedtior to instruct it to select this new tab again once it has loaded.
|
696
|
+
WYMeditor.onload_functions.push(function() {
|
697
|
+
page_options.tabs.tabs('select', $('#new_page_part_index').val());
|
698
|
+
});
|
699
|
+
|
700
|
+
// Wipe the title and increment the index counter by one.
|
701
|
+
$('#new_page_part_index').val(parseInt($('#new_page_part_index').val(), 10) + 1);
|
702
|
+
$('#new_page_part_title').val('');
|
703
|
+
|
704
|
+
page_options.tabs.find('> ul li a').corner('top 5px');
|
705
|
+
|
706
|
+
$('#new_page_part_dialog').dialog('close');
|
707
|
+
}
|
708
|
+
);
|
709
|
+
}else{
|
710
|
+
alert("A content section with that title already exists, please choose another.");
|
711
|
+
}
|
712
|
+
}else{
|
713
|
+
alert("You have not entered a title for the content section, please enter one.");
|
714
|
+
}
|
715
|
+
});
|
716
|
+
|
717
|
+
$('#new_page_part_cancel').click(function(e){
|
718
|
+
e.preventDefault();
|
719
|
+
$('#new_page_part_dialog').dialog('close');
|
720
|
+
$('#new_page_part_title').val('');
|
721
|
+
});
|
722
|
+
|
723
|
+
$('#delete_page_part').click(function(e){
|
724
|
+
e.preventDefault();
|
725
|
+
|
726
|
+
if(confirm("This will remove the content section '" + $('#page_parts .ui-tabs-selected a').text() + "' immediately even if you don't save this page, are you sure?")) {
|
727
|
+
var tabId = page_options.tabs.tabs('option', 'selected');
|
728
|
+
$.ajax({
|
729
|
+
url: page_options.del_part_url + '/' + $('#page_parts_attributes_' + tabId + '_id').val(),
|
730
|
+
type: 'DELETE'
|
731
|
+
});
|
732
|
+
page_options.tabs.tabs('remove', tabId);
|
733
|
+
$('#page_parts_attributes_' + tabId + '_id').remove();
|
734
|
+
$('#submit_continue_button').remove();
|
735
|
+
}
|
736
|
+
|
737
|
+
});
|
738
|
+
|
739
|
+
}
|
740
|
+
|
741
|
+
};
|
742
|
+
|
743
|
+
var image_dialog = {
|
744
|
+
initialised: false
|
745
|
+
, callback: null
|
746
|
+
|
747
|
+
, init: function(callback){
|
748
|
+
this.callback = callback;
|
749
|
+
this.init_tabs();
|
750
|
+
this.init_select();
|
751
|
+
this.init_actions();
|
752
|
+
this.initialised = true;
|
753
|
+
return this;
|
754
|
+
}
|
755
|
+
|
756
|
+
, init_tabs: function(){
|
757
|
+
var radios = $('#dialog_menu_left input:radio');
|
758
|
+
var selected = radios.parent().filter(".selected_radio").find('input:radio').first() || radios.first();
|
759
|
+
|
760
|
+
radios.click(function(){
|
761
|
+
link_dialog.switch_area($(this));
|
762
|
+
});
|
763
|
+
|
764
|
+
selected.attr('checked', 'true');
|
765
|
+
link_dialog.switch_area(selected);
|
766
|
+
}
|
767
|
+
|
768
|
+
, switch_area: function(radio){
|
769
|
+
$('#dialog_menu_left .selected_radio').removeClass('selected_radio');
|
770
|
+
$(radio).parent().addClass('selected_radio');
|
771
|
+
$('#dialog_main .dialog_area').hide();
|
772
|
+
$('#' + radio.value + '_area').show();
|
773
|
+
}
|
774
|
+
|
775
|
+
, init_select: function(){
|
776
|
+
$('#existing_image_area_content ul li img').click(function(){
|
777
|
+
image_dialog.set_image(this);
|
778
|
+
});
|
779
|
+
//Select any currently selected, just uploaded...
|
780
|
+
if ((selected_img = $('#existing_image_area_content ul li.selected img')).length > 0) {
|
781
|
+
image_dialog.set_image(selected_img.first());
|
782
|
+
}
|
783
|
+
}
|
784
|
+
|
785
|
+
, set_image: function(img){
|
786
|
+
if ($(img).length > 0) {
|
787
|
+
$('#existing_image_area_content ul li.selected').removeClass('selected');
|
788
|
+
|
789
|
+
$(img).parent().addClass('selected');
|
790
|
+
var imageId = $(img).attr('data-id');
|
791
|
+
var geometry = $('#existing_image_size_area li.selected a').attr('data-geometry');
|
792
|
+
var size = $('#existing_image_size_area li.selected a').attr('data-size');
|
793
|
+
var resize = $("#wants_to_resize_image").is(':checked');
|
794
|
+
|
795
|
+
image_url = resize ? $(img).attr('data-' + size) : $(img).attr('data-original');
|
796
|
+
|
797
|
+
if (parent) {
|
798
|
+
if ((wym_src = parent.document.getElementById('wym_src')) != null) {
|
799
|
+
wym_src.value = image_url;
|
800
|
+
}
|
801
|
+
if ((wym_title = parent.document.getElementById('wym_title')) != null) {
|
802
|
+
wym_title.value = $(img).attr('title');
|
803
|
+
}
|
804
|
+
if ((wym_alt = parent.document.getElementById('wym_alt')) != null) {
|
805
|
+
wym_alt.value = $(img).attr('alt');
|
806
|
+
}
|
807
|
+
if ((wym_size = parent.document.getElementById('wym_size')) != null
|
808
|
+
&& typeof(geometry) != 'undefined') {
|
809
|
+
wym_size.value = geometry.replace(/[<>=]/g, '');
|
810
|
+
}
|
811
|
+
}
|
812
|
+
}
|
813
|
+
}
|
814
|
+
|
815
|
+
, submit_image_choice: function(e) {
|
816
|
+
e.preventDefault();
|
817
|
+
if((img_selected = $('#existing_image_area_content ul li.selected img').get(0)) && $.isFunction(this.callback))
|
818
|
+
{
|
819
|
+
this.callback(img_selected);
|
820
|
+
}
|
821
|
+
|
822
|
+
close_dialog(e);
|
823
|
+
}
|
824
|
+
|
825
|
+
, init_actions: function(){
|
826
|
+
var _this = this;
|
827
|
+
// get submit buttons not inside a wymeditor iframe
|
828
|
+
$('#existing_image_area .form-actions-dialog #submit_button')
|
829
|
+
.not('.wym_iframe_body #existing_image_area .form-actions-dialog #submit_button')
|
830
|
+
.click($.proxy(_this.submit_image_choice, _this));
|
831
|
+
|
832
|
+
// get cancel buttons not inside a wymeditor iframe
|
833
|
+
$('.form-actions-dialog #cancel_button')
|
834
|
+
.not('.wym_iframe_body .form-actions-dialog #cancel_button')
|
835
|
+
.click($.proxy(close_dialog, _this));
|
836
|
+
|
837
|
+
$('#existing_image_size_area ul li a').click(function(e) {
|
838
|
+
$('#existing_image_size_area ul li').removeClass('selected');
|
839
|
+
$(this).parent().addClass('selected');
|
840
|
+
$('#existing_image_size_area #wants_to_resize_image').attr('checked', 'checked');
|
841
|
+
image_dialog.set_image($('#existing_image_area_content ul li.selected img'));
|
842
|
+
e.preventDefault();
|
843
|
+
});
|
844
|
+
|
845
|
+
$('#existing_image_size_area #wants_to_resize_image').change(function(){
|
846
|
+
if($(this).is(":checked")) {
|
847
|
+
$('#existing_image_size_area ul li:first a').click();
|
848
|
+
} else {
|
849
|
+
$('#existing_image_size_area ul li').removeClass('selected');
|
850
|
+
image_dialog.set_image($('#existing_image_area_content ul li.selected img'));
|
851
|
+
}
|
852
|
+
});
|
853
|
+
|
854
|
+
image_area = $('#existing_image_area').not('#wym_iframe_body #existing_image_area');
|
855
|
+
image_area.find('.form-actions input#submit_button').click($.proxy(function(e) {
|
856
|
+
e.preventDefault();
|
857
|
+
$(this.document.getElementById('wym_dialog_submit')).click();
|
858
|
+
}, parent));
|
859
|
+
image_area.find('.form-actions a.close_dialog').click(close_dialog);
|
860
|
+
}
|
861
|
+
};
|
862
|
+
|
863
|
+
var list_reorder = {
|
864
|
+
initialised: false
|
865
|
+
, init: function() {
|
866
|
+
$('#reorder_action').click(list_reorder.enable_reordering);
|
867
|
+
$('#reorder_action_done').click(list_reorder.disable_reordering);
|
868
|
+
if(list_reorder.tree === false) {
|
869
|
+
list_reorder.sortable_list.find('li').addClass('no-nest');
|
870
|
+
}
|
871
|
+
list_reorder.sortable_list.nestedSortable({
|
872
|
+
disableNesting: 'no-nest',
|
873
|
+
forcePlaceholderSize: true,
|
874
|
+
handle: list_reorder.tree ? 'div' : null,
|
875
|
+
items: 'li',
|
876
|
+
opacity: .6,
|
877
|
+
placeholder: 'placeholder',
|
878
|
+
tabSize: 25,
|
879
|
+
tolerance: 'pointer',
|
880
|
+
toleranceElement: list_reorder.tree ? '> div' : null,
|
881
|
+
disabled: true,
|
882
|
+
start: function () {
|
883
|
+
},
|
884
|
+
change: function () {
|
885
|
+
if (list_reorder.tree) {
|
886
|
+
list_reorder.reset_branch_classes(this);
|
887
|
+
}
|
888
|
+
},
|
889
|
+
stop: function () {
|
890
|
+
if (list_reorder.tree) {
|
891
|
+
list_reorder.reset_branch_classes(this);
|
892
|
+
} else {
|
893
|
+
list_reorder.reset_on_off_classes(this);
|
894
|
+
}
|
895
|
+
}
|
896
|
+
});
|
897
|
+
if (list_reorder.tree) {
|
898
|
+
list_reorder.reset_branch_classes(list_reorder.sortable_list);
|
899
|
+
} else {
|
900
|
+
list_reorder.reset_on_off_classes(list_reorder.sortable_list);
|
901
|
+
}
|
902
|
+
this.initialised = true;
|
903
|
+
}
|
904
|
+
, reset_on_off_classes: function(ul) {
|
905
|
+
$("> li", ul).each(function(i, li) {
|
906
|
+
$(li).removeClass('on off on-hover').addClass(i % 2 === 0 ? 'on' : 'off');
|
907
|
+
});
|
908
|
+
}
|
909
|
+
|
910
|
+
, reset_branch_classes: function (ul) {
|
911
|
+
$("li.ui-sortable-helper", this).removeClass("record").removeClass("branch_start").removeClass("branch_end");
|
912
|
+
$("li", ul).removeClass("branch_start").removeClass("branch_end");
|
913
|
+
|
914
|
+
$("> li:first", ul).addClass("branch_start");
|
915
|
+
$("> li:last", ul).addClass("branch_end");
|
916
|
+
|
917
|
+
var nested_ul = $("ul", ul);
|
918
|
+
$("> li:last", nested_ul).addClass("branch_end");
|
919
|
+
}
|
920
|
+
|
921
|
+
,enable_reordering: function(e) {
|
922
|
+
if(e) { e.preventDefault(); }
|
923
|
+
$('#sortable_list').addClass("reordering");
|
924
|
+
|
925
|
+
$('#sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(500, 0.3);
|
926
|
+
$('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(500, 0.55);
|
927
|
+
|
928
|
+
list_reorder.sortable_list.nestedSortable("enable");
|
929
|
+
$('#reorder_action').hide();
|
930
|
+
$('#reorder_action_done').show();
|
931
|
+
}
|
932
|
+
|
933
|
+
, disable_reordering: function(e) {
|
934
|
+
if($('#reorder_action_done').hasClass('loading')){
|
935
|
+
return false;
|
936
|
+
}
|
937
|
+
if(e) { e.preventDefault(); }
|
938
|
+
$('#reorder_action_done').addClass('loading');
|
939
|
+
list_reorder.sortable_list.nestedSortable("disable");
|
940
|
+
|
941
|
+
$('#sortable_list').removeClass("reordering");
|
942
|
+
|
943
|
+
if (list_reorder.update_url != null) {
|
944
|
+
|
945
|
+
var serialized = list_reorder.sortable_list.serializelist();
|
946
|
+
|
947
|
+
$.post(list_reorder.update_url, serialized, function(data) {
|
948
|
+
list_reorder.restore_controls(e);
|
949
|
+
});
|
950
|
+
} else {
|
951
|
+
list_reorder.restore_controls(e);
|
952
|
+
}
|
953
|
+
}
|
954
|
+
|
955
|
+
, restore_controls: function(e) {
|
956
|
+
if (list_reorder.tree && !$.browser.msie) {
|
957
|
+
list_reorder.sortable_list.add(list_reorder.sortable_list.find('ul, li, div')).draggable({ disabled: true });
|
958
|
+
} else {
|
959
|
+
$(list_reorder.sortable_list).sortable('destroy');
|
960
|
+
}
|
961
|
+
$(list_reorder.sortable_list).removeClass('reordering, ui-sortable');
|
962
|
+
|
963
|
+
$('#sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(250, 1);
|
964
|
+
$('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(250, 1, function() {
|
965
|
+
$('#reorder_action_done').hide().removeClass('loading');
|
966
|
+
$('#reorder_action').show();
|
967
|
+
});
|
968
|
+
}
|
969
|
+
};
|
970
|
+
|
971
|
+
var image_picker = {
|
972
|
+
initialised: false
|
973
|
+
, options: {
|
974
|
+
selected: ''
|
975
|
+
, thumbnail: 'medium'
|
976
|
+
, field: '#image'
|
977
|
+
, image_display: '.current_picked_image'
|
978
|
+
, no_image_message: '.no_picked_image_selected'
|
979
|
+
, image_container: '.current_image_container'
|
980
|
+
, remove_image_button: '.remove_picked_image'
|
981
|
+
, picker_container: '.image_picker_container'
|
982
|
+
, image_link: '.current_image_link'
|
983
|
+
, image_toggler: null
|
984
|
+
}
|
985
|
+
|
986
|
+
, init: function(new_options){
|
987
|
+
this.options = $.extend(this.options, new_options);
|
988
|
+
$(this.options.picker_container).find(this.options.remove_image_button)
|
989
|
+
.click($.proxy(this.remove_image, {container: this.options.picker_container, picker: this}));
|
990
|
+
$(this.options.picker_container).find(this.options.image_toggler)
|
991
|
+
.click($.proxy(this.toggle_image, {container: this.options.picker_container, picker: this}));
|
992
|
+
|
993
|
+
this.initialised = true;
|
994
|
+
|
995
|
+
return this;
|
996
|
+
}
|
997
|
+
|
998
|
+
, remove_image: function(e) {
|
999
|
+
e.preventDefault();
|
1000
|
+
|
1001
|
+
$(this.container).find(this.picker.options.image_display)
|
1002
|
+
.removeClass('brown_border')
|
1003
|
+
.attr({'src': '', 'width': '', 'height': ''})
|
1004
|
+
.css({'width': 'auto', 'height': 'auto'})
|
1005
|
+
.hide();
|
1006
|
+
$(this.container).find(this.picker.options.field).val('');
|
1007
|
+
$(this.container).find(this.picker.options.no_image_message).show();
|
1008
|
+
$(this.container).find(this.picker.options.remove_image_button).hide();
|
1009
|
+
$(this).hide();
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
, toggle_image: function(e) {
|
1013
|
+
$(this.container).find(this.options.image_toggler).html(
|
1014
|
+
($(this.container).find(options.image_toggler).html() == 'Show' ? 'Hide' : 'Show')
|
1015
|
+
);
|
1016
|
+
$(this.container).find(this.options.image_container).toggle();
|
1017
|
+
e.preventDefault();
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
, changed: function(e) {
|
1021
|
+
$(this.container).find(this.picker.options.field).val(
|
1022
|
+
this.image.id.replace("image_", "")
|
1023
|
+
);
|
1024
|
+
|
1025
|
+
var size = this.picker.options.thumbnail || 'original';
|
1026
|
+
this.image.src = $(this.image).attr('data-' + size);
|
1027
|
+
current_image = $(this.container).find(this.picker.options.image_display);
|
1028
|
+
current_image.replaceWith(
|
1029
|
+
$("<img src='"+this.image.src+"?"+Math.floor(Math.random() * 100000)+"' id='"+current_image.attr('id')+"' class='"+this.picker.options.image_display.replace(/^./, '')+" brown_border' />")
|
1030
|
+
);
|
1031
|
+
|
1032
|
+
$(this.container).find(this.picker.options.remove_image_button).show();
|
1033
|
+
$(this.container).find(this.picker.options.no_image_message).hide();
|
1034
|
+
}
|
1035
|
+
};
|
1036
|
+
|
1037
|
+
var resource_picker = {
|
1038
|
+
initialised: false
|
1039
|
+
, callback: null
|
1040
|
+
|
1041
|
+
, init: function(callback) {
|
1042
|
+
this.callback = callback;
|
1043
|
+
this.initialised = true;
|
1044
|
+
}
|
1045
|
+
};
|
1046
|
+
|
1047
|
+
close_dialog = function(e) {
|
1048
|
+
if (iframed())
|
1049
|
+
{
|
1050
|
+
the_body = $(parent.document.body);
|
1051
|
+
the_dialog = parent.$('.ui-dialog-content');
|
1052
|
+
} else {
|
1053
|
+
the_body = $(document.body).removeClass('hide-overflow');
|
1054
|
+
the_dialog = $('.ui-dialog-content');
|
1055
|
+
the_dialog.filter(':data(dialog)').dialog('close');
|
1056
|
+
the_dialog.remove();
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
// if there's a wymeditor involved don't try to close the dialog as wymeditor will.
|
1060
|
+
if (!$(document.body).hasClass('wym_iframe_body')) {
|
1061
|
+
the_body.removeClass('hide-overflow');
|
1062
|
+
the_dialog.filter(':data(dialog)').dialog('close');
|
1063
|
+
the_dialog.remove();
|
1064
|
+
e.preventDefault();
|
1065
|
+
}
|
1066
|
+
};
|
1067
|
+
|
1068
|
+
//parse a URL to form an object of properties
|
1069
|
+
parseURL = function(url)
|
1070
|
+
{
|
1071
|
+
//save the unmodified url to href property
|
1072
|
+
//so that the object we get back contains
|
1073
|
+
//all the same properties as the built-in location object
|
1074
|
+
var loc = { 'href' : url };
|
1075
|
+
|
1076
|
+
//split the URL by single-slashes to get the component parts
|
1077
|
+
var parts = url.replace('//', '/').split('/');
|
1078
|
+
|
1079
|
+
//store the protocol and host
|
1080
|
+
loc.protocol = parts[0];
|
1081
|
+
loc.host = parts[1];
|
1082
|
+
|
1083
|
+
//extract any port number from the host
|
1084
|
+
//from which we derive the port and hostname
|
1085
|
+
parts[1] = parts[1].split(':');
|
1086
|
+
loc.hostname = parts[1][0];
|
1087
|
+
loc.port = parts[1].length > 1 ? parts[1][1] : '';
|
1088
|
+
|
1089
|
+
//splice and join the remainder to get the pathname
|
1090
|
+
parts.splice(0, 2);
|
1091
|
+
// ensure we don't destroy absolute urls like /system/images/whatever.jpg
|
1092
|
+
loc.pathname = (loc.href[0] == '/' ? ("/" + loc.host) : '');
|
1093
|
+
loc.pathname += '/' + parts.join('/');
|
1094
|
+
|
1095
|
+
//extract any hash and remove from the pathname
|
1096
|
+
loc.pathname = loc.pathname.split('#');
|
1097
|
+
loc.hash = loc.pathname.length > 1 ? '#' + loc.pathname[1] : '';
|
1098
|
+
loc.pathname = loc.pathname[0];
|
1099
|
+
|
1100
|
+
//extract any search query and remove from the pathname
|
1101
|
+
loc.pathname = loc.pathname.split('?');
|
1102
|
+
loc.search = loc.pathname.length > 1 ? '?' + loc.pathname[1] : '';
|
1103
|
+
loc.pathname = loc.pathname[0];
|
1104
|
+
|
1105
|
+
var options = url.split('?')[1];
|
1106
|
+
loc.options = options;
|
1107
|
+
|
1108
|
+
//return the final object
|
1109
|
+
return loc;
|
1110
|
+
};
|
1111
|
+
|
1112
|
+
iframed = function() {
|
1113
|
+
return (parent && parent.document.location.href != document.location.href && $.isFunction(parent.$));
|
1114
|
+
};
|