/src/main/webapp/public/js/common.js

http://thoughtsite.googlecode.com/ · JavaScript · 68 lines · 47 code · 6 blank · 15 comment · 12 complexity · b67c0c99f1696324c349eb2c7c18d1dd MD5 · raw file

  1. /* Copyright 2010 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS.
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License
  14. */
  15. google.setOnLoadCallback(function() {
  16. ie.Login.setLoggedinUserCallback('handleUserProfileTab');
  17. ie.Login.setLoggedinUserCallback('handleAdminTab');
  18. setTimeout('ie.Login.socialLogin()', 1000);
  19. $('#keyword').focus(function () {
  20. if($('#keyword').val() == 'Enter Search Keyword') {
  21. $('#keyword').val('');
  22. }
  23. });
  24. $('#keyword').blur(function () {
  25. if($('#keyword').val() == '') {
  26. $('#keyword').val('Enter Search Keyword');
  27. }
  28. });
  29. $('#dialog').dialog({
  30. autoOpen: false,
  31. modal: true
  32. });
  33. $("#tab-menu").tabs();
  34. });
  35. function validateSearch() {
  36. if('Enter Search Keyword' == $.trim($('#keyword').val())) {
  37. $('#keyword').val('');
  38. }
  39. return true;
  40. }
  41. function handleUserProfileTab(isLoggedIn) {
  42. if(isLoggedIn) {
  43. $('#userProfile').show();
  44. }
  45. else {
  46. $('#userProfile').hide();
  47. }
  48. }
  49. function handleAdminTab(isLoggedIn, role) {
  50. if(role != ie.config.ADMIN_ROLE)
  51. return;
  52. if(isLoggedIn) {
  53. $('#admin').show();
  54. }
  55. else {
  56. $('#admin').hide();
  57. }
  58. }
  59. // theme for re captcha
  60. var RecaptchaOptions = {
  61. theme : 'clean'
  62. };