1/* 2 auth:quandi 2020/2/22 3 email:[email protected] 4*/ 5$.rand = function (len) { 6 var rows = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; 7 return rows.map(function (x, i, self) { 8 if (i < len) { 9 return rows[parseInt(rows.length * Math.random())]; 10 } 11 }).join(""); 12}; 13$.rand_color = function (start, end) { 14 var rs = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]; 15 if (isNaN(start)) { start = 0; } 16 if (isNaN(end)) { end = rs.length; } 17 18 var rows = rs.slice(start, end); 19 var tb_htm = "#"; 20 for (var i = 0; i < 6; i++) { 21 tb_htm += rows[parseInt(rows.length * Math.random())]; 22 } 23 return tb_htm; 24} 25$.rand_rgb = function (start, end) { 26 if (isNaN(start)) { start = 0; } 27 if (isNaN(end)) { end = 255; } 28 if (start <= 0) { start = 0; } 29 if (end >= 255) { end = 255; } 30 var rows = []; 31 for (i = start; i <= end; i++) { 32 rows.push(i); 33 } 34 return rows[parseInt(rows.length * Math.random())]; 35} 36$.pwd_level=function(str,len){ 37 if(isNaN(len)){len=6;} 38 var level=0; 39 if(str.length>=len) 40 { 41 level+=2; 42 } 43 if(/[a-z]/.test(str)&&/[A-Z]/.test(str)) 44 { 45 level+=2; 46 } 47 if(/\d/.test(str)) 48 { 49 level+=1; 50 } 51 return level; 52}; 53$.randnum = function (len) { 54 var rows = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; 55 return rows.map(function (x, i, self) { 56 if (i < len) { 57 return rows[parseInt(rows.length * Math.random())]; 58 } 59 }).join(""); 60} 61$.get_string = function (name) { 62 var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); 63 64 var r = window.location.search.substr(1).match(reg); 65 if (r != null) { 66 if (r[2].indexOf("%") != -1) { 67 return unescape(r[2]); 68 } else { 69 return decodeURIComponent(r[2]); 70 } 71 } else { 72 return ""; 73 } 74 return null; 75} 76//客æ·ç«¯å¤æ 77function IsPC(ua) { 78 var userAgentInfo = navigator.userAgent; 79 if (typeof (ua) != "undefined") { userAgentInfo = ua; } 80 var Agents = [ 81 "Android", 82 "iPhone", 83 "SymbianOS", 84 "Windows Phone", 85 "iPad", "iPod" 86 ]; 87 var flag = true; 88 for (var v = 0; v < Agents.length; v++) { 89 if (userAgentInfo.indexOf(Agents[v]) > 0) { 90 flag = false; 91 break; 92 } 93 } 94 return flag; 95} 96 97function is_mobile(str) { 98 var Agents = [ 99 "Android", 100 "iPhone", 101 "SymbianOS", 102 "Windows Phone", 103 "iPad", "iPod" 104 ]; 105 var flag = true; 106 for (var v = 0; v < Agents.length; v++) { 107 if (str.indexOf(Agents[v]) > 0) { 108 flag = false; 109 break; 110 } 111 } 112 return flag; 113}; 114//éæºå¼ 115function rand(len) { 116 var rows = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; 117 return rows.map(function (x, i, self) { 118 if (i < len) { 119 return rows[parseInt(rows.length * Math.random())]; 120 } 121 }).join(""); 122} 123//éæºå¼ 124function rand_num(len) { 125 var rows = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]; 126 return rows.map(function (x, i, self) { 127 if (i < len) { 128 return rows[parseInt(rows.length * Math.random())]; 129 } 130 }).join(""); 131} 132//çªä½ 133$.fn.window = function (options) { 134 var defaults = { 135 is_max: true,//æ¯å¦æå¤§å 136 hide: false, 137 hide_zoom: true, 138 hide_close: false, 139 width: "auto", 140 height: "auto", 141 maxWidth: "100%", 142 maxHeight: "100%", 143 left: 0, 144 top: 0, 145 right: 0, 146 bottom: 0, 147 zIndex: 1000, 148 title: "ç³»ç»æç¤º", 149 content: "", 150 loading_text: "æ°æ®å è½½ä¸â¦â¦", 151 tmodal_click: function (node) { 152 153 }, 154 call: function (loading) { 155 setTimeout(function (e) { 156 $(loading).hide(); 157 }, 200); 158 }, 159 close_click: function (e,div) { 160 161 }, 162 zoom_click: function (e, div, is_max) { 163 164 } 165 }; 166 var div = $(this); 167 if (div.length == 0) { console.log("对象ä¸åå¨"); return; } 168 169 $.extend(defaults, options); 170 var key = rand(6); 171 if (typeof (div.attr("key")) == "undefined") { div.attr("key", key); } 172 key = div.attr("key"); 173 if (typeof (options) == "object") { $(div).data("defaults", defaults); } 174 defaults = div.data("defaults"); 175 176 function quandi() { 177 var parent = this; 178 var tb, thead, tbody, title, tool, loading; 179 var bt_zoom, bt_close; 180 this.init = function () { 181 if (div.attr("init") != "true") { 182 $(div).wrapInner("<div id='tb_" + key + "'></div>"); 183 $("#tb_" + key).wrapInner("<div id='tbody_" + key + "'></div>"); 184 $("#tb_" + key).append("<div id='loading_" + key + "'></div>"); 185 $("#tb_" + key).prepend("<div id='thead_" + key + "'></div>"); 186 div.attr("init", "true"); 187 } 188 tb = $("#tb_" + key); 189 thead = $("#thead_" + key); 190 loading = $("#loading_" + key); 191 tbody = $("#tbody_" + key); 192 thead.html("<div id='title_" + key + "'>" + defaults.title + "</div><a href='javascript:void(0);' id='bt_zoom_" + key + "' title='æå¤§'>â</a><a href='javascript:void(0);' id='bt_close_" + key + "' title='å ³é'>X</a>"); 193 title = $("#title_" + key); 194 bt_zoom = $("#bt_zoom_" + key); 195 bt_close = $("#bt_close_" + key); 196 197 loading.css({ 198 left: 0, 199 right: 0, 200 top: thead.outerHeight(), 201 bottom: 0, 202 transition: "all 0.4s", 203 opacity: "1", 204 backgroundColor: "rgba(255,255,255,1)", 205 position: "absolute",
206 display: "block", 207 textAlign: "center", 208 transition: "all 0.4s" 209 }).html("<div style='width:auto;height:auto;display:inline-block;margin:auto;overflow:hidden;position:absolute;left:45%;top:45%;transiton:all 0.4s;' id='load_" + key + "'><img src='data:image/gif;base64,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' width='40'><div style='text-align:center;display:block;margin:auto;'>" + defaults.loading_text + "</div></div>"); 210 211 if (defaults.content != null) { 212 tbody.html(defaults.content); 213 } 214 $(tbody).find("img,embed,video,audio,iframe").load(function (e) { 215 $(loading).css({ opacity: "0" }); 216 //if(!defaults.is_max){tbody.css({height:(tb.height()-40)+"px"});} 217 if (typeof (defaults.call) == "function") { 218 defaults.call(loading); 219 } 220 }); 221 222 setTimeout(function (e) { 223 if (loading.css("display") != "none") 224 $(loading).hide(); 225 }, 1000); 226 div.css({ 227 display: "flex", 228 display: "-webkit-flex", 229 "justify-content": "center", 230 "align-items": "center", 231 "overflow": "auto", 232 width: "auto", 233 height: "auto", 234 margin: "auto", 235 backgroundColor: "rgba(0,0,0,0.4)", 236 left: 0, 237 right: 0, 238 top: 0, 239 bottom: 0, 240 position: "fixed", 241 zIndex: defaults.zIndex 242 }); 243 tb.css({ 244 width: defaults.width, 245 height: defaults.height, 246 maxWidth: defaults.maxWidth, 247 maxHeight: defaults.maxHeight, 248 display: "block", 249 overflow: "hidden", 250 boxSizing: "border-box", 251 backgroundColor: "#fff", 252 transition: "all 0.4s", 253 transform: "scale(0,0)", 254 opacity: "1" 255 }); 256 257 thead.css({ 258 "-webkit-user-select": "none", 259 "-moz-user-select": "none", 260 "-ms-user-select": "none", 261 "user-select": "none", 262 "column-gap": "5px", 263 backgroundColor: "#f5f5f5", 264 backgroundImage: "linear-gradient(0deg,#f5f5f5,#fff)", 265 width: "auto", 266 height: "auto", 267 padding: "5px", 268 display: "flex", 269 display: "-webkit-flex", 270 "flex-direction": "row", 271 "flex-wrap": "nowrap", 272 "justify-content": "space-between", 273 "align-items": "center", 274 cursor: "pointer", 275 overflow: "hidden" 276 }); 277 278 if (defaults.hide) { 279 thead.hide(); 280 tb.css({ 281 padding: "0px" 282 }); 283 } else { 284 thead.show(); 285 } 286 tbody.css({ 287 width: "auto", 288 height: "calc(100% - 40px)", 289 display: "block", 290 margin: "auto", 291 overflow: "auto" 292 }); 293 if (tbody.children().is("iframe")) { tbody.css({ overflow: "hidden" }); } 294 title.css({ 295 width: "auto", 296 height: "auto", 297 fontSize: "14px", 298 fontWeight: "bold", 299 display: "block", 300 whiteSpace: "nowrap", 301 overflow: "hidden", 302 padding: "5px" 303 }); 304 305 bt_zoom.css({
306 width: "20px", 307 height: "20px", 308 lineHeight: "20px", 309 fontFamily: "arial", 310 fontSize: "14px", 311 display: "block", 312 boxSizing: "border-box", 313 backgroundColor: "#666", 314 color: "#fff", 315 borderRadius: "2px", 316 textAlign: "center", 317 overflow: "hidden", 318 marginLeft: "auto" 319 }); 320 321 322 bt_close.css({ 323 width: "20px", 324 height: "20px", 325 lineHeight: "20px", 326 fontFamily: "arial", 327 fontSize: "14px", 328 display: "block", 329 boxSizing: "border-box", 330 backgroundColor: "#666", 331 color: "#fff", 332 borderRadius: "2px", 333 textAlign: "center", 334 overflow: "hidden" 335 }); 336 setTimeout(function () { 337 tb.css({ transform: "scale(1,1)" }); 338 }, 5) 339 if (defaults.hide_close) { 340 bt_close.hide(); 341 } 342 if (defaults.hide_zoom) { 343 bt_zoom.hide(); 344 } 345 if (defaults.is_max) { 346 bt_zoom.attr("zoom", "false"); 347 parent.max(); 348 } 349 bt_close.click(function (e) { 350 defaults.close_click(e, div); 351 parent.hide(); 352 }); 353 bt_zoom.click(function (e) { 354 parent.zoom(); 355 defaults.zoom_click(e, div, defaults.is_max); 356 }); 357 $(tb).click(function (e) { 358 e.stopPropagation(); 359 }); 360 $(tb).mouseout(function (e) { 361 $(tb).unbind("mousemove"); 362 }); 363 $(thead).mousedown(function (e) { 364 if (defaults.is_max) { return; } 365 var start_x = e.pageX; 366 var start_y = e.pageY; 367 var left = $(tb).position().left; 368 var top = $(tb).position().top; 369 $(thead).mousemove(function (e) { 370 var len_x = e.pageX - start_x; 371 var len_y = e.pageY - start_y; 372 $(tb).css({ 373 left: left + len_x, 374 top: top + len_y 375 }); 376 }); 377 }).mouseup(function (e) { 378 $(this).unbind("mousemove"); 379 }); 380 }; 381 382 this.zoom = function () { 383 if (bt_zoom.attr("zoom") != "true") { 384 tb.css({ 385 height: "100%", 386 width: "100%", 387 top: 0, 388 left: 0, 389 right: 0, 390 bottom: 0 391 }); 392 bt_zoom.attr("zoom", "true"); 393 } else { 394 bt_zoom.removeAttr("zoom"); 395 tb.css({ 396 width: defaults.width, 397 height: defaults.height, 398 top: defaults.top, 399 left: defaults.left 400 }); 401 } 402 } 403 this.max = function () { 404 tb.css({ 405 height: "100%", 406 width: "100%", 407 top: 0, 408 left: 0, 409 right: 0, 410 bottom: 0 411 }); 412 }; 413 this.normal = function () { 414 tb.css({ 415 width: defaults.width, 416 height: defaults.height, 417 top: defaults.top, 418 left: defaults.left 419 }); 420 }; 421 this.set_title = function (val) { 422 defaults.title = val; 423 thead.html(val); 424 }; 425 this.set_content = function (val) { 426 tbody.html(val); 427 }; 428 this.set_top = function (val) { 429 defaults.top = val; 430 tb.css({ 431 top: top 432 }); 433 }; 434 this.set_left = function (val) { 435 defaults.left = val; 436 tb.css({ 437 left: val 438 }); 439 }; 440 this.set_size = function (width, height) { 441 defaults.width = width; 442 defaults.height = height; 443 tb.css({ 444 width: width, 445 height: height 446 }); 447 }; 448 this.hide = function () { 449 tb.css({ 450 transform: "scale(0,0)", 451 opacity: "0" 452 }); 453 setTimeout(function () { 454 div.hide(); 455 }, 200); 456 }; 457 this.close = function () { 458 tb.css({ 459 transform: "scale(0,0)", 460 opacity: "0" 461 }); 462 setTimeout(function () { 463 div.remove(); 464 }, 200); 465 }; 466 this.show = function () { 467 tb.css({ 468 transform: "scale(1,1)", 469 opacity: "1" 470 }); 471 setTimeout(function () { 472 div.css({ 473 display: "flex", 474 display: "-webkit-flex" 475 }); 476 }, 200); 477 }; 478 this.clear = function () { 479 div.html(""); 480 }; 481 } 482 var _quandi = new quandi(); 483 _quandi.init(); 484 var param = arguments; 485 switch (options) { 486 case "set_title": 487 _quandi.set_title(arguments[1]); 488 break; 489 case "set_content": 490 _quandi.set_content(arguments[1]); 491 break; 492 case "set_top": 493 _quandi.set_top(arguments[1]); 494 break; 495 case "set_left": 496 _quandi.set_left(arguments[1]); 497 break; 498 case "set_size": 499 _quandi.set_size(arguments[1], arguments[2]); 500 break; 501 case "hide": 502 _quandi.hide(); 503 break; 504 case "close": 505 _quandi.close(); 506 break; 507 case "show": 508 _quandi.show(); 509 break; 510 case "zoom": 511 _quandi.zoom(); 512 break; 513 case "max": 514 _quandi.max(); 515 break; 516 case "normal": 517 _quandi.normal(); 518 break; 519 } 520 _quandi = null; 521}; 522 523$.msg_set = { 524 title: "ç³»ç»æç¤º", 525 yes_text: " ç¡® å® ", 526 no_text: " å æ¶ " 527};
528$.alert = function (options) { 529 var defaults = { 530 tb_css: "msg_tb", 531 thead_css: "msg_thead", 532 tbody_css: "msg_tbody", 533 tfoot_css: "msg_tfoot", 534 yes_css: "msg_yes", 535 title: null, 536 yes_text: null, 537 content: "", 538 zIndex: 1000, 539 time: null, 540 click: function (e) { 541 542 } 543 }; 544 $.extend(defaults, options); 545 if (defaults.title == null) { defaults.title = $.msg_set.title; } 546 if (defaults.yes_text == null) { defaults.yes_text = $.msg_set.yes_text; } 547 var key = $.rand(6); 548 $("body").append(` 549 <div id="${key}"> 550 <div id="${key}_tb" class="msg_tb"> 551 <div id="${key}_thead" class="msg_thead">${defaults.title}</div> 552 <div id="${key}_tbody" class="msg_tbody">${defaults.content}</div> 553 <div id="${key}_tfoot" class="msg_tfoot"><a href="javascript:void(0);" id="${key}_yes" class="msg_yes">${defaults.yes_text}</a></div> 554 </div> 555 </div> 556 `); 557 var div = $("#" + key); 558 div.css({ 559 width: "100%", 560 height: "100%", 561 display: "flex", 562 display: "-webkit-flex", 563 margin: "auto", 564 "justify-content": "center", 565 "align-items": "center", 566 position: "fixed", 567 transition: "all 1s", 568 zIndex: defaults.zIndex, 569 left: 0, 570 right: 0, 571 top: 0, 572 bottom: 0 573 }); 574 575 $("#" + key + "_yes").unbind("click").click(function (e) { 576 $(div).remove(); 577 defaults.click(); 578 }); 579 580 if (defaults.time !== null && typeof (defaults.time) == "number") { 581 setTimeout(function () { 582 div.css({ 583 opacity: "0" 584 }); 585 586 setTimeout(function () { 587 div.remove(); 588 }, defaults.time); 589 }, 200); 590 } 591}; 592$.confirm = function (options) { 593 var defaults = { 594 tb_css: "msg_tb", 595 thead_css: "msg_thead", 596 tbody_css: "msg_tbody", 597 tfoot_css: "msg_tfoot", 598 yes_css: "msg_yes", 599 no_css: "msg_no", 600 title: null, 601 yes_text: null, 602 no_text: null, 603 time: null, 604 content: "", 605 zIndex: 1000, 606 yes_click: function (e) { 607 div.hide(); 608 }, 609 no_click: function (e) { 610 div.hide(); 611 } 612 }; 613 $.extend(defaults, options); 614 if (defaults.title == null) { defaults.title = $.msg_set.title; } 615 if (defaults.yes_text == null) { defaults.yes_text = $.msg_set.yes_text; } 616 if (defaults.no_text == null) { defaults.no_text = $.msg_set.no_text; } 617 618 var key = $.rand(6); 619 $("body").append(` 620 <div id="${key}"> 621 <div id="${key}_tb" class="msg_tb"> 622 <div id="${key}_thead" class="msg_thead">${defaults.title}</div> 623 <div id="${key}_tbody" class="msg_tbody">${defaults.content}</div> 624 <div id="${key}_tfoot" class="msg_tfoot"> 625 <a href="javascript:void(0);" id="${key}_yes" class="msg_yes">${defaults.yes_text}</a> 626 <a href="javascript:void(0);" id="${key}_no" class="msg_no">${defaults.no_text}</a> 627 </div> 628 </div> 629 </div> 630 `); 631 var div = $("#" + key); 632 div.css({ 633 width: "100%", 634 height: "100%", 635 display: "flex", 636 display: "-webkit-flex", 637 margin: "auto", 638 "justify-content": "center", 639 "align-items": "center", 640 transition: "all 1s", 641 position: "fixed", 642 zIndex: defaults.zIndex, 643 left: 0, 644 right: 0, 645 top: 0, 646 bottom: 0 647 }); 648 649 $("#" + key + "_yes").unbind("click").click(function (e) { 650 $(div).remove(); 651 defaults.yes_click(); 652 }); 653 $("#" + key + "_no").unbind("click").click(function (e) { 654 $(div).remove(); 655 defaults.no_click(); 656 }); 657 658 if (defaults.time !== null && typeof (defaults.time) == "number") { 659 setTimeout(function () { 660 div.css({ 661 opacity: "0" 662 }); 663 664 setTimeout(function () { 665 div.remove(); 666 }, defaults.time); 667 }, 200); 668 } 669}; 670/*ç¾é¡µçª*/ 671(function (a) { 672 (function () { 673 var b = false; 674 var c = (/xyz/.test(function () { 675 xyz 676 })) ? (/\b_super\b/) : (/.*/); 677 this.Class = function () { }; 678 Class.extend = function (h) { 679 var g = this.prototype; 680 b = true; 681 var f = new this(); 682 b = false; 683 for (var e in h) { 684 if (typeof h[e] == "function" && typeof g[e] == "function" && c.test(h[e])) { 685 f[e] = (function (i, j) { 686 return function () { 687 var l = this._super; 688 this._super = g[i]; 689 var k = j.apply(this, arguments); 690 this._super = l; 691 return k 692 } 693 })(e, h[e]) 694 } else { 695 f[e] = h[e] 696 } 697 } 698 function d() { 699 if (!b && this.init) { 700 this.init.apply(this, arguments) 701 } 702 } 703 d.prototype = f; 704 d.constructor = d; 705 d.extend = arguments.callee; 706 return d 707 } 708 })(); 709 a.fn.shutter = function (b) { 710 var d = { 711 displayDuration: 2000, 712 animateDuration: 1500, 713 numColumns: 10, 714 transitions: "fade,slideUp,slideDown,slideLeft,slideRight,slideUpAndDown,slideLeftAndRight,fadeAndSlideUp,fadeAndSlideDown,fadeAndSlideLeft,fadeAndSlideRight,fadeSlideUpAndRight,fadeSlideDownAndLeft", 715 random: false,
716 hidePrevAndNextArrows: false, 717 hideSlideChooser: false, 718 captionOpacity: 0.8 719 }; 720 var c = a.extend({}, 721 d, b); 722 this.each(function () { 723 var j = a(this); 724 var t = Class.extend({ 725 $imgs: null, 726 size: null, 727 displayImg: null, 728 nextImg: null, 729 numDivs: null, 730 divWidth: null, 731 baseCSS: null, 732 $divs: null, 733 transitions: [], 734 transition: null, 735 transitionCount: null, 736 interval: null, 737 width: null, 738 init: function () { 739 this.$imgs = a("img", j); 740 this.size = this.$imgs.size(); 741 this.$imgs.hide(); 742 this.nextImg = 0; 743 this.width = j.width(); 744 this.numDivs = c.numColumns; 745 this.divWidth = this.width / this.numDivs; 746 this.baseCSS = { 747 width: this.divWidth, 748 position: "absolute", 749 top: 0, 750 backgroundRepeat: "no-repeat" 751 }; 752 this.createDivs(); 753 this.$divs = a("div", j); 754 this.transitionCount = -1 755 }, 756 createDivs: function () { 757 for (var A = 0; A < this.numDivs; A++) { 758 var B = a("<div></div>"); 759 B.css(this.baseCSS); 760 B.css("left", this.divWidth * A); 761 B.appendTo(j) 762 } 763 } 764 }); 765 var y = new t(); 766 var g = Class.extend({ 767 baseDuration: null, 768 originalOffset: null, 769 offset: null, 770 init: function () { 771 this.baseDuration = c.animateDuration / 8; 772 this.originalOffset = 7 * c.animateDuration / (8 * y.numDivs); 773 this.offset = 7 * c.animateDuration / (8 * y.numDivs) 774 }, 775 duration: function () { 776 return this.baseDuration + this.offset 777 }, 778 increment: function () { 779 this.offset += this.originalOffset 780 }, 781 reset: function () { 782 this.offset = this.originalOffset 783 }, 784 getCSS: function (A) { 785 return {} 786 }, 787 eachDiv: function () { 788 return {} 789 }, 790 applyTransition: function () { 791 y.$divs.each(this.eachDiv); 792 this.reset() 793 } 794 }); 795 var v = g.extend({ 796 applyTransition: function () { 797 var A = this; 798 y.$divs.each(function () { 799 var B = A.eachDiv; 800 if (typeof (A.eachDiv) == "function") { 801 B = B() 802 } 803 a(this).animate(B, A.duration()); 804 A.increment() 805 }); 806 this.reset() 807 } 808 }); 809 var m = v.extend({ 810 getCSSIndex: null, 811 eachDivIndex: null, 812 getCSSGroup: null, 813 eachDivGroup: null, 814 init: function () { 815 this._super(); 816 this.getCSSGroup = new Array(); 817 this.eachDivGroup = new Array(); 818 this.getCSSIndex = 0; 819 this.eachDivIndex = 0 820 }, 821 getCSS: function (B) { 822 var A = this.getCSSGroup[this.getCSSIndex]; 823 this.getCSSIndex = (this.getCSSIndex + 1) % this.getCSSGroup.length; 824 return A(B) 825 }, 826 addTransition: function (A) { 827 this.getCSSGroup.push(A.getCSS); 828 this.eachDivGroup.push(A.eachDiv) 829 }, 830 applyTransition: function () { 831 var A = this; 832 y.$divs.each(function () { 833 var B = A.eachDivGroup[A.eachDivIndex]; 834 if (typeof (B) == "function") { 835 B = B() 836 } 837 a(this).animate(B, A.duration()); 838 A.eachDivIndex = (A.eachDivIndex + 1) % A.eachDivGroup.length; 839 A.increment() 840 }); 841 this.reset() 842 } 843 }); 844 var u = v.extend({ 845 getCSS: function (A) { 846 return { 847 opacity: 0 848 } 849 }, 850 eachDiv: { 851 opacity: 1 852 } 853 }); 854 var f = v.extend({ 855 getCSS: function (A) { 856 return { 857 top: y.$imgs.eq(y.nextImg).height() 858 } 859 }, 860 eachDiv: { 861 top: 0 862 } 863 }); 864 var h = v.extend({ 865 getCSS: function (A) { 866 return { 867 height: 0 868 } 869 }, 870 eachDiv: function () { 871 return { 872 height: y.$imgs.eq(y.nextImg).height() 873 } 874 } 875 }); 876 var r = v.extend({ 877 getCSS: function (B) { 878 var A = B.css("left"); 879 A = parseInt(A.substring(0, A.length - 2), 10); 880 return { 881 left: A + y.divWidth, 882 width: 0 883 } 884 }, 885 eachDiv: { 886 left: "-=" + y.divWidth, 887 width: y.divWidth 888 } 889 }); 890 var q = v.extend({ 891 getCSS: function (A) { 892 return { 893 width: 0 894 } 895 }, 896 eachDiv: { 897 width: y.divWidth 898 } 899 }); 900 var o = m.extend({ 901 addTransitions: function (A, B) { 902 this.addTransition(A); 903 this.addTransition(B) 904 } 905 }); 906 var w = m.extend({ 907 addTransitions: function (B, A) { 908 this.addTransition(B); 909 this.addTransition(A) 910 } 911 }); 912 var k = m.extend({ 913 addTransitions: function (A, B) { 914 this.addTransition(A); 915 this.addTransition(B) 916 } 917 }); 918 var n = m.extend({ 919 addTransitions: function (A, B) { 920 this.addTransition(A); 921 this.addTransition(B) 922 } 923 }); 924 var p = m.extend({ 925 addTransitions: function (A, B) { 926 this.addTransition(A); 927 this.addTransition(B) 928 } 929 }); 930 var e = m.extend({ 931 addTransitions: function (A, B) { 932 this.addTransition(A); 933 this.addTransition(B) 934 } 935 }); 936 var x = m.extend({ 937 addTransitions: function (A, C, B) { 938 this.addTransition(A); 939 this.addTransition(C); 940 this.addTransition(B) 941 } 942 }); 943 var s = m.extend({ 944 addTransitions: function (C, A, B) { 945 this.addTransition(C); 946 this.addTransition(A); 947 this.addTransition(B) 948 } 949 }); 950 var z = { 951 fade: new u(), 952 slideUp: new f(), 953 slideDown: new h(), 954 slideLeft: new r(), 955 slideRight: new q(), 956 slideUpAndDown: new o(), 957 slideLeftAndRight: new w(), 958 fadeAndSlideUp: new k(), 959 fadeAndSlideDown: new n(), 960 fadeAndSlideLeft: new p(), 961 fadeAndSlideRight: new e(), 962 fadeSlideUpAndRight: new x(), 963 fadeSlideDownAndLeft: new s() 964 }; 965 z.slideUpAndDown.addTransitions(z.slideUp, z.slideDown);
966 z.slideLeftAndRight.addTransitions(z.slideLeft, z.slideRight); 967 z.fadeAndSlideUp.addTransitions(z.slideUp, z.fade); 968 z.fadeAndSlideDown.addTransitions(z.fade, z.slideDown); 969 z.fadeAndSlideLeft.addTransitions(z.fade, z.slideLeft); 970 z.fadeAndSlideRight.addTransitions(z.slideRight, z.fade); 971 z.fadeSlideUpAndRight.addTransitions(z.slideUp, z.fade, z.slideRight); 972 z.fadeSlideDownAndLeft.addTransitions(z.slideDown, z.fade, z.slideLeft); 973 t.prototype.populateTransitions = function () { 974 var B = c.transitions.split(/,\s*/g); 975 for (var A in B) { 976 this.transitions.push(z[B[A]]) 977 } 978 }; 979 t.prototype.getTransition = function () { 980 if (c.random) { 981 var A = Math.floor(Math.random() * this.transitions.length); 982 return this.transitions[A] 983 } else { 984 this.transitionCount = (this.transitionCount + 1) % this.transitions.length; 985 return this.transitions[this.transitionCount] 986 } 987 }; 988 t.prototype.addDivCSS = function () { 989 var B = this; 990 var C = B.$imgs.eq(B.nextImg); 991 var D = "url(" + C.attr("src") + ")"; 992 var A = C.height(); 993 this.$divs.each(function () { 994 var E = a(this); 995 E.css({ 996 backgroundImage: D, 997 backgroundPosition: "-" + E.css("left") + " 0px", 998 height: A 999 }); 1000 E.css(B.transition.getCSS(E)) 1001 }) 1002 }; 1003 t.prototype.process = function () { 1004 j.css({ 1005 backgroundImage: "url(" + this.$imgs.eq(this.displayImg).attr("src") + ")", 1006 backgroundRepeat: "no-repeat" 1007 }); 1008 this.transition = this.getTransition(); 1009 this.addDivCSS(); 1010 this.transition.applyTransition(); 1011 j.animate({ 1012 height: this.$imgs.eq(this.nextImg).height() 1013 }, 1014 c.animateDuration); 1015 this.advanceShow() 1016 }; 1017 t.prototype.updateCurrent = function () { 1018 a('.circle[rel="' + this.displayImg + '"]').removeClass("circle-current"); 1019 a('.circle[rel="' + this.nextImg + '"]').addClass("circle-current") 1020 }; 1021 t.prototype.advanceShow = function () { 1022 this.updateCurrent(); 1023 this.displayImg = this.nextImg; 1024 if (this.nextImg == this.size - 1) { 1025 this.nextImg = 0 1026 } else { 1027 this.nextImg++ 1028 } 1029 }; 1030 t.prototype.startShow = function () { 1031 this.interval = window.setInterval(a.proxy(this.runner, this), c.displayDuration + c.animateDuration) 1032 }; 1033 t.prototype.stopShow = function () { 1034 window.clearInterval(this.interval) 1035 }; 1036 t.prototype.goToSlide = function (A) { 1037 if (this.$divs.filter(":animated").size() > 0) { 1038 return 1039 } 1040 this.stopShow(); 1041 this.nextImg = A; 1042 this.updateCurrent(); 1043 this.runner(); 1044 if (this.nextImg == 0) { 1045 this.displayImg = this.size - 1 1046 } else { 1047 this.displayImg = this.nextImg - 1 1048 } 1049 this.startShow() 1050 }; 1051 t.prototype.applyLink = function () { 1052 var C = this.$imgs.eq(this.displayImg); 1053 var B = C.parent(); 1054 if (B.is("a")) { 1055 B.removeAttr("style") 1056 } 1057 var A = this.$imgs.eq(this.nextImg); 1058 var D = A.parent(); 1059 if (D.is("a")) { 1060 D.css({ 1061 display: "block", 1062 textDecoration: "none", 1063 border: "0", 1064 width: j.width(), 1065 height: A.height(), 1066 position: "absolute", 1067 top: 0, 1068 left: 0, 1069 zIndex: 100 1070 }) 1071 } 1072 }; 1073 t.prototype.applyCaption = function () { 1074 var A = this.$imgs.eq(this.nextImg); 1075 var C = A.attr("title"); 1076 var D = a(".caption", j); 1077 D.slideUp(function () { 1078 a(this).html(C) 1079 }); 1080 if (C != "") { 1081 if (D.size() > 0) { 1082 if (!D.is(":visible")) { 1083 D.html(C) 1084 } 1085 D.slideDown() 1086 } else { 1087 var B = a('<div class="caption"><span>' + C + "</span></div>"); 1088 B.css({ 1089 opacity: c.captionOpacity, 1090 width: j.width(), 1091 position: "absolute", 1092 top: 0, 1093 left: 0, 1094 display: "none" 1095 }); 1096 B.appendTo(j); 1097 1098 1099 B.slideDown() 1100 } 1101 } 1102 }; 1103 t.prototype.runner = function () { 1104 this.applyLink(); 1105 this.applyCaption(); 1106 this.process() 1107 }; 1108 t.prototype.begin = function () { 1109 var A = this.$imgs.eq(this.nextImg); 1110 j.css({ 1111 backgroundImage: "url(" + A.attr("src") + ")", 1112 height: A.height() 1113 }); 1114 this.runner(); 1115 this.transitionCount--; 1116 this.startShow() 1117 }; 1118 var i = Class.extend({ 1119 circleCount: null, 1120 init: function () { 1121 this.circleCount = 0 1122 }, 1123 addAll: function () { 1124 this.addCircles(); 1125 this.addPrevAndNextLinks(); 1126 a("a.circle").click(this.circleClickHandler); 1127 a(".prev-link").click(this.prevLinkHandler); 1128 a(".next-link").click(this.nextLinkHandler); 1129 if (c.hideSlideChooser) { 1130 a("a.circle").hide() 1131 } 1132 if (c.hidePrevAndNextArrows) { 1133 a(".prev-link, .next-link").hide() 1134 } 1135 }, 1136 addCircles: function () { 1137 var A = this; 1138 y.$imgs.each(function () { 1139 var B = a('<a href="#" rel="' + A.circleCount + '" class="circle"></a>'); 1140 B.css({ 1141 right: (y.size - A.circleCount - 1) * 20 + 10 1142 });
1143 B.appendTo(j); 1144 A.circleCount++ 1145 }) 1146 }, 1147 addPrevAndNextLinks: function () { 1148 a('<a href="#" class="prev-link"></a>').appendTo(j); 1149 a('<a href="#" class="next-link"></a>').appendTo(j) 1150 }, 1151 circleClickHandler: function (B) { 1152 var A = parseInt(a(this).attr("rel"), 10); 1153 y.goToSlide(A); 1154 B.preventDefault() 1155 }, 1156 prevLinkHandler: function (B) { 1157 var A = y.displayImg - 1; 1158 if (A < 0) { 1159 A = y.size - 1 1160 } 1161 y.goToSlide(A); 1162 B.preventDefault() 1163 }, 1164 nextLinkHandler: function (B) { 1165 var A = y.displayImg + 1; 1166 if (A >= y.size) { 1167 A = 0 1168 } 1169 y.goToSlide(A); 1170 B.preventDefault() 1171 } 1172 }); 1173 var l = new i(); 1174 l.addAll(); 1175 y.populateTransitions(); 1176 y.begin() 1177 }); 1178 return this 1179 } 1180})(jQuery); 1181//èåæé® 1182$.fn.menubutton = function (options) { 1183 var defaults = { 1184 css: ".menubutton", 1185 click: function (e, node) { 1186 1187 }, 1188 zIndex: 1000 1189 }; 1190 $.extend(defaults, options); 1191 1192 $(this).each(function (i, v) { 1193 var sub = $(v).attr("sub"); 1194 if (typeof (sub) == "undefined") { return; } 1195 var submenu = $(sub); 1196 if (submenu.length == 0) { return; } 1197 submenu.attr("tabindex", i); 1198 $(submenu).mouseenter(function (e) { 1199 submenu.show(); 1200 }).mouseleave(function (e) { 1201 setTimeout(function () { submenu.hide(); }, 1); 1202 }); 1203 }); 1204 1205 $("body").on({ 1206 click: function (e) { 1207 defaults.click(e, $(this)); 1208 var sub = $(this).attr("sub"); 1209 if (typeof (sub) == "undefined") { return; } 1210 var submenu = $(sub); 1211 if (submenu.length == 0) { return; } 1212 submenu.attr("tabindex", "0"); 1213 var left = $(this).offset().left; 1214 var top = $(this).offset().top + $(this).height() - 1; 1215 var max_left = $(window).width() - $(submenu).outerWidth(); 1216 if (left > max_left) { left = max_left; } 1217 submenu.css({ 1218 zIndex: defaults.zIndex, 1219 display: "block", 1220 left: left + "px", 1221 top: top + "px" 1222 }); 1223 $(submenu).mouseenter(function (e) { 1224 submenu.show(); 1225 }).mouseleave(function (e) { 1226 setTimeout(function () { submenu.hide(); }, 1); 1227 }); 1228 }, 1229 mouseleave: function (e) { 1230 var sub = $(this).attr("sub"); 1231 if (typeof (sub) == "undefined") { return; } 1232 var submenu = $(sub); 1233 if (submenu.length == 0) { return; } 1234 submenu.hide(); 1235 } 1236 }, defaults.css); 1237}; 1238 1239/*æ°æ®è¡¨æ ¼*/ 1240$.fn.grid=function(options){ 1241 var defaults={ 1242 key_id:"qd_guid", 1243 hide_thead:false, 1244 init_thead:true, 1245 is_fixed:true, 1246 is_index:false, 1247 is_check:true, 1248 link_back:"#fff", 1249 link_color:"#333", 1250 hover_back:"#f90", 1251 hover_color:"#fff", 1252 cols:[], 1253 step:10, 1254 node_click:function(e,row,index,tr){}, 1255 click:function(e,row,index,tr){}, 1256 dblclick:function(e,row,index,tr){}, 1257 mouseover:function(e,row,index,tr){}, 1258 mouseout:function(e,row,index,tr){}, 1259 contextmenu:function(e,row,index,tr){}, 1260 call:function(node,rs){} 1261 }; 1262 $.extend(defaults,options); 1263 var dom=this.ownerDocument; 1264 var div=$(this); 1265 1266 if(div.length==0){console.log(div);console.log("对象ä¸åå¨");return;} 1267 if(typeof($(div).data("rows"))=="undefined"){div.data("rows",{});} 1268 var key=rand(6); 1269 var link_back=div.attr("link_back"); 1270 var link_color=div.attr("link_color"); 1271 var hover_back=div.attr("hover_back"); 1272 var hover_color=div.attr("hover_color"); 1273 if(typeof(link_back)=="undefined"){link_back="#fff";} 1274 if(typeof(link_color)=="undefined"){link_color="#333";} 1275 if(typeof(hover_back)=="undefined"){hover_back="#f90";} 1276 if(typeof(hover_color)=="undefined"){hover_color="#fff";} 1277 1278 if(typeof(div.data("key"))=="undefined"){div.data("key",key);} 1279 if(typeof(div.data("defaults"))=="undefined"){div.data("defaults",defaults);} 1280 defaults=div.data("defaults"); 1281 1282 if(defaults.is_fixed) 1283 { 1284 div.css("table-layout","fixed"); 1285 } 1286 var cols=defaults.cols; 1287 var key_id=defaults.key_id; 1288 1289 var _quandi=new quandi(); 1290 _quandi.init(); 1291 1292 switch(options) 1293 { 1294 case "append": 1295 _quandi.append(arguments[1],arguments[2]); 1296 break; 1297 case "prepend": 1298 _quandi.prepend(arguments[1],arguments[2]); 1299 break; 1300 case "del": 1301 _quandi.del(arguments[1]); 1302 break; 1303 case "del_index": 1304 _quandi.del_index(arguments[1]); 1305 break; 1306 case "update": 1307 _quandi.update(arguments[1],arguments[2],arguments[3]); 1308 break; 1309 case "up": 1310 _quandi.up(arguments[1]); 1311 break; 1312 case "down": 1313 _quandi.down(arguments[1]); 1314 break; 1315 case "check": 1316 _quandi.check(arguments[1]); 1317 break; 1318 case "un_check": 1319 _quandi.un_check(arguments[1]); 1320 break; 1321 case "check_all": 1322 _quandi.check_all(); 1323 break; 1324 case "un_check_all": 1325 _quandi.un_check_all(); 1326 break; 1327 case "select": 1328 _quandi.select(arguments[1]); 1329 break; 1330 case "un_select": 1331 _quandi.un_select(arguments[1]); 1332 break; 1333 case "each": 1334 _quandi.each(arguments[1]); 1335 break; 1336 case "html": 1337 _quandi.html(arguments[1],arguments[2]); 1338 break; 1339 case "clear": 1340 _quandi.clear(); 1341 break; 1342 case "remove": 1343 _quandi.remove(arguments[1]); 1344 break; 1345 case "index": 1346 return _quandi.index(arguments[1]); 1347 break; 1348 case "last": 1349 return _quandi.last(arguments[1]); 1350 break; 1351 case "first": 1352 return _quandi.first(arguments[1]); 1353 break; 1354 case "row": 1355 return _quandi.row(arguments[1]); 1356 break; 1357 case "rows": 1358 return _quandi.rows(arguments[1]); 1359 break; 1360 case "checked": 1361 return _quandi.checked(); 1362 break; 1363 case "click": 1364 return _quandi.click(arguments[1]); 1365 break; 1366 case "dblclick": 1367 return _quandi.dblclick(arguments[1]); 1368 break; 1369 case "append_col": 1370 _quandi.append_col(arguments[1]); 1371 break;
1372 case "del_col": 1373 _quandi.del_col(arguments[1]); 1374 break; 1375 case "before_col": 1376 _quandi.before_col(arguments[1],arguments[2]); 1377 break; 1378 case "after_col": 1379 _quandi.after_col(arguments[1],arguments[2]); 1380 break; 1381 case "up_col": 1382 _quandi.up_col(arguments[1]); 1383 break; 1384 case "down_col": 1385 _quandi.down_col(arguments[1]); 1386 break; 1387 case "index_col": 1388 return _quandi.index_col(arguments[1]); 1389 break; 1390 case "get_cols": 1391 return _quandi.get_cols(); 1392 break; 1393 case "set_cols": 1394 _quandi.set_cols(arguments[1]); 1395 break; 1396 case "set_thead": 1397 _quandi.set_thead(arguments[1]); 1398 break; 1399 } 1400 _quandi.events(); 1401 _quandi=null; 1402 1403 1404 function quandi() 1405 { 1406 var parent=this; 1407 var thead,tbody; 1408 this.init=function(){ 1409 div.data("rows",[]); 1410 $(div).on({ 1411 click:function(e){ 1412 if($(this).prop("checked")) 1413 { 1414 parent.check($(this).val()); 1415 }else 1416 { 1417 parent.un_check($(this).val()); 1418 } 1419 1420 var row=parent.row($(this).val()); 1421 var node=tbody.children("#tr_"+row[key_id]); 1422 defaults.node_click(e,row,node); 1423 row=null; 1424 node=null; 1425 $(this).off("click"); 1426 } 1427 },"[name='ck']"); 1428 1429 if(typeof(options)=="string") 1430 { 1431 thead=div.children("thead"); 1432 tbody=div.children("tbody"); 1433 return; 1434 } 1435 if(div.children("thead").length==0) 1436 { 1437 div.prepend("<thead></thead>"); 1438 } 1439 if(div.children("tbody").length==0){div.append("<tbody></tbody>");} 1440 thead=div.children("thead"); 1441 tbody=div.children("tbody"); 1442 if(!defaults.init_thead) 1443 { 1444 if(typeof(options)=="object") 1445 { 1446 if(options.cols instanceof Array) 1447 { 1448 div.data("defaults").cols=options.cols; 1449 } 1450 } 1451 html_thead(defaults.cols); 1452 } 1453 if(!div.attr("init")) 1454 { 1455 div.attr("init","true"); 1456 } 1457 if(defaults.hide_thead) 1458 { 1459 thead.hide(); 1460 }else 1461 { 1462 thead.show(); 1463 } 1464 1465 1466 }; 1467 1468 this.append=function(row,call){ 1469 var tb_htm=html_node(row); 1470 tbody.append(tb_htm); 1471 tb_htm=null; 1472 if(typeof(call)=="function"){call(row);} 1473 }; 1474 this.prepend=function(row,call){ 1475 var tb_htm=html_node(row); 1476 tbody.prepend(tb_htm); 1477 tb_htm=null; 1478 if(typeof(call)=="function"){call(row);} 1479 }; 1480 this.del=function(id){ 1481 if(tbody.children("#tr_"+id).length==0){return;} 1482 tbody.children("#tr_"+id).remove(); 1483 var index=this.index(id); 1484 }; 1485 this.remove=function(rows){ 1486 if(!Array.isArray(rows)){return;} 1487 rows.forEach(function(x,i){ 1488 if(typeof(x[key_id])=="string") 1489 { 1490 var id=x[key_id]; 1491 if(tbody.children("#tr_"+id).length>0){ 1492 tbody.children("#tr_"+id).remove(); 1493 } 1494 id=null; 1495 } 1496 }); 1497 }; 1498 this.del_index=function(index){ 1499 if($(tbody.children("tr").get(index)).length==0){return;} 1500 tbody.children("tr").get(index).remove(); 1501 }; 1502 this.update=function(row,id,call){ 1503 var tb_htm=html_node(row); 1504 tbody.children("#tr_"+id).replaceWith(tb_htm); 1505 tb_htm=null; 1506 if(typeof(call)=="function"){call(row);} 1507 }; 1508 this.up=function(id){ 1509 var next=tbody.children("#tr_"+id).prev("tr"); 1510 if(next.length==0){return;} 1511 tbody.children("#tr_"+id).insertBefore(next); 1512 next=null; 1513 }; 1514 this.down=function(id){ 1515 var next=tbody.children("#tr_"+id).next("tr"); 1516 if(next.length==0){return;} 1517 tbody.children("#tr_"+id).insertAfter(next); 1518 next=null; 1519 }; 1520 this.check=function(id){ 1521 tbody.children("#tr_"+id).attr("check","true"); 1522 tbody.find("#ck_"+id).prop("checked","checked"); 1523 }; 1524 this.un_check=function(id){ 1525 tbody.children("#tr_"+id).removeAttr("check"); 1526 tbody.find("#ck_"+id).removeProp("checked"); 1527 }; 1528 this.select=function(id){ 1529 tbody.children("tr").removeAttr("select").css({ 1530 backgroundColor:defaults.link_back, 1531 color:defaults.link_color 1532 }); 1533 tbody.children("#tr_"+id).attr("select","true").css({ 1534 backgroundColor:defaults.hover_back, 1535 color:defaults.hover_color 1536 }); 1537 }; 1538 this.un_select=function(id){ 1539 tbody.children("#tr_"+id).removeAttr("select").css({ 1540 backgroundColor:defaults.link_back, 1541 color:defaults.link_color 1542 }); 1543 }; 1544 1545 this.html=function(rows,call){ 1546 tbody.html(""); 1547 que({ 1548 em:tbody, 1549 data:rows, 1550 format:function(row,i){ 1551 return html_node(row,i); 1552 }, 1553 call:function(node,rs){ 1554 if(typeof(call)=="function"){call(node,rs);} 1555 } 1556 }); 1557 }; 1558 this.clear=function(){ 1559 tbody.html(""); 1560 div.data("rows",[]); 1561 }; 1562 1563 1564 this.index=function(call){ 1565 var index=-1; 1566 parent.rows(function(row,i){ 1567 if(typeof(call)=="function") 1568 { 1569 if(call(row,i)){ 1570 index=i; 1571 } 1572 } 1573 }); 1574 return index; 1575 }; 1576 this.check_all=function(){ 1577 tbody.find("[name='ck']").prop("checked","checked"); 1578 tbody.children("tr").attr("check","true"); 1579 }; 1580 this.un_check_all=function(){ 1581 tbody.find("[name='ck']").removeProp("checked"); 1582 tbody.children("tr").removeAttr("check"); 1583 }; 1584 1585 this.first=function(){ 1586 var row; 1587 var node=tbody.children("tr:first"); 1588 if(node.length>0) 1589 { 1590 var id=$(node).attr("key_id"); 1591 row=parent.row(id); 1592 id=null; 1593 } 1594 return row; 1595 }; 1596 this.last=function(){ 1597 var row; 1598 var node=tbody.children("tr:last"); 1599 if(node.length>0) 1600 { 1601 var id=$(node).attr("key_id"); 1602 row=parent.row(id); 1603 id=null; 1604 } 1605 return row; 1606 }; 1607 this.row=function(id){ 1608 var node; 1609 if(typeof(id)=="undefined") 1610 { 1611 node=$(tbody.children("tr[select='true']")); 1612 }else if(typeof(id)=="number") 1613 { 1614 node=$(tbody.children("tr").get(id)); 1615 }else 1616 { 1617 node=$(tbody.children("#tr_"+id)); 1618 } 1619 if($(node).length==0){return;} 1620 return $.evalJSON(unescape($(node).attr("str"))); 1621 }; 1622 1623 this.rows=function(call){ 1624 var rows=[]; 1625 tbody.children("tr").each(function(i,v){ 1626 var id=$(v).attr("key_id"); 1627 1628 var row=parent.row(id); 1629 1630 id=null; 1631 if(typeof(call)=="function") 1632 { 1633 row=call(row,i,v); 1634 } 1635 if(typeof(row)!="undefined") 1636 { 1637 rows.push(row); 1638 } 1639 row=null; 1640 }); 1641 return rows; 1642 }; 1643 this.each=function(call){ 1644 tbody.children("tr").each(function(i,v){ 1645 var id=$(v).attr("key_id"); 1646 var row=parent.row(id); 1647 id=null; 1648 if(typeof(call)=="function") 1649 { 1650 row=call(row,i,$(v)); 1651 if(row==false){return false;} 1652 } 1653 if(!row){return row;} 1654 }); 1655 }; 1656 this.checked=function(call){ 1657 var rows=[]; 1658 tbody.children("tr[check='true']").each(function(i,v){ 1659 var id=$(v).attr("key_id"); 1660 var row=parent.row(id); 1661 id=null; 1662 if(typeof(call)=="function") 1663 { 1664 row=call(row,i); 1665 } 1666 rows.push(row); 1667 }); 1668 return rows; 1669 }; 1670 1671 this.click=function(call){ 1672 tbody.children("tr").unbind("click").click(function(e){
1673 if(typeof(call)=="function") 1674 { 1675 var id=$(this).attr("key_id"); 1676 var row=parent.row(id); 1677 id=null; 1678 call(e,row,$(this)); 1679 row=null; 1680 } 1681 }); 1682 }; 1683 this.dblclick=function(call){ 1684 tbody.children("tr").unbind("dblclick").dblclick(function(e){ 1685 if(typeof(call)=="function") 1686 { 1687 var id=$(this).attr("key_id"); 1688 var row=parent.row(id); 1689 id=null; 1690 call(e,row,$(this)); 1691 row=null; 1692 } 1693 }); 1694 }; 1695 1696 this.events=function(){ 1697 defaults.call(div,this.rows()); 1698 if(defaults.is_index) 1699 { 1700 div.find("[field='index_td']").show(); 1701 }else 1702 { 1703 div.find("[field='index_td']").hide(); 1704 } 1705 if(defaults.is_check){ 1706 div.find("[field='ck_td']").show(); 1707 }else 1708 { 1709 div.find("[field='ck_td']").hide(); 1710 } 1711 1712 thead.find("[cid='ck_all']").click(function(e){ 1713 if($(this).prop("checked")) 1714 { 1715 parent.check_all(); 1716 }else 1717 { 1718 parent.un_check_all(); 1719 } 1720 }); 1721 1722 tbody.find("[name='index']").each(function(i,v){ 1723 $(v).html(i+1); 1724 }); 1725 $(tbody).children("tr").each(function(i,v){ 1726 $(v).bind({ 1727 click:function(e){ 1728 var id=$(this).attr("key_id"); 1729 var row=parent.row(id); 1730 parent.select(id); 1731 id=null; 1732 var i=tbody.children("tr").index($(this)); 1733 defaults.click(e,row,i,$(this)); 1734 row=null; 1735 }, 1736 dblclick:function(e){ 1737 var id=$(this).attr("key_id"); 1738 var row=parent.row(id); 1739 parent.select(id); 1740 id=null; 1741 var i=tbody.children("tr").index($(this)); 1742 defaults.dblclick(e,row,i,$(this)); 1743 row=null; 1744 }, 1745 mouseover:function(e){ 1746 var id=$(this).attr("key_id"); 1747 var row=parent.row(id); 1748 id=null; 1749 var i=tbody.children("tr").index($(this)); 1750 defaults.mouseover(e,row,i,$(this)); 1751 row=null; 1752 }, 1753 mouseout:function(e){ 1754 var id=$(this).attr("key_id"); 1755 var row=parent.row(id); 1756 id=null; 1757 var i=tbody.children("tr").index($(this)); 1758 defaults.mouseout(e,row,i,$(this)); 1759 row=null; 1760 }, 1761 contextmenu:function(e){ 1762 var id=$(this).attr("key_id"); 1763 var row=parent.row(id); 1764 id=null; 1765 var i=tbody.children("tr").index($(this)); 1766 defaults.contextmenu(e,row,i,$(this)); 1767 row=null; 1768 } 1769 }); 1770 }); 1771 }; 1772 1773 /*theadæä½*/ 1774 this.set_thead=function(html){ 1775 thead.html(html); 1776 }; 1777 /*åè¿è¡æä½*/ 1778 this.append_col=function(col){
1779 if(typeof(col.field)=="undefined"){col.field=col.name;} 1780 if(typeof(col.title)=="undefined"){col.title=col.name;} 1781 if(typeof(col.width)=="undefined"){col.width="auto";} 1782 if(typeof(col.css)=="undefined"){col.css="";} 1783 if(typeof(col.extend)=="undefined"){col.extend="";} 1784 defaults.cols.push(col); 1785 div.data("defaults",defaults); 1786 var rowspan=thead.children("tr").length; 1787 $(thead.children("tr").get(0)).append(html_th(col)); 1788 tbody.children("tr").each(function(i,v){ 1789 var row=$.evalJSON(unescape($(v).attr("str"))); 1790 var tb_htm=html_td(col,row); 1791 $(v).append(tb_htm); 1792 row=null; 1793 tb_htm=null; 1794 }); 1795 }; 1796 this.before_col=function(col,index){ 1797 if(index<=0){index==0;}else{index=(index-1);} 1798 defaults.cols.splice(index,0,col); 1799 div.data("defaults",defaults); 1800 thead.children("tr").each(function(i,v){}); 1801 $(thead.children("tr").get(0)).children("th").each(function(i,v){ 1802 if(i==index) 1803 { 1804 $(v).before(html_th(col)); 1805 } 1806 }); 1807 tbody.children("tr").each(function(i,v){ 1808 if(i==index) 1809 { 1810 var row=$.evalJSON(unescape($(v).attr("str"))); 1811 var tb_htm=html_td(col,row); 1812 $(v).insertAfter(tb_htm); 1813 row=null; 1814 tb_htm=null; 1815 } 1816 }); 1817 }; 1818 1819 this.after_col=function(col,index){ 1820 defaults.cols.splice(index,0,col); 1821 div.data("defaults",defaults); 1822 thead.children("tr").each(function(i,v){}); 1823 $(thead.children("tr").get(0)).children("th").each(function(i,v){ 1824 if(i==index) 1825 { 1826 $(v).after(html_th(col)); 1827 } 1828 }); 1829 tbody.children("tr").each(function(i,v){ 1830 if(i==index) 1831 { 1832 var row=$.evalJSON(unescape($(v).attr("str"))); 1833 var tb_htm=html_td(col,row); 1834 $(v).insertBefore(tb_htm); 1835 row=null; 1836 tb_htm=null; 1837 } 1838 }); 1839 }; 1840 1841 this.del_col=function(name){ 1842 var cols=div.data("defaults").cols; 1843 $(cols).map(function(i,v){ 1844 if(v.name==name) 1845 { 1846 cols.splice(i,1); 1847 } 1848 }); 1849 defaults.cols=cols; 1850 cols=null; 1851 div.data("defaults",defaults); 1852 div.find("[field='"+name+"']").remove(); 1853 }; 1854 1855 this.index_col=function(call){ 1856 var cols=div.data("defaults").cols; 1857 var index=-1; 1858 $(cols).map(function(i,v){ 1859 if(typeof(call)=="function") 1860 { 1861 if(call(v)){index=i;} 1862 }else if(typeof(call)=="string") 1863 { 1864 if(v.name==call) 1865 { 1866 index=i; 1867 1868 } 1869 } 1870 }); 1871 return index; 1872 }; 1873 1874 this.get_cols=function(){ 1875 return div.data("defaults").cols; 1876 }; 1877 1878 this.set_cols=function(cols){ 1879 var tb_htm=""; 1880 tb_htm+="<tr>"; 1881 if(defaults.is_index) 1882 { 1883 tb_htm+="<th width='30' field='index'></th>"; 1884 } 1885 if(defaults.is_check) 1886 { 1887 tb_htm+="<th width='20' field='ck'><input type='checkbox' cid='ck_all'></th>"; 1888 } 1889 1890 for(var i=0;i<cols.length;i++) 1891 { 1892 var col=cols[i]; 1893 if(typeof(col.title)=="undefined"){col.title=col.name;} 1894 if(typeof(col.width)=="undefined"){col.width="auto";} 1895 tb_htm+=html_th(col); 1896 col=null; 1897 } 1898 tb_htm+="</tr>"; 1899 thead.html(tb_htm); 1900 tb_htm=null; 1901 defaults.cols=cols; 1902 div.data("defaults",defaults); 1903 }; 1904 1905 function html_thead(cols) 1906 { 1907 var tb_htm=""; 1908 tb_htm+="<tr>"; 1909 if(defaults.is_check) 1910 { 1911 tb_htm+=` 1912 <th field="ck_td" width="20"><input type="checkbox" cid="ck_all" value=""></th> 1913 `; 1914 } 1915 if(defaults.is_index) 1916 { 1917 tb_htm+=` 1918 <th field="index_td"></th> 1919 `; 1920 } 1921 for(var i=0;i<cols.length;i++) 1922 { 1923 var col=cols[i]; 1924 if(typeof(col["colspan"])=="undefined"){col["colspan"]="1";} 1925 if(typeof(col["rowspan"])=="undefined"){col["rowspan"]="1";} 1926 if(typeof(col["css"])=="undefined"){col["css"]="";} 1927 if(typeof(col["ext"])=="undefined"){col["ext"]="";}
1928 if(typeof(col.field)=="undefined"){col.field=col.name;} 1929 if(typeof(col.title)=="undefined"){col.title=col.name;} 1930 if(typeof(col.width)=="undefined"){col.width="auto";} 1931 tb_htm+=` 1932 <th field="${col.name}" class="${col.css}" colspan='${col.colspan}' rowspan="${col.rowspan}" width="${col.width}" ${col.ext}>${typeof(col.format)=="function"?col.format(col,i):col.title}</th> 1933 `; 1934 col=null; 1935 } 1936 tb_htm+="</tr>"; 1937 $(thead).html(tb_htm); 1938 } 1939 1940 function html_th(col){ 1941 if(typeof(col.field)=="undefined"){col.field=col.name;} 1942 if(typeof(col.title)=="undefined"){col.title=col.name;} 1943 if(typeof(col.width)=="undefined"){col.width="auto";} 1944 var rowspan=thead.children("tr").length; 1945 var tb_htm=""; 1946 tb_htm+="<th field='"+col.field+"' width='"+col.width+"' rowspan='"+rowspan+"'>"; 1947 if(typeof(col.gsh)=="function") 1948 { 1949 tb_htm+=col.gsh(col); 1950 }else 1951 { 1952 tb_htm+=col.title; 1953 } 1954 tb_htm+="</th>"; 1955 rowspan=null; 1956 return tb_htm; 1957 } 1958 function html_td(col,row) 1959 {
1960 if(typeof(col.field)=="undefined"){col.field=col.name;} 1961 if(typeof(col.title)=="undefined"){col.title=col.name;} 1962 if(typeof(col.css)=="undefined"){col.css="";} 1963 if(typeof(col.extend)=="undefined"){col.extend="";} 1964 if(typeof(col.style)=="undefined"){col.style="";} 1965 if(typeof(col.width)=="undefined"){col.width="auto";} 1966 var val=row[col.name]; 1967 var tb_htm=""; 1968 tb_htm+=` 1969 <td field="${col.field}" class="${col.css}" ${col.extend} align='left'> 1970 <div style="white-space:nowrap;${col.style}"> 1971 `; 1972 if(typeof(col.formatter)=="function") 1973 { 1974 tb_htm+=col.formatter(row,col,val); 1975 }else if(typeof(col.format)=="function"){ 1976 tb_htm+=col.format(row,col,val); 1977 }else 1978 { 1979 if(typeof(row[col.name])=="undefined") 1980 { 1981 tb_htm+=""; 1982 }else 1983 { 1984 tb_htm+=row[col.name]; 1985 } 1986 } 1987 tb_htm+=`</div></td>`; 1988 return tb_htm; 1989 } 1990 function html_node(row){ 1991 var cols=div.data("defaults").cols; 1992 var tb_htm=` 1993 <tr id="tr_${row[key_id]}" key_id="${row[key_id]}" str="${escape($.toJSON(row))}"> 1994 <td field="ck_td"><input type="checkbox" name="ck" id="ck_${row[key_id]}" value="${row[key_id]}"></td> 1995 <td field="index_td"><div name="index" id="index_${row[key_id]}">0</div></td> 1996 `; 1997 1998 for(var i=0;i<cols.length;i++) 1999 { 2000 var col=cols[i];
2001 if(typeof(col.field)=="undefined"){col.field=col.name;} 2002 if(typeof(col.title)=="undefined"){col.title=col.name;} 2003 if(typeof(col.css)=="undefined"){col.css="";} 2004 if(typeof(col.extend)=="undefined"){col.extend="";} 2005 if(typeof(col.style)=="undefined"){col.style="";} 2006 if(typeof(col.width)=="undefined"){col.width="auto";} 2007 tb_htm+=html_td(col,row); 2008 col=null; 2009 width=null; 2010 extend=null; 2011 } 2012 tb_htm+=`</div>`; 2013 cols=null; 2014 return tb_htm; 2015 } 2016 } 2017}; 2018 2019/*å页æ¡*/ 2020$.fn.pagebar = function (options) { 2021 var defaults = { 2022 total: 0, 2023 page: 1, 2024 pagesize: 10, 2025 bt: { 2026 first: "第ä¸é¡µ", 2027 prev: "ä¸ä¸é¡µ", 2028 next: "ä¸ä¸é¡µ", 2029 end: "尾页", 2030 reload: "å·æ°" 2031 }, 2032 left: { 2033 before: "ä½ç½®ï¼", 2034 center: "å ±", 2035 after: "æ¡ä¿¡æ¯" 2036 }, 2037 right: { 2038 before: "æ¾ç¤º : ", 2039 center: ", å ± ", 2040 after: " æ¡ä¿¡æ¯" 2041 }, 2042 change: function (e, page) { 2043 2044 }, 2045 click: function (e, page) { 2046 2047 } 2048 }; 2049 $.extend(defaults, options); 2050 var div = $(this); 2051 var tb_css = div.attr("tb_css"); 2052 var left_css = div.attr("left_css"); 2053 var tool_css = div.attr("tool_css"); 2054 var right_css = div.attr("right_css"); 2055 var bt_css = div.attr("bt_css"); 2056 if (typeof (tb_css) == "undefined") { tb_css = "pagebar_tb"; } 2057 if (typeof (left_css) == "undefined") { left_css = "pagebar_left"; } 2058 if (typeof (tool_css) == "undefined") { tool_css = "pagebar_tool"; } 2059 if (typeof (right_css) == "undefined") { right_css = "pagebar_right"; } 2060 if (typeof (bt_css) == "undefined") { bt_css = "pagebar_bt"; } 2061 var key = rand(6); 2062 if (typeof (div.data("key")) == "undefined") { div.data("key", key); } 2063 if (typeof (div.data("defaults")) == "undefined" || typeof (options) == "object") { div.data("defaults", defaults); } 2064 defaults = div.data("defaults"); 2065 key = div.data("key"); 2066 var pagecount = Math.ceil(defaults.total / defaults.pagesize); 2067 var page = parseInt(defaults.page); 2068 var start = ((page - 1) * defaults.pagesize + 1); 2069 var end = (page * defaults.pagesize); 2070 if (page >= pagecount || defaults.total < defaults.pagesize) { end = defaults.total; } 2071 2072 var _quandi = new quandi(); 2073 _quandi.init(); 2074 _quandi.events(); 2075 _quandi = null; 2076 function quandi() { 2077 var parent = this; 2078 var tb, tb_left, tb_right; 2079 this.init = function () { 2080 if (typeof (options) == "string") { 2081 tb = div.children("#tb_" + key); 2082 tb_left = tb.children("#tb_left_" + key); 2083 tb_right = tb.children("#tb_right_" + key); 2084 return; 2085 } 2086 var tb_htm = ""; 2087 tb_htm += "<div id='tb_" + key + "' class='" + tb_css + "'>"; 2088 tb_htm += "<div id='tb_left_" + key + "' class='" + left_css + "'>"; 2089 tb_htm += defaults.right.before; 2090 tb_htm += start + " - " + end; 2091 tb_htm += defaults.right.center; 2092 tb_htm += defaults.total; 2093 tb_htm += defaults.right.after; 2094 tb_htm += "</div>"; 2095 tb_htm += "<div id='tb_right_" + key + "' class='" + right_css + "'>"; 2096 2097 tb_htm += "<div class='" + tool_css + "'>"; 2098 tb_htm += "<a href='javascript:void(0);' name='bt_" + key + "' ctype='first' class='" + bt_css + "'>" + defaults.bt.first + "</a>"; 2099 tb_htm += "<a href='javascript:void(0);' name='bt_" + key + "' ctype='prev' class='" + bt_css + "'>" + defaults.bt.prev + "</a>"; 2100 tb_htm += "<a href='javascript:void(0);' name='bt_" + key + "' ctype='next' class='" + bt_css + "'>" + defaults.bt.next + "</a>"; 2101 tb_htm += "<a href='javascript:void(0);' name='bt_" + key + "' ctype='end' class='" + bt_css + "'>" + defaults.bt.end + "</a>"; 2102 tb_htm += "</div>"; 2103 tb_htm += "<a href='javascript:void(0);' name='bt_" + key + "' ctype='reload' class='" + bt_css + "'>" + defaults.bt.reload + "</a>"; 2104 2105 tb_htm += defaults.left.before; 2106 tb_htm += "<select id='page_" + key + "' class='tool-input'>"; 2107 for (var i = 0; i < pagecount; i++) { 2108 if (defaults.page == (i + 1)) { 2109 tb_htm += "<option value='" + (i + 1) + "' selected>" + (i + 1) + "/ " + pagecount + "</option>"; 2110 } else { 2111 tb_htm += "<option value='" + (i + 1) + "'>" + (i + 1) + "/ " + pagecount + "</option>"; 2112 } 2113 } 2114 tb_htm += "</select> "; 2115 2116 tb_htm += "</div>"; 2117 tb_htm += "</div>"; 2118 div.html(tb_htm); 2119 tb_htm = null; 2120 tb = div.children("#tb_" + key); 2121 tb_left = tb.children("#tb_left_" + key); 2122 tb_right = tb.children("#tb_right_" + key); 2123 }; 2124 this.events = function () { 2125 div.find("#page_" + key).unbind("change").change(function (e) { 2126 var page = parseInt($(this).val()); 2127 defaults.change(e, page); 2128 }); 2129 div.find("[name='bt_" + key + "']").click(function (e) { 2130 var ctype = $(this).attr("ctype"); 2131 var page = parseInt(div.find("#page_" + key).val()); 2132 switch (ctype) { 2133 case "first": 2134 page = 1; 2135 break; 2136 case "prev": 2137 if (page > 1) { 2138 page--; 2139 } 2140 break; 2141 case "next": 2142 if (page < pagecount) { 2143 page++; 2144 } 2145 break; 2146 case "end": 2147 page = pagecount; 2148 break; 2149 case "reload": 2150 break; 2151 } 2152 defaults.click(e, page); 2153 ctype = null; 2154 }); 2155 } 2156 } 2157}; 2158$.imgbox=function(options){ 2159 var defaults={ 2160 bars:true, 2161 rows:[], 2162 index:0, 2163 id:"imgbox", 2164 zIndex:400, 2165 type:"html", 2166 content:"", 2167 back_color:"rgba(0,0,0,0.9)", 2168 fore_color:"#fff", 2169 close_click:function(node){ 2170 2171 }, 2172 format:function(rows,index,type){ 2173 var row=rows[index]; 2174 switch(type) 2175 { 2176 case "img": 2177 return row.qd_pic; 2178 break; 2179 case "video": 2180 return row.qd_path; 2181 break; 2182 case "iframe": 2183 return row.qd_path; 2184 break; 2185 case "html": 2186 return row.qd_content; 2187 break; 2188 } 2189 } 2190 }; 2191 $.extend(defaults,options); 2192 var parent=this; 2193 var id=defaults.id; 2194 var type=defaults.type; 2195 2196 if($(`#${id}`).length==0){ 2197 $("body").append(` 2198 <div id="${id}"> 2199 <div id="${id}_thead"><div id="${id}_close">X</div></div> 2200 <div id="${id}_tbody"></div> 2201 <div id="${id}_tfoot"> 2202 <div class="${id}_bt fa fa-fast-backward" cid="first"></div> 2203 <div class="${id}_bt fa fa-backward" cid="prev"></div> 2204 <div class="${id}_bt fa fa-forward" cid="next"></div> 2205 <div class="${id}_bt fa fa-fast-forward" cid="last"></div> 2206 <div class="${id}_bt fa fa-magnifying-glass-plus" cid="max"></div> 2207 <div class="${id}_bt fa fa-magnifying-glass-minus" cid="min"></div> 2208 </div> 2209 </div> 2210 `); 2211 } 2212 var div=$(`#${id}`); 2213 var thead=div.children(`#${id}_thead`); 2214 var tbody=div.children(`#${id}_tbody`); 2215 var tfoot=div.children(`#${id}_tfoot`); 2216 var bt=$(tfoot.children(`.${id}_bt`)); 2217 var close=thead.children(`#${id}_close`); 2218 2219 div.data("index",defaults.index).css({ 2220 display:"flex", 2221 display:"-webkit-flex", 2222 flexDirection:"column", 2223 backgroundColor:"rgba(0,0,0,0.9)", 2224 width:"100%", 2225 height:"100%", 2226 position:"fixed", 2227 margin:"auto", 2228 zIndex:defaults.zIndex, 2229 left:0, 2230 right:0, 2231 top:0, 2232 bottom:0 2233 }); 2234 thead.css({ 2235 display:"flex", 2236 display:"-webkit-flex", 2237 "justify-content":"flex-end" 2238 }); 2239 tfoot.css({ 2240 display:"flex", 2241 display:"-webkit-flex", 2242 "justify-content":"flex-end" 2243 }); 2244 tbody.css({ 2245 display:"block", 2246 width:"100%", 2247 height:"100%", 2248 overflow:"hidden", 2249 position:"relative" 2250 }); 2251 bt.css({ 2252 display:"flex", 2253 display:"-webkit-flex", 2254 width:"40px", 2255 height:"40px", 2256 fontSize:"14px", 2257 color:"#eee", 2258 "justify-content":"center", 2259 "align-items":"center" 2260 }); 2261 2262 close.css({ 2263 color:"#fff", 2264 fontSize:"20px", 2265 width:"40px", 2266 height:"40px", 2267 lineHeight:"40px", 2268 display:"block", 2269 textAlign:"center", 2270 fontFamily:"arial", 2271 cursor:"pointer" 2272 }); 2273 if(defaults.rows.length==0){ 2274 $(`.${id}_bt[cid="first"],.${id}_bt[cid="prev"],.${id}_bt[cid="next"],.${id}_bt[cid="last"]`).hide(); 2275 } 2276 var node; 2277 show_tbody(defaults.content); 2278 this.show=function(content){ 2279 show_tbody(content); 2280 }; 2281 if(type=="img") 2282 { 2283 $(`.${id}_bt[cid='max'],.${id}_bt[cid='min']`).show(); 2284 }else{ 2285 $(`.${id}_bt[cid='max'],.${id}_bt[cid='min']`).hide(); 2286 } 2287 2288 function show_tbody(content) 2289 { 2290 var tb_htm=""; 2291 switch(defaults.type) 2292 { 2293 case "img": 2294 2295 tb_htm+=`<img src="${content}" id="${id}_node"><div id="${id}_modal"></div>`; 2296 break; 2297 case "video": 2298 tb_htm+=`<video src="${content}" controls="controls" id="${id}_node"></video>`; 2299 break; 2300 case "iframe": 2301 tb_htm+=`<iframe width="854" height="480" src="${content}" frameboder="0" allowfullscreen="" id="${id}_node"> </iframe> 2302 `; 2303 break; 2304 case "html": 2305 tb_htm+=`<div style="display:block;width:100%;height:100%;" id="${id}_node">${content}</div>`; 2306 break; 2307 } 2308 tbody.html(tb_htm); 2309 node=$(`#${id}_node`); 2310 switch(defaults.type) 2311 { 2312 case "img": 2313 var modal=$(`#${id}_modal`); 2314 $(node).data("rate",new Number(1.0)); 2315 $(node).load(function(){ 2316 $(node).data("width",this.width); 2317 $(node).data("height",this.height); 2318 }); 2319 2320 $(node).css({ 2321 display:"block", 2322 transition:"all 0.4s", 2323 margin:"auto", 2324 width:"auto", 2325 height:"auto", 2326 maxWidth:"100%", 2327 maxHeight:"100%", 2328 position:"absolute",
2329 visibility:"hidden" 2330 }); 2331 $(node).load(function(e){ 2332 $(node).css({ 2333 visibility:"visible", 2334 left:($(tbody).width()-$(node).width())/2, 2335 top:($(tbody).height()-$(node).height())/2 2336 }); 2337 }); 2338 2339 $(modal).css({ 2340 position:"absolute", 2341 margin:"auto", 2342 display:"block", 2343 cursor:"pointer", 2344 left:0, 2345 right:0, 2346 top:0, 2347 bottom:0 2348 }) 2349 var rate=$(node).data("rate"); 2350 $(modal).mousedown(function(e){ 2351 var rate=$(node).data("rate"); 2352 var start_x=e.pageX; 2353 var start_y=e.pageY; 2354 var left=$(node).position().left; 2355 var top=$(node).position().top; 2356 //console.log("left:"+left+",top:"+top); 2357 2358 $(modal).unbind("mousemove").mousemove(function(e){ 2359 var end_x=e.pageX; 2360 var end_y=e.pageY; 2361 var len_x=(end_x-start_x); 2362 var len_y=(end_y-start_y); 2363 $(node).css({ 2364 transition:"unset", 2365 left:left+len_x, 2366 top:top+len_y 2367 }); 2368 }) 2369 }).mouseout(function(e){ 2370 $(this).unbind("mousemove"); 2371 }).mouseup(function(e){ 2372 $(this).unbind("mousemove"); 2373 }).bind({ 2374 touchstart:function(ea){console.log(ea); 2375 var e=ea.originalEvent.touches[0]; 2376 var start_x=e.pageX; 2377 var start_y=e.pageY; 2378 var left=$(node).position().left; 2379 var top=$(node).position().top; 2380 $(this).bind({ 2381 touchmove:function(ea){ 2382 var e=ea.originalEvent.touches[0]; 2383 var end_x=e.pageX; 2384 var end_y=e.pageY; 2385 var len_x=(end_x-start_x); 2386 var len_y=(end_y-start_y); 2387 $(node).css({ 2388 transition:"unset", 2389 left:left+len_x, 2390 top:top+len_y 2391 });
2392 } 2393 }); 2394 }, 2395 touchend:function(ea){ 2396 $(this).unbind("touchmove"); 2397 } 2398 }); 2399 break; 2400 case "video": 2401 $(node).css({ 2402 display:"block", 2403 transition:"all 0.4s", 2404 margin:"auto", 2405 maxWidth:"80%", 2406 maxHeight:"80%" 2407 }); 2408 break; 2409 case "iframe": 2410 $(node).css({ 2411 display:"block", 2412 transition:"all 0.4s", 2413 margin:"auto", 2414 maxWidth:"80%", 2415 maxHeight:"80%" 2416 }); 2417 break; 2418 case "html": 2419 break; 2420 } 2421 } 2422 $(bt).unbind("click").click(function(e){ 2423 var index=div.data("index"); 2424 var cid=$(this).attr("cid"); 2425 var rows=defaults.rows; 2426 switch(cid) 2427 { 2428 case "first": 2429 index=0; 2430 div.data("index",index); 2431 show_tbody(defaults.format(defaults.rows,index,type)); 2432 break; 2433 case "prev": 2434 index--; 2435 if(index<=0){index=0;} 2436 div.data("index",index); 2437 show_tbody(defaults.format(defaults.rows,index,type)); 2438 break; 2439 case "next": 2440 index++; 2441 if(index>=rows.length){index=rows.length-1;} 2442 div.data("index",index); 2443 show_tbody(defaults.format(defaults.rows,index,type)); 2444 break; 2445 case "last": 2446 index=rows.length; 2447 div.data("index",index); 2448 show_tbody(defaults.format(defaults.rows,index,type)); 2449 break; 2450 case "max": 2451 rate=$(node).data("rate"); 2452 rate=rate+0.1; 2453 if(rate>=4){rate=4;} 2454 var top=$(node).position().top; 2455 var left=$(node).position().left; 2456 var width=$(node).data("width")*rate; 2457 $(node).data("rate",rate).css({ 2458 transition:"all 0.4s", 2459 maxWidth:"unset", 2460 maxHeight:"unset", 2461 width:`${width}px`, 2462 height:"auto" 2463 }); 2464 break; 2465 case "min": 2466 rate=$(node).data("rate"); 2467 rate=rate-0.1; 2468 if(rate<=0){rate=0.1;} 2469 var width=$(node).data("width")*rate; 2470 $(node).data("rate",rate).css({ 2471 transition:"all 0.4s", 2472 maxWidth:"unset", 2473 maxHeight:"unset", 2474 width:`${width}px`, 2475 height:"auto" 2476 }); 2477 break; 2478 } 2479 }); 2480 close.unbind("click").click(function(e){ 2481 div.hide(); 2482 defaults.close_click(node); 2483 }); 2484 2485}; 2486/*é项å¡*/ 2487$.fn.tab = function (options) { 2488 var defaults = { 2489 zIndex: 100, 2490 click: function (e, div, thead, tbody) { } 2491 }; 2492 $.extend(defaults, options) 2493 var div = $(this); 2494 if (div.length == 0) { return; } 2495 var key = rand(6); 2496 var thead_css = div.attr("thead_css"); 2497 var tbody_css = div.attr("tbody_css"); 2498 var tfoot_css = div.attr("tfoot_css"); 2499 var item_css = div.attr("item_css"); 2500 var item_on_css = div.attr("item_on_css"); 2501 var more_css = div.attr("more_css"); 2502 var close_css = div.attr("close_css"); 2503 var more_css = div.attr("more_css"); 2504 var tfoot_item_css = div.attr("tfoot_item_css"); 2505 2506 if (typeof (thead_css) == "undefined") { thead_css = "tab_thead"; } 2507 if (typeof (tfoot_css) == "undefined") { tfoot_css = "tab_tfoot"; } 2508 if (typeof (tbody_css) == "undefined") { tbody_css = "tab_tbody"; } 2509 if (typeof (item_css) == "undefined") { item_css = "tab_item"; } 2510 if (typeof (item_on_css) == "undefined") { item_on_css = "tab_item_on"; } 2511 if (typeof (left_css) == "undefined") { left_css = "tab_left"; } 2512 if (typeof (right_css) == "undefined") { right_css = "tab_right"; } 2513 if (typeof (more_css) == "undefined") { more_css = "tab_more"; } 2514 if (typeof (close_css) == "undefined") { close_css = "tab_close"; } 2515 if (typeof (tfoot_item_css) == "undefined") { tfoot_item_css = "tab_tfoot_item"; } 2516 2517 if (typeof (div.data("key")) == "undefined") { div.data("key", key); } 2518 if (typeof (div.data("defaults")) == "undefined") { div.data("defaults", defaults); } 2519 key = div.data("key"); 2520 defaults = div.data("defaults"); 2521 if (div.css("position") != "absolute" && div.css("position") != "fixed") { div.css({ position: "relative" }) } 2522 2523 var _quandi = new quandi(); 2524 _quandi.init(); 2525 switch (options) { 2526 case "select": 2527 _quandi.select(arguments[1]); 2528 break; 2529 case "show": 2530 return _quandi.show(arguments[1]); 2531 break; 2532 case "hide": 2533 return _quandi.hide(arguments[1]); 2534 break; 2535 } 2536 _quandi.events(); 2537 _quandi = null; 2538 2539 function quandi() { 2540 var parent = this; 2541 var thead, tbody, tfoot; 2542 var left, right, more, close; 2543 this.init = function () { 2544 if (typeof (options) == "string") { 2545 thead = div.children("#thead_" + key); 2546 tbody = div.children("#tbody_" + key); 2547 tfoot = div.children("#tfoot_" + key); 2548 left = thead.children("#left_" + key); 2549 right = thead.children("#right_" + key); 2550 more = right.children("#more_" + key); 2551 close = tfoot.find("#close_" + key); 2552 return; 2553 } 2554 2555 if (!div.data("init")) { 2556 div.wrapInner("<div id='tbody_" + key + "' class='" + tbody_css + "'></div>"); 2557 div.prepend("<div id='thead_" + key + "' class='" + thead_css + "' style='height:40px;'></div>"); 2558 div.append("<div id='tfoot_" + key + "' class='" + tfoot_css + "'></div>"); 2559 div.data("init", true); 2560 } 2561 thead = div.children("#thead_" + key); 2562 tbody = div.children("#tbody_" + key); 2563 tfoot = div.children("#tfoot_" + key); 2564 2565 if (typeof (div.attr("tbody_style")) == "string") { tbody.attr("style", div.attr("tbody_style")); } 2566 if (typeof (div.attr("thead_style")) == "string") { thead.attr("style", div.attr("thead_style")); } 2567 2568 tfoot.css({ 2569 width: "100%", 2570 height: "100%", 2571 display: "none", 2572 margin: "auto", 2573 overflow: "auto", 2574 position: "absolute",
2575 left: 0, 2576 right: 0, 2577 top: 0, 2578 bottom: 0 2579 }); 2580 2581 if (tbody.children("div").length == 0) { return; } 2582 if (tbody.children("div[select='true']").length == 0) { $(tbody.children("div").get(0)).attr("select", "true"); } 2583 var tfoot_htm = ""; 2584 tfoot_htm += "<table cellspacing='0' cellpadding='0' width='100%'>"; 2585 tfoot_htm += "<tr>"; 2586 tfoot_htm += "<td align='right' valing='top' style='background-color:#f5f5f5;'>"; 2587 tfoot_htm += "<a href='javascript:void(0);' id='close_" + key + "' class='" + close_css + "'></a>"; 2588 tfoot_htm += "</td>"; 2589 tfoot_htm += "</tr>"; 2590 tfoot_htm += "<tr>"; 2591 tfoot_htm += "<td valign='top' align='left'>"; 2592 2593 var tb_htm = ""; 2594 tb_htm += "<div id='left_" + key + "' class='" + left_css + "'>"; 2595 tbody.children("div").each(function (i, v) { 2596 if ($(v).attr("select") == "true") { 2597 tb_htm += "<div class='" + item_on_css + "'>" + $(v).attr("text") + "</div>"; 2598 } else { 2599 tb_htm += "<div class='" + item_css + "'>" + $(v).attr("text") + "</div>"; 2600 } 2601 tfoot_htm += "<div class='" + tfoot_item_css + "' name='tfoot_item_" + key + "'><a href='javascript:void(0);'>" + $(v).attr("text") + "</a></div>"; 2602 }); 2603 tb_htm += "</div>"; 2604 tb_htm += "<div id='right_" + key + "' class='" + right_css + "'>"; 2605 tb_htm += "<a href='javascript:void(0);' id='more_" + key + "' class='" + more_css + "'></a>"; 2606 tb_htm += "</div>"; 2607 2608 thead.html(tb_htm); 2609 div.css({ 2610 "box-sizing": "border-box", 2611 paddingTop: thead.height() + "px" 2612 }); 2613 2614 tfoot_htm += "<td>"; 2615 tfoot_htm += "</tr>"; 2616 tfoot_htm += "</table>"; 2617 tfoot.html(tfoot_htm); 2618 2619 2620 left = thead.children("#left_" + key); 2621 right = thead.children("#right_" + key); 2622 more = right.children("#more_" + key); 2623 close = tfoot.find("#close_" + key); 2624 2625 thead.css({ 2626 zIndex: defaults.zIndex, 2627 width: "100%", 2628 "box-sizing": "border-box", 2629 paddingRight: "40px" 2630 }); 2631 left.css({ 2632 width: "auto", 2633 height: "100%", 2634 overflow: "hidden", 2635 "white-space": "nowrap", 2636 margin: "auto", 2637 display: "inline-block" 2638 }) 2639 2640 var index = $(thead.children("div")).index(thead.children("div[select='true']")); 2641 if (index < 0) { index = 0; } 2642 parent.select(index); 2643 2644 }; 2645 this.select = function (index) { 2646 if (typeof (index) != "number") { index = tbody.children("div").index(tbody.children(index)); } 2647 if (index < 0) { return; } 2648 tbody.children("div").removeAttr("select").hide(); 2649 $(tbody.children("div").get(index)).attr("select", "true").show(); 2650 left.children("div").prop("class", item_css); 2651 $(left.children("div").get(index)).prop("class", item_on_css); 2652 var width = parseInt($(left.children("div").get(index)).position().left + $(left.children("div").get(index)).width()); 2653 var max_index = 3; 2654 left.children("div").each(function (i, v) { 2655 if ($(v).position().left >= left.width()) { 2656 max_index = i; 2657 return false; 2658 } 2659 }); 2660 if (index < max_index) { width = 0; } 2661 $(left).scrollLeft(width); 2662 }; 2663 this.append = function (row) { 2664 }; 2665 this.prepend = function () { 2666 2667 }; 2668 this.get_index = function () { 2669 return tbody.children("div").index(tbody.children("div[select='true']")); 2670 }; 2671 this.update = function (row, index) { }; 2672 this.up = function (index) { 2673 if (typeof (index) != "number") { index = tbody.children("div").index(tbody.children(index)); } 2674 var thead_item = $(left.children("div").get(index)); 2675 var tbody_item = $(tbody.children("div").get(index)); 2676 var thead_item_next = $(thead_item.prev("div")); 2677 var tbody_item_next = $(tbody_item.prev("div")); 2678 if (typeof (thead_item_next) == "undefined") { return; } 2679 thead_item.insertAfter(thead_item_next); 2680 tbody_item.insertAfter(tbody_item_next); 2681 }; 2682 this.down = function (index) { 2683 if (typeof (index) != "number") { index = tbody.children("div").index(tbody.children(index)); } 2684 var thead_item = $(left.children("div").get(index)); 2685 var tbody_item = $(tbody.children("div").get(index)); 2686 var thead_item_next = $(thead_item.next("div")); 2687 var tbody_item_next = $(tbody_item.next("div")); 2688 if (typeof (thead_item_next) == "undefined") { return; } 2689 thead_item.insertAfter(thead_item_next); 2690 tbody_item.insertAfter(tbody_item_next); 2691 }; 2692 this.del = function (index) { 2693 if (typeof (index) != "number") { index = tbody.children("div").index(tbody.children(index)); } 2694 $(left.children("div").get(index)).remove(); 2695 $(tbody.children("div").get(index)).remove(); 2696 }; 2697 2698 this.show = function (id) {
2699 var index = tbody.children("div").index(tbody.children(id)); 2700 if (index == -1) { return; } 2701 var tbody_item = tbody.children(id); 2702 if (tbody_item.attr("select") == "true") { 2703 tbody.children("div").hide(); 2704 $(tbody.children("div").get(index)).show(); 2705 } 2706 $(left.children("div").get(index)).show(); 2707 $(tfoot.find("[name='tfoot_item_" + key + "']").get(index)).show(); 2708 switch_right(); 2709 }; 2710 this.hide = function (id) { 2711 var index = tbody.children("div").index(tbody.children(id)); 2712 if (index == -1) { return; } 2713 var tbody_item = tbody.children(id); 2714 $(tbody.children("div").get(index)).hide(); 2715 $(left.children("div").get(index)).hide(); 2716 $(tfoot.find("[name='tfoot_item_" + key + "']").get(index)).hide(); 2717 switch_right(); 2718 }; 2719 2720 this.events = function () { 2721 tfoot.find("[name='tfoot_item_" + key + "']").each(function (i, v) { 2722 $(v).unbind("click").click(function (e) { 2723 var index = tfoot.find("[name='tfoot_item_" + key + "']").index($(this)); 2724 if (index < 0) { return; } 2725 parent.select(index); 2726 tfoot.hide(); 2727 }); 2728 }); 2729 switch_right(); 2730 left.children("div").each(function (i, v) { 2731 $(this).bind({ 2732 click: function (e) { 2733 parent.select(i); 2734 defaults.click(e, div, thead, tbody); 2735 } 2736 }); 2737 }); 2738 more.unbind("click").click(function (e) { 2739 tfoot.show(); 2740 }); 2741 close.unbind("click").click(function (e) { 2742 tfoot.hide(); 2743 }); 2744 }; 2745 function switch_right() { 2746 var width = 0; 2747 $(left.children("div")).each(function (i, v) { 2748 if ($(v).css("display") != "none") { 2749 width += $(v).outerWidth(); 2750 } 2751 }); 2752 if (thead.width() < width) { 2753 $(right).show(); 2754 } else { 2755 $(right).hide(); 2756 } 2757 } 2758 } 2759}; 2760/*æ ç¶è¡¨æ ¼*/ 2761$.fn.treegrid = function (options) { 2762 var defaults = { 2763 key_id: "qd_guid", 2764 is_index: false, 2765 is_check: true, 2766 is_fold: false, 2767 link_back: "#fff", 2768 link_color: "#333", 2769 hover_back: "#f90", 2770 hover_color: "#fff", 2771 cols: [], 2772 click: function (e, row, i, node) { }, 2773 dblclick: function (e, row, i, node) { }, 2774 mouseover: function (e, row, i, node) { }, 2775 mouseout: function (e, row, i, node) { }, 2776 contextmenu: function (e, row, i, node) { }, 2777 node_click: function (e, row, i, node) { } 2778 }; 2779 $.extend(defaults, options); 2780 var div = $(this); 2781 div.css("table-layout", "fixed"); 2782 if (typeof (div.data("rows")) == "undefined") { div.data("rows", {}); } 2783 if (typeof (div.data("defaults")) == "undefined") { div.data("defaults", defaults); } 2784 var defaults = div.data("defaults"); 2785 var cols = defaults.cols; 2786 var key_id = defaults.key_id; 2787 var thead = div.children("thead"); 2788 var colspan = defaults.cols.length + 1; 2789 if (defaults.is_index) { colspan = colspan + 1; } 2790 if (defaults.is_check) { colspan = colspan + 1; } 2791 2792 var _quandi = new quandi(); 2793 _quandi.init(); 2794 switch (options) { 2795 case "append": 2796 _quandi.append(arguments[1], arguments[2]); 2797 break; 2798 case "prepend": 2799 _quandi.prepend(arguments[1], arguments[2]); 2800 break; 2801 case "update": 2802 _quandi.update(arguments[1], arguments[2]); 2803 break; 2804 case "del": 2805 _quandi.del(arguments[1]); 2806 break; 2807 case "up": 2808 _quandi.up(arguments[1]); 2809 break; 2810 case "down": 2811 _quandi.down(arguments[1]); 2812 break; 2813 case "move": 2814 _quandi.move(arguments[1], arguments[2]); 2815 break; 2816 case "check": 2817 _quandi.check(arguments[1]); 2818 break; 2819 case "un_check": 2820 _quandi.un_check(arguments[1]); 2821 break; 2822 case "check_all": 2823 _quandi.check_all(); 2824 break; 2825 case "un_check_all": 2826 _quandi.un_check_all(); 2827 break; 2828 case "select": 2829 _quandi.select(arguments[1]); 2830 break; 2831 case "un_select": 2832 _quandi.un_select(arguments[1]); 2833 break; 2834 case "html": 2835 _quandi.html(arguments[1], arguments[2]); 2836 break; 2837 case "clear": 2838 _quandi.clear(); 2839 break; 2840 case "each": 2841 return _quandi.each(arguments[1], arguments[2]); 2842 break; 2843 case "row": 2844 return _quandi.row(arguments[1]); 2845 break; 2846 case "rows": 2847 return _quandi.rows(arguments[1], arguments[2]); 2848 break; 2849 case "list": 2850 return _quandi.rows(arguments[1], arguments[2]); 2851 break; 2852 case "checked": 2853 return _quandi.checked(arguments[1]); 2854 break; 2855 case "first": 2856 return _quandi.first(arguments[1]); 2857 break; 2858 case "last": 2859 return _quandi.last(arguments[1]); 2860 break; 2861 case "level": 2862 return _quandi.level(arguments[1]); 2863 break; 2864 } 2865 _quandi.events(); 2866 _quandi = null; 2867 2868 function quandi() { 2869 var parent = this; 2870 this.init = function () { 2871 if (div.children("tbody").length == 0) { div.append("<tbody></tbody>"); } 2872 if (div.children("thead").length == 0) { div.prepend("<thead></thead>"); } 2873 var tbody = $(div.children("tbody")); 2874 if (typeof (tbody.attr("id")) == "undefined") { tbody.attr("id", "tbody_0"); } 2875 if (typeof (tbody.attr("index")) == "undefined") { tbody.attr("index", "0"); } 2876 if (div.children("thead").find("[field='index_td']").length == 0) { 2877 $(div.children("thead").children("tr")).prepend("<th field='index_td' width='40'></th>"); 2878 } 2879 if (div.children("thead").find("[cid='ck_all']").length == 0) { 2880 //$(div.children("thead").children("tr")).prepend("<th field='ck_td' width='20'><input type='checkbox' cid='ck_all' /></th>"); 2881 } 2882 $(div.children("thead").find("[cid='ck_all']").parent()).attr("field", "ck_td"); 2883 if (div.attr("init") != "true") { 2884 div.attr("init", "true"); 2885 div.on({ 2886 click: function (e) { 2887 var id = $(this).attr("key_id"); 2888 var row = parent.row(id); 2889 var tbody = $("#tbody_" + id); 2890 if ($(this).attr("fold") == "true") { 2891 parent.show(id); 2892 } else { 2893 parent.hide(id); 2894 } 2895 defaults.node_click(e, row);
2896 row = null; 2897 id = null; 2898 tbody = null; 2899 $(this).off("click"); 2900 } 2901 }, "[name='node']"); 2902 2903 div.on({ 2904 click: function (e) { 2905 if ($(this).prop("checked")) { 2906 div.find("#tr_" + $(this).val()).attr("check", "true"); 2907 } else { 2908 div.find("#tr_" + $(this).val()).removeAttr("check"); 2909 } 2910 } 2911 }, "[name='ck']"); 2912 } 2913 }; 2914 2915 this.append = function (row, parentid) { 2916 var tb_htm = html_node(row, parentid); 2917 var tbody = div.find("#tbody_" + parentid); 2918 $(tbody).append(tb_htm); 2919 delete row.children; 2920 div.data("rows")[row[key_id]] = row; 2921 tbody = null; 2922 tb_htm = null; 2923 }; 2924 this.prepend = function (row, parentid) { 2925 var tb_htm = html_node(row, parentid); 2926 var tbody = $("#tbody_" + parentid); 2927 $(tbody).prepend(tb_htm); 2928 delete row.children; 2929 div.data("rows")[row[key_id]] = row; 2930 tbody = null; 2931 tb_htm = null; 2932 }; 2933 this.update = function (row, id) { 2934 var tr = $(div.find("#tr_" + id)); 2935 var parentid = $(tr).attr("parentid"); 2936 var tb_htm = html_node(row, parentid, true); 2937 tr.replaceWith(tb_htm); 2938 delete row.children; 2939 div.data("rows")[id] = row; 2940 tb_htm = null; 2941 parentid = null; 2942 parent.select(id); 2943 }; 2944 this.del = function (id) { 2945 del(id); 2946 if (div.find("#tr_" + id).length == 0) { return; } 2947 var parentid = $(div.find("#tr_" + id)).attr("parentid"); 2948 div.find("#tr_" + id).remove(); 2949 div.find("#tra_" + id).remove(); 2950 if (div.find("#tbody_" + parentid).length == 0) { return; } 2951 if ($(div.find("#tbody_" + parentid).children("tr")).length == 0) { 2952 $(div.find("#node_" + id)).prop("class", "node"); 2953 2954 } 2955 parentid = null; 2956 }; 2957 this.level = function (id) { 2958 var level = -1; 2959 if (div.find("#tr_" + id).length == 0) { return level; } 2960 level = parseInt($(div.find("#tr_" + id)).attr("index")); 2961 return level; 2962 } 2963 function del(id) { 2964 delete div.data("rows")[id]; 2965 div.data("rows", div.data("rows")); 2966 var tbody = div.find("#tbody_" + id); 2967 tbody.children("tr").each(function (i, v) { 2968 var id = $(v).attr("key_id"); 2969 del(id); 2970 id = null; 2971 }); 2972 } 2973 this.move = function (id, parentid) { 2974 var tr = $(tbody.children("#tr_" + id)); 2975 if (tr.length == 0) { return; } 2976 if (parentid == "0") { 2977 tbody.append(tr); 2978 } else { 2979 var parent_node = $(tbody.children("#tr_" + parentid)); 2980 if (parent_node.length == 0) { return; } 2981 var key_id = parent_node.attr("key_id"); 2982 var nodes = $(tbody.children("[parentid='" + key_id + "']")); 2983 if (nodes.length == 0) { return; } 2984 var node = nodes[nodes.length - 1]; 2985 $(tr).insertAfter(node); 2986 node = null; 2987 nodes = null; 2988 key_id = null; 2989 parent_node = null; 2990 } 2991 tr = null; 2992 }; 2993 this.up = function (id) { 2994 var tr = $(div.find("#tr_" + id)); 2995 if (tr.length == 0) { return; } 2996 var tra = $(div.find("#tra_" + id)); 2997 var next = $($(tr).prevAll("tr[name='tr']").get(0)); 2998 if (next.length == 0) { return; } 2999 $(tr).insertBefore(next); 3000 $(tra).insertAfter(tr); 3001 tra = null; 3002 next = null; 3003 tr = null; 3004 }; 3005 this.down = function (id) { 3006 var tr = $(div.find("#tr_" + id)); 3007 if (tr.length == 0) { return; } 3008 var tra = $(div.find("#tra_" + id)); 3009 var next = $($(tra).nextAll("tr[name='tra']").get(0)); 3010 if (next.length == 0) { return; } 3011 $(tr).insertAfter(next); 3012 $(tra).insertAfter(tr); 3013 tra = null; 3014 next = null; 3015 tr = null; 3016 }; 3017 this.check = function (id) { 3018 $(div.find("#tr_" + id)).attr("check", "true"); 3019 $(div.find("#ck_" + id)).prop("checked", "checked"); 3020 }; 3021 this.un_check = function (id) { 3022 $(div.find("#tr_" + id)).removeAttr("check"); 3023 $(div.find("#ck_" + id)).removeProp("checked"); 3024 }; 3025 this.check_all = function () { 3026 div.find("tr[name='tr']").attr("check", "true"); 3027 div.find("[name='ck']").prop("checked", "checked"); 3028 }; 3029 this.un_check_all = function () { 3030 div.find("tr").removeAttr("check"); 3031 div.find("[name='ck']").removeProp("checked"); 3032 }; 3033 3034 this.select = function (id) { 3035 div.find("tr").removeAttr("select").css({ 3036 backgroundColor: defaults.link_back, 3037 color: defaults.link_color 3038 }); 3039 $(div.find("#tr_" + id)).attr("select", "true").css({ 3040 backgroundColor: defaults.hover_back, 3041 color: defaults.hover_color 3042 }); 3043 }; 3044 this.un_select = function (id) { 3045 $(div.find("#tr_" + id)).removeAttr("select").css({ 3046 backgroundColor: defaults.link_back, 3047 color: defaults.link_color 3048 }); 3049 }; 3050 this.html = function (rows, parentid) { 3051 div.find("#tbody_" + parentid).html(""); 3052 for (var i = 0; i < rows.length; i++) { 3053 var row = rows[i]; 3054 var rs = row.children; 3055 parent.append(row, parentid); 3056 if (rs.length > 0) { 3057 parent.html(rs, row[key_id]); 3058 } 3059 rs = null; 3060 row = null; 3061 } 3062 }; 3063 this.clear = function () { 3064 div.data("rows", {}); 3065 div.children("tbody").html(""); 3066 }; 3067 this.row = function (id) { 3068 var row; 3069 if (typeof (id) == "string") { 3070 if (div.find("#tr_" + id).length > 0) {
3071 row = $.extend({}, div.data("rows")[id]); 3072 } 3073 } else if (typeof (id) == "undefined") { 3074 if (div.find("tr[name='tr'][select='true']").length > 0) { 3075 id = $(div.find("tr[name='tr'][select='true']")).attr("key_id"); 3076 row = $.extend({}, div.data("rows")[id]); 3077 } 3078 } 3079 3080 return row; 3081 }; 3082 this.rows = function (call, parentid) { 3083 if (typeof (parentid) == "undefined") { parentid = "0"; } 3084 var rows = []; 3085 var tbody = $(div.find("#tbody_" + parentid)); 3086 if (tbody.length == 0) { return rows; } 3087 $(tbody).children("tr[name='tr']").each(function (i, v) { 3088 var index = parseInt($(v).parent().attr("index")); 3089 var id = $(v).attr("key_id"); 3090 var row = parent.row(id); 3091 if (typeof (call) == "function") { 3092 var r = call(row, i, v, index); 3093 if (typeof (r) == "object") { row = r; } 3094 r = null; 3095 } 3096 3097 row.children = parent.rows(call, id); 3098 3099 rows.push(row); 3100 row = null; 3101 index = null; 3102 }); 3103 tbody = null; 3104 return rows; 3105 }; 3106 this.list = function (parentid, call) { 3107 if (typeof (parentid) == "undefined") { parentid = "0"; } 3108 var rows = []; 3109 var tbody = $(div.find("#tbody_" + parentid)); 3110 if (tbody.length == 0) { return rows; } 3111 $(tbody).children("tr[name='tr']").each(function (i, v) { 3112 var index = parseInt($(v).parent().attr("index")); 3113 var id = $(v).attr("key_id"); 3114 var row = parent.row(id); 3115 if (typeof (call) == "function") { 3116 var r = call(row, i, v, index); 3117 if (typeof (r) == "object") { row = r; } 3118 r = null; 3119 } 3120 rows.push(row); 3121 row = null; 3122 index = null; 3123 }); 3124 tbody = null; 3125 return rows; 3126 }; 3127 this.each = function (call, parentid) { 3128 if (typeof (parentid) == "undefined") { parentid = "0"; } 3129 div.find("tr[name='tr']").each(function (i, v) { 3130 var id = $(v).attr("key_id"); 3131 var row = parent.row(id); 3132 if (typeof (call) == "function") { 3133 call(row, i, v); 3134 } 3135 row.children = parent.rows(call, row[key_id]); 3136 row = null; 3137 }); 3138 }; 3139 this.checked = function (call) { 3140 var rows = []; 3141 div.find("[name='tr'][check='true']").each(function (i, v) { 3142 var id = $(v).attr("key_id"); 3143 var row = parent.row(id); 3144 3145 if (typeof (call) == "function") { 3146 var r = call(row, i, v); 3147 if (typeof (r) == "object") { row = r; } 3148 r = null; 3149 } 3150 rows.push(row); 3151 row = null; 3152 }); 3153 return rows; 3154 }; 3155 3156 this.first = function (parentid) { 3157 var row; 3158 var tbody = div.find("#tbody_" + parentid); 3159 var node = tbody.children("tr[name='tr']").first(); 3160 if (node.length > 0) { 3161 var id = $(node).attr("key_id"); 3162 row = parent.row(id); 3163 id = null; 3164 } 3165 tbody = null; 3166 node = null; 3167 return row; 3168 }; 3169 this.last = function (parentid) { 3170 var row; 3171 var tbody = div.find("#tbody_" + parentid); 3172 var node = tbody.children("tr[name='tr']").last(); 3173 if (node.length > 0) { 3174 var id = $(node).attr("key_id"); 3175 row = parent.row(id); 3176 id = null; 3177 } 3178 tbody = null; 3179 node = null; 3180 return row; 3181 }; 3182 this.hide = function (parentid) { 3183 var tbody = div.find("#tbody_" + parentid); 3184 var node = div.find("#node_" + parentid); 3185 if ($(tbody).length == 0) { return; } 3186 if (tbody.children().length == 0) { $(node).prop("class", "node"); } else { $(node).attr("fold", "true").prop("class", "tree"); } 3187 tbody.hide(); 3188 tbody = null; 3189 node = null; 3190 }; 3191 this.show = function (parentid) { 3192 var tbody = div.find("#tbody_" + parentid); 3193 var node = div.find("#node_" + parentid); 3194 if ($(tbody).length == 0) { return; } 3195 if (tbody.children().length == 0) { $(node).prop("class", "node"); } else { $(node).attr("fold", "false").prop("class", "tree_on"); } 3196 tbody.show(); 3197 tbody = null; 3198 }; 3199 this.events = function () { 3200 div.find("td[field='index_td']").each(function (i, v) { 3201 $(v).html((i + 1)); 3202 }); 3203 if (defaults.is_index) { 3204 3205 div.find("[field='index_td']").show(); 3206 } else { 3207 div.find("[field='index_td']").hide(); 3208 } 3209 if (defaults.is_check) { 3210 div.find("td[field='ck_td']").show(); 3211 } else { 3212 div.find("td[field='ck_td']").hide(); 3213 } 3214 3215 div.find("[name='node']").each(function (i, v) { 3216 var parentid = $(v).attr("key_id"); 3217 var fold = $(v).attr("fold"); 3218 var tbody = div.find("#tbody_" + parentid); 3219 if (fold == "true") { 3220 tbody.hide(); 3221 $(v).prop("class", "tree"); 3222 } else { 3223 tbody.show(); 3224 $(v).prop("class", "tree_on"); 3225 } 3226 if (tbody.children().length == 0) { $(v).prop("class", "node"); } 3227 tbody = null; 3228 fold = null; 3229 parentid = null; 3230 }); 3231 3232 div.children("thead").find("[cid='ck_all']").click(function (e) { 3233 if ($(this).prop("checked")) { 3234 div.find("tr[name='tr']").attr("check", "true"); 3235 div.find("[name='ck']").prop("checked", "checked"); 3236 } else { 3237 div.find("tr[name='tr']").removeAttr("check"); 3238 div.find("[name='ck']").removeProp("checked"); 3239 } 3240 }); 3241 3242 div.find("tr[name='tr']").each(function (i, v) { 3243 $(v).bind({ 3244 click: function (e) { 3245 var id = $(this).attr("key_id"); 3246 var row = div.data("rows")[id]; 3247 var i = div.find("tr[name='tr']").index($(this)); 3248 defaults.click(e, row, i, $(this)); 3249 parent.select(id); 3250 id = null;
3251 row = null; 3252 }, 3253 dblclick: function (e) { 3254 var id = $(this).attr("key_id"); 3255 var row = div.data("rows")[id]; 3256 var i = div.find("tr[name='tr']").index($(this)); 3257 defaults.dblclick(e, row, i, $(this)); 3258 parent.select(id); 3259 id = null; 3260 row = null; 3261 }, 3262 mouseover: function (e) { 3263 var id = $(this).attr("key_id"); 3264 var row = div.data("rows")[id]; 3265 id = null; 3266 var i = div.find("tr[name='tr']").index($(this)); 3267 defaults.mouseover(e, row, i, $(this)); 3268 row = null; 3269 }, 3270 mouseout: function (e) { 3271 var id = $(this).attr("key_id"); 3272 var row = div.data("rows")[id]; 3273 id = null; 3274 var i = div.find("tr[name='tr']").index($(this)); 3275 defaults.mouseout(e, row, i, $(this)); 3276 row = null; 3277 qd_guid = null; 3278 }, 3279 contextmenu: function (e) { 3280 var id = $(this).attr("key_id"); 3281 var row = div.data("rows")[id]; 3282 id = null; 3283 var i = div.find("tr[name='tr']").index($(this)); 3284 defaults.contextmenu(e, row, i, $(this)); 3285 row = null; 3286 } 3287 }) 3288 }); 3289 3290 3291 }; 3292 function html_node(row, parentid, flag) { 3293 var thead = div.children("thead"); 3294 var index = 0; 3295 var index = parseInt(div.find("#tbody_" + parentid).attr("index")); 3296 var data = $.extend({}, row); 3297 delete data.children; 3298 var tb_htm = ""; 3299 tb_htm += "<tr class='treegrid_tr' name='tr' index='" + (index + 1) + "' id='tr_" + row[key_id] + "' key_id='" + row[key_id] + "' parentid='" + parentid + "'>"; 3300 tb_htm += "<td class='treegrid_td' style='width:20px;text-align:center;' field='ck_td' ><input type='checkbox' name='ck' id='ck_" + row[key_id] + "' value='" + row[key_id] + "' key_id='" + row[key_id] + "'/></td>"; 3301 tb_htm += "<td class='treegrid_td' style=width:40px;text-align:center;' field='index_td' ><div name='index' >0</div></td>"; 3302 3303 for (var i = 0; i < cols.length; i++) { 3304 var col = cols[i]; 3305 if (typeof (fold) == "undefined") { fold = "false"; } 3306 if (typeof (col.style) == "undefined") { col.style = ""; } 3307 if (typeof (col.field) == "undefined") { col.field = col.name; } 3308 if (typeof (col.extend) == "undefined") { col.extend = ""; } 3309 tb_htm += "<td class='treegrid_td' field='" + col.field + "' " + col.extend + ">"; 3310 if (col.tree) { 3311 tb_htm += "<div style='width:auto;display:grid;grid-template-columns:20px auto;padding-left:" + (index * 16) + "px;'>"; 3312 tb_htm += "<a href='javascript:void(0);' name='node' class='node' id='node_" + row[key_id] + "' key_id=" + row[key_id] + " fold='" + defaults.is_fold + "'></a>"; 3313 tb_htm += "<div style='width:auto;display:block;'>"; 3314 tb_htm += "<div style='width:100%;max-width:100%;display:block;white-space:nowrap;overflow:hidden;" + col.style + "'>"; 3315 if (typeof (col.formatter) == "function") { 3316 tb_htm += col.formatter(row, index); 3317 } else { 3318 tb_htm += row[col.name]; 3319 } 3320 tb_htm += "</div>"; 3321 tb_htm += "</div>"; 3322 tb_htm += "</div>"; 3323 } else { 3324 tb_htm += "<div style='width:100%;max-width:100%;display:block;white-space:nowrap;overflow:hidden;" + col.style + "'>"; 3325 if (typeof (col.formatter) == "function") { 3326 tb_htm += col.formatter(row, index); 3327 } else { 3328 tb_htm += row[col.name]; 3329 } 3330 tb_htm += "</div>"; 3331 } 3332 3333 3334 tb_htm += "</td>"; 3335 col = null; 3336 fold = null; 3337 } 3338 tb_htm += "</tr>"; 3339 3340 var colspan = defaults.cols.length; 3341 if (defaults.is_index) { colspan = colspan + 1; } 3342 if (defaults.is_check) { colspan = colspan + 1; } 3343 if (!flag) { 3344 tb_htm += "<tr name='tra' id='tra_" + row[key_id] + "'>"; 3345 tb_htm += "<td align='left' valign='top' colspan='" + colspan + "' style='padding:0px;'>"; 3346 tb_htm += "<table cellpadding='0' cellspacing='0' width='100%' style='table-layout:fixed;'>"; 3347 tb_htm += "<thead >"; 3348 $(div).children("thead").children("tr").each(function (i, v) { 3349 tb_htm += "<tr>"; 3350 3351 $(v).children("th").each(function (j, n) { 3352 tb_htm += "<th "; 3353 $.each(this.attributes, function (i, v) { 3354 tb_htm += " " + this.name + "=\"" + this.value + "\""; 3355 });
3356 tb_htm += ">"; 3357 tb_htm += "</th>"; 3358 }) 3359 3360 3361 tb_htm += "</tr>"; 3362 }); 3363 tb_htm += "</thead>"; 3364 tb_htm += "<tbody id='tbody_" + row[key_id] + "' index='" + (index + 1) + "'>"; 3365 tb_htm += "</tbody>"; 3366 tb_htm += "</table>"; 3367 tb_htm += "</td>"; 3368 tb_htm += "</tr>"; 3369 } 3370 return tb_htm; 3371 } 3372 } 3373} 3374/*æ¥ææ¶é´*/ 3375$.datetime = function (options) { 3376 var defaults = { 3377 key: "date", 3378 hide: true, 3379 parent_node: null, 3380 tmodal_css: "date_tmodal", 3381 tb_css: "date_tb", 3382 thead_css: "date_thead", 3383 tbody_css: "date_tbody", 3384 tfoot_css: "date_tfoot", 3385 bottom_css: "date_bottom", 3386 3387 link_color: "#333", 3388 link_back: "transparent", 3389 3390 hover_color: "#333", 3391 hover_back: "#f5f5f5", 3392 3393 active_color: "#fff", 3394 active_back: "#f90", 3395 3396 left: 0, 3397 top: 0, 3398 zIndex: 1002, 3399 weeks: ["æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å "], 3400 year_text: "å¹´", 3401 month_text: "æ", 3402 hour_text: "æ¶", 3403 minute_text: "å", 3404 second_text: "ç§", 3405 3406 yes_css: "date_yes", 3407 no_css: "date_no", 3408 yes_text: " ç¡® å® ", 3409 no_text: " æ¸ ç©º ", 3410 3411 val: "2020/01/01 00:00:00", 3412 min_val: "2010/01/01 00:00:00", 3413 max_val: "2050/01/01 23:59:59", 3414 yes_click: function (e, de) { }, 3415 no_click: function (e, de) { } 3416 }; 3417 $.extend(defaults, options); 3418 3419 var key = defaults; 3420 if ($("#" + key).length == 0) { $("body").append("<div id='" + key + "'></div>"); } 3421 var div = $("#" + key); 3422 3423 if (typeof (div.data("key")) == "undefined") { div.data("key", key); } 3424 if (typeof (div.data("defaults")) == "undefined" || typeof (options) == "object") { div.data("defaults", defaults); } 3425 key = div.data("key"); 3426 defaults = div.data("defaults"); 3427 var parent_node = $(defaults.parent_node); 3428 if (defaults.parent_node == null) { parent_node = $("body"); } 3429 var tmodal_css = defaults.tmodal_css; 3430 var tb_css = defaults.tb_css; 3431 var thead_css = defaults.thead_css; 3432 var tbody_css = defaults.tbody_css; 3433 var tfoot_css = defaults.tfoot_css; 3434 var bottom_css = defaults.bottom_css; 3435 3436 var year_text = defaults.year_text; 3437 var month_text = defaults.month_text; 3438 var hour_text = defaults.hour_text; 3439 var minute_text = defaults.minute_text; 3440 var second_text = defaults.second_text; 3441 3442 var yes_css = defaults.yes_css; 3443 var no_css = defaults.no_css; 3444 var yes_text = defaults.yes_text; 3445 var no_text = defaults.no_text; 3446 3447 var link_color = defaults.link_color; 3448 var link_back = defaults.link_back; 3449 var hover_color = defaults.hover_color; 3450 var hover_back = defaults.hover_back; 3451 var active_color = defaults.active_color; 3452 var active_back = defaults.active_back; 3453 3454 3455 var min_val = new Date(defaults.min_val); 3456 var max_val = new Date(defaults.max_val); 3457 var val = new Date(defaults.val); 3458 3459 div.css({ 3460 display: "block", 3461 position: "absolute", 3462 margin: "auto", 3463 width: "auto", 3464 height: "auto", 3465 overflow: "hidden", 3466 transform: "scale(0,0)", 3467 zIndex: defaults.zIndex 3468 }).show(); 3469 3470 3471 var _quandi = new quandi(); 3472 _quandi.init(); 3473 _quandi.events(); 3474 _quandi = null; 3475 3476 function quandi() { 3477 var parent = this; 3478 var tb, thead, tbody, tmodal, bottom; 3479 var tfoot; 3480 var year, month, hour, minute, second; 3481 var yes, no; 3482 this.init = function () { 3483 var tb_htm = ""; 3484 tb_htm += "<div id='tb_" + key + "' class='" + tb_css + "'>"; 3485 tb_htm += "<div id='thead_" + key + "' class='" + thead_css + "'>"; 3486 tb_htm += "<select id='year_" + key + "' style='margin-right:10px;'>"; 3487 for (var i = min_val.getFullYear(); i <= max_val.getFullYear(); i++) { 3488 tb_htm += "<option value='" + i + "' "; 3489 if (i == val.getFullYear()) { 3490 tb_htm += "selected "; 3491 } 3492 tb_htm += " value='" + i + "'>" + i + year_text + "</option>"; 3493 } 3494 tb_htm += "</select>"; 3495 tb_htm += "<select id='month_" + key + "'>"; 3496 tb_htm += "</select>"; 3497 tb_htm += "</div>"; 3498 tb_htm += "<div id='tbody_" + key + "' class='" + tbody_css + "'>"; 3499 for (var i = 0; i < defaults.weeks.length; i++) { 3500 tb_htm += "<div>"; 3501 tb_htm += defaults.weeks[i]; 3502 tb_htm += "</div>"; 3503 } 3504 tb_htm += "</div>"; 3505 tb_htm += "<div id='tfoot_" + key + "' class='" + tfoot_css + "'>"; 3506 tb_htm += "</div>"; 3507 tb_htm += "<div id='bottom_" + key + "' class='" + bottom_css + "'>"; 3508 tb_htm += "<select id='hour_" + key + "' style='margin:5px;'>"; 3509 tb_htm += "</select>"; 3510 tb_htm += hour_text; 3511 tb_htm += "<select id='minute_" + key + "' style='margin:5px;'>"; 3512 tb_htm += "</select>"; 3513 tb_htm += minute_text; 3514 tb_htm += "<select id='second_" + key + "' style='margin:5px;'>"; 3515 tb_htm += "</select>"; 3516 tb_htm += second_text; 3517 tb_htm += "</div>"; 3518 tb_htm += "<div style='width:auto;height:auto;padding:5px;display:block;overflow:hidden;text-align:center;'>"; 3519 tb_htm += "<a href='javascript:void(0);' id='yes_" + key + "' class='" + yes_css + "'>
3519" + yes_text + "</a>"; 3520 tb_htm += "<a href='javascript:void(0);' id='no_" + key + "' class='" + no_css + "'>" + no_text + "</a>"; 3521 tb_htm += "</div>"; 3522 tb_htm += "</div>"; 3523 div.html(tb_htm); 3524 3525 tb = div.children("#tb_" + key); 3526 thead = tb.children("#thead_" + key); 3527 tbody = tb.children("#tbody_" + key); 3528 tfoot = tb.children("#tfoot_" + key); 3529 year = thead.children("#year_" + key); 3530 month = thead.children("#month_" + key); 3531 bottom = tb.children("#bottom_" + key); 3532 hour = bottom.children("#hour_" + key); 3533 minute = bottom.children("#minute_" + key); 3534 second = bottom.children("#second_" + key); 3535 yes = div.find("#yes_" + key); 3536 no = div.find("#no_" + key); 3537 3538 if (defaults.hide) { bottom.hide(); } else { bottom.show(); } 3539 3540 div.css({ 3541 position: "absolute", 3542 left: defaults.left, 3543 top: defaults.top 3544 }); 3545 3546 tb.css({ 3547 width: "auto", 3548 height: "auto", 3549 display: "block", 3550 }) 3551 }; 3552 this.events = function () { 3553 html_month(); 3554 html_date(); 3555 html_hour(); 3556 html_minute(); 3557 html_second(); 3558 3559 year.unbind("change").change(function () { 3560 html_month(); 3561 html_date(); 3562 }); 3563 month.unbind("change").change(function () { 3564 html_date(); 3565 }); 3566 if (tb.position().left + tb.outerWidth() > div.width()) { 3567 tb.css({ 3568 left: (div.width() - tb.outerWidth()) + "px" 3569 }); 3570 } 3571 if (tb.position().top + tb.outerHeight() > div.height()) { 3572 tb.css({ 3573 top: (div.height() - tb.outerHeight()) + "px" 3574 }); 3575 } 3576 }; 3577 function html_month() { 3578 var start = 1; 3579 var end = 12; 3580 var y = parseInt(year.val()); 3581 if (y == min_val.getFullYear()) { start = min_val.getMonth() + 1; } 3582 if (y == max_val.getFullYear()) { end = max_val.getMonth() + 1; } 3583 3584 var tb_htm = ""; 3585 for (var i = start; i <= end; i++) { 3586 var v = i; 3587 if (i < 10) { v = "0" + i; } 3588 tb_htm += "<option value='" + v + "' "; 3589 if (i == (val.getMonth() + 1)) { 3590 tb_htm += "selected "; 3591 } 3592 tb_htm += " >" + i + month_text + "</option>"; 3593 } 3594 month.html(tb_htm); 3595 } 3596 function html_date() { 3597 var tb_htm = ""; 3598 var y = parseInt(year.val()); 3599 var m = parseInt(month.val()); 3600 var max_date = 30; 3601 if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) { 3602 max_date = 31; 3603 } else if (m == 4 || m == 6 || m == 11) { 3604 max_date = 30; 3605 } else if (m == 2) { 3606 if (y % 4 == 0) { 3607 max_date = 29; 3608 } else { 3609 max_date = 28; 3610 } 3611 } 3612 var start = 1; 3613 var end = max_date; 3614 if ((min_val.getFullYear() == y) && ((min_val.getMonth() + 1) == m)) { 3615 start = min_val.getDate(); 3616 } 3617 if ((max_val.getFullYear() == y) && ((max_val.getMonth() + 1) == m)) { 3618 end = max_val.getDate(); 3619 } 3620 var tb_htm = ""; 3621 for (var i = start; i <= end; i++) { 3622 if (val.getDate() == i) { 3623 tb_htm += "<div style='background-color:" + active_back + ";color:" + active_color + ";' select='true'>" + i + "</div>"; 3624 } else { 3625 tb_htm += "<div style='background-color:" + link_back + ";color:" + link_color + ";' >" + i + "</div>"; 3626 } 3627 } 3628 tfoot.html(tb_htm); 3629 var marginLeft = parseInt(new Date(y + "/" + m + "/" + start + " 00:00:00").getDay() * (tfoot.innerWidth() / 7)); 3630 $(tfoot.children("div").get(0)).css({ marginLeft: marginLeft + "px" }); 3631 3632 tfoot.children("div").unbind("click").click(function (e) { 3633 tfoot.children("div").removeAttr("select").css({ 3634 color: link_color, 3635 backgroundColor: link_back 3636 }); 3637 $(this).css({ 3638 color: active_color, 3639 backgroundColor: active_back 3640 }).attr("select", "true"); 3641 html_hour(); 3642 html_minute(); 3643 html_second(); 3644 }).unbind("mouseover").mouseover(function (e) { 3645 if ($(this).attr("select") != "true") { 3646 $(this).css({ 3647 color: hover_color, 3648 backgroundColor: hover_back 3649 }); 3650 } 3651 }).unbind("mouseout").mouseout(function (e) { 3652 if ($(this).attr("select") != "true") { 3653 $(this).css({ 3654 color: link_color, 3655 backgroundColor: link_back 3656 });
3657 } 3658 }); 3659 hour.unbind("change").change(function (e) { 3660 html_minute(); 3661 html_second(); 3662 }); 3663 minute.unbind("change").change(function (e) { 3664 html_second(); 3665 }); 3666 yes.unbind("click").click(function (e) { 3667 var date = 1; 3668 if (tfoot.children("div[select='true']").length > 0) { date = parseInt(tfoot.children("div[select='true']").html()); } 3669 var de = new Date(year.val() + "/" + month.val() + "/" + date + " " + hour.val() + ":" + minute.val() + ":" + second.val()); 3670 defaults.yes_click(e, de); 3671 div.remove(); 3672 }); 3673 no.unbind("click").click(function (e) { 3674 var date = 1; 3675 if (tfoot.children("div[select='true']").length > 0) { date = parseInt(tfoot.children("div[select='true']").html()); } 3676 var de = new Date(year.val() + "/" + month.val() + "/" + date + " " + hour.val() + ":" + minute.val() + ":" + second.val()); 3677 defaults.no_click(e, de); 3678 div.remove(); 3679 }); 3680 } 3681 function html_hour() { 3682 var start = 1; 3683 var end = 24; 3684 var y = parseInt(year.val()); 3685 var m = parseInt(month.val()); 3686 var d = 1; 3687 if (tfoot.children("div[select='true']").length > 0) { d = parseInt(tfoot.children("div[select='true']").html()); } 3688 if ((min_val.getFullYear() == y) && ((min_val.getMonth() + 1) == m) && ((min_val.getDate()) == d)) { 3689 start = min_val.getHours(); 3690 } 3691 if ((max_val.getFullYear() == y) && ((max_val.getMonth() + 1) == m) && ((max_val.getDate()) == d)) { 3692 end = max_val.getHours(); 3693 } 3694 3695 var h = hour.val(); 3696 var f = minute.val(); 3697 var s = second.val(); 3698 var zhi = new Date(y + "/" + m + "/" + d + " " + h + ":" + f + ":" + s); 3699 if (zhi >= new Date(min_val) && zhi <= new Date(max_val)) { return; } 3700 zhi = null; 3701 3702 var tb_htm = ""; 3703 for (var i = start; i <= end; i++) { 3704 var v = i; 3705 if (i < 10) { v = "0" + i; } 3706 tb_htm += "<option value='" + i + "' "; 3707 if (i == val.getHours()) { 3708 tb_htm += " selected "; 3709 } 3710 tb_htm += " >" + v + "</option>"; 3711 v = null; 3712 } 3713 hour.html(tb_htm); 3714 } 3715 function html_minute() { 3716 var start = 0; 3717 var end = 60; 3718 var y = parseInt(year.val()); 3719 var m = parseInt(month.val()); 3720 var d = 1; 3721 if (tfoot.children("div[select='true']").length > 0) { d = parseInt(tfoot.children("div[select='true']").html()); } 3722 var h = parseInt(hour.val()); 3723 if ((min_val.getFullYear() == y) && ((min_val.getMonth() + 1) == m) && ((min_val.getDate()) == d) && ((min_val.getHours()) == h)) { 3724 start = min_val.getMinutes(); 3725 } 3726 if ((max_val.getFullYear() == y) && ((max_val.getMonth() + 1) == m) && ((max_val.getDate()) == d) && ((max_val.getHours()) == h)) { 3727 end = max_val.getMinutes(); 3728 } 3729 var h = hour.val(); 3730 var f = minute.val(); 3731 var s = second.val(); 3732 var zhi = new Date(y + "/" + m + "/" + d + " " + h + ":" + f + ":" + s); 3733 if (zhi >= new Date(min_val) && zhi <= new Date(max_val)) { return; } 3734 zhi = null; 3735 3736 var tb_htm = ""; 3737 for (var i = start; i <= end; i++) { 3738 var v = i; 3739 if (i < 10) { v = "0" + i; } 3740 tb_htm += "<option value='" + v + "' "; 3741 if (i == val.getMinutes()) { 3742 tb_htm += " selected "; 3743 } 3744 tb_htm += ">" + v + "</option>"; 3745 v = null; 3746 } 3747 minute.html(tb_htm); 3748 } 3749 function html_second() { 3750 var start = 0; 3751 var end = 60; 3752 var y = parseInt(year.val()); 3753 var m = parseInt(month.val()); 3754 var d = 1; 3755 if (tfoot.children("div[select='true']").length > 0) { d = parseInt(tfoot.children("div[select='true']").html()); } 3756 var h = parseInt(hour.val()); 3757 var mi = parseInt(minute.val()); 3758 3759 if ((min_val.getFullYear() == y) && ((min_val.getMonth() + 1) == m) && ((min_val.getDate()) == d) && ((min_val.getHours()) == h) && ((min_val.getMinutes()) == mi)) { 3760 start = min_val.getSeconds(); 3761 } 3762 if ((max_val.getFullYear() == y) && ((max_val.getMonth() + 1) == m) && ((max_val.getDate()) == d) && ((max_val.getHours()) == h) && ((max_val.getMinutes()) == mi)) { 3763 end = max_val.getSeconds(); 3764 } 3765 3766 var h = hour.val(); 3767 var f = minute.val(); 3768 var s = second.val(); 3769 var zhi = new Date(y + "/" + m + "/" + d + " " + h + ":" + f + ":" + s); 3770 if (zhi >= new Date(min_val) && zhi <= new Date(max_val)) { return; } 3771 zhi = null; 3772 3773 var tb_htm = ""; 3774 for (var i = start; i <= end; i++) { 3775 var v = i; 3776 if (i < 10) { v = "0" + i; } 3777 tb_htm += "<option value='" + v + "' "; 3778 if (i == val.getSeconds()) { 3779 tb_htm += " selected "; 3780 } 3781 tb_htm += " >" + v + "</option>"; 3782 } 3783 second.html(tb_htm); 3784 } 3785 } 3786} 3787/*æ¥ææ¶é´*/ 3788$.fn.datetime = function (options) { 3789 var defaults = { 3790 css: "date", 3791 kid:"datetime",
3792 one: true, 3793 readonly:true, 3794 tb_css: "date_tb", 3795 thead_css: "date_thead", 3796 tbody_css: "date_tbody", 3797 tfoot_css: "date_tfoot", 3798 bottom_css: "date_bottom", 3799 3800 link_color: "#333", 3801 link_back: "transparent", 3802 3803 hover_color: "#333", 3804 hover_back: "#f5f5f5", 3805 3806 active_color: "#fff", 3807 active_back: "#f90", 3808 3809 left: 0, 3810 top: 0, 3811 zIndex: 1002, 3812 weeks: ["æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å "], 3813 year_text: "å¹´", 3814 month_text: "æ", 3815 hour_text: "æ¶", 3816 minute_text: "å", 3817 second_text: "ç§", 3818 3819 yes_css: "date_yes", 3820 no_css: "date_no", 3821 yes_text: " ç¡® å® ", 3822 no_text: " å æ¶ ", 3823 format:function(de){ 3824 return de.datetime(); 3825 }, 3826 click: function (node,date) { 3827 3828 }, 3829 3830 val: new Date().datetime(), 3831 min_val: "2010/01/01 00:00:00", 3832 max_val: "2050/12/31 23:59:59", 3833 yes_click: function (node, de,input) { }, 3834 no_click: function (node, de,input) { } 3835 }; 3836 $.extend(defaults, options); 3837 var args=arguments; 3838 var div = $(this); 3839 if(div.length==0){console.log("Date ä¸åå¨");return;} 3840 div.hide(); 3841 if(typeof(div.data("defaults"))=="undefined"){div.data("defaults",defaults);} 3842 defaults=div.data("defaults"); 3843 var css=defaults.css; 3844 var link_back=defaults.link_back; 3845 var link_color=defaults.link_color; 3846 var active_back=defaults.active_back; 3847 var active_color=defaults.active_color; 3848 var kid=defaults.kid; 3849 3850 if(isNaN(new Date(defaults.min_val).getFullYear())){defaults.min_val="2010/01/01 00:00:00";} 3851 if(isNaN(new Date(defaults.max_val).getFullYear())){defaults.max_val="2050/12/31 59:59:59";} 3852 3853 div.each(function(i,v){ 3854 var $v=$(v); 3855 var id=rand(6); 3856 if(typeof(options)=="string") 3857 { 3858 id=$v.attr("cid"); 3859 switch(options) 3860 { 3861 case "set": 3862 $(`#${id}`).attr(args[1]); 3863 break; 3864 case "get": 3865 return { 3866 val:$(`#${id}`).attr("val"), 3867 min_val:$(`#${id}`).attr("min_val"), 3868 max_val:$(`#${id}`).attr("max_val") 3869 }; 3870 break; 3871 case "set_val": 3872 if(isNaN(new Date(args[1]).getFullYear())){console.log("val set error!");return;} 3873 $v.val(args[1]); 3874 $(`#${id}_input`).val(args[1]); 3875 $(`#${id}`).attr({val:args[1]}); 3876 break; 3877 case "get_val": 3878 return $(`#${id}`).attr("val"); 3879 break; 3880 } 3881 }else 3882 { 3883 if(typeof($v.attr("cid"))=="undefined") 3884 { 3885 $v.attr("cid",id); 3886 id=$v.attr("cid"); 3887 var min_val=$v.attr("min_val"); 3888 var max_val=$v.attr("max_val"); 3889 var node_css=$v.prop("class"); 3890 var value=$v.val(); 3891 var val=value; 3892 var size=$v.attr("size"); 3893 var maxlength=$v.attr("maxlength"); 3894 var readonly=$v.attr("readonly"); 3895 3896 if(typeof(min_val)=="undefined"){min_val=defaults.min_val;} 3897 if(typeof(max_val)=="undefined"){max_val=defaults.max_val;} 3898 if(typeof(size)=="undefined"){size=defaults.size;} 3899 if(typeof(maxlength)=="undefined"){maxlength=defaults.maxlength;} 3900 if(typeof(readonly)=="undefined"){readonly=defaults.readonly;} 3901 if(value==""){val=defaults.val;} 3902 3903 3904 $v.after(` 3905 <div class="${css} ${node_css}" id="${id}" kid="${kid}"> 3906 <div class="${css}_head"> 3907 <input type="input" class="${css}_input " id="${id}_input" size="${size}" maxlength="${maxlength}" value="${value}" ${readonly}> 3908 <div class="${css}_arrow" id="${id}_arrow" qd_id="${id}" kid="${kid}"></div> 3909 </div> 3910 <div style="position:relative;overflow:visible;height:0px"> 3911 <div class="${css}_tb" id="${id}_tb"> 3912 <div class="${css}_thead" id="${id}_thead" style="display:flex;display:-webkit-flex;justify-content:center;align-items:center;column-gap:5px;"> 3913 <select id="${id}_year" class="${css}_year tool-input" qd_id="${id}" kid="${kid}"></select> 3914 <select id="${id}_month" class="${css}_month tool-input" qd_id="${id}" kid="${kid}"></select> 3915 <input type="hidden" id="${id}_date"> 3916 </div> 3917 <div class="${css}_week" id="${id}_week"></div> 3918 <div class="${css}_tbody" id="${id}_tbody" qd_id="${id}"></div> 3919 <div style='display:flex;display:-webkit-flex;column-gap:2px;justify-content:center;padding:10px;'> 3920 <select id="${id}_hour" class="${css}_hour tool-input" kid="${kid}"></select> 3921 <select id="${id}_minutes" class="${css}_minutes tool-input" kid="${kid}"></select> 3922 <select id="${id}_second" class="${css}_second tool-input" kid="${kid}"></select> 3923 </div> 3924 <div style='display:flex;display:-webkit-flex;column-gap:2px;justify-content:flex-end;padding:10px;'> 3925 <div class="${css}_yes" id="${id}_yes" qd_id="${id}" kid="${kid}">${defaults.yes_text}</div> 3926 <div class="${css}_no" id="${id}_no" qd_id="${id}" kid="${kid}">${defaults.no_text}</div> 3927 </div> 3928 </div> 3929 </div> 3930 </div> 3931 `); 3932 que({ 3933 em:`#${id}_week`, 3934 data:defaults.weeks, 3935 format:function(row,i){ 3936 return `<div style="width:14.2%;text-align:center;display:inline-block;vertical:middle;text-align:center;font-size:14px;font-weight:bold;">${defaults.weeks[i]}</div>`; 3937 } 3938 }); 3939 que({ 3940 em:`#${id}_tbody`, 3941 data:null, 3942 min:1, 3943 max:42, 3944 format:function(row,i){ 3945 return `<div class='${css}_item' cname="${id}_item" kid="${kid}"></div>`; 3946 } 3947 }); 3948 $(`#${id}`).attr({ 3949 max_val:max_val, 3950 min_val:min_val, 3951 val:val 3952 }).data("defaults",defaults); 3953 } 3954 } 3955 3956 3957 }); 3958 3959 $(`.${css}_arrow[kid='${kid}']`).unbind("click").click(function(e){
3960 var id=$(this).attr("qd_id"); 3961 var tb=$(`#${id}_tb`); 3962 var node=$(`#${id}`); 3963 var defaults=$(node).data("defaults"); 3964 defaults.click(node); 3965 if(tb.css("display")=="none") 3966 { 3967 html_year(id); 3968 html_month(id); 3969 html_date(id); 3970 html_hours(id); 3971 html_minutes(id); 3972 html_second(id); 3973 $(`.${css}_tb`).hide(); 3974 tb.show(); 3975 }else 3976 { 3977 tb.hide(); 3978 } 3979 defaults=null; 3980 }); 3981 $(`.${css}_year[kid='${kid}']`).unbind("change").change(function(e){ 3982 var id=$(this).attr("qd_id"); 3983 html_month(id); 3984 html_date(id); 3985 html_hours(id); 3986 html_minutes(id); 3987 html_second(id); 3988 id=null; 3989 }); 3990 $(`.${css}_month[kid='${kid}']`).unbind("change").change(function(e){ 3991 var id=$(this).attr("qd_id"); 3992 html_date(id); 3993 id=null; 3994 }); 3995 3996 $(`.${css}_yes[kid='${kid}']`).unbind("click").click(function(e){ 3997 var id=$(this).attr("qd_id"); 3998 var node=$(`#${id}`); 3999 var prev=$(node.prev(`input[cid='${id}']`)); 4000 var input=$(`#${id}_input`); 4001 var de=new Date($(`#${id}_year`).val()+"/"+$(`#${id}_month`).val()+"/"+$(`#${id}_date`).val()+" "+$(`#${id}_hour`).val()+":"+$(`#${id}_minutes`).val()+":"+$(`#${id}_second`).val()); 4002 var defaults=$(node).data("defaults"); 4003 prev.val(de.datetime("/")); 4004 input.val(defaults.format(de)); 4005 defaults.yes_click(node,de,input); 4006 $(`#${id}_tb`).hide(); 4007 $(`#${id}`).attr("val",de.datetime("/")); 4008 de=null; 4009 id=null; 4010 node=null; 4011 input=null; 4012 defaults=null; 4013 prev=null; 4014 }); 4015 4016 $(`.${css}_no[kid='${kid}']`).unbind("click").click(function(e){ 4017 var id=$(this).attr("qd_id"); 4018 var node=$(`#${id}`); 4019 var input=$(`#${id}_input`); 4020 var de=new Date($(`#${id}_year`).val()+"/"+$(`#${id}_month`).val()+"/"+$(`#${id}_date`).val()+" "+$(`#${id}_hours`).val()+":"+$(`#${id}_minutes`).val()+":"+$(`#${id}_second`).val()); 4021 var defaults=$(node).data("defaults"); 4022 defaults.no_click(node,de,input); 4023 $(`#${id}_tb`).hide(); 4024 id=null; 4025 de=null; 4026 node=null; 4027 input=null; 4028 defaults=null; 4029 }); 4030 4031 4032 $(`.${css}_item[kid='${kid}']`).off("click").on({ 4033 click:function(e){ 4034 var id=$($(this).parent("div")).attr("qd_id"); 4035 var val=$(this).html(); 4036 if(val==""){return;} 4037 $(`.${css}_item`).css({ 4038 backgroundColor:link_back, 4039 color:link_color, 4040 }); 4041 $(this).css({ 4042 backgroundColor:active_back, 4043 color:active_color, 4044 }); 4045 $(`#${id}_date`).val(val); 4046 html_hours(id); 4047 html_minutes(id); 4048 html_second(id); 4049 id=null; 4050 val=null; 4051 } 4052 }); 4053 4054 4055 4056 $(document).click(function (e) { $(`.${css}_tb`).hide(); }); 4057 $(`.${css}[kid='${kid}']`).unbind("click").click(function (e) { e.stopPropagation(); }); 4058 4059 4060 4061 function html_year(id) { 4062 var max_val=$(`#${id}`).attr("max_val"); 4063 var min_val=$(`#${id}`).attr("min_val"); 4064 var val=$(`#${id}`).attr("val"); 4065 4066 var max=new Date(max_val).getFullYear(); 4067 var min=new Date(min_val).getFullYear(); 4068 var val=new Date(val).getFullYear(); 4069 4070 if(isNaN(max)||isNaN(min)){console.log("max or min set error");return;} 4071 que({ 4072 em:`#${id}_year`, 4073 data:null, 4074 min:min, 4075 max:max, 4076 format:function(row,i){ 4077 return `<option value="${row}" ${row==val?"selected":""}>${row}${defaults.year_text}</option>`; 4078 } 4079 }); 4080 4081 } 4082 function html_month(id) { 4083 var max_val=$(`#${id}`).attr("max_val"); 4084 var min_val=$(`#${id}`).attr("min_val"); 4085 var val=$(`#${id}`).attr("val"); 4086 var max=new Date(max_val); 4087 var min=new Date(min_val); 4088 var val=new Date(val).getMonth()+1; 4089 if(isNaN(max)||isNaN(min)){console.log("max or min set error");return;} 4090 var bt_year=$(`#${id}_year`); 4091 var start = 1; 4092 var end = 12; 4093 var y = parseInt(bt_year.val()); 4094 if (y == min.getFullYear()) { start = min.getMonth() + 1; } 4095 if (y == max.getFullYear()) { end = max.getMonth() + 1; } 4096 4097 que({ 4098 em:`#${id}_month`, 4099 data:null, 4100 min:start, 4101 max:end, 4102 format:function(row,i){ 4103 return `<option value="${row}" ${row==val?"selected":""}>${row}${defaults.month_text}</option>`; 4104 } 4105 }); 4106 } 4107 function html_date(id) { 4108 var max_val=$(`#${id}`).attr("max_val"); 4109 var min_val=$(`#${id}`).attr("min_val"); 4110 var val=$(`#${id}`).attr("val"); 4111 var max=new Date(max_val); 4112 var min=new Date(min_val); 4113 var d=new Date(val).getDate(); 4114 4115 var bt_year=$(`#${id}_year`); 4116 var bt_month=$(`#${id}_month`); 4117 var bt_date=$(`#${id}_date`); 4118 bt_date.val(d); 4119 4120 var y = parseInt(bt_year.val()); 4121 var m = parseInt(bt_month.val()); 4122 var max_date = 30; 4123 if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) { 4124 max_date = 31; 4125 } else if (m == 4 || m == 6 || m == 11) { 4126 max_date = 30; 4127 } else if (m == 2) { 4128 if (y % 4 == 0) { 4129 max_date = 29; 4130 } else { 4131 max_date = 28; 4132 } 4133 } 4134 4135 var start = 1; 4136 var end = max_date; 4137 if ((min.getFullYear() == y) && ((min.getMonth() + 1) == m)) { 4138 start = min.getDate(); 4139 } 4140 if ((max.getFullYear() == y) && ((max.getMonth() + 1) == m)) { 4141 end = max.getDate(); 4142 } 4143 4144 4145 var qd_date = y + "/" + m + "/" + start + " 00:00:00"; 4146 var week = new Date(qd_date).getDay(); 4147 var date = start; 4148 $("[cname='"+id+"_item']").html(""); 4149 $("[cname='"+id+"_item']").css({ 4150 backgroundColor:link_back, 4151 color:link_color, 4152 }); 4153 4154 $("[cname='"+id+"_item']").each(function(i,v){ 4155 if (i >= week) { 4156 if (date >= (start) && date <= end) { 4157 $(v).attr("on", "true").html(date); 4158 if(d==date){ 4159 $(v).css({ 4160 backgroundColor:active_back, 4161 color:active_color, 4162 });
4163 } 4164 date++; 4165 4166 } 4167 } 4168 }); 4169 } 4170 4171 function html_hours(id) { 4172 var max_val=$(`#${id}`).attr("max_val"); 4173 var min_val=$(`#${id}`).attr("min_val"); 4174 var val=$(`#${id}`).attr("val"); 4175 var bt_year=$(`#${id}_year`); 4176 var bt_month=$(`#${id}_month`); 4177 var bt_date=$(`#${id}_date`); 4178 var bt_hour=$(`#${id}_hour`); 4179 4180 var max=new Date(max_val); 4181 var min=new Date(min_val); 4182 var val=new Date(val); 4183 4184 var start = 1; 4185 var end = 24; 4186 var y = parseInt(bt_year.val()); 4187 var m = parseInt(bt_month.val()); 4188 var d = parseInt(bt_date.val()); 4189 var h = val.getHours(); 4190 4191 4192 4193 if(min.getFullYear()==y&&(min.getMonth()+1)==m&&min.getDate()==d) 4194 { 4195 start = min.getHours(); 4196 } 4197 if(max.getFullYear()==y&&(max.getMonth()+1)==m&&max.getDate()==d) 4198 { 4199 end = max.getHours(); 4200 } 4201 que({ 4202 em:bt_hour, 4203 data:null, 4204 min:start, 4205 max:end, 4206 format:function(row,i){ 4207 var v = row; 4208 if (i < 10) { v = "0" + i; } 4209 return `<option value="${v}" ${i==h?"selected":""}>${v+defaults.hour_text}</option>`; 4210 } 4211 }); 4212 } 4213 function html_minutes(id) { 4214 var max_val=$(`#${id}`).attr("max_val"); 4215 var min_val=$(`#${id}`).attr("min_val"); 4216 var val=$(`#${id}`).attr("val"); 4217 var bt_year=$(`#${id}_year`); 4218 var bt_month=$(`#${id}_month`); 4219 var bt_date=$(`#${id}_date`); 4220 var bt_hour=$(`#${id}_hour`); 4221 var bt_minutes=$(`#${id}_minutes`); 4222 4223 var max=new Date(max_val); 4224 var min=new Date(min_val); 4225 var val=new Date(val); 4226 4227 var y = parseInt(bt_year.val()); 4228 var m = parseInt(bt_month.val()); 4229 var d = parseInt(bt_date.val()); 4230 var h = parseInt(bt_hour.val()); 4231 var mi = val.getMinutes(); 4232 4233 4234 var start = 0; 4235 var end = 60; 4236 if(min.getFullYear()==y&&(min.getMonth()+1)==m&&min.getDate()==d) 4237 { 4238 start = min.getMinutes(); 4239 } 4240 if(max.getFullYear()==y&&(max.getMonth()+1)==m&&max.getDate()==d) 4241 { 4242 end = max.getMinutes(); 4243 } 4244 4245 que({ 4246 em:bt_minutes, 4247 data:null, 4248 min:start, 4249 max:end, 4250 format:function(row,i){ 4251 var v = row; 4252 if (i < 10) { v = "0" + i; } 4253 return `<option value="${v}" ${i==mi?"selected":""}>${v+defaults.minute_text}</option>`; 4254 } 4255 }); 4256 } 4257 function html_second(id) { 4258 var max_val=$(`#${id}`).attr("max_val"); 4259 var min_val=$(`#${id}`).attr("min_val"); 4260 var val=$(`#${id}`).attr("val"); 4261 var bt_year=$(`#${id}_year`); 4262 var bt_month=$(`#${id}_month`); 4263 var bt_date=$(`#${id}_date`); 4264 var bt_hour=$(`#${id}_hour`); 4265 var bt_minutes=$(`#${id}_minutes`); 4266 var bt_second=$(`#${id}_second`); 4267 4268 var max=new Date(max_val); 4269 var min=new Date(min_val); 4270 var val=new Date(val); 4271 4272 var y = parseInt(bt_year.val()); 4273 var m = parseInt(bt_month.val()); 4274 var d = parseInt(bt_date.val()); 4275 var h = parseInt(bt_hour.val()); 4276 var mi = parseInt(bt_minutes.val()); 4277 var s = val.getSeconds(); 4278 4279 var start = 0; 4280 var end = 60; 4281 4282 if(min.getFullYear()==y&&(min.getMonth()+1)==m&&min.getDate()==d) 4283 { 4284 start = min.getSeconds(); 4285 } 4286 if(max.getFullYear()==y&&(max.getMonth()+1)==m&&max.getDate()==d) 4287 { 4288 end = max.getSeconds(); 4289 } 4290 4291 que({ 4292 em:bt_second, 4293 data:null, 4294 min:start, 4295 max:end, 4296 format:function(row,i){ 4297 var v = row; 4298 if (i < 10) { v = "0" + i; } 4299 return `<option value="${v}" ${i==s?"selected":""}>${v+defaults.second_text}</option>`; 4300 } 4301 }); 4302 } 4303}; 4304$.fn.date = function (options) { 4305 var defaults = { 4306 css: "date", 4307 kid:"date", 4308 one: true, 4309 readonly:true, 4310 4311 link_color: "#333", 4312 link_back: "transparent", 4313 4314 hover_color: "#333", 4315 hover_back: "#f5f5f5", 4316 4317 active_color: "#fff", 4318 active_back: "#f90", 4319 4320 left: 0, 4321 top: 0, 4322 zIndex: 1002, 4323 weeks: ["æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å "], 4324 year_text: "å¹´", 4325 month_text: "æ", 4326 4327 yes_css: "date_yes", 4328 no_css: "date_no", 4329 yes_text: " ç¡® å® ", 4330 no_text: " å æ¶ ", 4331 format:function(de){ 4332 return de.year_date(); 4333 }, 4334 click: function (node,date) { 4335 4336 }, 4337 4338 val: new Date().year_date(), 4339 min_val: "2010/01/01", 4340 max_val: "2050/01/01", 4341 yes_click: function (node, de,input) { }, 4342 no_click: function (node, de,input) { } 4343 }; 4344 $.extend(defaults, options); 4345 var div = $(this); 4346 if(div.length==0){console.log("Date ä¸åå¨");return;} 4347 div.hide(); 4348 if(typeof(div.data("defaults"))=="undefined"){div.data("defaults",defaults);} 4349 defaults=div.data("defaults"); 4350 var css=defaults.css; 4351 var link_back=defaults.link_back; 4352 var link_color=defaults.link_color; 4353 var active_back=defaults.active_back; 4354 var active_color=defaults.active_color; 4355 var kid=defaults.kid; 4356 var args=arguments; 4357 4358 if(isNaN(new Date(defaults.min_val).getFullYear())){defaults.min_val="2010/01/01";} 4359 if(isNaN(new Date(defaults.max_val).getFullYear())){defaults.max_val="2050/01/01";} 4360 4361 4362 4363 div.each(function(i,v){ 4364 var $v=$(v); 4365 var id=rand(6); 4366 if(typeof(options)=="string") 4367 { 4368 id=$v.attr("cid"); 4369 switch(options) 4370 { 4371 case "set": 4372 $(`#${id}`).attr(args[1]); 4373 break; 4374 case "get": 4375 return { 4376 val:$(`#${id}`).attr("val"), 4377 min_val:$(`#${id}`).attr("min_val"), 4378 max_val:$(`#${id}`).attr("max_val") 4379 }; 4380 break; 4381 case "set_val": 4382 if(isNaN(new Date(args[1]+" 00:00:00").getFullYear())){console.log("val set error!");return;} 4383 $v.val(args[1]); 4384 $(`#${id}_input`).val(args[1]); 4385 $(`#${id}`).attr({val:args[1]}); 4386 break; 4387 case "get_val": 4388 return $(`#${id}`).attr("val"); 4389 break; 4390 } 4391 }else 4392 { 4393 if(typeof($v.attr("cid"))=="undefined") 4394 { 4395 $v.attr("cid",id); 4396 id=$v.attr("cid"); 4397 var node_css=$v.prop("class"); 4398 var min_val=$v.attr("min_val"); 4399 var max_val=$v.attr("max_val"); 4400 var value=$v.val(); 4401 var val=value; 4402 var size=$v.attr("size"); 4403 var maxlength=$v.attr("maxlength"); 4404 var readonly=$v.attr("readonly"); 4405 4406 if(typeof(min_val)=="undefined"){min_val=defaults.min_val;} 4407 if(typeof(max_val)=="undefined"){max_val=defaults.max_val;} 4408 if(typeof(size)=="undefined"){size=defaults.size;} 4409 if(typeof(maxlength)=="undefined"){maxlength=defaults.maxlength;} 4410 if(typeof(readonly)=="undefined"){readonly=defaults.readonly;}
4411 if(value==""){val=defaults.val;} 4412 4413 $v.after(` 4414 <div class="${css} ${node_css}" id="${id}" kid="${kid}"> 4415 <div class="${css}_head"> 4416 <input type="input" class="${css}_input" id="${id}_input" size="${size}" maxlength="${maxlength}" value="${value}" ${readonly}> 4417 <div class="${css}_arrow" id="${id}_arrow" qd_id="${id}" kid="${kid}"></div> 4418 </div> 4419 <div style="position:relative;overflow:visible;height:0px"> 4420 <div class="${css}_tb" id="${id}_tb" kid="${kid}"> 4421 <div class="${css}_thead" id="${id}_thead" style="display:flex;display:-webkit-flex;justify-content:center;align-items:center;column-gap:5px;"> 4422 <select id="${id}_year" class="${css}_year tool-input" qd_id="${id}" kid="${kid}"></select> 4423 <select id="${id}_month" class="${css}_month tool-input" qd_id="${id}" kid="${kid}"></select> 4424 <input type="hidden" id="${id}_date" kid="${kid}"> 4425 </div> 4426 <div class="${css}_week" id="${id}_week" kid="${kid}"></div> 4427 <div class="${css}_tbody" id="${id}_tbody" qd_id="${id}" kid="${kid}"></div> 4428 <div style='display:flex;display:-webkit-flex;column-gap:2px;justify-content:flex-end;padding:10px;'> 4429 <div class="${css}_yes" id="${id}_yes" qd_id="${id}" kid="${kid}">${defaults.yes_text}</div> 4430 <div class="${css}_no" id="${id}_no" qd_id="${id}" kid="${kid}">${defaults.no_text}</div> 4431 </div> 4432 </div> 4433 </div> 4434 </div> 4435 `); 4436 que({ 4437 em:`#${id}_week`, 4438 data:defaults.weeks, 4439 format:function(row,i){ 4440 return `<div style="width:14.2%;text-align:center;display:inline-block;vertical:middle;text-align:center;font-size:14px;font-weight:bold;">${defaults.weeks[i]}</div>`; 4441 } 4442 }); 4443 que({ 4444 em:`#${id}_tbody`, 4445 data:null, 4446 min:1, 4447 max:42, 4448 format:function(row,i){ 4449 return `<div class='${css}_item' cname="${id}_item" kid="${kid}"></div>`; 4450 } 4451 }); 4452 $(`#${id}`).attr({ 4453 max_val:max_val, 4454 min_val:min_val, 4455 val:val 4456 }).data("defaults",defaults); 4457 } 4458 } 4459 4460 }); 4461 4462 $(`.${css}_arrow[kid='${kid}']`).unbind("click").click(function(e){ 4463 var id=$(this).attr("qd_id"); 4464 var tb=$(`#${id}_tb`); 4465 var node=$(`#${id}`); 4466 var defaults=$(node).data("defaults"); 4467 defaults.click(node); 4468 if(tb.css("display")=="none") 4469 { 4470 html_year(id); 4471 html_month(id); 4472 html_date(id); 4473 $(`.${css}_tb`).hide(); 4474 tb.show(); 4475 }else 4476 { 4477 tb.hide(); 4478 } 4479 defaults=null; 4480 }); 4481 $(`.${css}_year[kid='${kid}']`).unbind("change").change(function(e){ 4482 var id=$(this).attr("qd_id"); 4483 html_month(id); 4484 html_date(id); 4485 id=null; 4486 }); 4487 $(`.${css}_month[kid='${kid}']`).unbind("change").change(function(e){ 4488 var id=$(this).attr("qd_id"); 4489 html_date(id); 4490 id=null; 4491 }); 4492 4493 console.log($(`.${css}_yes[kid='${kid}']`).length); 4494 $(`.${css}_yes[kid='${kid}']`).unbind("click").click(function(e){ 4495 4496 var id=$(this).attr("qd_id"); 4497 var node=$(`#${id}`); 4498 var prev=$(node.prev(`input[cid='${id}']`)); 4499 var input=$(`#${id}_input`); 4500 var de=new Date($(`#${id}_year`).val()+"/"+$(`#${id}_month`).val()+"/"+$(`#${id}_date`).val()+" 00:00:00"); 4501 var defaults=$(node).data("defaults"); 4502 prev.val(de.year_date()); 4503 input.val(defaults.format(de)); 4504 //defaults.yes_click(node,de,input,prev); 4505 $(`#${id}_tb`).hide(); 4506 $(`#${id}`).attr("val",de.year_date()); 4507 de=null; 4508 id=null; 4509 node=null; 4510 input=null; 4511 defaults=null; 4512 prev=null; 4513 }); 4514 4515 $(`.${css}_no[kid='${kid}']`).unbind("click").click(function(e){ 4516 var id=$(this).attr("qd_id"); 4517 var node=$(`#${id}`); 4518 var input=$(`#${id}_input`); 4519 var de=new Date($(`#${id}_year`).val()+"/"+$(`#${id}_month`).val()+"/"+$(`#${id}_date`).val()+" 00:00:00"); 4520 var defaults=$(node).data("defaults"); 4521 defaults.no_click(node,de,input); 4522 $(`#${id}_tb`).hide(); 4523 id=null; 4524 de=null; 4525 node=null; 4526 input=null; 4527 defaults=null; 4528 }); 4529 4530 4531 $(`.${css}_item[kid='${kid}']`).off("click").on({ 4532 click:function(e){ 4533 var id=$($(this).parent("div")).attr("qd_id"); 4534 var val=$(this).html(); 4535 if(val==""){return;} 4536 $(`.${css}_item`).css({ 4537 backgroundColor:link_back, 4538 color:link_color, 4539 }); 4540 $(this).css({ 4541 backgroundColor:active_back, 4542 color:active_color, 4543 }); 4544 $(`#${id}_date`).val(val); 4545 id=null; 4546 val=null; 4547 } 4548 }); 4549 4550 4551 4552 $(document).click(function (e) { $(`.${css}_tb[kid='${kid}']`).hide(); }); 4553 $(`.${css}[kid='${kid}']`).unbind("click").click(function (e) { e.stopPropagation(); }); 4554 4555 4556 4557 function html_year(id) { 4558 var max_val=$(`#${id}`).attr("max_val"); 4559 var min_val=$(`#${id}`).attr("min_val"); 4560 var val=$(`#${id}`).attr("val"); 4561 4562 var max=new Date(max_val+" 00:00:00").getFullYear(); 4563 var min=new Date(min_val+" 00:00:00").getFullYear(); 4564 var val=new Date(val+" 00:00:00").getFullYear(); 4565 if(isNaN(max)||isNaN(min)){console.log("max or min set error");return;} 4566 que({ 4567 em:`#${id}_year`, 4568 data:null, 4569 min:min, 4570 max:max, 4571 format:function(row,i){ 4572 return `<option value="${row}" ${row==val?"selected":""}>${row}${defaults.year_text}</option>`; 4573 } 4574 }); 4575 4576 } 4577 function html_month(id) { 4578 var max_val=$(`#${id}`).attr("max_val"); 4579 var min_val=$(`#${id}`).attr("min_val"); 4580 var val=$(`#${id}`).attr("val"); 4581 var max=new Date(max_val+" 00:00:00"); 4582 var min=new Date(min_val+" 00:00:00"); 4583 var val=new Date(val+" 00:00:00").getMonth()+1; 4584 if(isNaN(max)||isNaN(min)){console.log("max or min set error");return;} 4585 var bt_year=$(`#${id}_year`); 4586 var start = 1; 4587 var end = 12; 4588 var y = parseInt(bt_year.val()); 4589 if (y == min.getFullYear()) { start = min.getMonth() + 1; } 4590 if (y == max.getFullYear()) { end = max.getMonth() + 1; } 4591 4592 que({ 4593 em:`#${id}_month`, 4594 data:null, 4595 min:start, 4596 max:end, 4597 format:function(row,i){ 4598 return `<option value="${row}" ${row==val?"selected":""}>${row}${defaults.month_text}</option>`; 4599 } 4600 }); 4601 } 4602 function html_date(id) { 4603 var max_val=$(`#${id}`).attr("max_val"); 4604 var min_val=$(`#${id}`).attr("min_val"); 4605 var val=$(`#${id}`).attr("val"); 4606 var max=new Date(max_val+" 00:00:00"); 4607 var min=new Date(min_val+" 00:00:00"); 4608 var d=new Date(val+" 00:00:00").getDate(); 4609 4610 var bt_year=$(`#${id}_year`); 4611 var bt_month=$(`#${id}_month`); 4612 var bt_date=$(`#${id}_date`); 4613 bt_date.val(d); 4614 4615 var y = parseInt(bt_year.val()); 4616 var m = parseInt(bt_month.val()); 4617 var max_date = 30; 4618 if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) { 4619 max_date = 31; 4620 } else if (m == 4 || m == 6 || m == 11) { 4621 max_date = 30; 4622 } else if (m == 2) { 4623 if (y % 4 == 0) { 4624 max_date = 29; 4625 } else { 4626 max_date = 28; 4627 } 4628 } 4629 4630 var start = 1; 4631 var end = max_date; 4632 if ((min.getFullYear() == y) && ((min.getMonth() + 1) == m)) { 4633 start = min.getDate(); 4634 } 4635 if ((max.getFullYear() == y) && ((max.getMonth() + 1) == m)) { 4636 end = max.getDate(); 4637 } 4638 4639 4640 var qd_date = y + "/" + m + "/" + start + " 00:00:00"; 4641 var week = new Date(qd_date).getDay(); 4642 var date = start; 4643 $("[cname='"+id+"_item']").html(""); 4644 $("[cname='"+id+"_item']").css({ 4645 backgroundColor:link_back, 4646 color:link_color, 4647 }); 4648 4649 $("[cname='"+id+"_item']").each(function(i,v){ 4650 if (i >= week) { 4651 if (date >= (start) && date <= end) { 4652 $(v).attr("on", "true").html(date); 4653 if(d==date){ 4654 $(v).css({ 4655 backgroundColor:active_back, 4656 color:active_color, 4657 });
4658 } 4659 date++; 4660 4661 } 4662 } 4663 }); 4664 } 4665}; 4666$.fn.loading = function (options) { 4667 var defaults = { 4668 zIndex: 1002, 4669 title: "<img src='data:image/gif;base64,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' width='50'>", 4670 content: `æ°æ®å è½½ä¸â¦â¦` 4671 }; 4672 $.extend(defaults, options); 4673 var div = $(this); 4674 var id = rand(6); 4675 if (div.length == 0) { $("body").append("<div id='" + id + "'></div>"); div = $("#" + id); } 4676 var key = rand(6); 4677 if (typeof ($(div).data("key")) == "undefined") { div.data("key", key); } 4678 key = div.data("key"); 4679 4680 var tb_css = div.attr("tb_css"); 4681 var thead_css = div.attr("thead_css"); 4682 var tbody_css = div.attr("tbody_css"); 4683 4684 if (typeof (tb_css) == "undefined") { tb_css = "loading_tb"; } 4685 if (typeof (tbody_css) == "undefined") { tbody_css = "loading_tbody"; } 4686 if (typeof (thead_css) == "undefined") { thead_css = "loading_thead"; } 4687 4688 div.show(); 4689 4690 var _quandi = new quandi(); 4691 _quandi.init(); 4692 switch (options) { 4693 case "close": 4694 _quandi.close(); 4695 break; 4696 case "set_title": 4697 _quandi.set_title(arguments[1]); 4698 break; 4699 case "set_content": 4700 _quandi.set_content(arguments[1]); 4701 break; 4702 } 4703 _quandi = null; 4704 function quandi() { 4705 var parent = this; 4706 var tb, thead, tbody; 4707 this.init = function () { 4708 var tb_htm = ` 4709 <div id="tb_${key}"> 4710 <div id="thead_${key}" >${defaults.title}</div> 4711 <div id="tbody_${key}">${defaults.content}</div> 4712 </div> 4713 `; 4714 4715 div.html(tb_htm); 4716 tb_htm = null; 4717 div.attr("init", "true"); 4718 4719 tb = div.children("#tb_" + key); 4720 thead = tb.children("#thead_" + key); 4721 tbody = tb.children("#tbody_" + key); 4722 4723 div.css({ 4724 width: "auto", 4725 height: "auto", 4726 display: "flex", 4727 display: "-webkit-flex", 4728 "justify-content": "center", 4729 "align-items": "center", 4730 margin: "auto", 4731 padding: "0px", 4732 position: "fixed", 4733 backgroundColor: "rgba(255,255,255,0.4)", 4734 left: 0, 4735 right: 0, 4736 top: 0, 4737 bottom: 0, 4738 zIndex: defaults.zIndex 4739 }); 4740 thead.css({ 4741 display: "block", 4742 padding: "10px", 4743 overflow: "hidden", 4744 width: "auto", 4745 height: "auto" 4746 }); 4747 tb.css({ 4748 overflow: "hidden", 4749 backgroundColor: "#fff", 4750 borderRadius: "10px", 4751 textAlign: "center", 4752 padding: "10px", 4753 display: "grid", 4754 "grid-template-rows": "auto auto", 4755 "align-items": "center", 4756 "justify-content": "center", 4757 margin: "auto", 4758 width: "auto", 4759 height: "auto", 4760 transition: "all 0.4s", 4761 "box-shadow": "0px 0px 10px 0px rgba(0,0,0,0.3)" 4762 }); 4763 4764 tbody.css({ 4765 width: "auto", 4766 height: "auto", 4767 display: "block", 4768 textAlign: "center", 4769 fontSize: "12px", 4770 lineHeight: "1.8" 4771 }); 4772 4773 4774 }; 4775 this.close = function () { div.hide(); }; 4776 this.set_title = function (val) { 4777 thead.html(val); 4778 }; 4779 this.set_content = function (val) { 4780 tbody.html(val); 4781 }; 4782 } 4783};
4784/**/ 4785$.upload = function (url, file, data, call) { 4786 var fm = new FormData(); 4787 fm.append("file", file); 4788 for (var key in data) { 4789 fm.append(key, data[key]); 4790 } 4791 $.ajax({ 4792 url: url, 4793 async: false, 4794 type: "POST", 4795 data: fm, 4796 processData: false, 4797 contentType: false, 4798 headers: { 4799 enctype: "multipart/form-data" 4800 }, 4801 complete: function (xhr, s) { 4802 if (typeof (call) == "function") { 4803 call(xhr, s); 4804 } 4805 } 4806 }); 4807} 4808//æ¾è²å¨ 4809$.color = function (options) { 4810 var defaults = { 4811 left: 0, 4812 right: 0, 4813 bottom: 0, 4814 top: 0, 4815 zIndex: 1000, 4816 val: "rgb(255,0,0)", 4817 4818 tmodal_css: "color_tmodal", 4819 tb_css: "color_tb", 4820 thead_css: "color_thead", 4821 red_green_css: "color_red_green", 4822 blue_css: "color_blue", 4823 alph_css: "color_alph", 4824 tbody_css: "color_tbody", 4825 tmain_css: "color_tmain", 4826 tfoot_css: "color_tfoot", 4827 yes_css: "color_yes", 4828 no_css: "color_no", 4829 input_css: "color_input", 4830 yes_text: " ç¡® å® ", 4831 no_text: " å æ¶", 4832 4833 yes_click: function (e, hex, rgb, r, g, b, a) { 4834 }, 4835 no_click: function (e, hex, rgb, r, g, b, a) { 4836 } 4837 }; 4838 $.extend(defaults, options); 4839 var key = rand(6); 4840 if ($("#" + key).length == 0) { $("body").append("<div id='" + key + "'></div>"); } 4841 var div = $("#" + key); 4842 div.css({ 4843 left: 0, 4844 right: 0, 4845 top: 0, 4846 bottom: 0, 4847 width: "auto", 4848 height: "auto", 4849 position: "absolute", 4850 zIndex: defaults.zIndex 4851 }); 4852 4853 var _quandi = new quandi(); 4854 _quandi.init(); 4855 _quandi.events(); 4856 _quandi = null; 4857 4858 function quandi() { 4859 var parent = this; 4860 var tmodal, tb, thead, tbody, tfoot, tmain; 4861 var bt_yes, bt_no; 4862 var bt_r, bt_g, bt_b, bt_a, bt_color, bt_hex; 4863 var red_gree, blue; 4864 var red_gree_node, blue_node; 4865 4866 this.init = function () { 4867 var tb_htm = ""; 4868 tb_htm += "<div id='" + key + "_tmodal' class='" + defaults.tmodal_css + "'>"; 4869 tb_htm += "</div>"; 4870 tb_htm += "<div id='" + key + "_tb' class='" + defaults.tb_css + "'>"; 4871 tb_htm += "<div id='" + key + "_thead' class='" + defaults.thead_css + "'>"; 4872 //红绿éé 4873 tb_htm += "<div id='" + key + "_red_green' class='" + defaults.red_green_css + "'>"; 4874 tb_htm += "<div id='" + key + "_red_green_node' >"; 4875 tb_htm += "</div>"; 4876 tb_htm += "</div>"; 4877 //èéé 4878 tb_htm += "<div id='" + key + "_blue' class='" + defaults.blue_css + "'>"; 4879 tb_htm += "<div id='" + key + "_blue_node'>"; 4880 tb_htm += "</div>"; 4881 tb_htm += "</div>"; 4882 4883 tb_htm += "</div>"; 4884 tb_htm += "<div id='" + key + "_tbody' class='" + defaults.tbody_css + "'>"; 4885 tb_htm += "<div id='" + key + "_color'></div>"; 4886 tb_htm += " HEX <input type='text' size='2' maxlength='7' id='" + key + "_hex' class='" + defaults.input_css + "' style='width:55px;'/>"; 4887 tb_htm += " R <input type='text' size='2' maxlength='4' id='" + key + "_r' class='" + defaults.input_css + "'/>"; 4888 tb_htm += " G <input type='text' size='2' maxlength='4' id='" + key + "_g' class='" + defaults.input_css + "'/>"; 4889 tb_htm += " B <input type='text' size='2' maxlength='4' id='" + key + "_b' class='" + defaults.input_css + "'/>"; 4890 tb_htm += " A "; 4891 tb_htm += "<select id='" + key + "_a'>"; 4892 var i = 10; 4893 do { 4894 tb_htm += "<option value='" + (i / 10) + "'>" + (i / 10) + "</option>"; 4895 i--; 4896 } while (i >= 0); 4897 4898 tb_htm += "</select>"; 4899 tb_htm += "</div>"; 4900 tb_htm += "<div id='" + key + "_tfoot' class='" + defaults.tfoot_css + "'>"; 4901 tb_htm += "<a href='javascript:void(0);' id='" + key + "_yes' class='" + defaults.yes_css + "'>"; 4902 tb_htm += defaults.yes_text; 4903 tb_htm += "</a>"; 4904 tb_htm += "<a href='javascript:void(0);' id='" + key + "_no' class='" + defaults.no_css + "'>"; 4905 tb_htm += defaults.no_text; 4906 tb_htm += "</a>"; 4907 tb_htm += "</div>"; 4908 tb_htm += "</div>"; 4909 div.html(tb_htm); 4910 tmodal = div.children("#" + key + "_tmodal"); 4911 tb = div.children("#" + key + "_tb"); 4912 4913 thead = tb.children("#" + key + "_thead"); 4914 red_green = thead.children("#" + key + "_red_green"); 4915 red_green_node = red_green.children("#" + key + "_red_green_node"); 4916 blue = thead.children("#" + key + "_blue"); 4917 blue_node = blue.children("#" + key + "_blue_node"); 4918 4919 tbody = tb.children("#" + key + "_tbody"); 4920 4921 bt_color = tbody.children("#" + key + "_color"); 4922 bt_hex = tbody.children("#" + key + "_hex"); 4923 bt_r = tbody.children("#" + key + "_r"); 4924 bt_g = tbody.children("#" + key + "_g"); 4925 bt_b = tbody.children("#" + key + "_b"); 4926 bt_a = tbody.find("#" + key + "_a"); 4927 tfoot = tb.children("#" + key + "_tfoot"); 4928 bt_yes = tfoot.children("#" + key + "_yes"); 4929 bt_no = tfoot.children("#" + key + "_no"); 4930 4931 red_green.css({ 4932 width: "255px", 4933 height: "255px", 4934 display: "block", 4935 margin: "auto", 4936 marginTop: "20px", 4937 float: "left", 4938 "background-image": "linear-gradient(135deg,rgb(255,0,0),rgb(0,255,0))", 4939 position: "relative", 4940 overflow: "visible" 4941 }); 4942 4943 blue.css({ 4944 width: "40px", 4945 height: "255px", 4946 display: "block", 4947 margin: "auto", 4948 float: "right", 4949 marginTop: "20px", 4950 marginLeft: "5px", 4951 "background-image": "linear-gradient(180deg,rgb(0,0,0),rgb(0,0,255))", 4952 position: "relative", 4953 overflow: "visible" 4954 }); 4955 4956 4957 red_green_node.css({ 4958 position: "absolute",
4959 left: 0, 4960 top: 0, 4961 display: "block", 4962 margin: "auto", 4963 border: "1px solid #333", 4964 cursor: "pointer", 4965 width: "10px", 4966 height: "10px", 4967 borderRadius: "50%" 4968 }); 4969 blue_node.css({ 4970 position: "absolute", 4971 left: 0, 4972 top: 50, 4973 display: "block", 4974 margin: "auto", 4975 backgroundColor: "#eee", 4976 cursor: "pointer", 4977 width: "40px", 4978 height: "4px", 4979 borderRadius: "2px" 4980 }); 4981 4982 4983 4984 bt_color.css({ 4985 width: "20px", 4986 height: "20px", 4987 overflow: "hidden", 4988 display: "inline-block", 4989 margin: "auto", 4990 "vertical-align": "middle", 4991 backgroundColor: defaults.val 4992 }); 4993 4994 tmodal.css({ 4995 width: "100%", 4996 height: "100%", 4997 display: "block", 4998 margin: "auto", 4999 overflow: "hidden", 5000 backgroundColor: "#000", 5001 opacity: "0.2" 5002 }); 5003 5004 tb.css({ 5005 width: "306px", 5006 height: "auto", 5007 display: "block", 5008 overflow: "hidden", 5009 padding: "5px", 5010 margin: "auto", 5011 position: "absolute", 5012 backgroundColor: "#fff", 5013 left: function () { 5014 if (typeof (options.left) == "number") { 5015 return defaults.left; 5016 } else { 5017 return; 5018 } 5019 }, 5020 right: function () { 5021 if (typeof (options.right) == "number") { 5022 return defaults.right; 5023 } else { 5024 return; 5025 } 5026 }, 5027 top: function () { 5028 if (typeof (options.top) == "number") { 5029 return defaults.top; 5030 } else { 5031 return; 5032 } 5033 }, 5034 bottom: function () { 5035 if (typeof (options.bottom) == "number") { 5036 return defaults.bottom; 5037 } else { 5038 return; 5039 } 5040 } 5041 }); 5042 5043 var r = 0; 5044 var g = 0; 5045 var b = 0; 5046 var str = defaults.val; 5047 var hex = defaults.val; 5048 if (defaults.val.indexOf("#") != -1) { 5049 str = defaults.val.replace(/#/gi, "").trim(); 5050 if (str.length != 6) { return; } 5051 r = parseInt("0x" + str.substring(0, 2)); 5052 g = parseInt("0x" + str.substring(2, 4)); 5053 b = parseInt("0x" + str.substring(4, 6)); 5054 } else if (defaults.val.indexOf("rgb") != -1) { 5055 str = defaults.val.toLowerCase().replace(/rgba\(|\)/gi, "").replace(/rgb\(|\)/gi, "").trim(); 5056 var rows = str.split(","); 5057 if (rows.length < 3) { return; } 5058 5059 r = parseInt(rows[0], 10); 5060 g = parseInt(rows[1], 10); 5061 b = parseInt(rows[2], 10); 5062 hex = "#"; 5063 5064 if (r < 10) { hex += "0" + r.toString(16); } else { hex += r.toString(16); } 5065 if (g < 10) { hex += "0" + g.toString(16); } else { hex += g.toString(16); } 5066 if (b < 10) { hex += "0" + b.toString(16); } else { hex += b.toString(16); } 5067 if (rows.length == 4) { 5068 bt_a.children("option[value='" + rows[3] + "']").attr("selected", "selected"); 5069 } 5070 } 5071 bt_hex.val(hex.toUpperCase()); 5072 bt_r.val(r); 5073 bt_g.val(g); 5074 bt_b.val(b); 5075 red_green_node.css({ 5076 left: r, 5077 top: g 5078 }); 5079 blue_node.css({ 5080 top: b 5081 }); 5082 }; 5083 this.events = function () { 5084 var max_left = div.width() - tb.outerWidth(); 5085 var max_top = div.height() - tb.outerHeight(); 5086 if (tb.position().left > max_left) { tb.css({ left: max_left }) } 5087 if (tb.position().top > max_top) { tb.css({ top: max_top }) } 5088 5089 red_green_node.css({ 5090 left: function () { }, 5091 top: function () { } 5092 }) 5093 red_green.unbind("mousedown").mousedown(function (e) { 5094 var left = parseInt(e.pageX - $(this).offset().left); 5095 var top = parseInt(e.pageY - $(this).offset().top); 5096 if (left < 0) { left = 0; } 5097 if (top < 0) { top = 0; } 5098 bt_r.val(left); 5099 bt_g.val(top); 5100 red_green_node.css({ left: left, top: top }) 5101 html(); 5102 $(this).mousemove(function (e) { 5103 var left = parseInt(e.pageX - $(this).offset().left); 5104 var top = parseInt(e.pageY - $(this).offset().top); 5105 if (left < 0) { left = 0; } 5106 if (top < 0) { top = 0; } 5107 bt_r.val(left); 5108 bt_g.val(top); 5109 red_green_node.css({ left: left, top: top }) 5110 html(); 5111 }); 5112 }).unbind("mouseup").mouseup(function (e) { 5113 $(this).unbind("mousemove"); 5114 }).unbind("mouseleave").mouseleave(function (e) { 5115 $(this).unbind("mousemove"); 5116 }); 5117 5118 red_green.bind({ 5119 touchstart: function () { 5120 $(this).bind("touchend"); 5121 }, 5122 touchend: function () { 5123 (this).unbind("touchend"); 5124 }, 5125 touchmove: function () { 5126 var end_touch = event.targetTouches[0]; 5127 var left = parseInt(end_touch.pageX - $(this).offset().left); 5128 var top = parseInt(end_touch.pageY - $(this).offset().top); 5129 if (left < 0) { left = 0; } 5130 if (top < 0) { top = 0; } 5131 bt_r.val(left); 5132 bt_g.val(top); 5133 red_green_node.css({ left: left, top: top }) 5134 html(); 5135 } 5136 }); 5137 blue.bind({ 5138 touchstart: function () { 5139 $(this).bind("touchend"); 5140 }, 5141 touchend: function () { 5142 (this).unbind("touchend"); 5143 }, 5144 touchmove: function () { 5145 var end_touch = event.targetTouches[0]; 5146 var top = parseInt(end_touch.pageY - $(this).offset().top); 5147 if (top < 0) { top = 0; } 5148 bt_b.val(top); 5149 blue_node.css({ top: top }) 5150 html(); 5151 } 5152 }) 5153 5154 blue.unbind("mousedown").mousedown(function (e) { 5155 var top = parseInt(e.pageY - $(this).offset().top); 5156 if (top < 0) { top = 0; } 5157 bt_b.val(top); 5158 blue_node.css({ top: top }) 5159 html(); 5160 $(this).mousemove(function (e) { 5161 var top = parseInt(e.pageY - $(this).offset().top); 5162 if (top < 0) { top = 0; } 5163 bt_b.val(top); 5164 blue_node.css({ top: top }) 5165 html(); 5166 }); 5167 }).unbind("mouseup").mouseup(function (e) { 5168 $(this).unbind("mousemove"); 5169 }
5169).unbind("mouseleave").mouseleave(function (e) { 5170 $(this).unbind("mousemove"); 5171 }); 5172 5173 bt_hex.unbind("change").change(function (e) { 5174 var hex = $(this).val().toUpperCase(); 5175 5176 if (hex.indexOf("#") == -1) { return; } 5177 var str = hex.replace(/#/gi, "").trim(); 5178 if (str.length != 6) { return; } 5179 var r = parseInt("0x" + str.substring(0, 2)); 5180 var g = parseInt("0x" + str.substring(2, 4)); 5181 var b = parseInt("0x" + str.substring(4, 6)); 5182 5183 bt_r.val(r); 5184 bt_g.val(g); 5185 bt_b.val(b); 5186 html(); 5187 }); 5188 bt_r.unbind("change").change(function (e) { 5189 var val = $.trim($(this).val()); 5190 if (val == "") { return; } 5191 val = parseInt(val); 5192 if (val < 0 || val > 255) { return; } 5193 html(); 5194 }); 5195 bt_g.unbind("change").change(function (e) { 5196 var val = $.trim($(this).val()); 5197 if (val == "") { return; } 5198 val = parseInt(val); 5199 if (val < 0 || val > 255) { return; } 5200 html(); 5201 }); 5202 bt_b.unbind("change").change(function (e) { 5203 var val = $.trim($(this).val()); 5204 if (val == "") { return; } 5205 val = parseInt(val); 5206 if (val < 0 || val > 255) { return; } 5207 html(); 5208 }); 5209 bt_a.unbind("change").change(function (e) { 5210 html(); 5211 }); 5212 bt_yes.click(function (e) { 5213 var hex = bt_hex.val(); 5214 var r = parseInt(bt_r.val()); 5215 var g = parseInt(bt_g.val()); 5216 var b = parseInt(bt_b.val()); 5217 var a = bt_a.val(); 5218 var rgb = "rgb(" + r + "," + g + "," + b + ")"; 5219 defaults.yes_click(e, hex, rgb, r, g, b, a); 5220 div.remove(); 5221 }); 5222 bt_no.click(function (e) { 5223 var hex = bt_hex.val(); 5224 var r = parseInt(bt_r.val()); 5225 var g = parseInt(bt_g.val()); 5226 var b = parseInt(bt_b.val()); 5227 var a = bt_a.val(); 5228 var rgb = "rgb(" + r + "," + g + "," + b + ")"; 5229 defaults.no_click(e, hex, rgb, r, g, b, a); 5230 div.remove(); 5231 }); 5232 5233 tmodal.click(function (e) { 5234 div.remove(); 5235 }); 5236 } 5237 function html() { 5238 var r = parseInt(bt_r.val()); 5239 var g = parseInt(bt_g.val()); 5240 var b = parseInt(bt_b.val()); 5241 var a = bt_a.val(); 5242 var hex = "#"; 5243 if (r < 10) { hex += "0" + r.toString(16); } else { hex += r.toString(16); } 5244 if (g < 10) { hex += "0" + g.toString(16); } else { hex += g.toString(16); } 5245 if (b < 10) { hex += "0" + b.toString(16); } else { hex += b.toString(16); } 5246 bt_color.css({ 5247 backgroundColor: "rgba(" + r + "," + g + "," + b + "," + a + ")" 5248 }); 5249 bt_hex.val(hex.toUpperCase()); 5250 } 5251 } 5252}; 5253$.fn.list = function (options) { 5254 var defaults = { 5255 key_id: "qd_cid", 5256 rows: [], 5257 color: "#f90", 5258 format: function (row, i) { return row.qd_content; }, 5259 call:function(node,rs){ 5260 5261 }, 5262 click: function (e, row, i, node) { 5263 5264 }, 5265 dblclick: function (e, row, i, node) { 5266 }, 5267 mouseover: function (e, row, i, node) { 5268 }, 5269 mouseout: function (e, row, i, node) { 5270 }, 5271 contextmenu: function (e, row, i, node) { 5272 } 5273 }; 5274 $.extend(defaults, options); 5275 var div = $(this); 5276 if(div.length==0){console.log("divä¸åå¨");return;} 5277 if (typeof div.data("rows") == "undefined") { div.data("rows", {}); } 5278 var key = rand(6); 5279 if (typeof (div.data("key")) == "undefined") { div.data("key", key); } 5280 if (typeof (div.data("defaults")) == "undefined") { div.data("defaults", defaults); } 5281 key = div.data("key"); 5282 defaults = div.data("defaults"); 5283 var key_id = defaults.key_id; 5284 var _quandi = new quandi(); 5285 _quandi.init(); 5286 switch (options) { 5287 case "append": 5288 _quandi.append(arguments[1]); 5289 break; 5290 case "prepend": 5291 _quandi.prepend(arguments[1]); 5292 break; 5293 case "update": 5294 _quandi.update(arguments[1], arguments[2]); 5295 break; 5296 case "del": 5297 _quandi.del(arguments[1]); 5298 break; 5299 case "css": 5300 _quandi.css(arguments[1], arguments[2]); 5301 break; 5302 case "html": 5303 _quandi.html(arguments[1]); 5304 break; 5305 case "clear": 5306 _quandi.clear(arguments[1]); 5307 break; 5308 case "check": 5309 _quandi.check(arguments[1]); 5310 break; 5311 case "un_check": 5312 _quandi.un_check(arguments[1]); 5313 break; 5314 case "view": 5315 _quandi.view(); 5316 break; 5317 case "un_view": 5318 _quandi.un_view(); 5319 break; 5320 case "select": 5321 _quandi.select(arguments[1]); 5322 break; 5323 case "un_select": 5324 _quandi.un_select(arguments[1]); 5325 break; 5326 case "del": 5327 _quandi.del(arguments[1]); 5328 break; 5329 case "each": 5330 _quandi.each(arguments[1]); 5331 break; 5332 case "rows": 5333 return _quandi.rows(arguments[1]); 5334 break; 5335 case "row": 5336 return _quandi.row(arguments[1]); 5337 break; 5338 case "up": 5339 _quandi.up(arguments[1]); 5340 break; 5341 case "down": 5342 _quandi.down(arguments[1]); 5343 break; 5344 } 5345 5346 _quandi.events(); 5347 if(typeof(options)!="object"){defaults.call(div,_quandi.rows());} 5348 _quandi = null; 5349 function quandi() { 5350 var parent = this; 5351 this.init = function () { 5352 5353 }; 5354 this.append = function (row) { 5355 var i = div.children("div").length; 5356 var tb_htm = html_node(row, i); 5357 div.append(tb_htm); 5358 div.data("rows")[row[key_id]] = row; 5359 div.data("rows", div.data("rows")); 5360 tb_htm = null; 5361 }; 5362 this.prepend = function (row) { 5363 var i = div.children("div").length; 5364 var tb_htm = html_node(row, i); 5365 div.append(tb_htm); 5366 div.data("rows")[row[key_id]] = row; 5367 div.data("rows", div.data("rows")); 5368 tb_htm = null; 5369 }; 5370 this.update = function (row, id) { 5371 var node = $(div.children("#list_" + id)); 5372 if (node.length == 0) { return; } 5373 row[key_id] = id; 5374 var i = div.children("div").index(node); 5375 var tb_htm = html_node(row, i); 5376 node.replaceWith(tb_htm); 5377 div.data("rows")[row[key_id]] = row; 5378 div.data("rows", div.data("rows")); 5379 tb_htm = null; 5380 node = null; 5381 }; 5382 this.del = function (id) { 5383 div.children("#list_" + id).remove(); 5384 delete div.data("rows")[id]; 5385 div.data("rows", div.data("rows")); 5386 }; 5387 this.select = function (id) { 5388 div.children("div").removeAttr("select"); 5389 div.children("#list_" + id).attr("select", "true"); 5390 }; 5391 this.un_select = function () { 5392 div.children("div").removeAttr("select"); 5393 }; 5394 this.check = function (id) { 5395 div.children("#list_" + id).attr("check", "true"); 5396 };
5397 this.un_check = function (id) { 5398 div.children("#list_" + id).removeAttr("check"); 5399 }; 5400 this.clear = function () { 5401 div.html(""); 5402 }; 5403 this.html = function (rows) { 5404 div.data("rows", {}); 5405 div.html(""); 5406 for (var i = 0; i < rows.length; i++) { 5407 var row = rows[i]; 5408 parent.append(row, i); 5409 row = null; 5410 } 5411 }; 5412 this.css = function (id, val) { 5413 div.children("#list_" + id).css(val); 5414 }; 5415 this.each = function (call) { 5416 div.children("div").each(function (i, v) { 5417 var id = $(v).attr("key_id"); 5418 var row = div.data("rows")[id]; 5419 call(row, i, $(v)); 5420 row = null; 5421 id = null; 5422 }); 5423 }; 5424 this.rows = function (call) { 5425 var rows = []; 5426 div.children("div").each(function (i, v) { 5427 var id = $(v).attr("key_id"); 5428 var row = div.data("rows")[id]; 5429 if (typeof (call) == "function") { 5430 row = call(row, i); 5431 } 5432 if (typeof (row) != "undefined") { 5433 rows.push(row); 5434 } 5435 row = null; 5436 id = null; 5437 }); 5438 return rows; 5439 }; 5440 this.row = function (id) { 5441 var id; 5442 if (typeof (id) == "string") { 5443 if (div.children("#list_" + id).length > 0) { 5444 id = $(div.children("#list_" + id)).attr("key_id"); 5445 } 5446 } else { 5447 if (div.children("div[select='true']").length > 0) { 5448 id = $(div.children("div[select='true']")).attr("key_id"); 5449 } 5450 } 5451 5452 return div.data("rows")[id]; 5453 }; 5454 this.up = function (id) { 5455 var next = div.children("#list_" + id).prev("div"); 5456 if (next.length == 0) { return; } 5457 div.children("#list_" + id).insertBefore(next); 5458 next = null; 5459 }; 5460 this.down = function (id) { 5461 var next = div.children("#list_" + id).next("div"); 5462 if (next.length == 0) { return; } 5463 div.children("#list_" + id).insertAfter(next); 5464 next = null; 5465 }; 5466 this.view = function () { 5467 div.children("div").css({ 5468 border: "none", 5469 minHeight: "auto" 5470 }); 5471 }; 5472 this.un_view = function () { 5473 div.children("div").css({ 5474 border: "1px dashed " + defaults.color, 5475 minHeight: "50px" 5476 }); 5477 }; 5478 5479 5480 this.events = function () { 5481 5482 div.children("div").each(function (i, v) { 5483 $(v).unbind("click").click(function (e) { 5484 var id = $(v).attr("key_id"); 5485 var row = div.data("rows")[id]; 5486 defaults.click(e, row, i, $(v)); 5487 parent.select(row[key_id]); 5488 row = null; 5489 id = null; 5490 }).unbind("dblclick").dblclick(function (e) { 5491 var id = $(v).attr("key_id"); 5492 var row = div.data("rows")[id]; 5493 defaults.dblclick(e, row, i, $(v)); 5494 parent.select(row[key_id]); 5495 row = null; 5496 id = null; 5497 }).unbind("mouseover").mouseover(function (e) { 5498 var id = $(v).attr("key_id"); 5499 var row = div.data("rows")[id]; 5500 defaults.mouseover(e, row, i, $(v)); 5501 row = null; 5502 id = null; 5503 }).unbind("mouseout").mouseout(function (e) { 5504 var id = $(v).attr("key_id"); 5505 var row = div.data("rows")[id]; 5506 defaults.mouseout(e, row, i, $(v)); 5507 row = null; 5508 id = null; 5509 }).unbind("contextmenu").contextmenu(function (e) { 5510 var id = $(v).attr("key_id"); 5511 var row = div.data("rows")[id]; 5512 defaults.contextmenu(e, row, i, $(v)); 5513 row = null; 5514 id = null; 5515 }); 5516 }); 5517 }; 5518 function html_node(row, i) { 5519 var tb_htm = ""; 5520 tb_htm += "<div id='list_" + row[key_id] + "' key_id='" + row[key_id] + "'>"; 5521 tb_htm += defaults.format(row, i); 5522 tb_htm += "</div>"; 5523 return tb_htm; 5524 } 5525 } 5526 5527}; 5528$.getJS = function (url, key) { 5529 $.getScript(url, function (data, s) { 5530 window[key] = $.evalJSON(data); 5531 }); 5532}; 5533//æç¤ºæ¡ 5534$.fn.box = function (options) { 5535 var defaults = { 5536 position: "absolute", 5537 left: 0, 5538 right: null, 5539 top: 0, 5540 bottom: null, 5541 width: "auto", 5542 height: "auto", 5543 zIndex: 1000, 5544 right: "", 5545 thead: "", 5546 tbody: "", 5547 call: function (key) { } 5548 }; 5549 $.extend(defaults, options); 5550 5551 var div = $(this); 5552 var key = rand(6); 5553 if (typeof (div.data("key")) == "undefined") { div.data("key", key); } 5554 if (typeof (div.data("defaults")) == "undefined" || typeof (options) == "object") { div.data("defaults", defaults); } 5555 key = div.data("key"); 5556 defaults = div.data("defaults"); 5557 5558 5559 var _quandi = new quandi(); 5560 _quandi.init(); 5561 switch (options) { 5562 case "hide": 5563 _quandi.hide(); 5564 break; 5565 case "show": 5566 _quandi.show(); 5567 break; 5568 case "hide_right": 5569 _quandi.hide_right(); 5570 break; 5571 case "show_right": 5572 _quandi.show_right(); 5573 break; 5574 case "set_thead": 5575 _quandi.set_thead(arguments[1]); 5576 break; 5577 case "set_tbody": 5578 _quandi.set_tbody(arguments[1]); 5579 break; 5580 case "css": 5581 _quandi.css(arguments[1]); 5582 break; 5583 } 5584 _quandi.events(); 5585 _quandi = null; 5586 5587 function quandi() { 5588 var tb, angle, thead, title, right, tbody, tfoot; 5589 this.init = function () { 5590 if (typeof (options) == "string") { 5591 tb = div.children("#" + key + "_tb"); 5592 angle = div.children("#" + key + "_angle"); 5593 thead = tb.children("#" + key + "_thead"); 5594 title = thead.children("#" + key + "_title"); 5595 5596 right = thead.children("#" + key + "_right"); 5597 tbody = tb.children("#" + key + "_tbody"); 5598 return; 5599 } 5600 var tb_htm = ""; 5601 5602 tb_htm += "<div id='" + key + "_tb'>"; 5603 tb_htm += "<div id='" + key + "_thead'>"; 5604 tb_htm += "<div id='" + key + "_title'>"; 5605 tb_htm += defaults.thead; 5606 tb_htm += "</div>"; 5607 tb_htm += "<div id='" + key + "_right'>"; 5608 tb_htm += defaults.right; 5609 tb_htm += "</div>"; 5610 tb_htm += "</div>"; 5611 tb_htm += "<div id='" + key + "_tbody'>"; 5612 tb_htm += defaults.tbody; 5613 tb_htm += "</div>"; 5614 tb_htm += "</div>"; 5615 tb_htm += "<div id='" + key + "_angle'>"; 5616 tb_htm += "</div>"; 5617 div.html(tb_htm); 5618 tb = div.children("#" + key + "_tb"); 5619 angle = div.children("#" + key + "_angle"); 5620 thead = tb.children("#" + key + "_thead"); 5621 title = thead.children("#" + key + "_title"); 5622 right = thead.children("#" + key + "_right"); 5623 tbody = tb.children("#" + key + "_tbody"); 5624 5625 tb.css({ 5626 width: "auto", 5627 height: "auto", 5628 display: "block", 5629 backgroundColor: "#fff", 5630 border: "1px solid #ccc", 5631 overflow: "visible", 5632 paddingTop: "50px", 5633 boxSizing: "border-box", 5634 margin: "auto", 5635 position: "relative", 5636 marginLeft: "10px" 5637 }); 5638 angle.css({ 5639 width: "15px", 5640 height: "15px", 5641 border: "1px solid #ccc", 5642 position: "absolute",
5643 backgroundColor: "#fff", 5644 left: 2, 5645 top: 18, 5646 transform: "rotate(-45deg)", 5647 borderRight: "none", 5648 borderBottom: "none" 5649 }); 5650 thead.css({ 5651 width: "100%", 5652 height: "40px", 5653 lineHeight: "30px", 5654 padding: "5px", 5655 display: "table", 5656 margin: "auto", 5657 overflow: "hidden", 5658 fontSize: "16px", 5659 position: "absolute", 5660 left: 0, 5661 right: 0, 5662 top: 0, 5663 fontWeight: "bold", 5664 backgroundColor: "#fff", 5665 borderBottom: "1px solid #ccc", 5666 boxSizing: "border-box" 5667 }); 5668 title.css({ 5669 width: "auto", 5670 height: "auto", 5671 display: "table-cell", 5672 textAlign: "left", 5673 5674 "vertical-align": "middle" 5675 }); 5676 right.css({ 5677 width: "auto", 5678 height: "auto", 5679 display: "table-cell", 5680 textAlign: "right", 5681 "vertical-align": "middle" 5682 }); 5683 tbody.css({ 5684 width: "auto", 5685 height: "auto", 5686 padding: "5px", 5687 display: "block", 5688 margin: "auto", 5689 overflow: "hidden", 5690 fontSize: "16px", 5691 fontWeight: "bold" 5692 }); 5693 5694 if (defaults.position == "absolute") { 5695 div.css({ 5696 position: "absolute", 5697 zIndex: defaults.zIndex, 5698 overflow: "hidden", 5699 display: "block", 5700 margin: "auto", 5701 transition: "all 0.4s", 5702 width: function () { 5703 return defaults.width; 5704 }, 5705 height: function () { 5706 return defaults.height; 5707 }, 5708 maxWidth: function () { 5709 if (!isNaN(parseInt(defaults.maxWidth))) { return defaults.maxWidth } else { return "100%"; } 5710 }, 5711 maxHeight: function () { 5712 if (!isNaN(parseInt(defaults.maxHeight))) { return defaults.maxHeight } else { return "100%"; } 5713 }, 5714 left: function () { 5715 if (!isNaN(parseInt(defaults.left))) { return defaults.left } else { return null; } 5716 }, 5717 right: function () { 5718 if (!isNaN(parseInt(defaults.right))) { return defaults.right } else { return null; } 5719 }, 5720 top: function () { 5721 if (!isNaN(parseInt(defaults.top))) { return defaults.top } else { return null; } 5722 }, 5723 bottom: function () { 5724 if (!isNaN(parseInt(defaults.bottom))) { return defaults.bottom } else { return null; } 5725 } 5726 }); 5727 } else { 5728 div.css({ 5729 position: "relative", 5730 overflow: "hidden", 5731 display: "block", 5732 // margin:"auto", 5733 transition: "all 0.4s", 5734 marginTop: function () { 5735 if (!isNaN(parseInt(defaults.top))) { return defaults.top } else { return null; } 5736 }, 5737 width: function () { 5738 return defaults.width; 5739 }, 5740 height: function () { 5741 return defaults.height; 5742 } 5743 }); 5744 } 5745 }; 5746 5747 this.css = function (val) { div.css(val); }; 5748 this.set_thead = function (val) { title.html(val); }; 5749 this.set_tbody = function (val) { tbody.html(val); }; 5750 this.show = function () { div.show(); }; 5751 this.hide = function () { div.hide(); }; 5752 this.show_right = function () { right.show(); }; 5753 this.hide_right = function () { right.hide(); }; 5754 this.events = function () { defaults.call(key); }; 5755 } 5756}; 5757/*æå¨ç»ä»¶*/ 5758$.fn.slider = function (options) { 5759 var defaults = { 5760 val: "0", 5761 height: "10px", 5762 width: "100px", 5763 step: 1, 5764 dir: "heng",// 5765 max_val: "100", 5766 min_val: "0", 5767 back_color: "#f00", 5768 fore_color: "#0f0" 5769 }; 5770 $.extend(defaults, options); 5771 var div = $(this); 5772 var key = rand(6); 5773 if (typeof (div).data("key") == "undefined") { div.data("key", key); } 5774 if (typeof (div).data("defaults") == "undefined") { div.data("defaults", defaults); } 5775 key = div.data("key"); 5776 defaults = div.data("defaults"); 5777 5778 function quandi() { 5779 var parent = this; 5780 var tb, thead, tbody; 5781 this.init = function () { 5782 if (typeof (options) == "string") { 5783 tb = div.children("#" + key + "_tb"); 5784 thead = div.children("#" + key + "_thead"); 5785 tbody = div.children("#" + key + "_tbody"); 5786 } 5787 var tb_htm = ""; 5788 tb_htm += "<div id='" + key + "_tb'>"; 5789 tb_htm += "<div id='" + key + "_thead'>"; 5790 tb_htm += "</div>"; 5791 tb_htm += "<div id='" + key + "_tbody'>"; 5792 tb_htm += "</div>"; 5793 tb_htm += "</div>"; 5794 div.html(tb_htm); 5795 tb = div.children("#" + key + "_tb"); 5796 thead = div.children("#" + key + "_thead"); 5797 tbody = div.children("#" + key + "_tbody"); 5798 tb.css({ 5799 position: "relative", 5800 display: "block", 5801 margin: "auto", 5802 overflow: "visible", 5803 width: defaults.width, 5804 height: defaults.height, 5805 backgroundColor: "" 5806 }); 5807 tbody.css({ 5808 position: "absolute",
5809 display: "block", 5810 cursor: "pointer", 5811 width: function () { 5812 if (defaults.dir == "heng") { return defaults.height; } else { return defaults.width; } 5813 }, 5814 height: function () { 5815 if (defaults.dir == "shu") { return defaults.width; } else { return defaults.width; } 5816 } 5817 }); 5818 }; 5819 this.events = function () { 5820 $(tbody).mousedown(function (ea) { 5821 $(div).mousemove(function (e) { 5822 var left = e.pageX - $(div).offset().left; 5823 var top = e.pageY - $(div).offset().top; 5824 if (defaults.dir == "heng") { 5825 $(tbody).css({ left: left }) 5826 } else { 5827 $(tbody).css({ top: top }) 5828 } 5829 }).mouseup(function (e) { 5830 $(div).unbind("mousemove"); 5831 }); 5832 }) 5833 }; 5834 } 5835}; 5836$.fn.slide=function (options) { 5837 var defaults = { 5838 arrows:false,//忢æé® 5839 dots:false,//æ¾ç¤ºç´¢å¼ 5840 autoplay:true,//èªå¨ææ¾ 5841 pause:false,//é¼ æ æ¬å 5842 fade:false,//å¹»ç¯çææ¾ 5843 equal:true,//å¹³ååé 5844 drag:false,//ææ¾åæ¢ 5845 brightness:"150%", 5846 blur:"5px", 5847 prevArrows:`<div class="slide_arrow slide_arrow_prev fa fa-caret-left" style="left:0px;"></div>`, 5848 nextArrows:`<div class="slide_arrow slide_arrow_next fa fa-caret-right" style="right:0px;"></div>`, 5849 data: [], 5850 responsive:[], 5851 init: true, 5852 time:4000, 5853 pagesize:1, 5854 direction:"left",//leftæ°´å¹³ï¼up:åç´ 5855 gap:10, 5856 format_dot:function(row,i,index){ 5857 return `${i+1}`; 5858 }, 5859 format: function (row, i) { 5860 return `<a href="${row.qd_path}"><img src="${row.qd_pic}" width="100%"></a> 5861 `; 5862 }, 5863 call:function(node,rs){ 5864 5865 } 5866 }; 5867 $.extend(defaults, options); 5868 var div = $(this); 5869 if (typeof (defaults.formatter) == "function") { defaults.format = defaults.formatter; } 5870 if(Array.isArray(defaults.rows)){defaults.data=defaults.rows;} 5871 var data = defaults.data; 5872 var brightness=defaults.brightness; 5873 var blur=defaults.blur; 5874 var init=defaults.init; 5875 var key=rand(4); 5876 var index=0; 5877 var page=0; 5878 var equal=defaults.equal; 5879 var drag=defaults.drag; 5880 var fade=defaults.fade; 5881 var gap=defaults.gap; 5882 var responsive=defaults.responsive; 5883 var pagesize=defaults.pagesize; 5884 reset(); 5885 var pagecount=Math.ceil(data.length/pagesize); 5886 var max_index=(pagecount-1)*pagesize; 5887 var dir="row"; 5888 if(defaults.direction=="left"){dir=="row";}else{dir="column";} 5889 5890 5891 //if(data.length%pagesize==0){max_index=(pagecount-1)*pagesize;} 5892 div.html(`<div class="slide_list" style="position:relative;display:block;overflow:hidden;height:inherit;width:100%;"> 5893 <div class="slide_track" style="${defaults.direction=="up"?`marginTop`:`marginLeft`}:0px;transition:all 0.4s;overflow:hidden;display:flex;display:-webkit-flex;flex-wrap:nowrap;flex-direction:${dir};"></div> 5894 </div>`); 5895 var slide_list=$(div.find(".slide_list")); 5896 var slide_track=$(div.find(".slide_track")); 5897 5898 que({ 5899 em:slide_track, 5900 data:data, 5901 format:function(row,i){ 5902 if(dir=="row") 5903 { 5904 var width="auto"; 5905 if(equal) 5906 { 5907 width=`calc(${(new Number(1/pagesize).toFixed(4))*100}% - ${gap*(pagesize-1)}px)`; 5908 } 5909 return ` 5910 <div id="${key}_slide_item_${i}" class="slide_item ${index==i?'slide_active':''}" style="width:${width};flex-shrink:0;overflow:hidden;"> 5911 <div class="slide_tb">${defaults.format(row,i)}</div> 5912 </div>`; 5913 }else{ 5914 var height="auto"; 5915 if(equal) 5916 { 5917 height=`calc(${(new Number(1/pagesize).toFixed(4))*100}% - ${gap*(pagesize-1)}px)`; 5918 } 5919 return ` 5920 <div id="${key}_slide_item_${i}" class="slide_item ${index==i?'slide_active':''}" style="width:auto;height:${height};flex-shrink:0;overflow:hidden;"> 5921 <div class="slide_tb">${defaults.format(row,i)}</div> 5922 </div>`; 5923 } 5924 }, 5925 call:function(row,i){ 5926 if(dir=="row"){ 5927 slide_track.css({ 5928 columnGap:`${gap}px`, 5929 width:"auto", 5930 height:"inherit" 5931 }); 5932 }else 5933 { 5934 slide_track.css({ 5935 rowGap:`${gap}px`, 5936 width:"100%", 5937 height:"auto" 5938 }); 5939 } 5940 defaults.call(slide_track,data); 5941 $(window).load(function(){ 5942 resize(); 5943 autosize(); 5944 }).resize(function(){ 5945 resize(); 5946 autosize(); 5947 }).blur(function(){ 5948 resize(); 5949 autosize(); 5950 }).focus(function(){ 5951 resize(); 5952 autosize(); 5953 }); 5954 5955 } 5956 }); 5957 5958 5959 function reset() 5960 { 5961 var win_width=$(window).width(); 5962 for(var i=0;i<responsive.length;i++) 5963 { 5964 var re=responsive[i]; 5965 if(win_width<re.width) 5966 { 5967 gap=re.gap; 5968 pagesize=re.pagesize; 5969 equal=re.equal; 5970 drag=re.drag; 5971 fade=re.fade; 5972 blur=re.blur; 5973 brightness=re.brightness; 5974 break; 5975 } 5976 re=null; 5977 } 5978 } 5979 5980 5981 5982 5983 (function(){ 5984 if(!defaults.arrows){return;} 5985 div.prepend(defaults.prevArrows); 5986 div.append(defaults.nextArrows); 5987 var prev=$($(div).children(".slide_arrow_prev")); 5988 var next=$($(div).children(".slide_arrow_next")); 5989 prev.unbind("click").click(function(e){
5990 page--; 5991 index=page*pagesize; 5992 if(index<0){index=0;} 5993 play(); 5994 }); 5995 next.unbind("click").click(function(e){ 5996 page++; 5997 if(index>=max_index){index=max_index;}else{index=page*pagesize;} 5998 play(); 5999 }); 6000 }()); 6001 6002 (function(){ 6003 if(!defaults.dots){return;} 6004 div.append(`<div class="slide_dots"></div>`); 6005 var slide_dots=$(div.find(".slide_dots")); 6006 var tb_htm=""; 6007 for(var i=0;i<pagecount;i++) 6008 { 6009 var cindex=pagesize*i; 6010 var row=data[cindex]; 6011 tb_htm+=`<div class="slide_dot ${index==cindex?'slide_dot_active':''}">${defaults.format_dot(row,i)}</div>`; 6012 row=null; 6013 cindex=null; 6014 } 6015 $(slide_dots).html(tb_htm); 6016 tb_html=null; 6017 $(slide_dots).children(".slide_dot").unbind("click").click(function(e){ 6018 page=$($(slide_dots).find(".slide_dot")).index($(this)); 6019 index=pagesize*page; 6020 6021 play(); 6022 }); 6023 }()); 6024 6025 (function(){ 6026 if(!defaults.autoplay){return;} 6027 var mar=setInterval(function(){ 6028 index=pagesize*(page+1); 6029 if(index>max_index){index=0;} 6030 if(max_index<=1){clearInterval(mar);return;} 6031 play(); 6032 6033 },defaults.time); 6034 slide_track.mouseover(function(e){ 6035 clearInterval(mar); 6036 }).mouseout(function(e){ 6037 mar=setInterval(function(){ 6038 index=pagesize*(page+1); 6039 if(index>max_index){index=0;} 6040 if(max_index<=1){clearInterval(mar);return;} 6041 play(); 6042 },defaults.time); 6043 }); 6044 })(); 6045 6046 (function(){ 6047 if(!drag){return;} 6048 div.bind({ 6049 mousedown: function (e) { 6050 var start_x = e.pageX; 6051 var flag = false; 6052 $(this).bind("mousemove",function(e){ 6053 var len = e.pageX - start_x; 6054 if (len >= 100) { 6055 page--; 6056 index=page*pagesize; 6057 if(index<0){index=0;} 6058 play(); 6059 flag = true; 6060 } 6061 if (len <= -100) { 6062 page++; 6063 if(index>=max_index){index=max_index;}else{index=page*pagesize;} 6064 play(); 6065 flag = true; 6066 } 6067 6068 if (flag) { 6069 $(this).unbind("mousemove"); 6070 } 6071 e.stopPropagation(); 6072 }); 6073 }, 6074 6075 6076 mouseup: function (e) { 6077 $(this).unbind("mousemove"); 6078 }, 6079 mouseout: function (e) { 6080 $(this).unbind("mousemove"); 6081 }, 6082 touchstart: function (e) { 6083 var start = event.touches[0].pageX; 6084 var flag = false; 6085 $(this).bind({ 6086 touchmove: function (e) { 6087 var len = event.touches[0].pageX - start; 6088 6089 if (len >= 100) { 6090 page--; 6091 index=page*pagesize; 6092 if(index<0){index=0;} 6093 play(); 6094 flag = true; 6095 } 6096 if (len <= -100) { 6097 page++; 6098 if(index>=max_index){index=max_index;}else{index=page*pagesize;} 6099 play(); 6100 flag = true; 6101 } 6102 6103 if (flag) { 6104 $(this).unbind("touchmove"); 6105 } 6106 }, 6107 touchend: function (e) { 6108 $(this).unbind("touchmove"); 6109 } 6110 }); 6111 } 6112 }); 6113 }()); 6114 function play() 6115 { 6116 page=Math.floor(index/pagesize); 6117 var node=$($(slide_track).children(".slide_item").get(index)); 6118 if(node.length==0){return;} 6119 resize(); 6120 autosize(); 6121 6122 6123 (function(){ 6124 if(!fade){return;} 6125 slide_track.css({ 6126 opacity:0, 6127 filter:`blur(${blur}) brightness(${brightness})` 6128 }); 6129 }()); 6130 6131 (function(){ 6132 6133 (function(){ 6134 if(!defaults.dots){return;} 6135 var dots=$(div).children(".slide_dots").children(".slide_dot"); 6136 $(dots).removeClass("slide_dot_active"); 6137 $($(dots).get(page)).addClass("slide_dot_active"); 6138 }()); 6139 setTimeout(function(){ 6140 var len=0; 6141 switch(defaults.direction) 6142 { 6143 case "up": 6144 len=0; 6145 for(var i=0;i<index;i++) 6146 { 6147 len-=$(slide_track.children("div").get(i)).height()+gap; 6148 } 6149 6150 css={ 6151 marginTop:`${len}px` 6152 }; 6153 break; 6154 case "left": 6155 len=0; 6156 for(var i=0;i<index;i++) 6157 { 6158 len-=$(slide_track.children("div").get(i)).width()+gap; 6159 } 6160 css={ 6161 marginLeft:`${len}px` 6162 }; 6163 break; 6164 } 6165 6166 slide_track.css(css); 6167 css=null; 6168 len=null; 6169 6170 if(init) 6171 { 6172 $(slide_track.children("div").get(index)).html(defaults.format(data[index],index)); 6173 } 6174 6175 },fade?200:0); 6176 }()); 6177 6178 6179 (function(){ 6180 if(!fade){return;} 6181 setTimeout(function(){ 6182 slide_track.css({ 6183 opacity:1, 6184 filter:"blur(0px) brightness(100%)" 6185 }); 6186 },400); 6187 }()); 6188 } 6189 6190 function resize(){ 6191 var css={}; 6192 if(equal) 6193 { 6194 if(dir=="row") 6195 { 6196 var width=slide_list.width()/pagesize-(gap*(pagesize-1)/pagesize); 6197 css={width:Math.floor(width)+"px"}; 6198 width=null; 6199 }else 6200 { 6201 var height=slide_list.height()/pagesize-(gap*(pagesize-1)/pagesize); 6202 css={height:Math.floor(height)+"px"}; 6203 height=null; 6204 } 6205 }else 6206 { 6207 if(dir=="row") 6208 { 6209 css={width:"auto"}; 6210 }else 6211 { 6212 css={height:"auto"}; 6213 } 6214 } 6215 6216 slide_track.children("div").css(css); 6217 css=null; 6218 } 6219 6220 function autosize() 6221 { 6222 var css={}; 6223 var len=0; 6224 if(dir=="row") 6225 { 6226 slide_track.children("div").each(function(i,v){ 6227 if(i>=index&&i<(index+pagesize)) 6228 { 6229 len+=$(v).width()+gap; 6230 } 6231 }); 6232 css={width:"100%"}; 6233 }else 6234 { 6235 slide_track.children("div").each(function(i,v){ 6236 if(i>=index&&i<(index+pagesize)) 6237 { 6238 len+=$(v).height()+gap; 6239 } 6240 }); 6241 css={height:(len-gap)+"px"}; 6242 } 6243 slide_list.css(css); 6244 css=null; 6245 len=null; 6246 } 6247}; 6248$.fn.swf = function (options) { 6249 var defaults = {
6250 arrows: false, 6251 dots: true, 6252 autoplay: true, 6253 auto_size: true, 6254 effect: "fade", 6255 6256 link_color: "#eee", 6257 hover_color: "#c00", 6258 6259 formatter: function (row, i) { 6260 return ` 6261 <a href="${row.qd_path}" target="${row.qd_target}" style="width:auto;height:100%;display:block;margin:auto;overflow:hidden;outline:none;background-image:url('${row.qd_pic}');background-repeat:no-repeat;background-size:auto 100%;background-position:center;"> 6262 </a> 6263 `; 6264 }, 6265 prev_format: function () { 6266 return ` 6267 <div style="z-index:2;position:absolute;left:0px;top:40%;width:40px;height:50px;background-color:rgba(0,0,0,0.6);color:#fff;display:flex;display:-webkit-flex;justify-content:center;align-items:center;font-size:20px;" class="fa fa-caret-left"></div> 6268 `; 6269 }, 6270 next_format: function () { 6271 return ` 6272 <div style="z-index:2;position:absolute;right:0px;top:40%;width:40px;height:50px;background-color:rgba(0,0,0,0.6);color:#fff;display:flex;display:-webkit-flex;justify-content:center;align-items:center;font-size:20px;" class="fa fa-caret-right"></div> 6273 `; 6274 }, 6275 dots_format: function (nodes, key) { 6276 var tb_htm = ""; 6277 tb_htm += `<div style="z-index:200;position:absolute;left:0px;right:0px;bottom:10px;padding:10px;display;flex;display:-webkit-flex;justify-content:center;align-items:center;">`; 6278 tb_htm += `<div style="display:flex;display:-webkit-flex;">`; 6279 for (var i = 0; i < nodes.length; i++) { 6280 tb_htm += `<div name="${key}_dot" style="margin:4px;width:30px;height:10px;border-radius:2px;background-color:#eee;display:flex;display:webkit-flex;justify-content:center;align-items:center;"></div>`; 6281 } 6282 tb_htm += `</div></div>`; 6283 return tb_htm; 6284 }, 6285 time: 4000 6286 }; 6287 $.extend(defaults, options); 6288 var effect = defaults.effect; 6289 var lay = $(this); 6290 if (lay.length == 0) { return; } 6291 var key = rand(6); 6292 $(lay).wrapInner(`<div id="${key}">`); 6293 var div = lay.children("#" + key); 6294 var mar = null; 6295 var max_index = $(div.children()).length; 6296 if (max_index <= 0) { return; } 6297 6298 lay.prepend(`<div id="${key}_prev">${defaults.prev_format()}</div>`); 6299 lay.append(`<div id="${key}_next">${defaults.next_format()}</div>`); 6300 lay.append(`<div id="${key}_dots"></div>`); 6301 $("#" + key + "_dots").html(defaults.dots_format(div.children(), key)); 6302 if (defaults.arrows) { 6303 $("#" + key + "_prev,#" + key + "_next").show(); 6304 } else { 6305 $("#" + key + "_prev,#" + key + "_next").hide(); 6306 } 6307 if (defaults.dots) { 6308 $("#" + key + "_dots").show(); 6309 } else { 6310 $("#" + key + "_dots").hide(); 6311 } 6312 6313 switch (effect) { 6314 case "slide": 6315 div.css({ 6316 width: "auto", 6317 display: "block", 6318 height: "100%", 6319 transition: "all 0.6s", 6320 "white-space": "nowrap" 6321 });
6322 if (defaults.auto_size) { 6323 div.css("height", "auto"); 6324 } 6325 break; 6326 case "fade": 6327 $(div.children()).each(function (i, v) { 6328 $(v).css({ 6329 display: "block", 6330 width: "auto", 6331 height: "auto", 6332 margin: "auto", 6333 transition: "all 1s", 6334 position: "absolute", 6335 visibility: "hidden", 6336 left: 0, 6337 right: 0, 6338 top: 0, 6339 bottom: 0 6340 }); 6341 }); 6342 break; 6343 } 6344 $("#" + key + "_prev").click(function (e) { 6345 var index = div.data("index"); 6346 index--; 6347 if (index <= 0) { index = 0; } 6348 clearTimeout(mar); 6349 auto(index); 6350 }); 6351 $("#" + key + "_next").click(function (e) { 6352 var index = div.data("index"); 6353 index++; 6354 if (index >= max_index - 1) { index = max_index - 1; } 6355 clearTimeout(mar); 6356 auto(index); 6357 }); 6358 6359 $(`[name="${key}_dot"]`).unbind("click").click(function (e) { 6360 var index = $(`[name="${key}_dot"]`).index($(this)); 6361 clearTimeout(mar); 6362 auto(index); 6363 }); 6364 div.bind({ 6365 mousedown: function (e) { 6366 var start = e.pageX; 6367 var flag = false; 6368 $(this).mousemove(function (ea) { 6369 var end = ea.pageX; 6370 var len = end - start; 6371 var index = div.data("index"); 6372 clearTimeout(mar); 6373 if (len > 100) { 6374 index--; 6375 if (index <= 0) { index = 0; } 6376 auto(index); 6377 flag = true; 6378 } else if (len < -100) { 6379 index++; 6380 if (index >= max_index) { index = max_index; } 6381 auto(index); 6382 flag = true; 6383 } 6384 if (flag) { 6385 $(this).unbind("mousemove"); 6386 } 6387 }); 6388 }, 6389 mouseup: function (e) { 6390 $(this).unbind("mousemove"); 6391 }, 6392 mouseout: function (e) { 6393 $(this).unbind("mousemove"); 6394 }, 6395 touchstart: function (e) { 6396 var touch = event.touches[0]; 6397 var start = touch.pageX; 6398 var flag = false; 6399 $(this).bind({ 6400 touchmove: function (ea) { 6401 var touch = event.touches[0]; 6402 var end = touch.pageX; 6403 var len = end - start; 6404 var index = div.data("index"); 6405 clearTimeout(mar); 6406 if (len > 100) { 6407 index--; 6408 if (index <= 0) { index = 0; } 6409 flag = true; 6410 auto(index); 6411 } else if (len < -100) { 6412 index++; 6413 if (index >= max_index) { index = max_index; } 6414 flag = true; 6415 auto(index); 6416 } 6417 if (flag) { 6418 $(this).unbind("touchmove"); 6419 } 6420 6421 }, 6422 touchend: function (e) { 6423 $(this).unbind("touchmove"); 6424 } 6425 }); 6426 } 6427 }); 6428 6429 if (defaults.autoplay) { 6430 auto(0); 6431 } 6432 6433 function auto(index) { 6434 if (index >= max_index) { 6435 index = 0; 6436 } 6437 //if(mar!=null){clearTimeout(mar);} 6438 play(index, true); 6439 var node = $(div.children().get(index)); 6440 mar = setTimeout(function () { 6441 switch (effect) { 6442 case "slide": 6443 auto(div.data("index") + 1); 6444 break; 6445 case "fade": 6446 6447 setTimeout(function () { 6448 auto(div.data("index") + 1); 6449 }, 20); 6450 break; 6451 } 6452 6453 }, defaults.time); 6454 } 6455 6456 function texiao(type) { 6457 var index = div.data(index); 6458 var node = $(div.children().get(index)); 6459 switch (type) { 6460 case 0: 6461 node; 6462 break; 6463 case 1: 6464 break; 6465 } 6466 } 6467 6468 function play(index) { 6469 if (index >= max_index) { 6470 index = max_index; 6471 } 6472 6473 var node = $(div.children().get(index)); 6474 var dot = $($("[name='" + key + "_dot']").get(index)); 6475 if (node.length == 0) { return; } 6476 div.data("index", index); 6477 $("[name='" + key + "_dot']").css("background-color", defaults.link_color); 6478 $(dot).css("background-color", defaults.hover_color); 6479 switch (effect) { 6480 case "slide": 6481 //console.log(index); 6482 div.children().css({ 6483 display: "inline-block", 6484 width: lay.width() + "px", 6485 height: "100%", 6486 overflow: "hidden", 6487 margin: "auto" 6488 });
6489 if (defaults.auto_size) { 6490 div.css("height", "auto"); 6491 div.children().css("height", "auto"); 6492 } 6493 var left = index * lay.outerWidth(); 6494 div.css({ marginLeft: (0 - left) + "px" }) 6495 break; 6496 case "fade": 6497 if (!defaults.auto_size) { 6498 div.css({ 6499 transition: "all 0.4s", 6500 width: "100%", 6501 height: "100%" 6502 }); 6503 } else { 6504 var height = $(node.children()).outerHeight();; 6505 div.css({ 6506 transition: "all 0.4s", 6507 height: height + "px" 6508 }); 6509 height = null; 6510 } 6511 $(div.children()).css({ 6512 visibility: "hidden", 6513 filter: "brightness(400%)blur(20px)" 6514 }); 6515 node.css({ 6516 filter: "brightness(100%)blur(0px)", 6517 visibility: "visible" 6518 }); 6519 break; 6520 } 6521 } 6522}; 6523 6524//å¹»ç¯ç 6525$.fn.ppt = function (options) { 6526 var defaults = { 6527 rows: [], 6528 time: 4000, 6529 pic_height: "100%", 6530 link_color: "#fff", 6531 hover_color: "#e00", 6532 formatter: function (row, i) { 6533 return "<a href='" + row.qd_path + "' target='" + row.qd_target + "' style=\"width:100%;height:100%;display:block;margin:auto;outline:none;background-image:url(\'" + row.qd_pic + "\');background-repeat:no-repeat;background-size:auto 100%;background-position:center;\"></a>"; 6534 } 6535 }; 6536 $.extend(defaults, options); 6537 var div = $(this); 6538 var key = rand(6); 6539 if (typeof (div.data("key")) == "undefined") { div.data("key", key); } 6540 if (typeof (div.data("defaults")) == "undefined") { div.data("defaults", defaults); } 6541 key = div.data("key"); 6542 defaults = div.data("defaults"); 6543 6544 var _quandi = new quandi(); 6545 _quandi.init(); 6546 _quandi.events(); 6547 _quandi = null; 6548 function quandi() { 6549 var parent = this; 6550 var tb, tbody, thead, item, node; 6551 this.init = function () { 6552 if (typeof (options) != "object") { return; } 6553 var tb_htm = ""; 6554 tb_htm += "<div id='" + key + "_tb'>"; 6555 tb_htm += "<div id='" + key + "_tbody'>"; 6556 for (var i = 0; i < defaults.rows.length; i++) { 6557 tb_htm += "<div name='" + key + "_item'>"; 6558 tb_htm += defaults.formatter(defaults.rows[i], i); 6559 tb_htm += "</div>"; 6560 } 6561 tb_htm += "</div>"; 6562 tb_htm += "<div id='" + key + "_thead'>"; 6563 for (var i = 0; i < defaults.rows.length; i++) { 6564 tb_htm += "<div name='" + key + "_node'>"; 6565 tb_htm += "</div>"; 6566 } 6567 tb_htm += "</div>"; 6568 tb_htm += "</div>"; 6569 div.html(tb_htm); 6570 tb = div.children("#" + key + "_tb"); 6571 tbody = tb.children("#" + key + "_tbody"); 6572 thead = tb.children("#" + key + "_thead"); 6573 item = tbody.children("[name='" + key + "_item']"); 6574 node = thead.children("[name='" + key + "_node']"); 6575 tb.css({ 6576 width: "100%", 6577 height: "100%", 6578 display: "block", 6579 margin: "auto", 6580 overflow: "hidden", 6581 zIndex: defaults.zIndex, 6582 position: "relative" 6583 }); 6584 tbody.css({ 6585 width: "100%", 6586 height: "100%", 6587 display: "block", 6588 margin: "auto", 6589 overflow: "hidden", 6590 transition: "all 0.8s", 6591 //zIndex:defaults.zIndex, 6592 position: "absolute", 6593 left: 0, 6594 top: 0 6595 }); 6596 thead.css({ 6597 width: "auto", 6598 height: "20px", 6599 display: "inline-block", 6600 margin: "auto", 6601 overflow: "hidden", 6602 position: "absolute", 6603 "text-align": "center", 6604 left: "0px", 6605 right: "0px", 6606 bottom: "5px", 6607 top: "auto" 6608 }); 6609 item.css({ 6610 width: "100%", 6611 height: "100%", 6612 display: "block", 6613 margin: "auto", 6614 overflow: "hidden", 6615 position: "absolute", 6616 transition: "all 1s", 6617 left: 0, 6618 right: 0, 6619 top: 0, 6620 bottom: 0, 6621 opacity: 0 6622 }); 6623 node.css({ 6624 width: "10px", 6625 6626 height: "10px", 6627 "background-color": defaults.link_color, 6628 "border-radius": "50%", 6629 "vertical-align": "top", 6630 display: "inline-block", 6631 margin: "2px", 6632 overflow: "hidden" 6633 }); 6634 }; 6635 6636 this.events = function () { 6637 var cindex = 0; 6638 var mar = null; 6639 marquee(0); 6640 function marquee(index) { 6641 cindex = index; 6642 node.css({ backgroundColor: defaults.link_color }); 6643 $(node.get(index)).css({ backgroundColor: defaults.hover_color }); 6644 $(item.get(index)).css("opacity", "1"); 6645 mar = setTimeout(function () { 6646 $(item).css("opacity", "0"); 6647 if (index >= defaults.rows.length - 1) { index = 0; } else { index++; } 6648 marquee(index); 6649 }, defaults.time); 6650 6651 } 6652 node.click(function (e) { 6653 var i = $(node).index(this); 6654 cindex = i; 6655 if (mar != null) { clearTimeout(mar); } 6656 marquee(cindex); 6657 }) 6658 tbody.bind({ 6659 mousedown: function (e) { 6660 var start = e.pageX; 6661 $(this).bind({ 6662 mousemove: function (e) { 6663 if (mar != null) { clearTimeout(mar); } 6664 var len = e.pageX - start; 6665 var flag = false; 6666 if (len > 100) { 6667 cindex = cindex - 1; 6668 if (cindex <= 0) { cindex = 0; } 6669 flag = true; 6670 } 6671 if (len < -100) { 6672 cindex = cindex + 1; 6673 if (cindex >= defaults.rows.length - 1) { cindex = defaults.rows.length - 1; } 6674 flag = true; 6675 } 6676 if (flag) { 6677 marquee(cindex); 6678 $(this).unbind("mousemove"); 6679 } 6680 6681 }, 6682 mouseleave: function (e) { 6683 $(this).unbind("mousemove"); 6684 }, 6685 mouseup: function (e) { 6686 $(this).unbind("mousemove"); 6687 }, 6688 mouseout: function (e) { 6689 $(this).unbind("mousemove"); 6690 } 6691 });
6692 }, 6693 touchstart: function (e) { 6694 var start = event.touches[0].pageX; 6695 $(this).bind({ 6696 touchmove: function (e) { 6697 if (typeof (mar) != null) { clearTimeout(mar); } 6698 var len = event.touches[0].pageX - start; 6699 var flag = false; 6700 if (len > 100) { 6701 cindex = cindex - 1; 6702 if (cindex <= 0) { cindex = 0; } 6703 flag = true; 6704 } 6705 if (len < -100) { 6706 cindex = cindex + 1; 6707 if (cindex >= defaults.rows.length - 1) { cindex = defaults.rows.length - 1; } 6708 flag = true; 6709 } 6710 6711 if (flag) { 6712 marquee(cindex); 6713 $(this).unbind("touchmove"); 6714 } 6715 }, 6716 touchend: function (e) { 6717 $(this).unbind("touchmove"); 6718 6719 } 6720 }) 6721 } 6722 }) 6723 }; 6724 } 6725 6726}; 6727$.fn.marquee = function (options) { 6728 var defaults = { 6729 time: 50, 6730 step: 1, 6731 rows: [], 6732 formatter: function (row, i) { 6733 var tb_htm = "<a href='" + row.qd_path + "' target='" + row.qd_target + "'>"; 6734 tb_htm += "<img src='" + row.qd_pic + "' width='180'>"; 6735 tb_htm += "<div >" + row.qd_name + "</div>"; 6736 tb_htm += "</a>"; 6737 return tb_htm; 6738 } 6739 }; 6740 $.extend(defaults, options); 6741 var div = $(this); 6742 if (div.length == 0) { console.log("marqueeä¸åå¨"); return; } 6743 6744 var tb_htm = ""; 6745 tb_htm += "<div style='width:100%;height:auto;margin:auto;display:block;overflow:hidden;'>"; 6746 tb_htm += "<div style='width:auto;height:auto;margin:auto;display:table;overflow:hidden;table-layout:fixed;'>"; 6747 for (var i = 0; i < defaults.rows.length; i++) { 6748 var row = defaults.rows[i]; 6749 tb_htm += "<div style='display:table-cell;margin:auto;width:auto;height:auto;vertical-align:top;overflow:hidden;'>"; 6750 tb_htm += defaults.formatter(row, i); 6751 tb_htm += "</div>"; 6752 row = null; 6753 } 6754 tb_htm += "</div>"; 6755 tb_htm += "</div>"; 6756 $(div).html(tb_htm); 6757 var tb = div.children("div"); 6758 var tbody = tb.children("div"); 6759 6760 var max_left = tb.width() - tbody.width(); 6761 if (tb.width() >= tbody.width()) { return; } 6762 var mar = marquee(); 6763 function marquee() { 6764 var left = parseFloat(tbody.css("margin-left")); 6765 if (left < max_left) { left = 0; } 6766 if (isNaN(left)) { left = 0 }; 6767 left = left - defaults.step; 6768 clearTimeout(mar); 6769 tbody.css({ 6770 marginLeft: left + "px" 6771 }); 6772 return setTimeout(function () { 6773 mar = marquee(); 6774 }, defaults.time); 6775 } 6776 tb.unbind("mouseover").mouseover(function (e) { 6777 clearTimeout(mar); 6778 }).unbind("mouseout").mouseout(function (e) { 6779 mar = marquee(); 6780 }); 6781}; 6782$.fn.frm = function (options) { 6783 var defaults = { 6784 path: "", 6785 data: {}, 6786 call: function () { 6787 6788 } 6789 }; 6790 $.extend(defaults, options); 6791 var key = rand(6); 6792 var div = $(this); 6793 div.html("<iframe src='about:blank' id='" + key + "'></iframe>"); 6794 document.getElementById(key).contentWindow.name = data; 6795 $("#" + key).attr("src", path); 6796} 6797$.fn.tishi = function (options) { 6798 var defaults = { 6799 width: "auto", 6800 height: "auto", 6801 left: 0, 6802 right: 0, 6803 zIndex: 1000, 6804 css: {}, 6805 formatter: function (key) { }, 6806 call: function () { 6807 6808 } 6809 }; 6810 $.extend(defaults, options); 6811 var div = $(this); 6812 6813 switch (options) { 6814 case "hide": 6815 return div.hide(); 6816 break; 6817 } 6818 var key = rand(6); 6819 $(div).html(defaults.formatter(key)); 6820 div.css(defaults.css).css({ 6821 width: defaults.width, 6822 height: defaults.height, 6823 "box-sizing": "border-box", 6824 position: "absolute", 6825 display: "block", 6826 overflow: "visible", 6827 border: "4px dashed #f00", 6828 backgroundColor: "rgba(255,255,255,0.6)", 6829 zIndex: defaults.zIndex, 6830 left: defaults.left, 6831 top: defaults.top 6832 }); 6833}; 6834$.form_set = { 6835 bt_text: "æäº¤ä¿¡æ¯", 6836 suc_text: "ä¿¡æ¯æäº¤æå!", 6837 title: "ç³»ç»æç¤º", 6838 yes_text: "ç¡®å®" 6839}; 6840$.message=function(options){ 6841 var defaults={ 6842 color:"#fff", 6843 qd_name:"Quote", 6844 suc_text:"Information submitted successfully!", 6845 back_color:"#EB1616", 6846 bt_text:"SEND MESSAGE", 6847 title:"Contact Us", 6848 miaoshu:"Leave your inquiry, we will provide you with quality products and services!", 6849 rows:[ 6850 {qd_title:"Message",qd_type:"textarea",id:"#qd_memo",qd_check:[ 6851 {type:"empty",content:"Please enter message!"} 6852 ]}, 6853 {qd_title:"Contacts",qd_type:"input",id:"#qd_contact",qd_check:[ 6854 {type:"empty",content:"Please enter contact!"} 6855 ]}, 6856 {qd_title:"E-mail",qd_type:"input",id:"#qd_email",qd_check:[ 6857 {type:"empty",content:"Please enter email!"}, 6858 {type:"email",content:"Please enter email!"} 6859 ]} 6860 ], 6861 call:function(node,rs) 6862 { 6863 6864 } 6865 }; 6866 $.extend(defaults,options); 6867 var rows=defaults.rows; 6868 var id=rand(4); 6869 $("body").append(` 6870 <div id="${id}_tb" class="chat_tb" style="display:none;"> 6871 <div id="${id}_thead" class="chat_thead"> 6872 <div id="${id}_close" class="chat_close fa fa-close"></div> 6873 <div id="${id}_title" class="chat_title">${defaults.title}</div> 6874 <div id="${id}_miaoshu" class="chat_miaoshu">${defaults.miaoshu}</div> 6875 </div> 6876 <div id="${id}_tbody" class="chat_tbody"></div> 6877 <div id="${id}_tfoot" class="chat_tfoot"> 6878 <div id="${id}_save" class="chat_save">${defaults.bt_text}</div> 6879 </div> 6880 </div> 6881 <div id="${id}" class="chat_bt fa fa-rocketchat"></div>`); 6882 var bt=$(`#${id}`); 6883 var tb=$(`#${id}_tb`); 6884 var close=$(`#${id}_close`); 6885 var thead=$(`#${id}_thead`);
6886 var title=$(`#${id}_title`); 6887 var miaoshu=$(`#${id}_miaoshu`); 6888 var tbody=$(`#${id}_tbody`); 6889 var save=$(`#${id}_save`); 6890 que({ 6891 em:tbody, 6892 data:rows, 6893 format:function(row,i){ 6894 var tb_htm=""; 6895 switch(row.qd_type) 6896 { 6897 case "input": 6898 tb_htm+=`<input type="input" class="chat_input" id="${row.id.replace(/#/,"")}" placeholder="${row.qd_title}">`; 6899 break; 6900 case "textarea": 6901 tb_htm+=`<textarea class="chat_textarea" id="${row.id.replace(/#/,"")}" placeholder="${row.qd_title}"></textarea>`; 6902 break; 6903 } 6904 return tb_htm; 6905 } 6906 }); 6907 thead.css({ 6908 backgroundColor:defaults.back_color, 6909 color:defaults.color 6910 }); 6911 save.css({ 6912 backgroundColor:defaults.back_color, 6913 color:defaults.color 6914 }); 6915 bt.css({ 6916 backgroundColor:defaults.back_color, 6917 color:defaults.color 6918 }); 6919 bt.click(function(e){ 6920 tb.show(); 6921 bt.hide(); 6922 }); 6923 close.click(function(e){ 6924 bt.show(); 6925 tb.hide(); 6926 }); 6927 save.click(function(e){ 6928 defaults.rows.forEach(function(r,j){ 6929 r.qd_value=$(r.id).val(); 6930 }); 6931 $.form({ 6932 qd_name:defaults.qd_name, 6933 suc_text:defaults.suc_text, 6934 rows:defaults.rows, 6935 call:function(d){ 6936 defaults.call(d); 6937 } 6938 }); 6939 }); 6940}; 6941$.form=function(options){ 6942 var defaults={ 6943 qd_name:"Message", 6944 suc_text:"The information has been successfully submitted!", 6945 rows:[], 6946 call:function(d){ 6947 6948 } 6949 }; 6950 $.extend(defaults,options); 6951 var url=form_url+"/plugins/form/"; 6952 var qd_name=defaults.qd_name; 6953 var rows=defaults.rows; 6954 if(rows.length==0){return;} 6955 6956 var rs=[]; 6957 var flag=true; 6958 for(var i=0;i<rows.length;i++) 6959 { 6960 var row=rows[i]; 6961 if(typeof(row.qd_value)=="undefined"&&$(row.id).length>0){row.qd_value=$(row.id).val();} 6962 var qd_value=row.qd_value; 6963 var res=row.qd_check; 6964 if(!Array.isArray(res)){res=[];} 6965 for(var j=0;j<res.length;j++) 6966 { 6967 var r=res[j]; 6968 if(r.type=="empty"&&qd_value=="") 6969 { 6970 flag=false; 6971 }else if(r.type=="email"&&!/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/gi.test(qd_value)) 6972 { 6973 flag=false; 6974 }else if(r.type=="number"&&!$.isNumeric(qd_value)) 6975 { 6976 flag=false; 6977 }else if(r.type=="int"&&isNaN(parseInt(qd_value))) 6978 { 6979 flag=false; 6980 }else if(r.type=="date"&&isNaN(new Date(qd_value).getFullYear())) 6981 { 6982 flag=false; 6983 }else if(r.type=="maxlength"&&!isNaN(parseInt($(row.id).attr("maxlength")))&&qd_value>=parseInt($(row.id).attr("maxlength"))) 6984 { 6985 flag=false; 6986 } 6987 if(!flag) 6988 { 6989 $.alert({ 6990 content:r.content, 6991 click:function(e){ 6992 if(typeof(row.id)!="undefined"&&$(row.id).length>0){$(row.id).focus()} 6993 if(typeof(r.call)=="function"){r.call();} 6994 } 6995 }); 6996 break; 6997 } 6998 6999 } 7000 res=null; 7001 if(!flag){break;} 7002 rs.push({qd_title:row.qd_title,qd_value:row.qd_value}); 7003 qd_value=null; 7004 row=null; 7005 } 7006 if(!flag){return;} 7007 if(rs.length==0){console.log("form not empty!");return;} 7008 var qd_title=rs[0].qd_value; 7009 var qd_form=$.toJSON(rs); 7010 var data={ 7011 qd_check:site_check, 7012 qd_title:qd_title, 7013 qd_name:qd_name, 7014 qd_form:qd_form, 7015 neixing:1 7016 }; 7017 $.post(url,data,function(myhtml,s,res){ 7018 try 7019 { 7020 var d=$.evalJSON(myhtml); 7021 if(d.result) 7022 { 7023 $.alert({ 7024 content:defaults.suc_text, 7025 click:function(e){ 7026 rows.forEach(function(x,i){ 7027 if(typeof(x.id)!="undefined"&&$(x.id).length>0) 7028 { 7029 $(x.id).val(""); 7030 } 7031 }); 7032 defaults.call(d); 7033 } 7034 }); 7035 }else 7036 { 7037 $.alert({ 7038 content:d.text, 7039 click:function(e){} 7040 }); 7041 } 7042 }catch(ex) 7043 { 7044 console.log(myhtml); 7045 } 7046 }); 7047}; 7048$.fn.form=function(options){ 7049 var defaults={ 7050 url:form_url+"/plugins/form/", 7051 key:"form", 7052 qd_name:"çè¨", 7053 suc_text:"ä¿¡æ¯æäº¤æåï¼", 7054 yes_text:"ç¡®å®", 7055 title:"ç³»ç»æç¤º", 7056 bt_text:"åéä¿¡æ¯", 7057 first:"", 7058 data:[], 7059 format:function(row,i,key){ 7060 var qd_type=row.qd_type; 7061 var qd_value=row.qd_value; 7062 var tb_htm=`<div class="${key}-left">${row.qd_title}</div><div class="${key}-right">`; 7063 switch(qd_type) 7064 { 7065 case "input": 7066 tb_htm+=`<input type="text" cid="${row.qd_name}" name="${key}" placeholder="${row.qd_tips}" qd_type="${row.qd_type}" id="${row.qd_cid}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" value="${row.qd_value}" class="${key}-${qd_type} bfb">`; 7067 break; 7068 case "number": 7069 tb_htm+=`<input type="number" min="1.0" step="0.1" cid="${row.qd_name}" name="${key}" placeholder="${row.qd_tips}" qd_type="${row.qd_type}" id="${row.qd_cid}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" value="${row.qd_value}" class="${key}-input bfb">`; 7070 break; 7071 case "int": 7072 tb_htm+=`<input type="number" min="1" step="1" cid="${row.qd_name}" name="${key}" placeholder="${row.qd_tips}" qd_type="${row.qd_type}" id="${row.qd_cid}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" value="${row.qd_value}" class="${key}-input bfb">`; 7073 break; 7074 case "date": 7075 if(!row.qd_value.is_date()){row.qd_value=new Date().year_date();} 7076 tb_htm+=`<input type="text" cid="${row.qd_name}" name="${key}" placeholder="${row.qd_tips}" qd_type="${row.qd_type}" id="${row.qd_cid}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" value="${row.qd_value}" class="${key}-${qd_type} bfb">`; 7077 break; 7078 case "datetime": 7079 if(!row.qd_value.is_datetime()){row.qd_value=new Date().datetime();} 7080 tb_htm+=`<input type="text" cid="${row.qd_name}" name="${key}" placeholder="${row.qd_tips}" qd_type="${row.qd_type}" id="${row.qd_cid}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" value="${row.qd_value}" class="${key}-${qd_type} bfb">`; 7081 break; 7082 case "textarea": 7083 tb_htm+=`<textarea type="text" cid="${row.qd_name}" name="${key}" placeholder="${row.qd_tips}" qd_type="${row.qd_type}" id="${row.qd_cid}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" class="${key}-${qd_type} bfb">${row.qd_value}</textarea>`; 7084 break; 7085 case "select": 7086 if(!Array.isArray(row.qd_option)){row.qd_option=[];} 7087 var rs=row.qd_option; 7088 tb_htm+=`<select name="${key}" cid="${row.qd_name}" placeholder="${row.qd_tips}" id="${row.qd_cid}" qd_type="${row.qd_type}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" value="${row.qd_value}" class="${key}-${qd_type} bfb">
7089 ${rs.map(function(x,j){ 7090 return `<option value="${x.qd_value}">${x.qd_name}</option>`; 7091 }).join("")} 7092 </select>`; 7093 break; 7094 case "text": 7095 tb_htm+=row.qd_value; 7096 break; 7097 case "radio": 7098 if(!Array.isArray(row.qd_option)){row.qd_option=[];} 7099 var rs=row.qd_option; 7100 tb_htm+=`<div name="${key}" cid="${row.qd_name}" placeholder="${row.qd_tips}" id="${row.qd_cid}" qd_type="${row.qd_type}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" value="${row.qd_value}" class="form-radios "> 7101 ${rs.map(function(x,j){ 7102 return `<input name="${row.qd_name}" type="radio" value="${x.qd_value}" ${qd_value==x.qd_value?`checked`:``} class="${key}-${qd_type}"> ${x.qd_name}`; 7103 }).join("")} 7104 </div>`; 7105 break; 7106 case "checkbox": 7107 if(!Array.isArray(row.qd_option)){row.qd_option=[];} 7108 var rs=row.qd_option; 7109 tb_htm+=`<div name="${key}" cid="${row.qd_name}" placeholder="${row.qd_tips}" id="${row.qd_cid}" qd_type="${row.qd_type}" qd_title="${encodeURIComponent(row.qd_title)}" qd_check="${row.qd_check}" qd_children="${encodeURIComponent($.toJSON(row.qd_children))}" value="${row.qd_value}" class="form-checkboxs "> 7110 ${rs.map(function(x,j){ 7111 return `<input name="${row.qd_name}" type="checkbox" value="${x.qd_value}" ${qd_value==x.qd_value?`checked`:``} class="${key}-${qd_type}"> ${x.qd_name}`; 7112 }).join("")} 7113 </div>`; 7114 break; 7115 } 7116 tb_htm+=``; 7117 tb_htm+=`</div>`; 7118 return tb_htm; 7119 }, 7120 call:function(myhtml,rs,node){ 7121 7122 } 7123 }; 7124 if(Array.isArray(options.rows)&&typeof(options.data)=="undefined"){options.data=options.rows;} 7125 $.extend(defaults,options); 7126 7127 var div=$(this); 7128 var key=defaults.key; 7129 var url=defaults.url; 7130 if(div.data("defaults")==undefined){div.data("defaults",defaults);} 7131 var defaults=div.data("defaults"); 7132 que({ 7133 em:div, 7134 data:defaults.data, 7135 first:defaults.first, 7136 last:`<div class="${key}-tfoot"><input type="button" class="${key}-btn" id="${key}-save" value="${defaults.bt_text}"></div>`, 7137 format:function(row,i){ 7138 return `<div class="${key}-item">${defaults.format(row,i,key)}</div>`; 7139 }, 7140 call:function(node,rs){ 7141 $(node).find(`input[qd_type='datetime']`).each(function(i,v){ 7142 $(v).datetime(); 7143 }); 7144 $(node).find(`input[qd_type='date']`).each(function(i,v){ 7145 $(v).date(); 7146 }); 7147 var bt_save=$($(node).find(`#${key}-save`)); 7148 bt_save.unbind("click").click(function(e){ 7149 var rows=[]; 7150 var flag=true; 7151 $(node).find(`[name='${key}']`).each(function(i,v){ 7152 var qd_check=$(v).attr("qd_check"); 7153 var qd_title=decodeURIComponent($(v).attr("qd_title")); 7154 var qd_type=$(v).attr("qd_type"); 7155 var qd_cid=$(v).prop("id"); 7156 var qd_value=$(v).val(); 7157 if(qd_type=="radio"){ 7158 qd_value=$(v).children("input[type='radio']:checked").val(); 7159 }else if(qd_type=="checkbox"){ 7160 qd_value=""; 7161 $(v).children("input[type='radio']:checked").each(function(i,v){ 7162 qd_value+=","+$(v).val(); 7163 }); 7164 } 7165 7166 if(qd_check=="æ¯") 7167 { 7168 var xs=$.evalJSON(decodeURIComponent($(v).attr("qd_children"))); 7169 7170 if(!Array.isArray(xs)){xs=[];} 7171 for(var j=0;j<xs.length;j++) 7172 { 7173 var x=xs[j]; 7174 switch(x.qd_type) 7175 { 7176 case "empty": 7177 if(qd_value=="") 7178 { 7179 flag=false; 7180 } 7181 break; 7182 case "email": 7183 if(/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/gi.test(qd_value)) 7184 { 7185 flag=false; 7186 } 7187 break; 7188 case "number": 7189 flag=new RegExp("^-{0,1}(0|[1-9]+).{0,1}[0-9]+$").test(qd_value); 7190 break; 7191 case "int": 7192 flag=new RegExp("^-{0,1}[0-9]+$").test(qd_value); 7193 break; 7194 } 7195 if(!flag) 7196 { 7197 $.alert({ 7198 title:defaults.title, 7199 yes_text:defaults.yes_text, 7200 content:x.qd_name, 7201 click:function(e){
7202 $(v).focus(); 7203 } 7204 }); 7205 return false; 7206 } 7207 } 7208 } 7209 rows.push({ 7210 qd_cid:qd_cid, 7211 qd_title:qd_title, 7212 qd_value:qd_value 7213 }); 7214 }); 7215 if(!flag){return;} 7216 if (typeof (site_check) == "undefiend") { site_check = ""; } 7217 if(rows.length==0){return;} 7218 var data = { 7219 neixing: 1, 7220 qd_check: site_check, 7221 qd_name: defaults.qd_name, 7222 qd_title: rows[0].qd_value, 7223 qd_form: $.toJSON(rows) 7224 }; 7225 7226 $.post({ 7227 url: url, 7228 data: data, 7229 type: "POST", 7230 success: function (myhtml, s) { 7231 defaults.data.forEach(function(x,i){{ 7232 if(x.qd_type=="input"||x.qd_type=="textarea") 7233 { 7234 div.find(`[cid="${x.qd_name}"]`).val(""); 7235 } 7236 }}); 7237 $.alert({ 7238 title:defaults.title, 7239 yes_text:defaults.yes_text, 7240 content:defaults.suc_text, 7241 yes_click:function(e){ 7242 defaults.call(myhtml, rows,div); 7243 } 7244 }) 7245 7246 } 7247 }); 7248 }); 7249 7250 } 7251 }); 7252 7253}; 7254$.news = function (options) { 7255 var defaults={ 7256 zIndex:2000 7257 }; 7258 var id = rand(6); 7259 var token = window.localStorage.getItem("token"); 7260 $("a").each(function (i, v) { 7261 var href = $(v).attr("href"); 7262 if (typeof (href) == "string") { 7263 if (href.substring(0, 5).toLowerCase() == "/q/h/" && href.substring(0, 5).toLowerCase() != "javascript:void(0);") { 7264 $(v).attr("href", site_path + href); 7265 } 7266 } 7267 href = null 7268 }); 7269 7270 if(typeof(extend)!="undefined"&&typeof(qd_news_extend)!="undefined"&&qd_news_extend!="") 7271 { 7272 var data=extend[qd_news_extend]; 7273 if(typeof(data)!="undefined") 7274 { 7275 $("[name='news']").each(function(i,v){ 7276 var qd_name=$(v).attr("qd_name"); 7277 var qd_type=data[qd_name]; 7278 if(typeof(qd_type)!="undfined"){$(v).attr("qd_type",qd_type);} 7279 qd_type=null; 7280 qd_name=null; 7281 }); 7282 }else 7283 { 7284 console.log("extend is not defined"); 7285 } 7286 data=null; 7287 } 7288 7289 7290 //åå¨news 7291 if(window.self === window.top){return;} 7292 if (token == null) { return; } 7293 if (typeof (nview) == "undefined") { nview = {}; } 7294 if($(`#${id}_bt`).length==0){$("body").append(`<div id="${id}_bt" style="font-size:12px;background-color:#f00;color:#fff;padding:5px;width:auto;height:auto;display:none;cursor:pointer;">å¼å§ç¼è¾</div>`);} 7295 7296 var bt = $("#" + id + "_bt"); 7297 $("[name='news']").unbind("mouseenter").mouseenter(function (e) { 7298 var node = $(this); 7299 var qd_name = $(node).attr("qd_name"); 7300 var qd_guid = $(node).attr("qd_guid"); 7301 var qd_type = $(node).attr("qd_type"); 7302 if(typeof(qd_type)=="undefined") 7303 { 7304 if(typeof(extend)=="object"){ 7305 if(typeof(qd_news_extend)=="string") 7306 { 7307 qd_extend=extend[qd_news_extend]; 7308 if(typeof(qd_extend)=="object"){ 7309 $(node).attr("qd_type",qd_extend[qd_name]); 7310 } 7311 } 7312 } 7313 } 7314 7315 if(typeof(qd_type)=="undefined"){return;} 7316 if (typeof (qd_guid) == "undefined") { qd_guid = window["qd_guid"]; $(node).attr("qd_guid", qd_guid); } 7317 $(bt).css("z-index","unset"); 7318 var zIndex =defaults.zIndex; 7319 var left = $(node).offset().left; 7320 var top = $(node).offset().top; 7321 $(bt).css({ 7322 position: "absolute", 7323 display: "block", 7324 left: left, 7325 top: top, 7326 zIndex: zIndex 7327 }); 7328 window["active_bt"]=bt; 7329 $(bt).unbind("click").click(function (e) { 7330 var qd_type=$(node).attr("qd_type"); 7331 var qd_name=$(node).attr("qd_name"); 7332 var qd_guid=$(node).attr("qd_guid"); 7333 var width = "auto"; 7334 var height = "auto"; 7335 if($(`#${id}`).length>0){$(`#${id}`).remove();} 7336 $("body").append(`<div id="${id}"></div>`); 7337 window["active_win"] = $(`#${id}`); 7338 window["active_node"] = node; 7339 7340 $(bt).hide(); 7341 var width="auto"; 7342 var height="auto"; 7343 switch(qd_type) 7344 { 7345 case "list": 7346 width="90%"; 7347 height="90%"; 7348 break; 7349 case "tiny": 7350 width="90%"; 7351 height="90%"; 7352 break; 7353 case "btiny": 7354 width="90%"; 7355 height="90%"; 7356 break; 7357 case "img": 7358 width="90%"; 7359 height="90%"; 7360 break; 7361 case "link": 7362 width="90%"; 7363 height="90%"; 7364 break; 7365 case "linktext": 7366 width="90%"; 7367 height="90%"; 7368 break; 7369 case "linktimg": 7370 width="90%"; 7371 height="90%"; 7372 break; 7373 case "date": 7374 width="350px"; 7375 height="400px"; 7376 break; 7377 case "datetime": 7378 width="350px"; 7379 height="400px"; 7380 break; 7381 case "textarea": 7382 width="350px"; 7383 height="400px"; 7384 break; 7385 case "input": 7386 width="400px"; 7387 height="200px"; 7388 break; 7389 case "int": 7390 width="400px"; 7391 height="200px"; 7392 break; 7393 } 7394 var options = { 7395 title: "ç¼è¾", 7396 is_max: false, 7397 max_able:true, 7398 //hide_close: true, 7399 close_click:function(e,div){ 7400 $(div).remove(); 7401 }, 7402 width: width, 7403 height: height, 7404 content: `<iframe src="/img/plugins/news/detail/qd_view/extend/${qd_type}.html?id=${id}_win&qd_name=${qd_name}&qd_guid=${qd_guid}&qd_type=${qd_type}" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>`, 7405 zIndex: zIndex 7406 }; 7407 $(`#${id}`).window(options); 7408 options = null; 7409 }); 7410 7411 }); 7412 $("[name='news_class']").unbind("mouseenter").mouseenter(function (e) { 7413 var node = $(this); 7414 var qd_name = $(node).attr("qd_name"); 7415 var qd_guid = $(node).attr("qd_guid"); 7416 var qd_type = $(node).attr("qd_type"); 7417 if(typeof(qd_type)=="undefined") 7418 { 7419 if(typeof(extend)=="object"){ 7420 if(typeof(qd_news_extend)=="string") 7421 { 7422 qd_extend=extend[qd_news_extend]; 7423 if(typeof(qd_extend)=="object"){ 7424 $(node).attr("qd_type",qd_extend[qd_name]); 7425 } 7426 } 7427 } 7428 } 7429 7430 if(typeof(qd_type)=="undefined"){return;} 7431 if (typeof (qd_guid) == "undefined") { qd_guid = window["qd_guid"]; $(node).attr("qd_guid", qd_guid); } 7432 $(bt).css("z-index","unset"); 7433 var zIndex = defaults.zIndex; 7434 var left = $(node).offset().left; 7435 var top = $(node).offset().top; 7436 $(bt).css({ 7437 position: "absolute",
7438 display: "block", 7439 left: left, 7440 top: top, 7441 zIndex: zIndex 7442 }); 7443 window["active_bt"]=bt; 7444 $(bt).unbind("click").click(function (e) { 7445 7446 var qd_type=$(node).attr("qd_type"); 7447 var qd_name=$(node).attr("qd_name"); 7448 var qd_guid=$(node).attr("qd_guid"); 7449 var width = "auto"; 7450 var height = "auto"; 7451 if($(`#${id}`).length>0){$(`#${id}`).remove();} 7452 $("body").append(`<div id="${id}"></div>`); 7453 window["active_win"] = $(`#${id}`); 7454 window["active_node"] = node; 7455 7456 $(bt).hide(); 7457 var width="auto"; 7458 var height="auto"; 7459 switch(qd_type) 7460 { 7461 case "list": 7462 width="90%"; 7463 height="90%"; 7464 break; 7465 case "tiny": 7466 width="90%"; 7467 height="90%"; 7468 break; 7469 case "btiny": 7470 width="90%"; 7471 height="90%"; 7472 break; 7473 case "img": 7474 width="90%"; 7475 height="90%"; 7476 break; 7477 case "link": 7478 width="90%"; 7479 height="90%"; 7480 break; 7481 case "linktext": 7482 width="90%"; 7483 height="90%"; 7484 break; 7485 case "linktimg": 7486 width="90%"; 7487 height="90%"; 7488 break; 7489 case "date": 7490 width="350px"; 7491 height="400px"; 7492 break; 7493 case "datetime": 7494 width="350px"; 7495 height="400px"; 7496 break; 7497 case "textarea": 7498 width="350px"; 7499 height="400px"; 7500 break; 7501 case "input": 7502 width="400px"; 7503 height="200px"; 7504 break; 7505 case "int": 7506 width="400px"; 7507 height="200px"; 7508 break; 7509 } 7510 var options = { 7511 title: "ç¼è¾", 7512 is_max: false, 7513 max_able:true, 7514 //hide_close: true, 7515 close_click:function(e,div){ 7516 $(div).remove(); 7517 }, 7518 width: width, 7519 height: height, 7520 content: `<iframe src="/img/plugins/news/class/qd_me/p/extend/${qd_type}.html?id=${id}_win&qd_name=${qd_name}&qd_guid=${qd_guid}&qd_type=${qd_type}" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>`, 7521 zIndex: zIndex 7522 }; 7523 $(`#${id}`).window(options); 7524 options = null; 7525 }); 7526 }); 7527 $("body").on({ 7528 mouseenter:function(e){ 7529 $(bt).css("z-index","unset"); 7530 var node = $(this); 7531 var qd_guid = $(node).attr("qd_guid"); 7532 if (typeof (qd_guid) == "undefined") { qd_guid = window["qd_news_guid"]; $(node).attr("qd_guid", qd_guid); } 7533 var left = $(node).offset().left; 7534 var top = $(node).offset().top; 7535 var zIndex =defaults.zIndex; 7536 $(bt).css({ 7537 position: "absolute", 7538 display: "block", 7539 left: left, 7540 top: top, 7541 zIndex: zIndex 7542 }); 7543 7544 $(bt).unbind("click").click(function (e) { 7545 if($(`#${id}`).length>0){$(`#${id}`).remove();} 7546 $("body").append(`<div id="${id}"></div>`); 7547 window["active_win"] = $(`#${id}`); 7548 window["active_node"] = node; 7549 $(bt).hide(); 7550 var qd_guid = $(node).attr("qd_guid"); 7551 if (typeof (qd_guid) == "undefined") { qd_guid = window["qd_news_guid"]; } 7552 var options = { 7553 is_max: false, 7554 close_click:function(e,div){ 7555 $(div).remove(); 7556 }, 7557 width: "90%", 7558 height: "90%", 7559 title: "ç¼è¾", 7560 content: `<iframe src="/img/plugins/news/class/qd_me/p/index.html?qd_guid=${qd_guid}" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>`, 7561 zIndex: zIndex 7562 }; 7563 $(`#${id}`).window(options); 7564 options = null; 7565 }); 7566 } 7567 },"[name='nclass']"); 7568 7569 $("body").on({ 7570 mouseenter:function(e){ 7571 $(bt).css("z-index","unset"); 7572 var node = $(this); 7573 var qd_guid = $(node).attr("qd_guid"); 7574 if (typeof (qd_guid) == "undefined") { qd_guid = window["qd_news_guid"]; $(node).attr("qd_guid", qd_guid); } 7575 var left = $(node).offset().left; 7576 var top = $(node).offset().top; 7577 var zIndex =defaults.zIndex; 7578 $(bt).css({ 7579 position: "absolute", 7580 display: "block", 7581 left: left, 7582 top: top, 7583 zIndex: zIndex 7584 }); 7585 7586 $(bt).unbind("click").click(function (e) { 7587 if($(`#${id}`).length>0){$(`#${id}`).remove();} 7588 $("body").append(`<div id="${id}"></div>`); 7589 window["active_win"] = $(`#${id}`); 7590 window["active_node"] = node; 7591 $(bt).hide(); 7592 var options = { 7593 is_max: false, 7594 close_click:function(e,div){ 7595 $(div).remove(); 7596 }, 7597 width: "90%", 7598 height: "90%", 7599 title: "ä¿¡æ¯ç®¡ç", 7600 content: `<iframe src="/img/plugins/news/detail/qd_me/p/index.html?qd_class_guid=${qd_guid}" id='frm' width="100%" height="100%" frameborder="0" scrolling="no"></iframe>`, 7601 zIndex: zIndex 7602 }; 7603 $(`#${id}`).window(options); 7604 options = null; 7605 }); 7606 } 7607 },"[name='ndetail']"); 7608}; 7609 7610 7611$.fn.mslide = function (options) { 7612 var defaults = { 7613 step: 100, 7614 time: 1000, 7615 rows: [], 7616 formatter: function (row, i) { 7617 } 7618 }; 7619 $.extend(defaults, options); 7620 7621 function quandi() { } 7622} 7623$.fn.combox = function (options) { 7624 var defaults = { 7625 val_id: "qd_cid", 7626 text_id: "qd_name", 7627 row: null, 7628 rows: [], 7629 click: function (e, row, div) { 7630 div.val(row.qd_name); 7631 }, 7632 formatter: function (row, i) { 7633 return row.qd_name; 7634 }, 7635 change: function (e, val) { }, 7636 input: function (val) { }, 7637 keydown: function (val) { } 7638 }; 7639 var div = $(this); 7640 var key = rand(6); 7641 var tb, thead, tbody, arrow; 7642 if (typeof (div.attr("key")) == "undefined") { 7643 $.extend(defaults, options); 7644 div.data("defaults", defaults); 7645 div.attr("key", key); 7646 div.after("<a href='javascript:void(0);' class='combox_arrow' id='" + key + "_arrow' key='" + key + "'></a>"); 7647 if ($("#" + key + "_tbody").length == 0) { $("body").append("<div class='combox_tbody' id='" + key + "_tbody'></div>"); } 7648 } 7649 thead = $("#" + key + "_thead"); 7650 arrow = $("#" + key + "_arrow"); 7651 key = div.attr("key"); 7652 if (typeof (div.data("defaults")) == "undefined") { 7653 div.data("defaults", defaults); 7654 } 7655 defaults = div.data("defaults"); 7656 var params = arguments; 7657 var _quandi = new quandi(); 7658 if (typeof (options) == "object") { 7659 _quandi.html(); 7660 } else { 7661 switch (options) { 7662 case "set_rows": 7663 defaults.rows = params[1]; 7664 div.data("defaults", defaults); 7665 break; 7666 case "rows": 7667 return defaults.rows; 7668 break; 7669 case "show": 7670 _quandi.show(); 7671 break; 7672 case "hide": 7673 _quandi.hide(); 7674 break; 7675 } 7676 } 7677 _quandi.events(); 7678 _quandi = null; 7679 7680 function quandi() { 7681 var that = this; 7682 this.html = function () { 7683 var tb_htm = ""; 7684 for (var i = 0; i < defaults.rows.length; i++) { 7685 var row = defaults.rows[i]; 7686 var str = escape($.toJSON(row)); 7687 tb_htm += "<li><div class='combox_item' tabindex='-1' value=\"" + row.qd_val + "\" str='" + str + "'>" + defaults.formatter(row, i) + "</div></li>"; 7688 str = null; 7689 row = null; 7690 } 7691 $("#" + key + "_tbody").html(tb_htm); 7692 tb_htm = null; 7693 }; 7694 this.show = function () { 7695 var top = $(div).offset().top + $(div).outerHeight(); 7696 var height = $(window).height() - top; 7697 if (height <= 20) { height = 200; } 7698 $("#" + key + "_tbody").css({ 7699 boxSizing: "border-box", 7700 overflow: "auto", 7701 height: "auto", 7702 maxHeight: height + "px", 7703 minWidth: div.outerWidth(), 7704 position: "absolute",
7705 display: "block", 7706 left: div.offset().left, 7707 top: div.outerHeight() + div.offset().top 7708 }); 7709 }; 7710 this.hide = function () { $("#" + key + "_tbody").hide(); }; 7711 this.events = function () { 7712 arrow.click(function (e) { 7713 if ($("#" + key + "_tbody").css("display") == "none") { 7714 that.html(); 7715 that.show(); 7716 } else { 7717 that.hide(); 7718 } 7719 e.stopPropagation(); 7720 }); 7721 7722 $("#" + key + "_tbody").on({ 7723 click: function (e) { 7724 //$(div).val($(this).html()); 7725 var str = unescape($(this).attr("str")); 7726 var row = $.evalJSON(str); 7727 defaults.click(e, row, div); 7728 row = null; 7729 str = null; 7730 } 7731 }, ".combox_item"); 7732 $(document).click(function (e) { that.hide(); }); 7733 div.change(function (e) { 7734 defaults.change(e, div.val()); 7735 }); 7736 }; 7737 7738 } 7739}; 7740 7741//æ°åæ»å¨ 7742$.fn.cal_num = function () { 7743 var div = $(this); 7744 if (div.length == 0) { return; } 7745 $(window).scroll(function (e) { 7746 var win_top = $(window).scrollTop(); 7747 $(div).each(function (i, v) { 7748 var node = $(this); 7749 var time = $(this).attr("time"), step = $(this).attr("step"), max_val = $(this).attr("max_val"), min_val = $(this).attr("min_val"); 7750 if (!$.isNumeric(time)) { time = 1; } else { time = parseInt(time); } 7751 if (!$.isNumeric(step)) { step = 1; } else { step = parseInt(step); } 7752 if (!$.isNumeric(max_val)) { max_val = 1; } else { max_val = parseInt(max_val); } 7753 if (!$.isNumeric(min_val)) { min_val = 1; } else { min_val = parseInt(min_val); } 7754 var top = $(this).offset().top; 7755 if (top >= win_top) { 7756 cal(node, min_val, max_val, step, time); 7757 } 7758 }); 7759 }); 7760 7761 7762 function cal(node, val, max_val, step, time) { 7763 var flag = true; 7764 if (val >= max_val) { 7765 val = max_val; 7766 flag = false; 7767 } else { 7768 val = val + step; 7769 } 7770 node.html(val); 7771 if (!flag) { return; } 7772 setTimeout(function () { 7773 clearTimeout(this); 7774 cal(node, val, max_val, step, time); 7775 val = null; 7776 }, time); 7777 } 7778}; 7779//æç¤º 7780$.fn.notice = function (options) { 7781 var defaults = { 7782 back_color: "#FF4A6F", 7783 color: "#fff", 7784 title: "ç³»ç»æç¤º", 7785 content: "", 7786 time: 2000 7787 }; 7788 $.extend(defaults, options); 7789 var div = $(this); 7790 var key = $.rand(6); 7791 div.data("key", key); 7792 key = div.data("key"); 7793 if (typeof (options) == "object") { 7794 div.data("defaults", defaults); 7795 defaults = div.data("defaults"); 7796 var tb_htm = ""; 7797 tb_htm += "<div id='" + key + "_thead' style='font-weight:bold;border-bottom:1px dotted #ddd;line-height:30px;padding:5px;text-align:left;display:block;margin:auto;width:auto;height:30px;overflow:hidden;'>"; 7798 tb_htm += defaults.title; 7799 tb_htm += "</div>"; 7800 tb_htm += "<div id='" + key + "_tbody' style='line-height:40px;padding:5px;text-align:left;display:block;margin:auto;width:auto;height:auto;overflow:hidden;'>"; 7801 tb_htm += defaults.content; 7802 tb_htm += "</div>"; 7803 tb_htm += "<div id='" + key + "_tfoot' style='cursor:pointer;font-family:arial;color:#333;position:absolute;right:10px;top:10px;width:20px;height:20px;line-height:20px;background-color:#fff;border:1px solid #ccc;text-align:center;border-radius:10px;'>"; 7804 tb_htm += "X"; 7805 tb_htm += "</div>"; 7806 div.html(tb_htm); 7807 tb_htm = null; 7808 div.css({ 7809 opacity: "1", 7810 transition: "all 0.4s", 7811 display: "block", 7812 color: defaults.color, 7813 backgroundColor: defaults.back_color 7814 }); 7815 7816 } 7817 var thead = $("#" + key + "_thead"); 7818 var tbody = $("#" + key + "_tbody"); 7819 var tfoot = $("#" + key + "_tfoot"); 7820 7821 if (typeof (defaults.time) == "number") { 7822 setTimeout(function () { 7823 div.css({ opacity: "0" }); 7824 setTimeout(function () { 7825 div.hide(); 7826 }, 400); 7827 }, defaults.time); 7828 } 7829 7830 tfoot.click(function (e) { 7831 div.hide(); 7832 }); 7833 div.css({ 7834 position: "relative", 7835 opacity: "1", 7836 display: "block" 7837 }); 7838}; 7839/*页ç å页*/ 7840$.fn.page = function (options) { 7841 var defaults = { 7842 page: 1, 7843 total: 1, 7844 pagesize: 10, 7845 first_format: function (page, prev) { 7846 var tb_htm = ""; 7847 if (page == 1) { 7848 tb_htm += `<span class="span-page" page="1">First</span>`; 7849 tb_htm += `<span class="span-page" page="${prev}">..</span>`; 7850 } else { 7851 tb_htm += `<a href="javascript:void(0);" class="a-page" name="bt_page" page="1">First</a>`; 7852 tb_htm += `<a href="javascript:void(0);" class="a-page" name="bt_page" page="${prev}">..</a>`; 7853 } 7854 return tb_htm; 7855 }, 7856 last_format: function (page, total, next) { 7857 var tb_htm = ""; 7858 if (page >= total) { 7859 tb_htm += `<span class="span-page" class="a-page" page="${next}">..</span>`; 7860 tb_htm += `<span class="span-page" class="a-page" page="${total}">Last</span>`; 7861 } else { 7862 tb_htm += `<a href="javascript:void(0);" class="a-page" name="bt_page" page="${next}">..</a>`; 7863 tb_htm += `<a href="javascript:void(0);" class="a-page" name="bt_page" page="${total}">Last</a>`; 7864 } 7865 return tb_htm; 7866 }, 7867 format: function (page, i) { 7868 var tb_htm = ""; 7869 if (page == i) { 7870 tb_htm += `<span class="ctx" page="${i}">${i}</span>`; 7871 } else { 7872 tb_htm += `<a href="javascript:void(0);" class="a-page" name="bt_page" page="${i}">${i}</a>`; 7873 } 7874 return tb_htm; 7875 }, 7876 click: function (page) { 7877 7878 } 7879 }; 7880 $.extend(defaults, options); 7881 var div = $(this); 7882 var tb_htm = ""; 7883 var page = defaults.page; 7884 var total = defaults.total; 7885 var pagesize = defaults.pagesize;
7886 var cpage = Math.ceil(page / pagesize); 7887 var start = (cpage - 1) * pagesize; 7888 var end = (cpage) * pagesize;; 7889 var prev = page - 1; 7890 var next = page + 1; 7891 if (start <= 1) { start = 1; } 7892 if (end >= total) { end = total; } 7893 if (prev <= 1) { prev = 1; } 7894 if (next >= total) { next = total; } 7895 7896 if (total <= pagesize) { 7897 start = 1; 7898 end = total; 7899 } 7900 var tb_htm = ""; 7901 tb_htm += defaults.first_format(page, prev); 7902 7903 for (var i = start; i <= end; i++) { 7904 tb_htm += defaults.format(page, i); 7905 } 7906 tb_htm += defaults.last_format(page, total, next); 7907 tb_htm += ` ${page}/${total}`; 7908 div.html(tb_htm); 7909 div.find("a[name='bt_page']").unbind("click").click(function (e) { 7910 var page = parseInt($(this).attr("page")); 7911 defaults.click(page); 7912 page = null; 7913 }); 7914}; 7915 7916/*è´ç©è½¦*/ 7917$.cart = { 7918 key: "cart", 7919 key_id: "qd_cid", 7920 rand: function (len) { 7921 var rows = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; 7922 var tb_htm = ""; 7923 for (var i = 0; i < len; i++) { 7924 tb_htm += rows[parseInt(rows.length * Math.random())]; 7925 } 7926 return tb_htm; 7927 }, 7928 init: function () { 7929 this.save([]); 7930 }, 7931 clear: function () { 7932 localStorage.setItem(this.key, "[]"); 7933 }, 7934 save: function (rows) { 7935 if (!rows instanceof Array) { return; } 7936 localStorage.setItem(this.key, $.toJSON(rows)); 7937 }, 7938 append: function (row) { 7939 if (!typeof (row) == "object" || !row instanceof Object) { return; } 7940 row[this.key_id] = this.rand(10); 7941 var rs = this.rows(); 7942 rs.push(row); 7943 this.save(rs); 7944 rs = null; 7945 }, 7946 prepend: function (row) { 7947 if (!typeof (row) == "object" || !row instanceof Object) { return; } 7948 row[this.key_id] = this.rand(10); 7949 var rs = this.rows(); 7950 rs.unshift(row); 7951 this.save(rs); 7952 rs = null; 7953 }, 7954 update: function (index, row) { 7955 if(index==-1){console.log("ä¿¡æ¯ä¸åå¨");return;} 7956 var rs = this.rows(); 7957 row[this.key_id] = rs[index][this.key_id]; 7958 rs[index] = row; 7959 this.save(rs); 7960 rs = null; 7961 }, 7962 update_key: function (key_id, row) { 7963 var node = this; 7964 this.index(function (r, i) { 7965 return r[node.key_id] == key_id; 7966 }, function (index, rs) { 7967 node.update(index,row); 7968 }); 7969 }, 7970 replace: function (index, row) { 7971 var rs = this.rows(); 7972 rs[index] = row; 7973 this.save(rs); 7974 rs = null; 7975 }, 7976 del: function (index) { 7977 var rs = this.rows(); 7978 //if(index>=rs.length||index<=0){return;} 7979 rs.splice(index, 1); 7980 this.save(rs); 7981 rs = null; 7982 }, 7983 del_key: function (key_id) { 7984 var node = this; 7985 this.index(function (r, i) { 7986 return r[node.key_id] == key_id; 7987 }, function (index, rs) { 7988 rs.splice(index, 1); 7989 node.save(rs); 7990 }); 7991 }, 7992 index: function (where, call) { 7993 var index = -1; 7994 var rs = this.rows(); 7995 for (var i = 0; i < rs.length; i++) { 7996 var r = rs[i]; 7997 if (where(r, i)) { 7998 index = i; 7999 break; 8000 } 8001 } 8002 if (typeof (call) == "function") { 8003 call(index, rs); 8004 } 8005 rs = null; 8006 return index; 8007 8008 }, 8009 row: function (where, call) { 8010 var row; 8011 var index = -1; 8012 this.index(where, function (i, rs) { 8013 if (i != -1) { 8014 row = rs[i]; 8015 index = i; 8016 } 8017 }); 8018 if (typeof (call) == "function") { 8019 call(row, index); 8020 } 8021 return row; 8022 }, 8023 rows: function () { 8024 var rows = []; 8025 try { 8026 if (localStorage.getItem("cart") != null) { 8027 rows = $.evalJSON(localStorage.getItem("cart")); 8028 } 8029 } catch (ex) { 8030 } 8031 return rows; 8032 }, 8033 each: function (call) { 8034 var rs = this.rows(); 8035 for (var i = 0; i < rs.length; i++) { 8036 var r = rs[i]; 8037 if (typeof (call) == "function") { 8038 call(r, i); 8039 } 8040 r = null; 8041 } 8042 rs = null; 8043 }, 8044 up: function (index) { 8045 if (index <= 0) { return; } 8046 var rs = this.rows(); 8047 var next = rs[index - 1]; 8048 var row = rs[index]; 8049 if (typeof (next) == "undefined" || typeof (row) == "undefined") { return; } 8050 rs[index] = next; 8051 rs[index - 1] = row; 8052 this.save(rs); 8053 rs = null; 8054 8055 }, 8056 down: function () { 8057 var rs = this.rows(); 8058 if (index >= rs.length - 1) { return; } 8059 var rs = this.rows(); 8060 var next = rs[index + 1]; 8061 var row = rs[index]; 8062 if (typeof (next) == "undefined" || typeof (row) == "undefined") { return; } 8063 rs[index] = next; 8064 rs[index + 1] = row; 8065 this.save(rs); 8066 rs = null; 8067 }, 8068 total: function (call) { 8069 var rs = this.rows(); 8070 var items = rs.length; 8071 var total = 0; 8072 for (var i = 0; i < rs.length; i++) { 8073 var r = rs[i];
8074 if ($.isNumeric(r.qd_num) && $.isNumeric(r.qd_price)) { 8075 total += parseFloat(r.qd_num); 8076 } 8077 r = null; 8078 } 8079 if (typeof (call) == "function") { 8080 call(items, total); 8081 } 8082 rs = null; 8083 8084 items = null; 8085 return total; 8086 }, 8087 amount: function (call) { 8088 var rs = this.rows(); 8089 var items = rs.length; 8090 var amount = 0; 8091 for (var i = 0; i < rs.length; i++) { 8092 var r = rs[i]; 8093 if ($.isNumeric(r.qd_num) && $.isNumeric(r.qd_price)) { 8094 amount += parseFloat(r.qd_num) * parseFloat(r.qd_price); 8095 } 8096 r = null; 8097 } 8098 if (typeof (call) == "function") { 8099 call(items, amount); 8100 } 8101 rs = null; 8102 items = null; 8103 return amount; 8104 } 8105}; 8106//客æ 8107$.fn.kf = function (data) { 8108 var rows = data; 8109 var tb_htm = ""; 8110 if (data instanceof Object && typeof data.qd_pic == "string") { 8111 tb_htm += "<div style='display:block;position:relative;overflow:visible;height:0px;margin:auto;width:auto;'><img src='" + data.qd_pic + "' class='kf_pic'></div>"; 8112 rows = data.rows; 8113 } 8114 if (data instanceof Object && typeof data.qd_tbody == "string") { 8115 tb_htm += "<div style='display:block;position:relative;overflow:visible;height:0px;margin:auto;width:auto;'><img src='" + data.qd_tbody + "' class='kf_pic'></div>"; 8116 rows = data.qd_code; 8117 } 8118 8119 for (var i = 0; i < rows.length; i++) { 8120 var row = rows[i]; 8121 var ico = row["qd_ico"]; 8122 tb_htm += `<div class="kf_item kf_item_${row.qd_type}" title="${row.qd_name}">`; 8123 switch (row.qd_type) { 8124 case "qq": 8125 if (typeof (ico) == "undefined") { ico = "fa fa-qq"; } 8126 tb_htm += `<a href="tencent://message/?uin=${row.qd_code}" class="kf_a ${ico}" >${row.qd_name}</a></div>`; 8127 break; 8128 case "msn": 8129 if (typeof (ico) == "undefined") { ico = "fa fa-msn"; } 8130 tb_htm += `<a href="msnim:chat?contact=${row.qd_code}" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8131 break; 8132 case "skype": 8133 if (typeof (ico) == "undefined") { ico = "fa fa-skype"; } 8134 tb_htm += `<a href="skype:${row.qd_code}" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8135 break; 8136 case "ww": 8137 if (typeof (ico) == "undefined") { ico = "fa fa-ww"; } 8138 tb_htm += `<a href="http://www.taobao.com/webww/?ver=1&&touid=${row.qd_code}&siteid=cntaobao&status=2&portalId=&gid=&itemsId=" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8139 break; 8140 case "tel": 8141 if (typeof (ico) == "undefined") { ico = "fa fa-phone"; } 8142 tb_htm += `<a href="tel:${row.qd_code}" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8143 break; 8144 case "sms": 8145 if (typeof (ico) == "undefined") { ico = "fa fa-comment-o"; } 8146 tb_htm += `<a href="sms:${row.qd_code}" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8147 break; 8148 case "app": 8149 if (typeof (ico) == "undefined") { ico = "fa fa-whatsapp"; } 8150 tb_htm += `<a href="https://api.whatsapp.com/send?phone=${row.qd_code}" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8151 break; 8152 case "home": 8153 if (typeof (ico) == "undefined") { ico = "fa fa-home"; } 8154 tb_htm += `<a href="${row.qd_code}" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8155 break; 8156 case "contact": 8157 if (typeof (ico) == "undefined") { ico = "fa fa-user-o"; } 8158 tb_htm += `<a href="${row.qd_code}" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8159 break; 8160 default: 8161 if (typeof (ico) == "undefined") { ico = "fa fa-link"; } 8162 tb_htm += `<a href="${row.qd_path}" class="kf_a ${ico}">${row.qd_name}</a></div>`; 8163 break; 8164 } 8165 tb_htm += `</div>`; 8166 row = null; 8167 } 8168 $(this).html(tb_htm); 8169 tb_htm = null; 8170}; 8171$.fn.kef = function (rs) { 8172 var node = $(this); 8173 que({ 8174 em: node, 8175 data: rs, 8176 format: function (row, i) { 8177 return `<div class="kf_item ${row.qd_type}_item"><a href="${row.qd_path}" target="_blank" class="kf_tb"><div class="kf_ico ${row.qd_ico}"></div><div class="kf_name">${row.qd_name}</div></a></div>`; 8178 } 8179 }) 8180}; 8181$.nav = function (options) { 8182 var defaults = { 8183 cates: [], 8184 navs: [], 8185 rows: [] 8186 }; 8187 $.extend(defaults, options); 8188 var cates = defaults.cates; 8189 var navs = defaults.navs; 8190 var rows = defaults.rows; 8191 for (var i = 0; i < rows.length; i++) { 8192 var row = rows[i]; 8193 row.children = []; 8194 row.qd_parent_guid="0"; 8195 row.qd_guid=row.qd_cid; 8196 if (row.qd_type == "å¤é¡µ" || row.qd_type == "æ ") { 8197 cates.sub(function (r, j) { 8198 if (r.qd_key == row.qd_key) { 8199 row.children = r.children; 8200 } 8201 }); 8202 } else if (row.qd_type == "å页") { 8203 if (typeof (navs[row.qd_key]) != "undefined") { 8204 row.children = navs[row.qd_key]; 8205 } 8206 8207 } 8208 if (!Array.isArray(row.children)) 8209 { 8210 row.children = []; 8211 }else{ 8212 row.children.select(function(r,j){ 8213 r.qd_parent_guid=row.qd_guid; 8214 return r; 8215 }); 8216 }
8217 if (row.children.length > 0&&(row.qd_type=="å页"||row.qd_type=="æ ")) { 8218 row.qd_path = row.children[0].qd_path; 8219 } 8220 rows[i] = row; 8221 row = null; 8222 } 8223 return rows; 8224}; 8225$.fn.html_nav=function(options){ 8226 var rows=$.nav({ 8227 cates:options.cates, 8228 navs:options.navs, 8229 rows:options.rows 8230 }); 8231 var defaults={ 8232 first:"", 8233 last:"", 8234 format:function(row,i,index){ 8235 var parent=this; 8236 var rs=row.children; 8237 if(!Array.isArray(rs)){rs=[];} 8238 if((index==0&&rs.length>1)||(index>0&&rs.length>0)) 8239 { 8240 return ` 8241 <div class="nav_tb ${index==0?`nav_tb_top`:``}"> 8242 <div class="nav_thead ${index==0?'nav_thead_top':''}"> 8243 <a href="${site_path+row.qd_path}" class="nav_name ${index==0?'nav_name_top':''}">${row.qd_name}</a> 8244 <div class="nav_fold fa fa-angle-down"></div> 8245 </div> 8246 <div class="nav_tbody ${index==0?'nav_tbody_top':''}"> 8247 ${rs.map(function(r,j){ 8248 return parent.format(r,j,index+1); 8249 }).join("")} 8250 </div> 8251 </div>`; 8252 }else 8253 { 8254 return `<div class="nav_item ${index==0?'nav_item_top':''}"><a href="${site_path+row.qd_path}" class="nav_name ${index==0?'nav_name_top':''}">${row.qd_name}</a></div>`; 8255 } 8256 }, 8257 call:function(node,rs){ 8258 8259 } 8260 }; 8261 $.extend(defaults,options); 8262 var em=$(this); 8263 que({ 8264 em:em, 8265 data:rows, 8266 index:0, 8267 format:function(row,i,index){ 8268 return defaults.format(row,i,index); 8269 }, 8270 call:function(node,rs){ 8271 defaults.call(node,rs); 8272 if($("#nav_close").length>0){ 8273 $("#nav_close").unbind("click").click(function(e){ 8274 if($(".nav_back").css("display")=="none") 8275 { 8276 $(".nav_back").show(); 8277 }else 8278 { 8279 $(".nav_back").hide(); 8280 } 8281 }); 8282 } 8283 } 8284 }); 8285}; 8286$.fn.nav = function (options) { 8287 var defaults = { 8288 rows: [], 8289 cates: [], 8290 navs: [], 8291 mid: "#nav", 8292 mm: "#mm", 8293 key: "nav", 8294 sub: "#sub_tbody", 8295 sub_key: "sub", 8296 first:"", 8297 last:"", 8298 mouseover:function(node,rs){ 8299 8300 }, 8301 format: function (row, i, key, sub_key) { 8302 return `<div class="${key}_item"> 8303 <a href="${row.qd_path}" target="${row.qd_target}" class="${key}_name" name="nav_name" qd_type="${row.qd_type}" qd_key="${row.qd_key}" qd_flag="${row.qd_flag}" qd_sub="${row.qd_sub}">${row.qd_name}</a> 8304 </div> 8305 `; 8306 } 8307 }; 8308 $.extend(defaults, options); 8309 var mm = defaults.mm; 8310 var rows = defaults.rows; 8311 var cates = defaults.cates; 8312 var navs = defaults.navs; 8313 var key = defaults.key; 8314 var sub_key = defaults.sub_key; 8315 var sub = defaults.sub; 8316 var div = $(this); 8317 defaults.cates.sub_each(function (x, i) { 8318 return x; 8319 }); 8320 defaults.rows.select(function (r, j) { 8321 r.children = []; 8322 if (r.qd_type == "å页") { 8323 r.children = navs[r.qd_key]; 8324 8325 } else if (r.qd_type == "åæ " || r.qd_type == "å¤é¡µ" || r.qd_type == "æ ") { 8326 8327 cates.sub(function (x, i) { if (x.qd_key == r.qd_key) { r.children = x.children; } }); 8328 } 8329 if (!Array.isArray(r.children)) { r.children = []; } 8330 if (r.children.length > 0&&(r.qd_type=="å页"||r.qd_type=="æ ")) { 8331 r.qd_path = r.children[0]["qd_path"]; 8332 } 8333 return r; 8334 8335 }); 8336 defaults.rows.sub_each(function (x, i) { 8337 if(x.qd_path!="javascript:void(0);") 8338 { 8339 if(x.qd_path.indexOf(site_path)==1) 8340 { 8341 8342 } x.qd_path = site_path + x.qd_path; 8343 } 8344 return x; 8345 }); 8346 if ($(defaults.mid).length > 0) { 8347 que({ 8348 em: $(defaults.mid), 8349 data: defaults.rows, 8350 first:defaults.first, 8351 last:defaults.last, 8352 format: function (row, i, index) { 8353 var node = this; 8354 var rs = row["children"]; 8355 if (!Array.isArray(rs)) { rs = []; } 8356 var nstr = ""; 8357 if (index > 0) { 8358 nstr = "â"; 8359 for (var j = 0; j < index; j++) { 8360 nstr += `â`; 8361 } 8362 } 8363 return ` 8364 <option value="${row.qd_path}" qd_type="${row.qd_type}">${nstr + row.qd_name}</option> 8365 ${rs.map(function (r, j) { 8366 return node.format(r, j, index + 1); 8367 }).join("")} 8368 `; 8369 }, 8370 call: function (node, rs) { 8371 $(node).change(function (e) { 8372 var qd_type = $($(node).children("option:selected")).attr("qd_type"); 8373 var qd_path = $(node).val(); 8374 if (qd_type == "å页" || qd_type == "æ ") { return; } 8375 window.location.href = qd_path; 8376 qd_path = null; 8377 }) 8378 } 8379 }); 8380 } 8381 8382 que({ 8383 em: div, 8384 data: defaults.rows, 8385 format: function (row, i) { 8386 return defaults.format(row, i, key, sub_key); 8387 } 8388 }); 8389 $(div).find("[qd_type='å¤é¡µ'],[qd_type='æ '],[qd_type='å页'],[qd_type='åæ ']").each(function (i, v) { 8390 var qd_key = $(v).attr("qd_key"); 8391 var qd_type = $(v).attr("qd_type"); 8392 var qd_flag = $(v).attr("qd_flag"); 8393 8394 $(v).unbind("mouseenter").mouseenter(function (e) { 8395 var qd_flag = $(v).attr("qd_flag"); 8396 if (qd_flag == "å¦") { return; } 8397 var qd_type = $(v).attr("qd_type"); 8398 var qd_key = $(v).attr("qd_key"); 8399 var rows = []; 8400 defaults.rows.where(function (x, i) { 8401 if (x.qd_key == qd_key) { rows = x.children; } 8402 }); 8403 if (rows.length <= 1) { return; } 8404 var tb_htm = html_tree(rows, sub_key, 0); 8405 var left = $(v).offset().left; 8406 var top = $(v).offset().top + $(v).outerHeight(); 8407 var width = $(v).outerWidth(); 8408 var sub_width=$(sub).outerWidth(); 8409 var left_step=(sub_width-width)/2; 8410 if(width>sub_width){left_step=0;} 8411 $(sub).html(tb_htm).attr("qd_key", qd_key).css({ 8412 width: width + "px", 8413 position: "absolute",
8414 left: left-left_step, 8415 top: top, 8416 display: "block" 8417 }); 8418 $(div).find("." + key + "_hover").removeClass(key + "_hover"); 8419 $(v).addClass(key + "_hover"); 8420 qd_key = null; 8421 defaults.mouseover(div,rows); 8422 }).unbind("mouseleave").mouseleave(function (e) { 8423 $(div).find("." + key + "_hover").removeClass(key + "_hover"); 8424 $(sub).hide(); 8425 }); 8426 8427 }); 8428 $(div).find("[qd_type='å ¶ä»']").each(function (i, v) { 8429 $(v).unbind("mouseenter").mouseenter(function (e) { 8430 var left = $(v).offset().left; 8431 var top = $(v).offset().top + $(v).outerHeight(); 8432 var qd_sub = $(v).attr("qd_sub"); 8433 if (qd_sub == "" || $(qd_sub).length == 0) { return; } 8434 var sub_width=$(qd_sub).outerWidth(); 8435 var width=$(v).outerWidth(); 8436 var left_step=(sub_width-width)/2; 8437 if(width>sub_width){left_step=0;} 8438 $(qd_sub).css({ 8439 position: "absolute", 8440 left: left-left_step, 8441 top: top, 8442 display: "block" 8443 }); 8444 8445 }).unbind("mouseleave").mouseleave(function (e) { 8446 $(div).find("." + key + "_hover").removeClass(key + "_hover"); 8447 var qd_sub = $(v).attr("qd_sub"); 8448 if (qd_sub == "" || $(qd_sub).length == 0) { return; } 8449 $(qd_sub).hide(); 8450 qd_sub = null; 8451 }); 8452 }); 8453 $(sub).unbind("mouseenter").mouseenter(function (e) { 8454 var qd_key = $(this).attr("qd_key"); 8455 var v = $("[qd_key='" + qd_key + "']"); 8456 $(div).find("." + key + "_hover").removeClass(key + "_hover"); 8457 $(v).addClass(key + "_hover"); 8458 $(sub).show(); 8459 qd_key = null; 8460 v = null; 8461 }).unbind("mouseleave").mouseleave(function (e) { 8462 $(div).find("." + key + "_hover").removeClass(key + "_hover"); 8463 $(sub).hide(); 8464 }); 8465 8466 (function () { 8467 que({ 8468 em:$(`${mm}_tbody`), 8469 data:defaults.rows, 8470 index:0, 8471 format:function(row,i,index){ 8472 var node=this; 8473 var rs=row.children; 8474 if (typeof (rs) == "undefined") { rs = []; } 8475 if (!Array.isArray(rs)) { rs = []; } 8476 if (rs.length == 0) { 8477 return `<div class="m_item m_item_${index}"><a href="${row.qd_path}" class="m_name m_name_${index}">${row.qd_name}</a></div>`; 8478 } else { 8479 return ` 8480 <div class="m_tb m_tb_${index}"> 8481 <div class="m_thead m_thead_${index}" style="display:flex;display:-webkit-flex;justify-content:space-between;align-items:center;${index == 0 ? 'font-weight:bold;' : 'font-weight:normal;'}"> 8482 <a href="${row.qd_path}" class="m_name m_name_${index}" >${row.qd_name}</a> 8483 <a href='javascript:void(0);' class='m_fold'>+</a> 8484 </div> 8485 <div class="m_tbody">${rs.map(function(r,j){ 8486 return node.format(r,j,index+1); 8487 }).join("")}</div> 8488 </div>`; 8489 } 8490 } 8491 }); 8492 $(".m_fold").click(function (e) { 8493 if ($(this).html() == "-") { 8494 $(this).html("+"); 8495 } else { 8496 $(this).html("-"); 8497 } 8498 $($(this).parent().parent().children(".m_tbody")).slideToggle(); 8499 }); 8500 }()); 8501}; 8502 8503$.postJSON = function (url, data, call) { 8504 $.post(url, data, function (myhtml, s, res) { 8505 try { 8506 var d = $.evalJSON(myhtml); 8507 if (typeof (call) == "function") { 8508 call(d, s, res); 8509 } 8510 d = null; 8511 } catch (ex) { 8512 console.log(myhtml); 8513 } 8514 }); 8515}; 8516/* 8517$.tongji({ 8518 qd_token:qd_token, 8519 site_server:site_server 8520}); 8521*/ 8522 8523$.tongji = function (options) { 8524 var qd_class_guid = window.localStorage.getItem("login_user_guid"); 8525 if (qd_class_guid == null || qd_class_guid == "") { 8526 window.localStorage.setItem("login_user_guid", rand(16)); 8527 } 8528 qd_class_guid = window.localStorage.getItem("login_user_guid"); 8529 var data = { 8530 qd_token: options.qd_token, 8531 qd_class_guid: qd_class_guid, 8532 qd_domain: document.domain, 8533 qd_title: escape(document.title.substring(0, 220)), 8534 qd_url: escape(window.location.href), 8535 qd_ref: escape(document.referrer), 8536 neixing: 1 8537 }; 8538 $.ajax({ 8539 url: site_server + "/plugins/tongji/", 8540 type: "GET", 8541 async: true, 8542 data: data, 8543 dataType: "jsonp", 8544 jsonp: "call", 8545 jsonpCallback: "call", 8546 success: function (data, s) { 8547 if (typeof (options.call) == "function") { 8548 options.call(data); 8549 } else { 8550 console.log(data); 8551 } 8552 } 8553 }); 8554}; 8555 8556$.flow = function (options) { 8557 var site_server = options.site_server; 8558 var qd_check = options.qd_check; 8559 var qd_guid = rand(20); 8560 if (window.localStorage) { 8561 if (window.localStorage.getItem("tongji_guid") == null) { window.localStorage.setItem("tongji_guid", qd_guid); } 8562 qd_guid = window.localStorage.getItem("tongji_guid"); 8563 } else { 8564 if ($.cookie("tongji_guid") == null) { $.cookie("tongji_guid", qd_guid); } 8565 qd_guid = $.cookie("tongji_guid"); 8566 } 8567 var data = { 8568 neixing: "1", 8569 qd_check: qd_check, 8570 qd_guid: qd_guid, 8571 qd_title: document.title.substring(0, 220), 8572 qd_domain: document.domain, 8573 qd_url: window.location.href, 8574 qd_date: new Date().datetime("-"), 8575 qd_ref: document.referrer 8576 }; 8577 //console.log(data.qd_ref); 8578 $.getJSON(site_server + "/plugins/tongji/", data, function (data, s, res) { 8579 console.log(res.responseText); 8580 }); 8581}; 8582 8583$.fn.html_news = function (qd_value) { 8584 var node = $(this); 8585 var qd_name = $(node).attr("qd_name"); 8586 var qd_type = $(node).attr("qd_type"); 8587 var cid = $(node).attr("cid"); 8588 var dis = $(node).attr("dis"); 8589 if (typeof (cid) == "undefined") {cid=qd_name; } 8590 if (typeof (qd_value) == "undefined") { return; } 8591 if (typeof (nview[cid]) == "function") 8592 {
8593 nview[cid](node, qd_value); 8594 }else 8595 { 8596 if(typeof(dis)!="undefined") 8597 { 8598 if(dis=="css") 8599 { 8600 $(node).css("background-image", `url('${qd_value}')`); 8601 }else if(dis=="val"){ 8602 $(node).val(qd_value); 8603 }else 8604 { 8605 $(node).attr(dis, qd_value); 8606 } 8607 }else 8608 { 8609 switch(qd_type) 8610 { 8611 case "tiny": 8612 $(node).html(qd_value); 8613 break; 8614 case "btiny": 8615 $(node).html(qd_value); 8616 break; 8617 case "img": 8618 $(node).attr("src", qd_value); 8619 break; 8620 case "link": 8621 $(node).attr("href",qd_value); 8622 break; 8623 default: 8624 $(node).html(qd_value); 8625 break; 8626 } 8627 } 8628 } 8629 8630}; 8631 8632$.fn.html_lb = function (qd_value) { 8633 var node=$(this); 8634 var edit=$(node).attr("edit"); 8635 var qd_type=$(node).attr("qd_type"); 8636 var qd_key=$(node).attr("qd_key"); 8637 var qd_name=$(node).attr("qd_name"); 8638 if(qd_type=="object") 8639 { 8640 node.find("[name='slb']").each(function(i,v){ 8641 var qd_name=$(v).attr("qd_name"); 8642 for(var i=0;i<qd_value.length;i++) 8643 { 8644 var row=qd_value[i]; 8645 if(row.qd_name==qd_name) 8646 { 8647 $(v).html_slb(row.qd_value); 8648 } 8649 row=null; 8650 } 8651 }); 8652 return; 8653 } 8654 $(node).set_node(qd_value); 8655 if(typeof(view[qd_key])!="object"){return;} 8656 var vie=view[qd_key]; 8657 if(typeof(vie[qd_name])=="undefined"){return;} 8658 var vi=vie[qd_name]; 8659 8660 if(Array.isArray(vi)) 8661 { 8662 for(var i=0;i<vi.length;i++) 8663 { 8664 var v=vi[i]; 8665 if(typeof(v.em)=="undefined"){v.em=node;} 8666 8667 que({ 8668 em:v.em, 8669 data:qd_value, 8670 first:typeof(v.first)!="undefined"?v.first:"", 8671 last:typeof(v.last)!="undefined"?v.last:"", 8672 format:function(row,i,index){ 8673 return v.html(row,i,index); 8674 }, 8675 call:function(node,rs){ 8676 v.call(node,rs); 8677 } 8678 }); 8679 v=null; 8680 } 8681 }else 8682 { 8683 if(typeof(vi.html)=="undefined"){vi.html=function(row,i){};} 8684 if(typeof(vi.call)=="undefined"){vi.call=function(node,rs){};} 8685 que({ 8686 em:node, 8687 data:qd_value, 8688 first:typeof(vi.first)!="undefined"?vi.first:"", 8689 last:typeof(vi.last)!="undefined"?vi.last:"", 8690 format:function(row,i,index){ 8691 return vi.html(row,i,index); 8692 }, 8693 call:function(node,rs){ 8694 vi.call(node,rs); 8695 } 8696 }); 8697 } 8698 8699 v=null; 8700 vi=null; 8701 vie=null; 8702 qd_key=null; 8703 qd_name=null; 8704 node=null; 8705 8706}; 8707$.fn.html_slb=function(qd_value){ 8708 var node=$(this); 8709 var qd_key=$(node).attr("qd_key"); 8710 var qd_parent_name=$(node).attr("qd_parent_name"); 8711 var qd_name=$(node).attr("qd_name"); 8712 $(node).set_node(qd_value); 8713 if(typeof(view[qd_key])!="object"){return;} 8714 var vie=view[qd_key]; 8715 if(typeof(vie[qd_parent_name])=="undefined"){return;} 8716 var vi=vie[qd_parent_name]; 8717 if(typeof(vi[qd_name])=="undefined"){return;} 8718 var v=vi[qd_name]; 8719 8720 if(Array.isArray(v)) 8721 { 8722 for(var i=0;i<v.length;i++) 8723 { 8724 var ve=v[i]; 8725 if(typeof(ve.em)=="undefined"){ve.em=node;} 8726 8727 que({ 8728 em:ve.em, 8729 data:qd_value, 8730 first:typeof(ve.first)!="undefined"?ve.first:"", 8731 last:typeof(ve.last)!="undefined"?ve.last:"", 8732 format:function(row,i,index){ 8733 return ve.html(row,i,index); 8734 }, 8735 call:function(node,rs){ 8736 ve.call(node,rs); 8737 } 8738 }); 8739 ve=null; 8740 } 8741 }else 8742 { 8743 if(typeof(v.html)=="undefined"){v.html=function(row,i){};} 8744 if(typeof(v.call)=="undefined"){v.call=function(node,rs){};} 8745 que({ 8746 em:node, 8747 data:qd_value, 8748 first:typeof(v.first)!="undefined"?v.first:"", 8749 last:typeof(v.last)!="undefined"?v.last:"", 8750 format:function(row,i){ 8751 return v.html(row,i); 8752 }, 8753 call:function(node,rs){ 8754 v.call(node,rs); 8755 } 8756 }); 8757 } 8758 8759 v=null; 8760 vi=null; 8761 vie=null; 8762 qd_key=null; 8763 qd_name=null; 8764 qd_parent_name=null; 8765 node=null; 8766}; 8767$.fn.set_node=function(qd_value){ 8768 var node=$(this); 8769 var qd_type=$(node).attr("qd_type"); 8770 var dis=$(node).attr("dis"); 8771 8772 if(typeof(dis)!="undefined") 8773 { 8774 switch(dis) 8775 { 8776 case "back": 8777 node.css("background-image",`url('${qd_value}')`); 8778 break; 8779 case "link": 8780 node.attr("href",qd_value); 8781 break; 8782 default: 8783 node.attr(dis,qd_value); 8784 break; 8785 } 8786 }else 8787 { 8788 switch (qd_type) { 8789 case "link": 8790 node.attr("href", qd_value); 8791 break; 8792 case "linktext": 8793 if (typeof (qd_value["qd_text"]) == "undefined"&&typeof (qd_value["title"])!="undefined") { qd_value["qd_text"] =qd_value["title"]; } 8794 node.attr("qd_text", qd_value["qd_text"]); 8795 node.html(qd_value["qd_text"]).attr("href", qd_value["qd_value"]); 8796 break; 8797 case "linkimg": 8798 if (typeof (qd_value["qd_pic"]) == "undefined") { qd_value["qd_pic"] = "/images/init.png"; } 8799 node.attr("href", qd_value["qd_value"]); 8800 $(node.children("img")).attr("src", qd_value["qd_pic"]); 8801 break; 8802 case "img": 8803 node.attr("src",qd_value); 8804 break; 8805 case "video": 8806 if (typeof (qd_value["qd_poster"]) == "undefined") { qd_value["qd_poster"] = "/images/init.png"; } 8807 if (typeof (qd_value["qd_pic"]) == "undefined"&&typeof (qd_value["qd_poster"])!="undefined") { qd_value["qd_pic"] =qd_value["qd_poster"]; } 8808 $(node).attr("poster", qd_value["qd_pic"]); 8809 $($(node).children("source")).attr("src", qd_value["qd_value"]); 8810 break; 8811 default: 8812 node.html(qd_value); 8813 break; 8814 } 8815 } 8816 8817} 8818$.fn.html_label = function (row) { 8819 var v = $(this); 8820 var vid = $(v).attr("vid"); 8821 var dis = $(v).attr("dis"); 8822 var wrap = $(v).attr("wrap"); 8823 var edit = $(v).attr("edit"); 8824 var node = $(v); 8825 var qd_key = row.qd_key; 8826 var key = qd_key; 8827 if (typeof (vid) != "undefined") { key = vid; } 8828 var rs = row["qd_code"]; 8829 window["label_" + qd_key] = rs; 8830 $(v).data("row", row).attr("qd_type", row.qd_type); 8831 8832 if (row.qd_type != "diy") { 8833 if (row.qd_thead_flag == "æ¾ç¤º") { 8834 if ($("#" + qd_key + "_title").length > 0) { $("#" + qd_key + "_title").html(row.qd_thead); } 8835 } else { 8836 if ($("#" + qd_key + "_thead").length > 0) { $("#" + qd_key + "_thead").remove(); } 8837 } 8838 if (row.qd_miaoshu_flag == "æ¾ç¤º" && $("#" + qd_key + "_miaoshu").length > 0) { 8839 $("#" + qd_key + "_miaoshu").html(row.qd_miaoshu); 8840 } else { 8841 if ($("#" + qd_key + "_miaoshu").length > 0) { $("#" + qd_key + "_miaoshu").remove(); } 8842 } 8843 } 8844 if (row.qd_thead_flag == "æ¾ç¤º") { node = $("#" + qd_key + "_tbody"); } 8845 switch (row.qd_type) { 8846 case "map": 8847 var url=`${site_url}/q/h/${row.qd_class_key}/${row.qd_key}.html?math=`+Math.random(); 8848 $(node).html(`<iframe src="${url}" width="100%" height="100%" frameborder="0" scrolling="no" ></iframe>`); 8849 url=null; 8850 break; 8851 case "block": 8852 $(node).html(row.qd_tbody); 8853 break; 8854 case "label": 8855 $(node).html(row.qd_tbody); 8856 break; 8857 case "diy": 8858 if (typeof (view) == "object") { 8859 if (typeof (view[qd_key]) == "function") { 8860 var data = {}; 8861 for (var j = 0; j < rs.length; j++) { 8862 var r = rs[j]; 8863 data[r.qd_name] = r.qd_value 8864 r = null; 8865 } 8866 view[qd_key](node, data); 8867 data = null; 8868 } 8869 } 8870 break; 8871 8872 case "img": 8873 switch (dis) { 8874 case "back": 8875 $(node).css("background-image", "url('" + row.qd_tbody + "')"); 8876 break; 8877 case "poster": 8878 $(node).attr("poster", row.qd_tbody); 8879 break; 8880 case "link": 8881 $(node).attr("href", row.qd_tbody); 8882 break; 8883 default: 8884 $(node).attr("src", row.qd_tbody); 8885 break; 8886 } 8887 break; 8888 default: 8889 if(typeof(view[qd_key])=="undefined"){view[qd_key]={};} 8890 var v=view[qd_key]; 8891 var vw={first:"",last:"",html:function(row,i){},call:function(node,rs){}}; 8892 if(typeof(v)=="object"){ 8893 $.extend(vw,v); 8894 }else if(typeof(v)=="function") 8895 { 8896 vw.html=v; 8897 } 8898 que({ 8899 em:node, 8900 first:vw.first, 8901 last:vw.last, 8902 data:row.qd_code, 8903 format:function(row,i){ 8904 return vw.html(row,i); 8905 }, 8906 call:function(node,rs){ 8907 vw.call(node,rs); 8908 } 8909 }); 8910 break; 8911 } 8912 //rs=null; 8913}; 8914 8915 8916$.label = function (options) { 8917 var defaults = { 8918 tid: "lbl", 8919 labels: {}, 8920 zIndex:2000, 8921 text: "å¼å§ç¼è¾", 8922 call:function(lbs,labes){ 8923 8924 } 8925 }; 8926 $.extend(defaults, options); 8927 var labels = defaults.labels; 8928 var text = defaults.text; 8929 if (typeof (data) == "undefined") { data = {}; } 8930 if (typeof (data) == "undefined") { data = {}; } 8931 8932 var tid = defaults.tid; 8933 var token = window.localStorage.getItem("token"); 8934 if (typeof (view) == "undefined") { window["view"] = {}; } 8935 var bt; 8936 (function(){ 8937 var lbs={}; 8938 for(var key in labels) 8939 { 8940 var row=labels[key]; 8941 if(row.qd_type=="diy"||row.qd_type=="cate") 8942 { 8943 lbs[key]={}; 8944 var rs=row.qd_code;
8945 rs.forEach(function(r,j){ 8946 lbs[key][r.qd_name]={ 8947 qd_key:key, 8948 qd_parent_name:r.qd_name, 8949 qd_guid:row.qd_guid, 8950 qd_type:r.qd_type, 8951 qd_value:r.qd_value 8952 } 8953 }); 8954 rs=null; 8955 } 8956 row=null; 8957 8958 } 8959 window["lbs"]=lbs; 8960 }()); 8961 8962 $("[name='label']").each(function (i, v) { 8963 var qd_key = $(v).attr("qd_key"); 8964 if (typeof ($(v).attr("id")) == "undefined") { $(v).attr("id", qd_key); } 8965 var row = labels[qd_key]; 8966 if (typeof (row) == "object") { 8967 if (row.qd_state == "ç¦ç¨") { $(v).remove(); } 8968 $(v).attr("qd_guid", row.qd_guid) 8969 $(v).attr("qd_class_guid", row.qd_class_guid).html_label(row); 8970 } 8971 row = null; 8972 qd_key = null; 8973 }); 8974 8975 $("[name='lb']").each(function (i, v) { 8976 var qd_key = $(this).attr("qd_key"); 8977 var qd_name = $(this).attr("qd_name"); 8978 (function(){ 8979 if (typeof (labels[qd_key]) == "undefined") {console.log(qd_key + " ä¸åå¨");return;} 8980 if (typeof (lbs[qd_key][qd_name]) == "undefined") {console.log(qd_key + `:${name} ä¸åå¨`);return;} 8981 var row=lbs[qd_key][qd_name]; 8982 $(v).attr("qd_guid",row.qd_guid).attr("qd_type",row.qd_type); 8983 if(row.qd_type=="object") 8984 { 8985 $(v).find("[name='slb']").attr("qd_guid",row.qd_guid).attr("qd_parent_name",row.qd_parent_name).attr("qd_key",row.qd_key); 8986 var rs=row.qd_value; 8987 for(var j=0;j<rs.length;j++) 8988 { 8989 var r=rs[j]; 8990 $(v).find(`[name='slb'][qd_guid='${row.qd_guid}'][qd_name='${r.qd_name}']`).attr("qd_type",r.qd_type); 8991 //$($(v).find(`[name='slb'][qd_guid='${row.qd_guid}'][qd_name='${r.qd_name}']`)).html_slb(r.qd_value); 8992 r=null; 8993 } 8994 rs=null; 8995 } 8996 8997 $(v).html_lb(row.qd_value); 8998 row=null; 8999 }()); 9000 parent_row=null; 9001 rows = null; 9002 qd_key = null; 9003 qd_name = null; 9004 }); 9005 9006 defaults.call(lbs,labels); 9007 lbs=null; 9008 if(window.self === window.top){return;} 9009 if (token != null && token != "") { 9010 if ($("#bar_" + tid).length == 0) { $("body").append("<div id='bar_" + tid + "'></div>"); } 9011 if ($("#tool_" + tid).length == 0) { 9012 $("body").append(` 9013 <div id="tool_${tid}"></div> 9014 `); 9015 } 9016 if ($("#" + tid).length == 0) { $("body").append(`<div id="${tid}">${text}</div>`); } 9017 if ($("#wan_" + tid).length == 0) { $("body").append("<div id='wan_" + tid + "'></div>"); } 9018 if ($("#win_" + tid).length == 0) { $("body").append("<div id='win_" + tid + "'></div>"); } 9019 if ($("#win").length == 0) { $("body").append("<div id='win'></div>"); } 9020 bt = $("#" + tid); 9021 9022 bt.css({ 9023 textAlign: "center", 9024 position: "absolute", 9025 display: "none", 9026 width: "auto", 9027 height: "auto", 9028 backgroundColor: "#f00", 9029 color: "#fff", 9030 cursor: "pointer", 9031 border: "1px solid #fff", 9032 fontSize: "12px", 9033 lineHeight: "30px", 9034 paddingLeft: "10px", 9035 paddingRight: "10px" 9036 }); 9037 } 9038 9039 //å è½½å¾ç 9040 setTimeout(function () { 9041 $(window).load(function () { load_img(); }); 9042 $(window).scroll(function () { load_img(); }); 9043 }, 10); 9044 function load_img() { 9045 var win_top = $(window).scrollTop() + $(window).height(); 9046 $("img[src='/images/init.png'],div[src='/images/init.png'],a[src='/images/init.png']").each(function (i, v) { 9047 var qd_pic = $(v).attr("qd_pic"); 9048 var top = $(v).offset().top; 9049 var dis = $(v).attr("dis"); 9050 if (typeof (qd_pic) == "string" && win_top >= top) { 9051 var img = new Image(); 9052 img.src = qd_pic; 9053 img.onload = function (e) { 9054 if (dis == "back") { 9055 $(v).css("background-image", "url('" + qd_pic + "')"); 9056 } 9057 $(v).attr("src", qd_pic); 9058 console.log(qd_pic + " å è½½å®æ¯"); 9059 9060 }; 9061 img.onerror = function (e) { 9062 console.warn(qd_pic + " å 载失败,åå æä»¶ä¸åå¨æå¤ªå¤§"); 9063 }; 9064 img = null; 9065 } 9066 }); 9067 } 9068 9069 if (token == "" || token == null) { return; } 9070 if ($("#loading_" + tid).length == 0) { $("body").append("<div id='loading_" + tid + "'></div>"); } 9071 9072 $(bt).unbind("mouseout").mouseout(function (e) { 9073 $(bt).hide(); 9074 }); 9075 9076 var zIndex=defaults.zIndex; 9077 9078 window["active_bt"]=bt; 9079 9080 $("[name='label']").unbind("mouseenter").mouseenter(function (e) { 9081 e.preventDefault(); 9082 e.stopPropagation(); 9083 var node=$(this); 9084 var edit=$(this).attr("edit"); 9085 if(edit=="no"){return;} 9086 $(bt).css("z-index","auto"); 9087 var qd_guid = $(node).attr("qd_guid"); 9088 var qd_type = $(node).attr("qd_type"); 9089 var left = $(this).offset().left; 9090 var top = $(this).offset().top; 9091 var zIndex =defaults.zIndex; 9092 bt.css({ 9093 display: "block", 9094 left: left, 9095 top: top, 9096 zIndex: zIndex 9097 }); 9098 9099 var qd_url = `/img/plugins/label/qd_view/${qd_type}/edit.html?qd_guid=${qd_guid}`; 9100 bt.data("width","90%").data("height","90%"); 9101 bt.data("qd_url",qd_url); 9102 bt.data("active_node",node); 9103 qd_url=null; 9104 qd_guid=null; 9105 qd_type=null; 9106 }); 9107 $("[name='lb']").unbind("mouseenter").mouseenter(function (e) { 9108 e.preventDefault(); 9109 e.stopPropagation(); 9110 var node=$(this); 9111 var edit=$(this).attr("edit"); 9112 if(edit=="no"){return;} 9113 $(bt).css("z-index","auto"); 9114 var qd_guid = $(node).attr("qd_guid"); 9115 var qd_type = $(node).attr("qd_type"); 9116 var qd_name = $(node).attr("qd_name"); 9117 var left = $(this).offset().left; 9118 var top = $(this).offset().top; 9119 var zIndex = defaults.zIndex; 9120 bt.css({ 9121 display: "block", 9122 left: left, 9123 top: top, 9124 zIndex: zIndex 9125 }); 9126 var qd_url = `/img/plugins/label/qd_view/lb/${qd_type}.html?qd_guid=${qd_guid}&qd_name=${qd_name}`; 9127 var width="90%"; 9128 var height="90%"; 9129 if (qd_type == "textarea") { 9130 width = "350px"; 9131 height = "300px"; 9132 } else if (qd_type == "input" ||qd_type == "number" ||qd_type == "int" ||qd_type == "color" ||qd_type == "dlist") { 9133 width = "350px"; 9134 height = "280px"; 9135 } else if (qd_type == "date" || qd_type == "datetime") { 9136 width = "350px"; 9137 height = "400px"; 9138 } 9139 bt.data("width","90%").data("height","90%"); 9140 bt.data("qd_url",qd_url); 9141 bt.data("active_node",node); 9142 qd_url=null; 9143 qd_guid=null; 9144 qd_type=null; 9145 }); 9146 $("[name='slb']").unbind("mouseenter").mouseenter(function (e) { 9147 e.preventDefault(); 9148 e.stopPropagation(); 9149 var node=$(this); 9150 var edit=$(this).attr("edit"); 9151 if(edit=="no"){return;} 9152 $(bt).css("z-index","auto"); 9153 var qd_guid = $(node).attr("qd_guid"); 9154 var qd_type = $(node).attr("qd_type"); 9155 var qd_name = $(node).attr("qd_name"); 9156 var qd_parent_name = $(node).attr("qd_parent_name"); 9157 var left = $(this).offset().left; 9158 var top = $(this).offset().top; 9159 var zIndex =defaults.zIndex; 9160 bt.css({ 9161 display: "block", 9162 left: left, 9163 top: top, 9164 zIndex: zIndex 9165 }); 9166 var qd_url = `/img/plugins/label/qd_view/slb/${qd_type}.html?qd_guid=${qd_guid}&qd_name=${qd_name}&qd_parent_name=${qd_parent_name}`; 9167 var width="90%"; 9168 var height="90%"; 9169 9170 if (qd_type == "textarea") { 9171 width = "350px"; 9172 height = "300px"; 9173 } else if (qd_type == "input" ||qd_type == "number" ||qd_type == "int" ||qd_type == "color" ||qd_type == "dlist") { 9174 width = "350px"; 9175 height = "280px"; 9176 } else if (qd_type == "date" || qd_type == "datetime") { 9177 width = "350px"; 9178 height = "400px"; 9179 }
9180 bt.data("width",width).data("height",height); 9181 bt.data("qd_url",qd_url); 9182 bt.data("active_node",node); 9183 qd_url=null; 9184 qd_guid=null; 9185 qd_type=null; 9186 }); 9187 9188 bt.unbind("click").click(function (e) { 9189 var qd_url=$(this).data("qd_url"); 9190 var qd_name=$(this).attr("qd_name"); 9191 var width=$(this).data("width"); 9192 var height=$(this).data("height"); 9193 var node=$(this).data("active_node"); 9194 window["active_node"]=node; 9195 var id=rand(4); 9196 if($("#"+id).length==0){$("body").append(`<div id="${id}"></div>`);} 9197 $(`#${id}`).window({ 9198 is_max: false, 9199 hide_zoom:false, 9200 close_click:function(e,div){ 9201 $(div).remove(); 9202 }, 9203 width:width, 9204 height:height, 9205 title: "ç¼è¾", 9206 content: `<iframe src="${qd_url}&id=${id}" frameborder="0" width="100%" height="100%" scrolling="auto"></iframe>`, 9207 zIndex: zIndex 9208 }); 9209 $(this).hide(); 9210 }); 9211} 9212$.load=function(options){ 9213 var defaults={ 9214 rows:[], 9215 call:function(){} 9216 }; 9217 $.extend(defaults,options); 9218 var rows=defaults.rows; 9219 load_url(rows); 9220 async function load_url(rows){ 9221 for(var i=0;i<rows.length;i++) 9222 { 9223 9224 await new Promise(function(res,rej){ 9225 var row=rows[i]; 9226 if($(row.em).length>0){ 9227 $(row.em).load(row.url,function(myhtml,s,res){ 9228 if(typeof(row.call)=="function") 9229 { 9230 row.call($(row.em),myhtml); 9231 } 9232 }); 9233 } 9234 row=null; 9235 }); 9236 9237 } 9238 } 9239 defaults.call(); 9240}; 9241$.submit = function (options) { 9242 var url = options.url; 9243 var row = options.row; 9244 var qd_parent = options.qd_parent; 9245 var call = options.call; 9246 var before = options.before; 9247 var data = { 9248 neixing: 2, 9249 token: token 9250 }; 9251 $.extend(data, row); 9252 var r = upfile(data, qd_parent); 9253 r.then(function (row) { 9254 if (typeof (before) == "function") { row = before(row); } 9255 $.ajax({ 9256 url: url, 9257 type: "POST", 9258 data: data, 9259 async: false, 9260 crossDomain: true, 9261 xhrFields: { 9262 withCredentials: true 9263 }, 9264 success: function (myhtml, s) { 9265 try { 9266 var d = $.evalJSON(myhtml); 9267 if (d.result) { 9268 if (typeof (call) == "function") { call(d); } 9269 $.alert({ 9270 content: d.text, 9271 click: function () { 9272 9273 } 9274 }); 9275 } else { 9276 $.alert({ 9277 content: d.text 9278 }); 9279 } 9280 d = null; 9281 } catch (ex) { 9282 console.log(myhtml); 9283 } 9284 } 9285 }); 9286 }); 9287}; 9288$.fn.accordion = function (options) { 9289 var defaults = { 9290 call: function (node, index) { }, 9291 autoplay: true, 9292 dir: "horizontal",//verticalåç´,horizontalæ°´å¹³ 9293 step: 200, 9294 time: 2000 9295 }; 9296 $.extend(defaults, options) 9297 var div = $(this); 9298 if (div.length == 0) { return; } 9299 div.css({ 9300 display: "flex", 9301 display: "-webkit-flex", 9302 "justify-content": "space-around" 9303 }); 9304 if (defaults.dir == "horizontal") { div.css({ "flex-direction": "row" }); } else { div.css({ "flex-direction": "column" }); } 9305 div.children().each(function (i, v) { 9306 $(v).css({ 9307 transition: "all 1s", 9308 overflow: "hidden" 9309 }); 9310 $(v).bind({ 9311 mouseover: function (e) { 9312 play(i); 9313 }, 9314 touchstart: function (e) { 9315 play(i); 9316 } 9317 }); 9318 }); 9319 9320 if (defaults.autoplay = true) { 9321 setTimeout(function () { 9322 auto(0); 9323 }, defaults.time); 9324 } 9325 9326 function auto(index) { 9327 if (index >= div.children().length) { index = 0; } 9328 play(index); 9329 setTimeout(function () { 9330 clearTimeout(this); 9331 auto(div.data("index") + 1); 9332 }, defaults.time); 9333 } 9334 9335 function play(index) { 9336 div.data("index", index) 9337 var node = $(div.children().get(index)); 9338 div.children().css({transition:"all 0.5s"}); 9339 if (defaults.dir == "horizontal") { 9340 div.children().css({ 9341 width: defaults.step / (div.children().length - 1) + "px", 9342 filter: "brightness(60%)" 9343 }); 9344 node.css({ 9345 width: `calc(100% - ${defaults.step}px)`, 9346 filter: "brightness(100%)" 9347 }); 9348 } else { 9349 div.children().css({ 9350 height: defaults.step / (div.children().length - 1) + "px", 9351 filter: "brightness(60%)" 9352 }); 9353 node.css({ 9354 height: `calc(100% - ${defaults.step}px)`, 9355 filter: "brightness(100%)" 9356 }); 9357 } 9358 defaults.call(node, index); 9359 } 9360};
9361/* 9362top,bottomé设置容å¨é«åº¦ 9363*/ 9364$.fn.hd = function (options) { 9365 var defaults = { 9366 dir: "top", 9367 step: 1, 9368 time: 20, 9369 stop: false, 9370 mouseover: function () { }, 9371 mouseout: function () { } 9372 }; 9373 $.extend(defaults, options); 9374 var div = $(this); 9375 if(div.length==0){console.log("div hd not exists!");return;} 9376 if(div.children().length==0){div.wrapInner("<div></div>");} 9377 div.html(div.html()+div.html()); 9378 var nodes=$(div.children()); 9379 $(nodes).css("flex-shrink","0"); 9380 div.css({ 9381 display:"flex", 9382 display:"-webkit-flex" 9383 }); 9384 var step=defaults.step; 9385 var dir=defaults.dir; 9386 var mar=marquee(); 9387 div.unbind("mouseover").mouseover(function(e){ 9388 if(defaults.stop){return;} 9389 clearInterval(mar); 9390 }).unbind("mouseout").mouseout(function(e){ 9391 mar=marquee(); 9392 }); 9393 function marquee(){ 9394 var max_len=0; 9395 switch(dir) 9396 { 9397 case "left": 9398 var width=div.width(); 9399 var max_width=0; 9400 nodes.each(function(i,v){ 9401 max_width+=$(v).outerWidth(); 9402 }); 9403 var max_len=width-max_width; 9404 if(max_len>=0){return;} 9405 var left=0; 9406 var node=$(nodes.get(0)); 9407 return setInterval(function(e){ 9408 left<=max_len?left=0:left-=step; 9409 node.css({ 9410 marginLeft:left+"px" 9411 }); 9412 },defaults.time); 9413 break; 9414 case "right": 9415 var width=div.width(); 9416 var max_width=0; 9417 nodes.each(function(i,v){ 9418 max_width+=$(v).outerWidth(); 9419 }); 9420 var max_len=width-max_width; 9421 if(max_len>=0){return;} 9422 var left=max_len; 9423 var node=$(nodes.get(0)); 9424 return setInterval(function(e){ 9425 left>=0?left=max_len:left+=step; 9426 node.css({ 9427 marginLeft:left+"px" 9428 }); 9429 },defaults.time); 9430 break; 9431 case "top": 9432 div.css("flex-direction","column"); 9433 var height=div.height(); 9434 var max_height=0; 9435 nodes.each(function(i,v){ 9436 max_height+=$(v).outerHeight(); 9437 }); 9438 var max_len=height-max_height; 9439 if(max_len>=0){return;} 9440 var left=0; 9441 var node=$(nodes.get(0)); 9442 return setInterval(function(e){ 9443 left<=max_len?left=0:left-=step; 9444 node.css({ 9445 marginTop:left+"px" 9446 }); 9447 },defaults.time); 9448 9449 break; 9450 case "bottom": 9451 div.css("flex-direction","column"); 9452 var height=div.height(); 9453 var max_height=0; 9454 nodes.each(function(i,v){ 9455 max_height+=$(v).outerHeight(); 9456 }); 9457 var max_len=height-max_height; 9458 if(max_len>=0){return;} 9459 var left=max_len; 9460 var node=$(nodes.get(0)); 9461 return setInterval(function(e){ 9462 left>=0?left=max_len:left+=step; 9463 node.css({ 9464 marginTop:left+"px" 9465 }); 9466 },defaults.time); 9467 break; 9468 } 9469 9470 } 9471}; 9472 9473 9474function html_tree(rows, val, index, call) { 9475 if (typeof (call) != "function") { 9476 call = function (row, i, index, val) { 9477 var rs = row.children; 9478 if (typeof (rs) == "undefined") { rs = []; } 9479 if (!Array.isArray(rs)) { rs = []; } 9480 if (rs.length == 0) { 9481 return `<div class="${val}_item"><a href="${row.qd_path}" class="${val}_name">${row.qd_name}</a></div>`; 9482 } else { 9483 return ` 9484 <div class="${val}_tb ${val}_tb_${index}"> 9485 <div class="${val}_thead ${val}_thead_${index}"><a href="${row.qd_path}" class="${val}_name">${row.qd_name}</a></div> 9486 <div class="${val}_tbody">${html_tree(rs, val, index + 1, call)}</div> 9487 </div>`; 9488 } 9489 rs = null; 9490 } 9491 } 9492 return rows.map(function (x, i) { 9493 return call(x, i, index, val); 9494 }).join("");; 9495} 9496function html_page(total, pagesize, page) { 9497 var pagecount = Math.ceil(total / pagesize); 9498 var tb_htm = ""; 9499 if (page > 1) { 9500 tb_htm += "<a href='javascript:void(0);' class='bt_page fa fa-caret-left' name='bt_page' page='1'></a>"; 9501 } 9502 for (var i = 1; i <= pagecount; i++) { 9503 if (page == i) { 9504 tb_htm += "<a href='javascript:void(0);' class='bt_page page_hover' name='bt_page' page='" + i + "'>" + i + "</a>"; 9505 } else { 9506 tb_htm += "<a href='javascript:void(0);' class='bt_page' name='bt_page' page='" + i + "'>" + i + "</a>"; 9507 } 9508 } 9509 if (page < pagecount) { 9510 tb_htm += "<a href='javascript:void(0);' class='bt_page fa fa-caret-right' name='bt_page' page='" + pagecount + "'></a>"; 9511 } 9512 return tb_htm; 9513} 9514function blob_url(file) { 9515 var url = null; 9516 if (window.createObjectURL != undefined) { // basic 9517 url = window.createObjectURL(file); 9518 } else if (window.URL != undefined) { // mozilla(firefox) 9519 url = window.URL.createObjectURL(file); 9520 } else if (window.webkitURL != undefined) { // webkit or chrome 9521 url = window.webkitURL.createObjectURL(file); 9522 } 9523 return url; 9524} 9525function load_img(nodes, index) { 9526 if (index >
9526= nodes.length) { return; } 9527 var node = $(nodes).get(index); 9528 var qd_pic = $(node).attr("qd_pic"); 9529 if (typeof (qd_pic) != "undefined") { 9530 var img = new Image(); 9531 img.src = qd_pic; 9532 img.onload = function () { 9533 setTimeout(function () { load_img(nodes, index + 1); }, 50); 9534 } 9535 img.onerror = function () { 9536 setTimeout(function () { load_img(nodes, index + 1); }, 50); 9537 } 9538 $(node).attr("src", qd_pic); 9539 img = null; 9540 } else { 9541 load_img(nodes, index + 1); 9542 } 9543 qd_pic = null; 9544 node = null; 9545} 9546/*卿è¿ä»£å¡«å */ 9547(que=function (options) { 9548 var defaults = { 9549 index: null, 9550 em: null, 9551 data: [], 9552 min:null, 9553 max:null, 9554 first:"", 9555 last:"", 9556 before: function (node, rs) { 9557 9558 }, 9559 after: function (node, rs) { 9560 9561 }, 9562 call: function (node, rs) { 9563 9564 }, 9565 format: function (r, i, index) { 9566 return ``; 9567 } 9568 }; 9569 $.extend(defaults, options); 9570 var em = defaults.em; 9571 if (em == null) { return; } 9572 var index = defaults.index; 9573 var rows = defaults.data; 9574 defaults.before(em, rows); 9575 var tb_htm = ""; 9576 tb_htm+=defaults.first; 9577 if(Array.isArray(rows)) 9578 { 9579 $(rows).each(function (i, v) { 9580 tb_htm += defaults.format(v, i, index); 9581 }); 9582 }else 9583 { 9584 if(rows==null) 9585 { 9586 var min=parseInt(defaults.min); 9587 var max=parseInt(defaults.max); 9588 if(!isNaN(min)&&!isNaN(max)&&max>=min){ 9589 for(var i=min;i<=max;i++) 9590 { 9591 tb_htm+=defaults.format(i,i); 9592 } 9593 9594 $(em).html(tb_htm); 9595 } 9596 }else 9597 { 9598 if (typeof (rows) == "string" || typeof (rows) == "number") { 9599 tb_htm += rows; 9600 } else { 9601 if(Object.prototype.toString.call(data)=="[object Object]") 9602 { 9603 var i=0; 9604 for(var key in rows) 9605 { 9606 tb_htm += defaults.format(key,rows[key], i); 9607 i++; 9608 } 9609 } 9610 } 9611 } 9612 } 9613 9614 tb_htm+=defaults.last; 9615 if ($(em).is("input") || $(em).is("textarea")) { 9616 $(em).val(tb_htm); 9617 } else { 9618 $(em).html(tb_htm); 9619 } 9620 defaults.after(em, rows); 9621 defaults.call(em, rows); 9622 tb_htm = null; 9623 em = null; 9624 rows = null; 9625})(); 9626 9627 9628 9629async function up_file(qd_content, qd_parent) { 9630 if (qd_content.indexOf("blob:http") != -1 || qd_content.indexOf("data:image/") != -1) { 9631 var rs = getimgsrc(qd_content); 9632 for (var i = 0; i < rs.length; i++) { 9633 var r = rs[i]; 9634 if (r.indexOf("blob:http") != -1 || r.indexOf("data:image/") != -1) { 9635 await new Promise(function (resolve, reject) { 9636 u(r, rand(6), qd_parent).then(function (data) { 9637 var reg = new RegExp(r, "gi"); 9638 if (data.result) { 9639 qd_content = qd_content.replace(reg, data.qd_path); 9640 } else { 9641 qd_content = qd_content.replace(reg, "/images/nopic.jpg"); 9642 } 9643 reg = null; 9644 resolve(qd_content); 9645 }); 9646 }); 9647 } 9648 r = null; 9649 } 9650 rs = null; 9651 } 9652 await new Promise(function (resolve, reject) { 9653 resolve(qd_content) 9654 }); 9655 return qd_content; 9656} 9657$.fn.html_cates = function (options) { 9658 var defaults = { 9659 index: 0, 9660 top_key: null, 9661 top_guid: null, 9662 data: null, 9663 type: "class", 9664 first:``, 9665 last:``, 9666 first_cate:``, 9667 last_cate:``, 9668 format: function (row, i, index) { 9669 var node = this; 9670 var rs = row.children; 9671 if (typeof (rs) != "object") { rs = []; } 9672 if (!Array.isArray(rs)) { rs = []; } 9673 if (site_path != "" && row["qd_path"].indexOf(site_path) == -1) { row["qd_path"] = site_path + row["qd_path"]; } 9674 var qd_key_guid = qd_news_guid; 9675 if (typeof (row.children) == "undefined" && typeof (qd_guid) != "undefined") { qd_key_guid = qd_guid; } 9676 if (rs.length == 0) { 9677 return `<div class="cate_item"><a href="${row.qd_path}" class="${row.qd_guid == qd_key_guid ? 'cate_hover' : 'cate_name'}">${row.qd_name}</a></div>`; 9678 } else { 9679 return `<div class="cate_tb"> 9680 <a href="${row.qd_path}" class="cate_thead">${row.qd_name}</a> 9681 <div class="cate_tbody"> 9682 ${rs.map(function (r, j) { 9683 return node.format(r, j, index + 1); 9684 }).join("")} 9685 </div> 9686 </div>`; 9687 } 9688 }, 9689 cate: "#cate", 9690 format_cate: function (row, i, index) { 9691 var node = this; 9692 var rs = row.children; 9693 if (typeof (rs) != "object") { rs = []; } 9694 if (!Array.isArray(rs)) { rs = []; } 9695 var tb_htm = ""; 9696 if (index > 0) { tb_htm += "â"; } 9697 for (var j = 0; j < index; j++) { 9698 tb_htm += `ââ`; 9699 } 9700 return ` 9701 <option value="${row.qd_path}" ${(row.qd_guid==qd_news_guid&&defaults.type=="class")||(row.qd_guid==qd_guid&&defaults.type=="detail")?'selected':''}>${tb_htm + row.qd_name}</option> 9702 ${rs.map(function (r, j) { 9703 return node.format_cate(r, j, index + 1); 9704 }).join("")} 9705 `; 9706 }, 9707 call:function(node,rs){} 9708 }; 9709 $.extend(defaults, options); 9710 if (defaults.top_key == null && typeof (window["qd_top_key"]) != "undefined" && defaults.type == "class") { defaults.top_key = window["qd_top_key"]; } 9711 if (defaults.top_guid == null && typeof (window["qd_news_guid"]) != "undefined") { defaults.top_guid = window["qd_news_guid"]; } 9712 var div = $(this); 9713 if(div.length==0){console.log("cates not exists");return;} 9714 if(typeof(div.attr("name"))=="undefined") 9715 { 9716 var type="ndetail"; 9717 if(defaults.type=="class"){type="nclass";} 9718 $(div).attr("name", type); 9719 type=null; 9720 } 9721 9722 var rows = []; 9723 if (defaults.type == "class") { 9724 cates.sub(function (x, i) { 9725 if (x.qd_key == defaults.top_key) { 9726 rows = x.children; 9727 } 9728 }); 9729 } else if (defaults.type == "detail") { 9730 if (defaults.top_key != null) { 9731 cates.sub(function (x, i) { if (x.qd_key == defaults.top_key) { defaults.top_guid = x.qd_guid; } }); 9732 } 9733 rows = news.where(function (x, i) { return x.qd_class_guid == defaults.top_guid; }).sort(function (a, b) { 9734 if (a.qd_id1 > b.qd_id1) { 9735 return 1; 9736 } else { 9737 return -1; 9738 } 9739 }); 9740 } 9741 if (defaults.data != null) { rows = defaults.data; } 9742 que({ 9743 index: defaults.index, 9744 first:defaults.first, 9745 last:defaults.last, 9746 em: div, 9747 data: rows, 9748 format: function (row, i, index) { 9749 return defaults.format(row, i, index); 9750 } 9751 }); 9752 if ($(defaults.cate).length>0) { 9753 que({ 9754 index: defaults.index, 9755 first:defaults.first_cate, 9756 last:defaults.last_cate, 9757 em: defaults.cate, 9758 data: rows, 9759 format: function (row, i, index) { 9760 return defaults.format_cate(row, i, index); 9761 }, 9762 call: function (node, rs) { 9763 $(defaults.cate).unbind("change").change(function () { 9764 window.location.href = $(this).val(); 9765 }); 9766 } 9767 }); 9768 } 9769 defaults.call(div,rows); 9770}; 9771$.html_neighbor = function (options) { 9772 var defaults = { 9773 id: "qd_id1", 9774 prev: "#prev", 9775 next: "#next", 9776 data: null, 9777 format: function (row, i) { 9778 return row.qd_name; 9779 } 9780 }; 9781 $.extend(defaults, options); 9782 var list = news.where(function (x, i) { return x.qd_class_guid == qd_news_guid; }).sort(function (a, b) { 9783 var cal = a[defaults.id] < b[defaults.id]; 9784 if (defaults.id == "qd_id") { cal = a[defaults.id] > b[defaults.id] } 9785 if (cal) { 9786 return 1; 9787 } else { 9788 return -1; 9789 } 9790 cal = null; 9791 }); 9792 if (defaults.data != null) { list = defaults.data; } 9793 var prev = list.prev(function (x, i) { return x.qd_guid == qd_guid; }); 9794 var next = list.next(function (x, i) { return x.qd_guid == qd_guid; }); 9795 if (typeof (prev) != "undefined") { 9796 $(defaults.prev).attr("href", site_path + prev.qd_path).html(defaults.format(prev)); 9797 } 9798 if (typeof (next) != "undefined") { 9799 $(defaults.next).attr("href", site_path + next.qd_path).html(defaults.format(next)); 9800 } 9801 next = null; 9802 prev = null; 9803 list = null; 9804};
9805$.fn.auto_size = function (em) { 9806 if (typeof (em) == "undefined") { em = "table,iframe,video"; } 9807 var div = $(this); 9808 $(div).find(em).each(function (i, v) { 9809 var width = $(v).width(); 9810 var height = $(v).height(); 9811 var max_width = $(div).width(); 9812 if (width > max_width) { 9813 var bilv = max_width / width; 9814 var left = 0 - (width - max_width) / 2; 9815 var top = 0 - (height - (height * bilv)) / 2; 9816 9817 $(v).css("transform", "scale(" + bilv + "," + bilv + ")"); 9818 var width = width * bilv; 9819 var height = height * bilv; 9820 height = 200; 9821 $(v).css({ 9822 marginTop: top + "px", 9823 marginLeft: left + "px" 9824 }); 9825 $(v).next("*").css({ 9826 marginTop: top + "px" 9827 }) 9828 } 9829 9830 }); 9831}; 9832$.fn.page_reload=function(options){ 9833 var defaults={ 9834 id:"news", 9835 first_title:"第ä¸é¡µ", 9836 prev_title:"ä¸ä¸é¡µ", 9837 next_title:"ä¸ä¸é¡µ", 9838 last_title:"尾页", 9839 total:0, 9840 pagesize:10, 9841 page:1, 9842 left:true, 9843 right:true, 9844 center:true, 9845 format:function(i,page){ 9846 return `<a href="javascript:void(0);" class="bt_page ${page==i?'bt_page_hover':''}" name="bt_page" page="${i}">${i}</a>`; 9847 }, 9848 click:function(page,total){ 9849 9850 }, 9851 change:function(page,total){ 9852 9853 } 9854 }; 9855 $.extend(defaults,options); 9856 var node=$(this); 9857 var total=defaults.total; 9858 var pagesize=defaults.pagesize; 9859 var page=parseInt(defaults.page); 9860 var max_page=Math.floor(defaults.total/defaults.pagesize)*defaults.pagesize; 9861 var pagecount=Math.ceil(defaults.total/defaults.pagesize); 9862 if(isNaN(page)){page=1;} 9863 var prev=page-1; 9864 if(prev<1){prev=1;} 9865 var next=page+1; 9866 if(next>total){next=total;} 9867 9868 var tb_htm=""; 9869 var start=page-1; 9870 var last=start+pagesize; 9871 9872 if(total<pagesize){last=total;} 9873 var page_step=Math.ceil(page/pagesize); 9874 var start=(page_step*pagesize)-pagesize+1; 9875 var last=start+pagesize-1; 9876 if(start<1){start=1;} 9877 if(last>total){last=total;} 9878 9879 9880 if(defaults.left) 9881 { 9882 tb_htm+=`<div class="page_left">`; 9883 tb_htm+=` 9884 9885 <button name="bt_page" page="1"class="page_btn fa fa-fast-backward ${page==1?`page_btn_disabled`:``}" title="${defaults.first_title}"></button> 9886 <button name="bt_page" page="${prev}" class="page_btn fa fa-backward ${page<=1?`page_btn_disabled`:``}" title="${defaults.prev_title}"></button> 9887 ${page>pagesize?`<button name="bt_page_other" class="page_btn page_pc">...</button> `:``} 9888 `; 9889 tb_htm+=`</div>`; 9890 } 9891 if(defaults.center) 9892 { 9893 tb_htm+=`<div class="page_center">`; 9894 for(var i=start;i<=last;i++) 9895 { 9896 tb_htm+=`<button name="bt_page" page="${i}" class="page_btn ${page==i?'page_btn_hover':''}">${i}</button>`; 9897 } 9898 tb_htm+=`</div>`; 9899 } 9900 tb_htm+=`<div class="page_phone"> 9901 <select id="page_index" class="page_select">`; 9902 for(var i=start;i<=last;i++) 9903 { 9904 tb_htm+=`<option value="${i}" class="page_option" ${page==i?'selected':''}>${i}/${total}</option>`; 9905 } 9906 tb_htm+=`</select></div>`; 9907 if(defaults.right) 9908 { 9909 tb_htm+=`<div class="page_right">`; 9910 tb_htm+=` 9911 ${page>=pagesize&&page<=max_page?`<button name="bt_page_other" class="page_btn page_pc">...</button> `:``} 9912 <button name="bt_page" page="${next}" class="page_btn fa fa-forward ${page>=total?`page_btn_disabled`:``}" title="${defaults.next_title}"></button> 9913 <button name="bt_page" page="${total}" class="page_btn fa fa-fast-forward ${page==total?`page_btn_disabled`:``}" title="${defaults.last_title}"></button> 9914 `; 9915 tb_htm+=`</div>`; 9916 } 9917 9918 tb_htm+=`<div class="page_other"> 9919 <input type="number" min="1" max="${total}" step="1" defaultValue="1" name="input_page" value="${defaults.page}" size="4" maxlength="10" class="page_input" ${total<=1?`disabled readonly`:``}"> 9920 /${total}</div>`; 9921 node.html(tb_htm); 9922 $(node).find(`[name='bt_page']`).unbind("click").click(function(e){ 9923 var new_page=$(this).attr("page"); 9924 if(page==new_page){return;} 9925 defaults.click(new_page,total); 9926 }); 9927 $(node).find(`[name='input_page']`).unbind("change").change(function(e){ 9928 var new_page=parseInt($(this).val()); 9929 if(isNaN(new_page)){return;} 9930 defaults.change(new_page,total); 9931 }); 9932 $(node).find(`#page_index`).unbind("change").change(function(e){
9933 var new_page=parseInt($(this).val()); 9934 defaults.change(new_page,total); 9935 }); 9936}; 9937$.fn.tb_reload = function (options) { 9938 var tb = $(this); 9939 if(tb.length==0){console.log("tb not exists");return;} 9940 tb.css({minHeight:"100px"}); 9941 var defaults = { 9942 data: [], 9943 pagelength: 5, 9944 pagesize: 12, 9945 page: 1, 9946 top_key: null, 9947 top_guid: null, 9948 none_id:"tb_notice", 9949 none_str:`<center style="color:#f00;">æ </center>`, 9950 type: "news", 9951 pagebar: null, 9952 where: function (row, keywords) { 9953 if (typeof (row.qd_tag) != "undefined") { 9954 return row.qd_name.toLowerCase().indexOf(keywords.toLowerCase()) != -1 || row.qd_tag.toLowerCase().indexOf(keywords.toLowerCase()) != -1; 9955 } else { 9956 return row.qd_name.toLowerCase().indexOf(keywords.toLowerCase()) != -1; 9957 } 9958 9959 }, 9960 sort_id: "qd_id", 9961 sort_way: "desc", 9962 page_click:function(page){}, 9963 format: function (row, i) { 9964 9965 }, 9966 before: function (node, rs, total, pagecount, page) { 9967 9968 }, 9969 call: function (node, rs, total, pagecount, page) { 9970 9971 } 9972 }; 9973 $.extend(defaults, options); 9974 if (defaults.top_guid == null && typeof (window["qd_news_guid"]) != "undefined") { defaults.top_guid = window["qd_news_guid"]; } 9975 var data = defaults.data; 9976 var page = defaults.page; 9977 var pagesize = defaults.pagesize; 9978 if(Array.isArray(defaults.where)) 9979 { 9980 var ws=defaults.where; 9981 for(var i=0;i<ws.length;i++) 9982 { 9983 var w=ws[i]; 9984 data = data.where(function (row, i) { 9985 return w(row, keywords); 9986 }); 9987 w=null; 9988 } 9989 }else if(typeof(defaults.where)=="function") 9990 { 9991 var keywords = ""; 9992 if (typeof ($.get_string) == "function") 9993 { 9994 keywords = $.get_string("keywords"); 9995 if (keywords != "") 9996 { 9997 data = data.where(function (row, i) { 9998 return defaults.where(row, keywords); 9999 }); 10000 } 10001 } 10002 } 10003 if (defaults.type == "news") { 10004 if ((defaults.top_key != null || defaults.top_guid != null) && typeof (cates) == "object") { 10005 if (cates instanceof Array) { 10006 var qd_guid; 10007 var rows = []; 10008 cates.sub(function (x, i) { 10009 if(defaults.top_key!=null) 10010 { 10011 if (x.qd_key == defaults.top_key) { 10012 rows = x.children; 10013 qd_guid = x.qd_guid; 10014 } 10015 }else 10016 { 10017 if (x.qd_guid == defaults.top_guid) { 10018 rows = x.children; 10019 qd_guid = x.qd_guid; 10020 } 10021 } 10022 10023 }); 10024 var raws = ["{" + qd_guid + "}"]; 10025 rows.sub(function (x, i) { 10026 raws.push("{" + x.qd_guid + "}"); 10027 }); 10028 var str = raws.join(","); 10029 data = data.where(function (x, i) { 10030 return str.indexOf("{" + x.qd_class_guid + "}") != -1; 10031 }); 10032 str = null; 10033 raws = null; 10034 rows = null; 10035 qd_guid = null; 10036 } 10037 } 10038 } else { 10039 10040 } 10041 var total = data.length; 10042 var pagecount = Math.ceil(total / pagesize); 10043 if(page<1){page=1;} 10044 if(page>=pagecount){page=pagecount} 10045 data.sort(function (a, b) { 10046 var cal = b[defaults.sort_id] > a[defaults.sort_id]; 10047 if (defaults.sort_way != "desc") { 10048 cal = b[defaults.sort_id] < a[defaults.sort_id]; 10049 } 10050 if (cal) { 10051 return 1; 10052 } else { 10053 return -1; 10054 } 10055 cal = null; 10056 }); 10057 var new_data = data; 10058 var n_data = defaults.before(tb, data); 10059 if (Array.isArray(n_data)) { new_data = n_data; } 10060 n_data = null; 10061 if(total==0&&defaults.none_id!=null){ 10062 if($("#"+defaults.none_id).length==0){ 10063 tb.after(`<div id="${defaults.none_id}">${defaults.none_str}</div>`); 10064 }else{ 10065 if($("#"+defaults.none_id).length>0) 10066 { 10067 $("#"+defaults.none_id).remove(); 10068 } 10069 } 10070 } 10071 new_data.to_rows(pagesize, page, function (ex, rs) { 10072 que({ 10073 em: tb, 10074 data: rs, 10075 format: function (row, i) { 10076 return defaults.format(row, i); 10077 }, 10078 call:function(node,rs){ 10079 if(defaults.pagebar!=null) 10080 { 10081 $(defaults.pagebar).page_reload({ 10082 total:pagecount, 10083 page:page, 10084 click:function(page,total){ 10085 defaults.page = page; 10086 $(tb).tb_reload(defaults); 10087 defaults.page_click(page); 10088 }, 10089 change:function(page,total){ 10090 defaults.page = page; 10091 $(tb).tb_reload(defaults); 10092 defaults.page_click(page); 10093 } 10094 });
10095 } 10096 } 10097 }); 10098 defaults.call(tb, rs, total, pagecount, page); 10099 }); 10100}; 10101$.fn.html_loc = function (options) { 10102 var defaults = { 10103 top_key: null, 10104 val: " » ", 10105 type: "class", 10106 text: "å½åä½ç½® : ", 10107 format: function (row, i) { 10108 if (row.qd_type == "å页" || row.qd_type == "æ ") { 10109 return row.qd_name; 10110 } else { 10111 if (row.qd_path.indexOf(site_path) == -1) { row.qd_path = site_path + row.qd_path; } 10112 return `<a href="${row.qd_path}">${row.qd_name}</a>`; 10113 } 10114 } 10115 }; 10116 $.extend(defaults, options); 10117 var node = $(this); 10118 if(node.length==0){console.log("cates not exists");return;} 10119 var rows = []; 10120 each(qd_news_guid); 10121 var tb_htm = defaults.text + rows.reverse().map(function (x, i) { 10122 return defaults.format(x, i); 10123 }).join(defaults.val); 10124 rows = null; 10125 $(node).html(tb_htm); 10126 10127 function each(qd_guid) { 10128 cates.sub(function (x, i) { 10129 if (x.qd_guid == qd_guid) { 10130 var row = {}; 10131 $.extend(row, x); 10132 delete row.children; 10133 rows.push(row); 10134 row = null; 10135 if (x.qd_top == "æ¯" || x.qd_parent_guid == "0") {}else{each(x.qd_parent_guid);} 10136 } 10137 }); 10138 } 10139 10140 10141}; 10142 10143$.fn.mm=function(options){ 10144 var defaults={ 10145 id:"mm", 10146 data:[], 10147 format_one:function(row,i,id){ 10148 var tb_htm=`<div class="${id}_item" style="display:flex;display:-webkit-flex;column-gap:5px;justify-content:space-between;padding:5px;">`; 10149 tb_htm+=`<a href="${row.qd_path}" class="${id}_name" style="display:-webkit-flex;justify-content:center;align-items:center;">${row.qd_name}</a>`; 10150 if(row.children.length>0){tb_htm+=`<div class="${id}_more" qd_guid="${row.qd_guid}" style="cursor:pointer;width:40px;display:flex;display:-webkit-flex;justify-content:center;align-items:center;">></div>`;} 10151 tb_htm+=`</div>`; 10152 10153 return tb_htm; 10154 } 10155 }; 10156 $.extend(defaults, options); 10157 var data=defaults.data; 10158 var id=defaults.id; 10159 var div=$(this); 10160 div.html(`<div id="${id}_tb" style="display:grid;grid-template-rows:40px auto;width:100%;height:100%;margin:auto;padding:0px;"> 10161 <div id="${id}_thead" style="display:flex;display:-webkit-flex;column-gap:5px;height:30px;justify-content:space-between;"> 10162 <div id="${id}_back" style="display:flex;display:-webkit-flex;justify-content:center;align-items:center;width:40px;font-size:14px;font-family:arial;border-right:1px solid #ddd;font-weight:bold;cursor:pointer;"><</div> 10163 <input type="hidden" id="${id}_guid" value=""> 10164 <input type="hidden" id="${id}_parent_guid" value=""> 10165 <div id="${id}_name" style="white-space:nowrap;overflow:hidden;width:100%;text-align:center;display:flex;display:-webkit-flex;justify-content:center;align-items:center;font-size:14px;"></div> 10166 <div id="${id}_close" style="display:flex;display:-webkit-flex;justify-content:center;align-items:center;width:40px;font-size:14px;font-family:arial;border-left:1px solid #ddd;cursor:pointer;font-weight:bold;">X</div> 10167 </div> 10168 <div id="${id}_tbody" style="display:flex;display:-webkit-flex;flex-direction:column;row-gap:5px;overflow:auto;height:100%;box-sizing:border-box;padding:10px;"></div> 10169 </div>`); 10170 var tb=div.children(`#${id}_tb`); 10171 var thead=tb.children(`#${id}_thead`); 10172 var tbody=tb.children(`#${id}_tbody`); 10173 var back=thead.children(`#${id}_back`); 10174 var name=thead.children(`#${id}_name`); 10175 var guid=thead.children(`#${id}_guid`); 10176 var parent_guid=thead.children(`#${id}_parent_guid`); 10177 var close=thead.children(`#${id}_close`); 10178 reload(); 10179 $(div).on({ 10180 click:function(){ 10181 $(`#${id}_guid`).val($(this).attr("qd_guid")); 10182 reload(); 10183 } 10184 },`.${id}_more`); 10185 10186 close.click(function(e){ 10187 div.hide(); 10188 }); 10189 back.click(function(e){ 10190 var qd_parent_guid=$(parent_guid).val(); 10191 $(guid).val(qd_parent_guid); 10192 reload(); 10193 }); 10194 function reload(){ 10195 var rows=data; 10196 var qd_guid=$(`#${id}_guid`).val(); 10197 $(name).html(""); 10198 if(qd_guid!="") 10199 { 10200 data.sub(function(x,i){ 10201 if(x.qd_guid==qd_guid){ 10202 rows=x.children; 10203 $(name).html(x.qd_name); 10204 $(parent_guid).val(x.qd_parent_guid); 10205 } 10206 }); 10207 } 10208 que({ 10209 em:tbody, 10210 data:rows, 10211 format:function(row,i){ 10212 return defaults.format_one(row,i,id); 10213 }, 10214 call:function(node,rs){ 10215 10216 } 10217 }); 10218 10219 } 10220}; 10221 10222$.max_zindex = function () { 10223 var rows = []; 10224 $("*").each(function (i, v) { 10225 if (!isNaN(parseInt($(v).css("z-index")))) { 10226 rows.push(parseInt($(v).css("z-index"))); 10227 } 10228 }); 10229 10230 rows.sort(function (a, b) { 10231 if (a < b) { 10232 return 1; 10233 } else { 10234 return -1; 10235 } 10236 }); 10237 if (rows.length > 0) { 10238 if (rows[0] >= 9999) { rows[0] = 9999; } 10239 return rows[0] + 1; 10240 } else { 10241 return "1"; 10242 } 10243}; 10244 10245function label_view() { 10246 var node; 10247 var rows = []; 10248 this.label = function (key, name) { 10249 var row = labels[key]; 10250 rows = labels[key]["qd_code"]; 10251 if (!Object.prototype.toString.call(rows).toLowerCase() == "[object array]") { rows = []; console.log("labels:" + key + "ä¸åå¨") } 10252 node = $("#" + key); 10253 if (labels[key]["qd_thead_flag"] == "æ¾ç¤º") { node = $("#" + key + "_tbody"); } 10254 var vid = $(node).attr("vid"); 10255 var dis = $(node).attr("dis"); 10256 var wrap = $(node).attr("wrap"); 10257 var edit = $(node).attr("edit"); 10258 switch (row.qd_type) { 10259 case "block": 10260 $(node).html(row.qd_tbody); 10261 break; 10262 case "label": 10263 $(node).html(row.qd_tbody); 10264 break; 10265 case "diy": 10266 if (typeof (view) == "object") { 10267 if (typeof (view[qd_key]) == "function") { 10268 var data = {}; 10269 for (var j = 0; j < rows.length; j++) { 10270 var r = rows[j]; 10271 data[r.qd_name] = r.qd_value 10272 r = null; 10273 } 10274 view[qd_key](node, data); 10275 data = null; 10276 } 10277 } 10278 break; 10279 10280 case "img": 10281 switch (dis) { 10282 case "back": 10283 $(node).css("background-image", "url('" + row.qd_tbody + "')"); 10284 break; 10285 case "poster": 10286 $(node).attr("poster", row.qd_tbody); 10287 break; 10288 case "link": 10289 $(node).attr("href", row.qd_tbody); 10290 break; 10291 default: 10292 $(node).attr("src", row.qd_tbody); 10293 break; 10294 } 10295 break; 10296 default: 10297 var tb_htm = ""; 10298 if (typeof (view) == "object") { 10299 if (typeof (view[key]) == "function") { 10300 10301 if (Object.prototype.toString.call(rows).toLowerCase() == "[object array]") { 10302 for (var j = 0; j < rows.length; j++) { 10303 var r = rows[j]; 10304 if (wrap == "no") { 10305 tb_htm += view[key](r, j); 10306 } else { 10307 tb_htm += "<div>"; 10308 tb_htm += view[key](r, j); 10309 tb_htm += "</div>"; 10310 } 10311 r = null; 10312 } 10313 } 10314 $(node).html(tb_htm); 10315 10316 } else if (typeof (view[key]) == "object") { 10317 if (Object.prototype.toString.call(rows).toLowerCase() == "[object array]") { 10318 if (typeof (view[key]["html"]) == "function") { 10319 for (var j = 0; j < rows.length; j++) { 10320 var r = rows[j]; 10321 if (wrap == "no") { 10322 tb_htm += view[key]["html"](r, j); 10323 } else { 10324 tb_htm += "<div>"; 10325 tb_htm += view[key]["html"](r, j); 10326 tb_htm += "</div>"; 10327 } 10328 r = null; 10329 } 10330 } 10331 10332 } 10333 $(node).html(tb_htm); 10334 if (typeof (view[key]["call"]) == "function") { view[key]["call"](node, rows); } 10335 } 10336 } 10337 tb_htm = null; 10338 break; 10339 } 10340 10341 return this; 10342 }; 10343 this.lb = function (key, name) { 10344 rows = lbs[key]; 10345 if (!Object.prototype.toString.call(rows).toLowerCase() == "[object array]") { rows = []; console.log("lbs:" + key + "ä¸åå¨") } 10346 node = $(`[name='lb'][qd_key='${key}']`); 10347 return this; 10348 }; 10349 this.html = function (call) { 10350 var tb_htm = ""; 10351 for (var i = 0; i < rows.length; i++) { 10352 var row = rows[i]; 10353 tb_htm += call(row, i); 10354 row = null; 10355 } 10356 node.html(tb_htm); 10357 tb_htm = null; 10358 return this; 10359 }; 10360 this.call = function (call) { 10361 call(node, rows); 10362 }; 10363} 10364/*计æ°å¨*/ 10365$.fn.num=function(options){ 10366 var defaults={ 10367 css:"num", 10368 val:1, 10369 step:1, 10370 size:4, 10371 min:1, 10372 readonly:"readonly", 10373 max:9999, 10374 change:function(num){ 10375 10376 } 10377 }; 10378 $.extend(defaults,options); 10379 var div=$(this); 10380 if(div.length==0){console.log("divä¸åå¨");return;} 10381 div.hide(); 10382 if(typeof(div.data("defaults")) =="undefined"){div.data("defaults",defaults);} 10383 defaults=div.data("defaults"); 10384 var css=defaults.css; 10385 10386 div.each(function(i,v){ 10387 if(typeof($(v).data("id"))=="undefined") 10388 { 10389 var $v=$(v); 10390 var id=rand(6); 10391 $v.data({ 10392 id:id 10393 }); 10394 var size=parseInt($v.attr("size")); 10395 var min=parseFloat($v.attr("min")); 10396 var max=parseFloat($v.attr("max")); 10397 var step=parseFloat($v.attr("step")); 10398 var readonly=$v.attr("readonly"); 10399 if(isNaN(size)){size="";}else{size=`size=${size}`;} 10400 if(typeof(readonly)=="undefined"){readonly=defaults.readonly;} 10401 if(isNaN(min)){min=defaults.min;} 10402 if(isNaN(max)){max=defaults.max;} 10403 if(isNaN(step)){step=defaults.step;} 10404 $v.after(` 10405 <div class="${css}_tb" id="${id}"> 10406 <div class="${css}_item" cname="num_prev" qd_id="${id}">-</div> 10407 <input type="text" class="${css}_input" cname="num_input" id="${id}_num" value="${defaults.val}" ${size} min="${min}" max="${max}" step="${step}" qd_id="${id}" ${readonly} > 10408 <div class="${css}_item" cname="num_next" qd_id="${id}">+</div> 10409 </div> 10410 `); 10411 $(id).data("v",$v); 10412 size=null; 10413 id=null; 10414 min=null; 10415 max=null; 10416 step=null; 10417 readonly=null; 10418 } 10419 10420 }); 10421 $(document).on({ 10422 click:function(e){
10423 var id=$(this).attr("qd_id"); 10424 var v=$(`#${id}`).prev("input"); 10425 var $v=$(`#${id}_num`); 10426 var min=parseFloat($v.attr("min")); 10427 var max=parseFloat($v.attr("max")); 10428 var step=parseFloat($v.attr("step")); 10429 var num=parseFloat($v.val()); 10430 num=num-step; 10431 if(isNaN(num)){ 10432 console.log("请è¾å ¥æ°åæ ¼å¼!"); 10433 $v.val($(v).val()); 10434 return; 10435 } 10436 10437 if(num<min){num=min;} 10438 $v.val(num); 10439 $(v).val(num); 10440 defaults.change($(v),num); 10441 id=null; 10442 num=null; 10443 min=null; 10444 max=null; 10445 step=null; 10446 } 10447 },"[cname='num_prev']"); 10448 10449 $(document).on({ 10450 click:function(e){ 10451 var id=$(this).attr("qd_id"); 10452 var v=$(`#${id}`).prev("input"); 10453 var $v=$(`#${id}_num`); 10454 var min=parseFloat($v.attr("min")); 10455 var max=parseFloat($v.attr("max")); 10456 var step=parseFloat($v.attr("step")); 10457 var num=parseFloat($v.val()); 10458 num=num+step; 10459 if(isNaN(num)){ 10460 console.log("请è¾å ¥æ°åæ ¼å¼!"); 10461 $v.val($(v).val()); 10462 return; 10463 } 10464 10465 if(num>max){num=max;} 10466 $v.val(num); 10467 $(v).val(num); 10468 defaults.change($(v),num); 10469 id=null; 10470 num=null; 10471 min=null; 10472 max=null; 10473 step=null; 10474 } 10475 },"[cname='num_next']"); 10476 10477 $(document).on({ 10478 change:function(e){ 10479 var id=$(this).attr("qd_id"); 10480 var v=$(`#${id}`).prev("input"); 10481 var $v=$(`#${id}_num`); 10482 var min=parseFloat($v.attr("min")); 10483 var max=parseFloat($v.attr("max")); 10484 var num=parseFloat($v.val()); 10485 10486 if(isNaN(num)){ 10487 console.log("请è¾å ¥æ°åæ ¼å¼!"); 10488 $v.val($(v).val()); 10489 return; 10490 } 10491 10492 if(num<min){num=min;} 10493 if(num>max){num=max;} 10494 $v.val(num); 10495 $(v).val(num); 10496 defaults.change($(v),num); 10497 id=null; 10498 num=null; 10499 min=null; 10500 max=null; 10501 } 10502 },"[cname='num_input']"); 10503}; 10504var nview=[]; 10505var cview={}; 10506var dview={}; 10507var LVIEW = new label_view();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.