framework.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. var parentTopHeight;
  2. var parentBottomHeight;
  3. var parentTopHeight_left;
  4. var parentBottomHeight_left;
  5. var parentTopHeight_middle;
  6. var parentBottomHeight_middle;
  7. var fixHeight;
  8. var skinName;
  9. var themeColor = "blue";
  10. var broswerFlag;
  11. var fontSize = 12;
  12. var prePath = "../../";
  13. var exitVtab = 0;
  14. var vtabIdx = 0;
  15. var hasIframe = 0;
  16. var parentScrollHeight;
  17. var boxWhiteBg = false;
  18. var hasScrollContent = true;
  19. var splitMode = false;
  20. var positionTarget = "";
  21. var box2Custom = false;
  22. var box3Custom = false;
  23. var box4Custom = false;
  24. var boxIe6Flag = 0;
  25. var boxIe7Flag = 0;
  26. var isHeadFixMode = 0;
  27. var headFixExcude = 0;
  28. var headFixExcude2 = 0;
  29. var depth = 500;
  30. $(function () {
  31. $("div,input,textarea,button,select,form,table,a,img").each(function () {
  32. if ($(this).hasClass("box1") || $(this).hasClass("box2") || $(this).hasClass("box3") || $(this).hasClass("box4")) {} else {
  33. $(this).render();
  34. }
  35. });
  36. });
  37. (function (a) {
  38. a.fn.render = function () {
  39. if (a(this).hasClass("spliter")) {
  40. try {
  41. a(this).spliterRender()
  42. } catch (b) {
  43. alert("分隔条出错,注意脚本的引入:spliter.js")
  44. }
  45. }
  46. if (a(this).is("input")) {
  47. if (a(this).attr("type") == "text") {
  48. if (a(this).hasClass("autoComplete")) {
  49. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  50. a(this).textInputStyleRender()
  51. }
  52. try {
  53. a(this).attr("trueType", "autoComplete");
  54. a(this).autoCompleteRender()
  55. } catch (b) {
  56. alert("自动完成框出错,注意脚本的引入:autoComplete.js")
  57. }
  58. }
  59. if (a(this).hasClass("autoCompleteIcon")) {
  60. a(this).attr("trueType", "autoComplete");
  61. a(this).textInputStyleRender()
  62. } else {
  63. if (a(this).hasClass("color")) {
  64. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  65. a(this).textInputStyleRender()
  66. }
  67. try {
  68. a(this).attr("trueType", "color");
  69. a(this).colorRender()
  70. } catch (b) {
  71. alert("颜色选择器出错,注意脚本的引入:color.js")
  72. }
  73. } else {
  74. if (a(this).hasClass("date")) {
  75. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  76. a(this).attr("trueType", "date");
  77. a(this).dateRender()
  78. }
  79. } else {
  80. if (a(this).hasClass("dateIcon")) {
  81. a(this).attr("trueType", "date");
  82. a(this).textInputStyleRender()
  83. } else {
  84. if (a(this).hasClass("keypad")) {
  85. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  86. a(this).textInputStyleRender()
  87. }
  88. try {
  89. a(this).attr("trueType", "keypad");
  90. a(this).keypadRender()
  91. } catch (b) {
  92. alert("软键盘控件出错,注意脚本的引入:keypad.js")
  93. }
  94. } else {
  95. if (a(this).hasClass("stepper")) {
  96. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  97. a(this).textInputStyleRender()
  98. }
  99. try {
  100. a(this).attr("trueType", "stepper");
  101. a(this).stepperRender()
  102. } catch (b) {
  103. alert("数字步进器出错,注意脚本的引入:stepper.js")
  104. }
  105. } else {
  106. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  107. a(this).attr("trueType", "textinput");
  108. a(this).textinputRender()
  109. }
  110. }
  111. }
  112. }
  113. }
  114. }
  115. }
  116. } else {
  117. if (a(this).attr("type") == "button" || a(this).attr("type") == "submit" || a(this).attr("type") == "reset") {
  118. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  119. a(this).buttonInputRender()
  120. }
  121. } else {
  122. if (a(this).attr("type") == "file") {
  123. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  124. a(this).attr("trueType", "file");
  125. a(this).fileRender()
  126. }
  127. } else {
  128. if (a(this).attr("type") == "password") {
  129. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  130. a(this).attr("trueType", "password");
  131. a(this).passInputRender()
  132. }
  133. if (a(this).hasClass("keypad")) {
  134. if (a(this).attr("keepDefaultStyle") == "true" || a(this).attr("keepDefaultStyle") == true) {} else {
  135. a(this).textInputStyleRender()
  136. }
  137. try {
  138. a(this).attr("trueType", "keypad");
  139. a(this).keypadRender()
  140. } catch (b) {
  141. alert("软键盘控件出错,注意脚本的引入:keypad.js")
  142. }
  143. }
  144. } else {
  145. if (a(this).attr("type") == "radio") {
  146. a(this).attr("trueType", "radio")
  147. } else {
  148. if (a(this).attr("type") == "checkbox") {
  149. a(this).attr("trueType", "checkbox")
  150. } else {
  151. if (a(this).attr("type") == "hidden") {
  152. a(this).attr("trueType", "hidden")
  153. }
  154. }
  155. }
  156. }
  157. }
  158. }
  159. }
  160. }
  161. };
  162. a.fn.textinputRender = function () {
  163. if (a(this).attr("class") == "keypad") {
  164. return
  165. }
  166. a(this).addClass("textinput");
  167. var b = null;
  168. a(this).hover(function () {
  169. if (b != a(this)[0]) {
  170. a(this).removeClass("textinput");
  171. a(this).addClass("textinput_hover")
  172. }
  173. }, function () {
  174. if (b != a(this)[0]) {
  175. a(this).removeClass("textinput_hover");
  176. a(this).addClass("textinput")
  177. }
  178. });
  179. a(this).focus(function () {
  180. b = a(this)[0];
  181. a(this).removeClass("textinput");
  182. a(this).removeClass("textinput_hover");
  183. a(this).addClass("textinput_click")
  184. });
  185. a(this).blur(function () {
  186. b = null;
  187. a(this).removeClass("textinput_click");
  188. a(this).addClass("textinput")
  189. });
  190. if (a(this).attr("clearable") == "true") {
  191. a(this).clearableTextField()
  192. }
  193. if (a(this).attr("maxNum") != null) {
  194. a(this).maxlength({
  195. maxCharacters: parseInt(a(this).attr("maxNum"))
  196. })
  197. }
  198. if (a(this).attr("watermark") != null) {
  199. a(this).watermark("watermark", a(this).attr("watermark"))
  200. }
  201. };
  202. a.fn.textInputStyleRender = function () {
  203. var b = null;
  204. if (a(this).attr("inputMode")) {
  205. var c = a(this).attr("inputMode");
  206. if (c == "numberOnly") {
  207. a(this)[0].onkeyup = function () {
  208. a(this)[0].value = a(this)[0].value.replace(/\D/g, "")
  209. };
  210. a(this)[0].onafterpaste = function () {
  211. a(this)[0].value = a(this)[0].value.replace(/\D/g, "")
  212. }
  213. }
  214. }
  215. a(this).hover(function () {
  216. if (b != a(this)[0]) {
  217. a(this).addClass("date_hover")
  218. }
  219. }, function () {
  220. if (b != a(this)[0]) {
  221. a(this).removeClass("date_hover")
  222. }
  223. });
  224. a(this).focus(function () {
  225. b = a(this)[0];
  226. a(this).removeClass("date_hover");
  227. a(this).addClass("date_click")
  228. });
  229. a(this).blur(function () {
  230. b = null;
  231. a(this).removeClass("date_click")
  232. })
  233. };
  234. a.fn.passInputRender = function () {
  235. var b = null;
  236. a(this).addClass("textinput");
  237. if (a(this).attr("inputMode")) {
  238. var c = a(this).attr("inputMode");
  239. if (c == "numberOnly") {
  240. a(this)[0].onkeyup = function () {
  241. a(this)[0].value = a(this)[0].value.replace(/\D/g, "")
  242. };
  243. a(this)[0].onafterpaste = function () {
  244. a(this)[0].value = a(this)[0].value.replace(/\D/g, "")
  245. }
  246. }
  247. }
  248. a(this).hover(function () {
  249. if (b != a(this)[0]) {
  250. a(this).removeClass("textinput");
  251. a(this).addClass("textinput_hover")
  252. }
  253. }, function () {
  254. if (b != a(this)[0]) {
  255. a(this).removeClass("textinput_hover");
  256. a(this).addClass("textinput")
  257. }
  258. });
  259. a(this).focus(function () {
  260. b = a(this)[0];
  261. a(this).removeClass("textinput");
  262. a(this).removeClass("textinput_hover");
  263. a(this).addClass("textinput_click")
  264. });
  265. a(this).blur(function () {
  266. b = null;
  267. a(this).removeClass("textinput_click");
  268. a(this).addClass("textinput")
  269. });
  270. if (a(this).attr("clearable") == "true") {
  271. a(this).clearableTextField()
  272. }
  273. if (a(this).attr("maxNum") != null) {
  274. a(this).maxlength({
  275. maxCharacters: parseInt(a(this).attr("maxNum"))
  276. })
  277. }
  278. if (a(this).attr("checkStrength") == "true") {
  279. a(this).password_strength()
  280. }
  281. a(this).caps(function (d) {
  282. if (jQuery.browser.safari) {
  283. return
  284. }
  285. if (d) {
  286. a.cursorMessage("注意:大写键开启了")
  287. } else {}
  288. })
  289. };
  290. })(jQuery);
  291. jQuery.fn.caps = function (a) {
  292. return this.keypress(function (f) {
  293. var b = f.which ? f.which : (f.keyCode ? f.keyCode : -1);
  294. var d = f.shiftKey ? f.shiftKey : (f.modifiers ? !! (f.modifiers & 4) : false);
  295. var g = ((b >= 65 && b <= 90) && !d) || ((b >= 97 && b <= 122) && d);
  296. a.call(this, g)
  297. })
  298. };