diff --git a/login_shadowbox/css/bg.gif b/login_shadowbox/css/bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..1ae9884a3f1db0797c9d74c1a9619f5e9a5d85e9 GIT binary patch literal 65 zcmZ?wbhEHb#j0_CS3_1)z0Fq~55}H%rD6!$%k#6A= Pt{c}*&%LY2%3uuuL|7P) literal 0 HcmV?d00001 diff --git a/login_shadowbox/css/login_shadowbox.css b/login_shadowbox/css/login_shadowbox.css index 111dfee..8b0d28b 100644 --- a/login_shadowbox/css/login_shadowbox.css +++ b/login_shadowbox/css/login_shadowbox.css @@ -1,11 +1,204 @@ -#sb-body .html { - background: #ACF; - padding: 50px; - border: 2px dotted #69C; +#sb-wrapper-inner.shadowbox-login { + border: 2px dotted #69C; } -#shadowbox_login { - width: 150px; - margin: 0 auto; - overflow: hidden; +#sb-wrapper-inner.shadowbox-login #sb-body { + background: url("bg.gif") repeat scroll left top #F4F4F4; +} + +.shadowbox_login_wrapper { + margin: 0 auto; + overflow: auto; + padding: 30px; + font-family: Georgia,"Times New Roman",Times,serif; + font-size: 14px; + line-height: 1.5; + word-wrap: break-word; +} + +.shadowbox_login_close_button { + position: absolute; + top: 10px; + right: 10px; +} + +.shadowbox_login_wrapper form { + margin: 0; + padding: 0; +} + +.shadowbox_login_wrapper .form-item { + margin-bottom: 1em; + margin-top: 2px; +} + +.shadowbox_login_wrapper .form-item, +.shadowbox_login_wrapper .form-actions { + margin-bottom: 1em; + margin-top: 1em; +} + +.shadowbox_login_wrapper .form-item label { + font-size: 0.929em; +} + +.shadowbox_login_wrapper label { + display: block; + font-weight: bold; + text-transform: none; +} + +.shadowbox_login_wrapper input { + "Lucida Grande","Lucida Sans Unicode",Verdana,sans-serif; +} + +.shadowbox_login_wrapper input[type="text"], +.shadowbox_login_wrapper input[type="password"] { + border: solid 2px #E5E5E5; + background: #FFFFFF; + color: #999999; + margin: 5px 0; + padding: 10px; + display: block; + font-size: 16px; + width: 90%; + background: -webkit-gradient( + linear, + left top, + left 25, + from(#FFFFFF), + color-stop(4%, #EEEEEE), + to(#FFFFFF) + ); + background: -moz-linear-gradient( + top, + #FFFFFF, + #EEEEEE 1px, + #FFFFFF 25px + ); +} + +.shadowbox_login_wrapper input[type="text"]:focus, +.shadowbox_login_wrapper input[type="password"]:focus { + color: #000000; + border: solid 2px #FFCC00; + background: #FEFFEF; +} + +.shadowbox_login_wrapper input[type="text"].error, +.shadowbox_login_wrapper input[type="password"].error { + color: #8C2E0B; + border: solid 2px red; + background: #FEF5F1; +} + +.shadowbox_login_wrapper .form-item .description { + font-size: 0.85em; +} + +.shadowbox_login_wrapper fieldset { + background: none repeat scroll 0 0 #FFFFFF; + border: 1px solid #CCCCCC; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + margin-bottom: 32px; + margin-top: 10px; + padding: 0 0 10px; + position: relative; + top: 12px; +} + +.shadowbox_login_wrapper fieldset legend { + -moz-border-bottom-colors: none; + -moz-border-image: none; + -moz-border-left-colors: none; + -moz-border-right-colors: none; + -moz-border-top-colors: none; + background: none repeat scroll 0 0 #DBDBDB; + border-color: #CCCCCC #CCCCCC -moz-use-text-color; + border-style: solid solid none; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-width: 1px 1px medium; + color: #3B3B3B; + display: block; + font-family: "Lucida Grande","Lucida Sans Unicode",Verdana,sans-serif; + height: 2em; + left: -1px; + line-height: 2; + padding: 0; + position: absolute; + text-indent: 10px; + text-shadow: 0 1px 0 #FFFFFF; + top: -12px; + width: 100%; +} + +.shadowbox_login_wrapper fieldset .fieldset-wrapper { + padding: 0 10px; +} + +.shadowbox_login_wrapper .fieldset-wrapper { + margin-top: 25px; +} + +.shadowbox_login_wrapper fieldset .fieldset-description { + color: #3C3C3C; + font-style: italic; + line-height: 1.4; + margin-bottom: 1em; + margin-top: 5px; +} + +.shadowbox_login_wrapper .form-actions { + padding-top: 10px; +} + +.shadowbox_login_wrapper ul { + padding: 0; + margin: 0; +} + +.shadowbox_login_wrapper .item-list ul li { + list-style: none; +} + +.shadowbox_login_wrapper #edit-actions { + margin-right: 0.6em; +} + +.shadowbox_login_wrapper #edit-actions, +.shadowbox_login_wrapper input[type="submit"] { + float: right; +} + +.shadowbox_login_wrapper input.form-submit, +.shadowbox_login_wrapper a.button { + -moz-border-bottom-colors: none; + -moz-border-image: none; + -moz-border-left-colors: none; + -moz-border-right-colors: none; + -moz-border-top-colors: none; + background: url("../images/buttons.png") repeat-x scroll 0 0 #FFFFFF; + border-color: #E4E4E4 #D2D2D2 #B4B4B4; + border-radius: 15px 15px 15px 15px; + border-style: solid; + border-width: 1px; + color: #3A3A3A; + cursor: pointer; + font-size: 0.929em; + font-weight: normal; + margin-bottom: 1em; + margin-right: 0.6em; + padding: 4px 17px; + text-align: center; +} + +body.shadowbox_login div.messages { + position: absolute; + top: 0; + left: 0; + margin: 0 !important; + z-index: 999; } diff --git a/login_shadowbox/login_shadowbox.admin.inc b/login_shadowbox/login_shadowbox.admin.inc index 801a27a..67ccba1 100644 --- a/login_shadowbox/login_shadowbox.admin.inc +++ b/login_shadowbox/login_shadowbox.admin.inc @@ -15,22 +15,79 @@ function login_shadowbox_settings() { '#default_value' => variable_get('login_shadowbox_enabled', FALSE), ); - $form['login_shadowbox_width'] = array( + $form['login_shadowbox_login'] = array( + '#type' => 'fieldset', + '#title' => 'Login Dimensions', + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + + $form['login_shadowbox_login']['login_shadowbox_width'] = array( '#type' => 'textfield', '#title' => t('Shadowbox login width'), - '#description' => t('The width (in pixels) of shadowbox when it appears on screen.'), + '#description' => t('The width (in pixels) of shadowbox login form when it appears on screen.'), '#size' => 5, '#maxlength' => 4, - '#default_value' => variable_get('login_shadowbox_width', 300), + '#default_value' => variable_get('login_shadowbox_width', 500), ); - $form['login_shadowbox_height'] = array( + $form['login_shadowbox_login']['login_shadowbox_height'] = array( '#type' => 'textfield', '#title' => t('Shadowbox login height'), - '#description' => t('The height (in pixels) of shadowbox when it appears on screen.'), + '#description' => t('The height (in pixels) of shadowbox login form when it appears on screen.'), + '#size' => 5, + '#maxlength' => 4, + '#default_value' => variable_get('login_shadowbox_height', 380), + ); + + $form['login_shadowbox_register'] = array( + '#type' => 'fieldset', + '#title' => 'Registration Dimensions', + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + + $form['login_shadowbox_register']['login_shadowbox_register_width'] = array( + '#type' => 'textfield', + '#title' => t('Shadowbox registration width'), + '#description' => t('The width (in pixels) of shadowbox containing the registration form when it appears on screen.'), + '#size' => 5, + '#maxlength' => 4, + '#default_value' => variable_get('login_shadowbox_register_width', 500), + ); + + $form['login_shadowbox_register']['login_shadowbox_register_height'] = array( + '#type' => 'textfield', + '#title' => t('Shadowbox registration height'), + '#description' => t('The height (in pixels) of shadowbox containing the registration form when it appears on screen.'), + '#size' => 5, + '#maxlength' => 4, + '#default_value' => variable_get('login_shadowbox_register_height', 440), + ); + + $form['login_shadowbox_password'] = array( + '#type' => 'fieldset', + '#title' => 'Reset Password Dimensions', + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + + $form['login_shadowbox_password']['login_shadowbox_password_width'] = array( + '#type' => 'textfield', + '#title' => t('Shadowbox reset password width'), + '#description' => t('The width (in pixels) of shadowbox containing the reset password form when it appears on screen.'), + '#size' => 5, + '#maxlength' => 4, + '#default_value' => variable_get('login_shadowbox_password_width', 500), + ); + + $form['login_shadowbox_password']['login_shadowbox_password_height'] = array( + '#type' => 'textfield', + '#title' => t('Shadowbox reset password height'), + '#description' => t('The height (in pixels) of shadowbox containing the reset password form when it appears on screen.'), '#size' => 5, '#maxlength' => 4, - '#default_value' => variable_get('login_shadowbox_height', 400), + '#default_value' => variable_get('login_shadowbox_password_height', 240), ); $form['login_shadowbox_modal'] = array( diff --git a/login_shadowbox/login_shadowbox.info b/login_shadowbox/login_shadowbox.info index f851efa..2c4d12f 100644 --- a/login_shadowbox/login_shadowbox.info +++ b/login_shadowbox/login_shadowbox.info @@ -6,3 +6,5 @@ dependencies[] = shadowbox files[] = login_shadowbox.module files[] = login_shadowbox.install files[] = login_shadowbox.admin.inc +files[] = login_shadowbox_page.tpl.php +files[] = login_shadowbox.pages.inc diff --git a/login_shadowbox/login_shadowbox.install b/login_shadowbox/login_shadowbox.install index e17e471..b94d8d7 100644 --- a/login_shadowbox/login_shadowbox.install +++ b/login_shadowbox/login_shadowbox.install @@ -8,9 +8,17 @@ function login_shadowbox_install() { * Implementation of hook_uninstall() */ function login_shadowbox_uninstall() { + // variables used to configure shadowbox login variable_del('login_shadowbox_enabled'); variable_del('login_shadowbox_width'); + variable_del('login_shadowbox_register_width'); + variable_del('login_shadowbox_password_width'); variable_del('login_shadowbox_height'); + variable_del('login_shadowbox_register_height'); + variable_del('login_shadowbox_password_height'); variable_del('login_shadowbox_modal'); variable_del('login_shadowbox_css'); + + // variables used to configure shadowbox login block + variable_del('login_shadowbox_login_block_visibility'); } diff --git a/login_shadowbox/login_shadowbox.module b/login_shadowbox/login_shadowbox.module index ba7cd8e..1b980c2 100644 --- a/login_shadowbox/login_shadowbox.module +++ b/login_shadowbox/login_shadowbox.module @@ -6,36 +6,46 @@ function login_shadowbox_init() { $enable = variable_get('login_shadowbox_enabled', FALSE) && variable_get('shadowbox_enabled', TRUE); + $path = drupal_get_path('module', 'login_shadowbox'); - if(user_is_anonymous() && $enable) { - - $login_path = drupal_get_path_alias('user/login'); + if ( $enable && (arg(0) != 'admin') ) { + drupal_add_js($path . '/scripts/login_shadowbox_check.js'); + } - $block = module_invoke('user', 'block_view', 'login'); + if(user_is_anonymous() && $enable) { - $login_form = '
'; - $login_form .= render($block); - $login_form .= '
'; + $login_path = drupal_get_path_alias('user/login'); + $register_path = drupal_get_path_alias('user/register'); + $password_path = drupal_get_path_alias('user/password'); + $login_content = url(drupal_get_path_alias('user/login/shadowbox')); + $register_content = url(drupal_get_path_alias('user/register/shadowbox')); + $password_content = url(drupal_get_path_alias('user/password/shadowbox')); + // Shadowbox login settings $shadowbox_login_settings = array ( - 'loginPath' => $login_path, - 'loginForm' => $login_form, - 'width' => variable_get('login_shadowbox_width', 300), - 'height' => variable_get('login_shadowbox_height', 400), - 'modal' => variable_get('login_shadowbox_modal', TRUE), + 'login_path' => $login_path, + 'register_path' => $register_path, + 'password_path' => $password_path, + 'login_content' => $login_content, + 'register_content' => $register_content, + 'password_content' => $password_content, + 'login_width' => variable_get('login_shadowbox_width', 500), + 'register_width' => variable_get('login_shadowbox_register_width', 500), + 'password_width' => variable_get('login_shadowbox_password_width', 500), + 'login_height' => variable_get('login_shadowbox_height', 380), + 'register_height' => variable_get('login_shadowbox_register_height', 440), + 'password_height' => variable_get('login_shadowbox_password_height', 240), + 'modal' => variable_get('login_shadowbox_modal', TRUE), ); - // Login block is blank in some paths so we check that before adding js and css files - if (isset($block['content']) && $block['content']) { - // we have to be sure shadowbox is loaded in case it is not - drupal_add_library('shadowbox', 'shadowbox'); - // add the neccessary javascript and css files needed by shadowbox login - $path = drupal_get_path('module', 'login_shadowbox'); - drupal_add_js(array('shadowboxLogin' => $shadowbox_login_settings), 'setting'); - drupal_add_js($path . '/scripts/login_shadowbox.js'); - $css_path = variable_get('login_shadowbox_css', $path . '/css/login_shadowbox.css'); - drupal_add_css($css_path, array('group' => 'CSS_THEME')); - } + // We have to be sure shadowbox is loaded in case it is not + drupal_add_library('shadowbox', 'shadowbox'); + + // Adding the neccessary javascript and css files needed by shadowbox login + drupal_add_js(array('shadowboxLogin' => $shadowbox_login_settings), 'setting'); + drupal_add_js($path . '/scripts/login_shadowbox.js'); + $css_path = variable_get('login_shadowbox_css', $path . '/css/login_shadowbox.css'); + drupal_add_css($css_path, array('group' => 'CSS_DEFAULT')); } } @@ -57,6 +67,30 @@ function login_shadowbox_menu() { 'file' => 'login_shadowbox.admin.inc', ); + $items['user/login/shadowbox'] = array( + 'title' => 'Login', + 'page callback' => 'login_shadowbox_login', + 'access callback' => 'user_is_anonymous', + 'type' => MENU_CALLBACK, + 'file' => 'login_shadowbox.pages.inc', + ); + + $items['user/register/shadowbox'] = array( + 'title' => 'Registration', + 'page callback' => 'login_shadowbox_register', + 'access callback' => 'user_is_anonymous', + 'type' => MENU_CALLBACK, + 'file' => 'login_shadowbox.pages.inc', + ); + + $items['user/password/shadowbox'] = array( + 'title' => 'Reset Password', + 'page callback' => 'login_shadowbox_password', + 'access callback' => 'user_is_anonymous', + 'type' => MENU_CALLBACK, + 'file' => 'login_shadowbox.pages.inc', + ); + return $items; } @@ -78,21 +112,76 @@ function login_shadowbox_permission() { */ function login_shadowbox_block_info() { $blocks['login_shadowbox_login_block'] = array ( - 'info' => t('Shadowbox Login Link'), + 'info' => t('Shadowbox Login'), 'cache' => DRUPAL_NO_CACHE, - 'visibility' => 0, - 'pages' => array('user/login'), + 'visibility' => BLOCK_VISIBILITY_NOTLISTED, + 'pages' => 'user/login', ); return $blocks; } /** + * Implementation of hook_block_configure() + */ +function login_shadowbox_block_configure($delta = '') { + $form = array(); + if ($delta == 'login_shadowbox_login_block') { + $form['login_shadowbox_login_block_visibility'] = array ( + '#type' => 'checkbox', + '#title' => t('Show when logged'), + '#default_value' => variable_get('login_shadowbox_login_block_visibility', 0), + '#description' => t('Check this box if you want to show shadowbox login block with a logout link when user is logged.'), + ); + } + return $form; +} + +/** + * Implementation of hook_block_save() + */ +function login_shadowbox_block_save($delta = '', $edit = array()) { + + if ($delta == 'login_shadowbox_login_block') { + variable_set('login_shadowbox_login_block_visibility', $edit['login_shadowbox_login_block_visibility']); + } + return; +} + +/** * Implementation of hook_block_view() */ function login_shadowbox_block_view($delta = '') { - if($delta == 'login_shadowbox_login_block' && user_is_anonymous() && !(arg(0) == 'user' && !is_numeric(arg(1)))) { - $block['subject'] = t('Login'); - $block['content'] = l(t('Login'), 'user/login'); + $block = array(); + $items = array(); + if($delta == 'login_shadowbox_login_block' && !(arg(0) == 'user' && !is_numeric(arg(1)))) { + if (user_is_anonymous()) { + $block['subject'] = t('Login'); + $items[] = l(t('Login'), 'user/login', array('attributes' => array('title' => t('Login')))); + if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) { + $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.')))); + } + $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.')))); + $block['content'] = theme('item_list', array('items' => $items)); + } else if (variable_get('login_shadowbox_login_block_visibility', 0)) { + $block['subject'] = t('Login'); + $items[] = l(t('Log out'), 'user/logout', array('attributes' => array('title' => t('Log out')))); + $block['content'] = theme('item_list', array('items' => $items)); + } return $block; } } + +/** + * Implementation of hook_theme() + */ +function login_shadowbox_theme() { + return array( + 'login_shadowbox_page' => array( + 'variables' => array( + 'title' => '', + 'content' => NULL, + ), + 'template' => 'login_shadowbox_page', + ), + ); +} diff --git a/login_shadowbox/login_shadowbox.pages.inc b/login_shadowbox/login_shadowbox.pages.inc new file mode 100644 index 0000000..f6c52ce --- /dev/null +++ b/login_shadowbox/login_shadowbox.pages.inc @@ -0,0 +1,79 @@ +'; + + $login_form .= ''; + + // add login form + $form = drupal_get_form("user_login"); + $login_form .= drupal_render($form); + + // add the registration and reset password links + if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) { + $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.')))); + } + $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.')))); + $links['links'] = array('#markup' => theme('item_list', array('items' => $items))); + $login_form .= drupal_render($links); + + $login_form .= ''; + // LOGIN FORM END + + print theme('login_shadowbox_page', array( + 'title' => 'Login', + 'content' => $login_form, + )); + + return NULL; +} + +function login_shadowbox_register() { + + _login_shadowbox_js_css(); + + // REGISTRATION FORM BEGIN + $register_form = '
'; + $register_form .= ''; + if (user_register_access()) $register_form .= drupal_render(drupal_get_form("user_register_form")); + $register_form .= '
'; + // REGISTRATION FORM END + + print theme('login_shadowbox_page', array( + 'title' => 'Registration', + 'content' => $register_form, + )); + + return NULL; +} + +function login_shadowbox_password() { + + _login_shadowbox_js_css(); + + // RESET PASSWORD FORM BEGIN + module_load_include('inc', 'user', 'user.pages'); + $password_form = '
'; + $password_form .= ''; + $password_form .= drupal_render(drupal_get_form("user_pass")); + $password_form .= '
'; + // RESET PASSWORD FORM END + + print theme('login_shadowbox_page', array( + 'title' => 'Registration', + 'content' => $password_form, + )); + + return NULL; +} + +function _login_shadowbox_js_css() { + $path = drupal_get_path('module', 'login_shadowbox'); + $css_path = variable_get('login_shadowbox_css', $path . '/css/login_shadowbox.css'); + drupal_add_css($css_path, array('group' => 'CSS_DEFAULT')); + drupal_add_js($path . '/scripts/login_shadowbox_messages.js'); +} diff --git a/login_shadowbox/login_shadowbox_page.tpl.php b/login_shadowbox/login_shadowbox_page.tpl.php new file mode 100644 index 0000000..f73279c --- /dev/null +++ b/login_shadowbox/login_shadowbox_page.tpl.php @@ -0,0 +1,18 @@ +dir = $language->direction ? 'rtl' : 'ltr'; + $rdf_namespaces = drupal_get_rdf_namespaces(); + $grddl_profile = 'http://www.w3.org/1999/xhtml/vocab'; +?> +> + + <?php print $title; ?> + + + + + + + + diff --git a/login_shadowbox/scripts/login_shadowbox.js b/login_shadowbox/scripts/login_shadowbox.js index 74997bd..718c65b 100644 --- a/login_shadowbox/scripts/login_shadowbox.js +++ b/login_shadowbox/scripts/login_shadowbox.js @@ -1,40 +1,193 @@ -(function($) -{ - Drupal.behaviors.shadowboxLogin = - { - attach:function() - { +(function($) { + Drupal.behaviors.shadowboxLogin = { + + attach:function() { + Shadowbox.ctrlPressed = false; var settings = Drupal.settings.shadowboxLogin; + Shadowbox.showLogin = function() { - Shadowbox.open({ - content: settings.loginForm, - player: 'html', - width: settings.width, - height: settings.height, - options: { - modal: settings.modal, - enableKeys: false - } - }); + Shadowbox.open([{ + content: settings.login_content, + player: 'iframe', + gallery: 'shadowbox_login', + width: settings.login_width, + height: settings.login_height, + options: { + modal: settings.modal, + enableKeys: false, + displayCounter: false, + displayNav: false, + onOpen: function() { + $("#sb-wrapper-inner").addClass("shadowbox-login"); + }, + onClose: function() { + $("#sb-wrapper-inner").removeClass("shadowbox-login"); + }, + onFinish: function(gallery) { + $('#sb-player').load(function() { + $('#sb-player').contents().find("a[href*='" + settings.register_path + "']").click(function(event) { + parent.Shadowbox.change(1); + return false; + }); + $('#sb-player').contents().find("a[href*='" + settings.password_path + "']").click(function(event) { + parent.Shadowbox.change(2); + return false; + }); + $('#sb-player').contents().find('#shadowbox_login #edit-name').focus(); + if (settings.modal) { + $('#sb-player').contents().find(".shadowbox_login_close_button").click(function() { + parent.Shadowbox.close(); + }); + } else { + $('#sb-player').contents().find(".shadowbox_login_close_button").hide(); + } + }); + } + + } + + }, { + content: settings.register_content, + player: 'iframe', + gallery: 'shadowbox_login', + width: settings.register_width, + height: settings.register_height, + options: { + modal: settings.modal, + enableKeys: false, + displayCounter: false, + displayNav: false, + onFinish: function() { + $('#sb-player').load(function() { + $('#sb-player').contents().find("#shadowbox_register .username").focus(); + if (settings.modal) { + $('#sb-player').contents().find(".shadowbox_login_close_button").click(function() { + parent.Shadowbox.close(); + }); + } else { + $('#sb-player').contents().find(".shadowbox_login_close_button").hide(); + } + }); + } + } + + }, { + content: settings.password_content, + player: 'iframe', + gallery: 'shadowbox_login', + width: settings.password_width, + height: settings.password_height, + options: { + modal: settings.modal, + enableKeys: false, + displayCounter: false, + displayNav: false, + onOpen: function() { + $("#sb-wrapper-inner").addClass("shadowbox-login"); + }, + onClose: function() { + $("#sb-wrapper-inner").removeClass("shadowbox-login"); + }, + onFinish: function() { + $('#sb-player').load(function() { + $('#sb-player').contents().find("#shadowbox_password #edit-name").focus(); + if (settings.modal) { + $('#sb-player').contents().find(".shadowbox_login_close_button").click(function() { + parent.Shadowbox.close(); + }); + } else { + $('#sb-player').contents().find(".shadowbox_login_close_button").hide(); + } + }); + } + } + }]); }; + if(!$.browser.msie || $.browser.version > 6 || window.XMLHttpRequest) { - $("a[href*='" + settings.loginPath + "']").each(function() - { - $(this).click(function() - { + $("a[href*='" + settings.login_path + "']").each(function() { + $(this).click(function() { Shadowbox.showLogin(); return false; }); }); - $(document).keyup(function(e) - { + $("a[href*='" + settings.register_path + "']").each(function() { + $(this).click(function() { + Shadowbox.open({ + content: settings.register_content, + player: 'iframe', + width: settings.register_width, + height: settings.register_height, + options: { + modal: settings.modal, + enableKeys: false, + displayCounter: false, + displayNav: false, + onOpen: function() { + $("#sb-wrapper-inner").addClass("shadowbox-login"); + }, + onClose: function() { + $("#sb-wrapper-inner").removeClass("shadowbox-login"); + }, + onFinish: function() { + $('#sb-player').load(function() { + $('#sb-player').contents().find("#shadowbox_register .username").focus(); + if (settings.modal) { + $('#sb-player').contents().find(".shadowbox_login_close_button").click(function() { + parent.Shadowbox.close(); + }); + } else { + $('#sb-player').contents().find(".shadowbox_login_close_button").hide(); + } + }); + } + } + }); + return false; + }); + }); + $("a[href*='" + settings.password_path + "']").each(function() { + $(this).click(function() { + Shadowbox.open({ + content: settings.password_content, + player: 'iframe', + width: settings.password_width, + height: settings.password_height, + options: { + modal: settings.modal, + enableKeys: false, + displayCounter: false, + displayNav: false, + onOpen: function() { + $("#sb-wrapper-inner").addClass("shadowbox-login"); + }, + onClose: function() { + $("#sb-wrapper-inner").removeClass("shadowbox-login"); + }, + onFinish: function() { + $('#sb-player').load(function() { + $('#sb-player').contents().find("#shadowbox_password #edit-name").focus(); + if (settings.modal) { + $('#sb-player').contents().find(".shadowbox_login_close_button").click(function() { + parent.Shadowbox.close(); + }); + } else { + $('#sb-player').contents().find(".shadowbox_login_close_button").hide(); + } + }); + } + } + }); + return false; + }); + }); + $(document).keyup(function(e) { if(e.keyCode === 17) { Shadowbox.ctrlPressed = false; } }); - $(document).keydown(function(e) - { + $(document).keydown(function(e) { if(e.keyCode === 17) { Shadowbox.ctrlPressed = true; } @@ -50,4 +203,4 @@ } } }; -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/login_shadowbox/scripts/login_shadowbox_check.js b/login_shadowbox/scripts/login_shadowbox_check.js new file mode 100644 index 0000000..e11dd61 --- /dev/null +++ b/login_shadowbox/scripts/login_shadowbox_check.js @@ -0,0 +1,13 @@ +(function($) { + + var is_shadowbox_form; + var current_location; + + current_location = document.location.href; + is_shadowbox_form = current_location.indexOf('shadowbox', current_location.length - 'shadowbox'.length) !== -1; + + if ( ! is_shadowbox_form && parent.Shadowbox.isOpen() ) { + parent.window.location.href = current_location; + } + +}(jQuery)); diff --git a/login_shadowbox/scripts/login_shadowbox_messages.js b/login_shadowbox/scripts/login_shadowbox_messages.js new file mode 100644 index 0000000..edd3d47 --- /dev/null +++ b/login_shadowbox/scripts/login_shadowbox_messages.js @@ -0,0 +1,7 @@ +(function($) { + + $(document).ready(function() { + $(".messages").delay(3000).slideUp("slow"); + }); + +}(jQuery));