lightbox_modal.js 952 B

12345678910111213141516171819202122232425262728293031323334353637
  1. (function ($) {
  2. function lightbox2_login() {
  3. $("a[href*='/user/login'], a[href*='?q=user/login']").each(function() {
  4. $(this).attr({
  5. href: this.href.replace(/user\/login?/,"user/login/lightbox2"),
  6. rel: 'lightmodal[|width:250px; height:210px;]'
  7. });
  8. $(this).addClass('lightmodal-login');
  9. });
  10. }
  11. function lightbox2_contact() {
  12. $("a[href$='/contact'], a[href$='?q=contact']").each(function() {
  13. if (!this.href.match('admin/build/contact')) {
  14. $(this).attr({
  15. href: this.href.replace(/contact?/,"contact/lightbox2"),
  16. rel: 'lightmodal[|width:450px; height:450px;]'
  17. });
  18. $(this).addClass('lightmodal-contact');
  19. }
  20. });
  21. }
  22. Drupal.behaviors.initLightboxModal = {
  23. attach: function(context, settings) {
  24. if (settings.lightbox2.enable_login) {
  25. lightbox2_login();
  26. }
  27. if (settings.lightbox2.enable_contact) {
  28. lightbox2_contact();
  29. }
  30. }
  31. };
  32. //End jQuery block
  33. }(jQuery));