utlis.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**
  2. *
  3. * @authors Eric Hsiao
  4. *
  5. */
  6. /* utlis */
  7. // if (typeof console == "undefined") {
  8. // window.console = {
  9. // log: function () {}
  10. // };
  11. // }
  12. // window.console = {
  13. // log: function () {}
  14. // };
  15. function ga_pageView(key) {
  16. ga('send', 'pageview', key);
  17. console.log("ga_pageView: " + key);
  18. }
  19. function ga_ButtonClick(key) {
  20. ga('send', 'event', 'Button', 'Click', key);
  21. console.log("ga_ButtonClick: " + key);
  22. }
  23. function setDefault(_textbox, _value) { // depend on jQuery
  24. $(_textbox).val(_value).css({opacity:.4});
  25. $(_textbox).focus(
  26. function() {
  27. if ($(this).val() == _value) {
  28. $(this).val('').css({opacity:1});
  29. }
  30. })
  31. .blur(function() {
  32. if ($(this).val() == '') {
  33. $(this).val(_value).css({opacity:.4});
  34. }
  35. });
  36. }
  37. var isMobile = false;
  38. var isIE = false;
  39. utlis = function (){
  40. //private menbers
  41. //private methods
  42. function init () {
  43. console.log('all is loaded.');
  44. }
  45. //constructor
  46. {
  47. if ($('html').is('.ie6, .ie7, .ie8')) {
  48. isIE = true;
  49. // alert('.ie6, .ie7, .ie8');
  50. }
  51. $(document).ready(function() {
  52. if($('body').width() <= 640){
  53. isMobile = true;
  54. }else{
  55. isMobile = false;
  56. }
  57. init();
  58. });
  59. }
  60. //public
  61. return {
  62. }
  63. }
  64. utlis = new utlis();