You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

jQuery.autoMail.js 6.9 kB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /**
  2. * 2015-01-11
  3. * edit by meng
  4. */
  5. (function($){
  6. $.fn.mailAutoComplete = function(options){
  7. var defaults = {
  8. boxClass: "mailListBox", //外部box样式
  9. listClass: "mailListDefault", //默认的列表样式
  10. focusClass: "mailListFocus", //列表选中样式
  11. markCalss: "mailListHlignt", //高亮样式
  12. zIndex: 1,
  13. autoClass: true,//是否使用插件自带class样式
  14. mailArr: ["qq.com","gmail.com","126.com","163.com","hotmail.com","live.com","sohu.com","sina.com","sina.cn","139.cn","189.cn"], //邮件数组
  15. textHint: false, //文字提示的自动显示与隐藏
  16. hintText: "",
  17. focusColor: "#333"
  18. //blurColor: "#999
  19. };
  20. // var settings = $.extend({}, defaults, options || {});
  21. // //页面装载CSS样式
  22. // if(settings.autoClass && $("#mailListAppendCss").size() === 0){
  23. // $('<style id="mailListAppendCss" type="text/css">.mailListBox{border:1px solid #369; background:#fff; font:12px/20px Arial;}.mailListDefault{padding:0 5px;cursor:pointer;white-space:nowrap;}.mailListFocus{padding:0 5px;cursor:pointer;white-space:nowrap;background:#369;color:white;}.mailListHlignt{color:red;}.mailListFocus .mailListHlignt{color:#fff;}</style>').appendTo($("head"));
  24. // }
  25. // var cb = settings.boxClass, cl = settings.listClass, cf = settings.focusClass, cm = settings.markCalss; //插件的class变量
  26. // var z = settings.zIndex, newArr = mailArr = settings.mailArr, hint = settings.textHint, text = settings.hintText, fc = settings.focusColor, bc = settings.blurColor;
  27. //创建邮件内部列表内容
  28. // $.createHtml = function(str, arr, cur){
  29. // var mailHtml = "";
  30. // if($.isArray(arr)){
  31. // $.each(arr, function(i, n){
  32. // if(i === cur){
  33. // mailHtml += '<div class="mailHover '+cf+'" id="mailList_'+i+'"><span class="'+cm+'">'+str+'</span>@'+arr[i]+'</div>';
  34. // }else{
  35. // mailHtml += '<div class="mailHover '+cl+'" id="mailList_'+i+'"><span class="'+cm+'">'+str+'</span>@'+arr[i]+'</div>';
  36. // }
  37. // });
  38. // }
  39. // return mailHtml;
  40. // };
  41. //一些全局变量
  42. var index = -1, s;
  43. // $(this).each(function(){
  44. // var that = $(this), i = $(".justForJs").size();
  45. // if(i > 0){ //只绑定一个文本框
  46. // return;
  47. // }
  48. // var w = that.outerWidth(), h = that.outerHeight(); //获取当前对象(即文本框)的宽高
  49. // //样式的初始化
  50. // that.wrap('<span style="display:inline-block;position:relative;"></span>')
  51. // .before('<div id="mailListBox_'+i+'" class="justForJs '+cb+'" style="min-width:'+w+'px;_width:'+w+'px;position:absolute;left:-6000px;top:'+h+'px;z-index:'+z+';"></div>');
  52. // var x = $("#mailListBox_" + i), liveValue; //列表框对象
  53. // that.focus(function(){
  54. // //父标签的层级
  55. // $(this).css("color", fc).parent().css("z-index", z);
  56. // //提示文字的显示与隐藏
  57. // if(hint && text){
  58. // var focus_v = $.trim($(this).val());
  59. // if(focus_v === text){
  60. // $(this).val("");
  61. // }
  62. // }
  63. // //键盘事件
  64. // $(this).keyup(function(e){
  65. // s = v = $.trim($(this).val());
  66. // if(/@/.test(v)){
  67. // s = v.replace(/@.*/, "");
  68. // }
  69. // if(v.length > 0){
  70. // //如果按键是上下键
  71. // if(e.keyCode === 38){
  72. // //向上
  73. // if(index <= 0){
  74. // index = newArr.length;
  75. // }
  76. // index--;
  77. // }else if(e.keyCode === 40){
  78. // //向下
  79. // if(index >= newArr.length - 1){
  80. // index = -1;
  81. // }
  82. // index++;
  83. // }else if(e.keyCode === 13){
  84. // //回车
  85. // if(index > -1 && index < newArr.length){
  86. // //如果当前有激活列表
  87. // $(this).val($("#mailList_"+index).text());
  88. // }
  89. // }else{
  90. // if(/@/.test(v)){
  91. // index = -1;
  92. // //获得@后面的值
  93. // //s = v.replace(/@.*/, "");
  94. // //创建新匹配数组
  95. // var site = v.replace(/.*@/, "");
  96. // newArr = $.map(mailArr, function(n){
  97. // var reg = new RegExp(site);
  98. // if(reg.test(n)){
  99. // return n;
  100. // }
  101. // });
  102. // }else{
  103. // newArr = mailArr;
  104. // }
  105. // }
  106. // x.html($.createHtml(s, newArr, index)).css("left", 0);
  107. // if(e.keyCode === 13){
  108. // //回车
  109. // if(index > -1 && index < newArr.length){
  110. // //如果当前有激活列表
  111. // x.css("left", "-6000px");
  112. // }
  113. // }
  114. // }else{
  115. // x.css("left", "-6000px");
  116. // }
  117. // }).blur(function(){
  118. // if(hint && text){
  119. // var blur_v = $.trim($(this).val());
  120. // if(blur_v === ""){
  121. // $(this).val(text);
  122. // }
  123. // }
  124. // $(this).css("color", bc).unbind("keyup").parent().css("z-index",0);
  125. // x.css("left", "-6000px");
  126. //
  127. // }).keydown(function(event){
  128. // if(event.keyCode == 13){
  129. // return false;
  130. // }
  131. // });
  132. // //鼠标经过列表项事件
  133. // //鼠标经过
  134. // $(".mailHover").on("mouseover", function(){
  135. // index = Number($(this).attr("id").split("_")[1]);
  136. // liveValue = $("#mailList_"+index).text();
  137. // x.children("." + cf).removeClass(cf).addClass(cl);
  138. // $(this).addClass(cf).removeClass(cl);
  139. // });
  140. // $(".mailHover").on("click", function(){
  141. // $("#mail").val($(this).html());
  142. // });
  143. //
  144. //
  145. // });
  146. //
  147. // x.bind("mousedown", function(){
  148. // that.val(liveValue);
  149. // });
  150. // });
  151. };
  152. })(jQuery);

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...