1var isLogin, login, appShare, share, shareWithType, pushVideoDetail, refreshHeight; 2var umsDomain = "u.meia.me"; 3var eduDomain = "meia.me"; 4if (window.webkit && window.webkit.messageHandlers) { 5 var iosBridge = window.webkit.messageHandlers; 6 if (iosBridge.log) { 7 console.log = function (a) { 8 iosBridge.log.postMessage(a); 9 } 10 } 11 console.log("å¼å§å¢å 彿°"); 12 var count = 0; 13 if (iosBridge.isLogin) { 14 count++; 15 isLogin = function () { 16 console.log("call isLogin"); 17 iosBridge.log.postMessage(); 18 } 19 } 20 if (iosBridge.login) { 21 count++; 22 login = function () { 23 console.log("call login"); 24 iosBridge.login.postMessage(); 25 } 26 } 27 if (iosBridge.appShare) { 28 count++; 29 appShare = function (type, title, desc, img, url) { 30 var param = { 31 type: type, 32 title: title, 33 desc: desc, 34 img: img, 35 url: url 36 } 37 console.log("call appShare, param->" + JSON.stringify(param)); 38 iosBridge.appShare.postMessage(JSON.stringify(param)); 39 } 40 } 41 if (iosBridge.share) { 42 count++; 43 share = function () { 44 console.log("call share"); 45 iosBridge.share.postMessage(); 46 } 47 } 48 if (iosBridge.shareWithType) { 49 count++; 50 shareWithType = function (a) { 51 console.log("call shareWithType, param->" + a); 52 iosBridge.shareWithType.postMessage(a); 53 } 54 } 55 if (iosBridge.pushVideoDetail) { 56 count++; 57 pushVideoDetail = function (a) { 58 console.log("call pushVideoDetail, param->" + a); 59 iosBridge.pushVideoDetail.postMessage(a); 60 } 61 } 62 if (iosBridge.refreshHeight) { 63 count++; 64 refreshHeight = function () { 65 console.log("call refreshHeight"); 66 iosBridge.refreshHeight.postMessage(); 67 } 68 } 69 console.log(count + "ä¸ªå½æ°å·²å¢å ") 70} 71$(function () { 72 //è·åç¨æ·ä¸å¿å°å 73 umsDomain = $("#umsDomain").data("domain") || umsDomain; 74 eduDomain = $("#eduDomain").data("domain") || eduDomain; 75 $("body").delegate(".video_box a,.act_box a", "click", function (e) { 76 e.stopPropagation(); 77 }); 78 $("body").delegate(".video_lecturer a,.act_logos a", "mouseover", 79 function (e) { 80 e.stopPropagation(); 81 }); 82 $("body").delegate(".video_layout .video_box,.gridlay .video_box", "click", 83 function () { 84 $(this).find(".video_bg a")[0].click(); 85 }); 86 $("body").delegate(".act_box", "click", function (e) { 87 $(this).find(".act_bg a")[0].click(); 88 }); 89 90 //ç»å®åå¤åæ°éå¶äºä»¶ 91 $("body").delegate(".js_limitCont", "input", function () { 92 var wordLength = $(this).val().length; 93 if (wordLength > 200) { 94 $(this).val($(this).val().substr(0, 200)) 95 } else { 96 $(this).siblings(".js_wordLimit").text("è¿å¯è¾å ¥" + (200 - wordLength) + "å"); 97 } 98 }); 99 100 if (!isMobile()) { 101 // 课ç¨çäºä»¶å¤ç 102 $("body").delegate(".video_layout .video_box,.gridlay .video_box", 103 "mouseover", function () { 104 $(this).css("cursor", "pointer"); 105 $(this).find(".video_txt h5 a").addClass("hover"); 106 $(this).find("a[class^=icon]").addClass("hover"); 107 }); 108 $("body").delegate(".video_layout .video_box,.gridlay .video_box", 109 "mouseout", function () { 110 $(this).css("cursor", ""); 111 $(this).find(".video_txt h5 a").removeClass("hover"); 112 $(this).find("a[class^=icon]").removeClass("hover"); 113 }); 114 115 // æ´»å¨çå表äºä»¶å¤ç 116 $("body").delegate(".act_box", "mouseover", function (e) { 117 $(this).css("cursor", "pointer") 118 $(this).find(".act_caption h5 a").addClass("hover"); 119 }); 120 $("body").delegate(".act_box", "mouseout", function (e) { 121 $(this).css("cursor", ""); 122 $(this).find(".act_caption h5 a").removeClass("hover"); 123 }); 124 } 125 //open native 126 if (typeof pushVideoDetail == 'function') { 127 $("a").click(function (e) { 128 var url = $(this).attr("href"); 129 var courseid = 0; 130 var courseReg = /(meia.me\/)?course\/(\d+)\/?.*?/ig; 131 var match = courseReg.exec(url); 132 if (match && match.length == 3) { 133 courseid = match[2]; 134 if (courseid > 0) { 135 e.preventDefault(); 136 pushVideoDetail(courseid); 137 } 138 } 139 }); 140 } 141 142 //ç¼è¾å¨å å¾çæ§å¶ 143 if ($(window).width() < 767) { 144 $("._js_editorImg img").parent().css({ 145 "display": "block", 146 "margin-left": "-25px", 147 "margin-right": "-25px", 148 "text-align": "center" 149 }); 150 } 151}); 152 153function hideHeader() { 154 $(".nav_navbar").hide(); 155 $(".main-container").css("top", 0); 156 $(".bottom_banner").css("top", 0); 157 $(".footbar").css("top", 0); 158} 159 160function escapeHTML(a) { 161 a = "" + a; 162 return a.replace("<", "<").replace(">", ">").replace("&", "&") 163 .replace('"', """).replace("'", "'").replace("'", "'").replace("\\", "\"); 164} 165 166function unescapeHTML(a) { 167 a = "" + a; 168 return a.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&") 169 .replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'").replace(/\/g, "\\"); 170} 171 172function isWechat() { 173 var ua = navigator.userAgent.toLowerCase(); 174 return /micromessenger/i.test(ua) || /windows phone/i.test(ua); 175} 176 177function isMobile() { 178 return navigator.userAgent.indexOf("iPad") == -1
179 && (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/ 180 .test(navigator.userAgent))); 181} 182 183function isPhone(number) { 184 return /^(0|86|17951)?(13|14|15|16|17|18|19)[0-9]{9}$/.test(number); 185} 186 187function isEmail(str) { 188 return /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(str); 189} 190 191function formatePrice(price) { 192 price = parseFloat(price) || 0; 193 if (price == 0) 194 return "0"; 195 else 196 return price.toFixed(2); 197} 198 199function getQuery(name) { 200 return location.href.match(new RegExp('[?#&]' + name + '=([^?#&]+)', 'i')) ? RegExp.$1 : ''; 201} 202 203function getShareImg() { 204 var share_img = ""; 205 $("img").each(function () { 206 var imgSrc = getImgSrc($(this).attr("src")); 207 if ($(this).height() >= 100 && imgSrc.indexOf("/u/") != -1) { 208 share_img = imgSrc; 209 return false; 210 } 211 }) 212 return share_img; 213} 214 215function getImgSrc(imgSrc) { 216 var protocol = window.location.protocol; 217 var host = window.location.host; 218 var paths = window.location.pathname; 219 var path = paths.split("/"); 220 var realPath = ""; 221 for (var i = 0; i < path.length - 1; i++) { 222 realPath += path[i] + "/"; 223 } 224 if (imgSrc.indexOf("http://") == 0 || imgSrc.indexOf("https://") == 0) { 225 imgSrc = imgSrc; 226 } else if (imgSrc.indexOf("//") == 0) { 227 imgSrc = protocol + imgSrc; 228 } else if (imgSrc.indexOf("/") == 0) {
229 imgSrc = protocol + "//" + host + imgSrc; 230 } else { 231 if (imgSrc != '') { 232 imgSrc = protocol + "//" + host + realPath + imgSrc; 233 } 234 } 235 return imgSrc; 236} 237 238function getDate(n) { 239 var today = new Date(); 240 today.setHours(0); 241 today.setMinutes(0); 242 today.setSeconds(0); 243 today.setMilliseconds(0); 244 var oneday = 24 * 60 * 60 * 1000; 245 return new Date(today.getTime() + n * oneday); 246} 247 248//è¿åæ¶é´çææå 忥æ 249function humanDate(dateStr) { 250 var weeks = ["æææ¥", "ææä¸", "ææäº", "ææä¸", "ææå", "ææäº", "ææå "]; 251 var d = new Date(dateStr); 252 var week = weeks[d.getDay()]; 253 254 var beforeTomorrow = getDate(1).getTime() - d.getTime(); 255 var duration = d.getTime() - new Date().getTime(); 256 257 var oneday = 24 * 60 * 60 * 1000; 258 if (duration > beforeTomorrow && duration < beforeTomorrow + oneday) { 259 return "æå¤© " + week + " " + dateStr.substring(10, 16); 260 } else if (duration < beforeTomorrow) { 261 return "ä»å¤© " + week + " " + dateStr.substring(10, 16); 262 } else { 263 return (d.getMonth() + 1) + "æ" + d.getDate() + "æ¥ " + week + " " + dateStr.substring(10, 16); 264 } 265} 266 267//è¿åæ¶é´ç¸å·®çå åå ç§ 268function timeDiff(time1, time2) { 269 var t1 = new Date(time1); 270 var t2 = new Date(time2); 271 var duration = t1.getTime() - t2.getTime(); 272 var hour = parseInt((duration * 1.0 / 1000 / 60 / 60)); 273 var minute = parseInt((duration * 1.0 / 1000 / 60) % 60); 274 var second = parseInt((duration * 1.0 / 1000) % 60); 275 if (hour >= 24) { 276 return Math.floor(hour / 24) + "天" + (hour % 24) + "å°æ¶" + (minute >= 10 ? minute : "0" + minute) + "å"; 277 } else if (second > 0) { 278 return hour + "å°æ¶" + (minute >= 10 ? minute : "0" + minute) + "å" + (second >= 10 ? second : "0" + second) + "ç§"; 279 } else { 280 hour = hour * -1; 281 minute = minute * -1; 282 second = second * -1; 283 if (hour >= 24) { 284 return Math.floor(hour / 24) + "天" + (hour % 24) + "å°æ¶" + (minute >= 10 ? minute : "0" + minute) + "åå"; 285 } else { 286 return hour + "å°æ¶" + (minute >= 10 ? minute : "0" + minute) + "å" + (second >= 10 ? second : "0" + second) + "ç§å"; 287 } 288 } 289} 290 291function paging(pageID, p, size, sum, fn, param1) { 292 var total = (sum % size == 0) ? (sum / size) : (Math.floor(sum / size) + 1); 293 var options = { 294 currentPage: p, 295 totalPages: total, 296 bootstrapMajorVersion: 3, 297 shouldShowPage: function (type, page, current) { 298 switch (type) { 299 case "first": 300 case "last": 301 return false; 302 default: 303 return true; 304 } 305 }, 306 itemTexts: function (type, page, current) { 307 switch (type) { 308 case "first": 309 return "é¦é¡µ"; 310 case "prev": 311 return "<"; 312 case "next": 313 return ">"; 314 case "last": 315 return "æ«é¡µ"; 316 case "page": 317 return page; 318 } 319 }, 320 tooltipTitles: function (type, page, current) { 321 switch (type) { 322 case "first": 323 return "é¦é¡µ"; 324 case "prev": 325 return "ä¸ä¸é¡µ"; 326 case "next": 327 return "ä¸ä¸é¡µ"; 328 case "last": 329 return "æ«é¡µ"; 330 case "page": 331 return "第" + page + "页"; 332 } 333 }, 334 itemContainerClass: function (type, page, current) { 335 if (type == 'next' || type == 'prev' || type == 'first' 336 || type == 'last') { 337 return ""; 338 } else { 339 return (page === current) ? "active" : ""; 340 } 341 }, 342 onPageClicked: function (e, originalEvent, type, page) { 343 console.log("page click" + page); 344 if (typeof fn == 'function') { 345 if (param1) 346 fn.call(this, param1, page, size, sum); 347 else 348 fn.call(this, page, size, sum); 349 } else { 350 var search = window.location.search; 351 var url = window.location.href; 352 if (typeof urlChange == 'function') { 353 var data = urlChange(); 354 url = data.url; 355 search = data.search; 356 } 357 var pRegex = /[\?|&]p=\d+/g 358 var sumRegex = /[\?|&]sum=\d+/g 359 if (search) { 360 if (pRegex.test(search) && sumRegex.test(search)) { 361 url = url.replace(/p=\d+/, 'p=' + page) 362 .replace(/sum=\d+/, 'sum=' + sum); 363 } else if (pRegex.test(search)) { 364 url = url.replace(/p=\d+/, 'p=' + page) 365 + "&sum=" + sum; 366 } else if (sumRegex.test(search)) { 367 url = url.replace(/sum=\d+/, 'sum=' + sum) 368 + "&p=" + page; 369 } else { 370 url = url + "&p=" + page + "&sum=" + sum; 371 } 372 } else {
373 url = url + "?p=" + page + "&sum=" + sum; 374 } 375 window.location.href = url.replace(/\?+/, "?").replace(/\?&/, "?").replace(/&+/, "&"); 376 } 377 } 378 } 379 if (total > 1) 380 $('#' + pageID).bootstrapPaginator(options); 381} 382 383var Cookie = { 384 get: function (k) { 385 return ((new RegExp(["(?:; )?", k, "=([^;]*);?"].join(""))).test(document.cookie) && RegExp["$1"]) || ""; 386 }, 387 set: function (k, v, e, d) { 388 var date = new Date(); 389 var expiresDays = parseInt(e) || 1; 390 date.setTime(date.getTime() + expiresDays * 60 * 60 * 24 * 1000); 391 document.cookie = k + "=" + v + "; expires=" + (e != '' ? date.toGMTString() : "GMT_String") + ";path=/;domain=" + (d || ""); 392 }, 393 del: function (k) { 394 this.set(k, "", -1); 395 } 396}; 397//æ°åå¢å containsæ¹æ³ 398Array.prototype.contains = function (item) { 399 return this.indexOf(item) != -1; 400} 401 402function _clearmsg() { 403 $("#loginbox span[id^=msgdiv_]").hide(); 404 $("#loginbox input").removeClass("border-red"); 405} 406 407function _getLoginHtml(returnURL) { 408 var loginBox = '<div class="loginpup" id="loginbox" style="display:none;">\ 409 <a href="javascript:;" class="icon icon-close"></a>\ 410 <div class="login_center">\ 411 <p class="login_tit">ç»å½ <a class="reg" href="//' + umsDomain + '/account/reg?returnURL=' + returnURL + '">注å></a></p>\ 412 <form name="loginForm" id="loginForm" class="form-horizontal" method="POST" action="//' + umsDomain + '/account/login" onsubmit="return _chkLogin();">\ 413 <div class="form-group">\ 414 <label for="email1">ææºå·æé®ç®±</label>\ 415 <input type="text" class="form-control impt_set1" name="username" value="" placeholder="请è¾å ¥ææºå·æé®ç®±" >\ 416 <span id="msgdiv_username" class="color-red"></span>\ 417 </div>\ 418 <div class="form-group">\ 419 <label for="password1">å¯ç </label>\ 420 <input type="password" class="form-control impt_set1" name="password" placeholder="请è¾å ¥å¯ç ">\ 421 <span id="msgdiv_password" class="color-red"></span>\ 422 </div>\ 423 <div class="login">\ 424 <input type="hidden" name="returnURL" value="' + returnURL + '">\ 425 <span id="msgdiv_error" class="color-red"></span>\ 426 <button type="submit" class="btn-block btn_set btn_green" onclick="_clearmsg();">ç» å½</button>\ 427 <div class="thirdparty">\ 428 <div style="float:left;margin-right:12px;">å¿«æ·ç»å½</div>\ 429 <div class="share">\ 430 <div class="bdsharebuttonbox bdshare-button-style0-16">\ 431 <a class="icon icon-weixin-o" href="//' + umsDomain + '/account/wxlogin?returnURL=' + returnURL + '" title="微信ç»å½"></a>\ 432 <a class="icon icon-qq-o" href="////' + umsDomain + '/account/qqlogin?returnURL=' + returnURL + '" title="qqç»å½"></a>\ 433 <a class="icon icon-sina-o" href="////' + umsDomain + '/account/wblogin?returnURL=' + returnURL + '" title="å¾®åç»å½"></a>\ 434 </div>\ 435 </div>\ 436 <span class="pull-right"><a class="link_blue" href="//' + umsDomain + '/account/forgot?returnURL=' + returnURL + '">å¿è®°å¯ç ?</a></span>\ 437 </div>\ 438 </div>\ 439 </form>\ 440 </div>\ 441 </div>'; 442 return loginBox; 443} 444 445function _chkLogin() { 446 if ($("#loginbox input[name=username]").val() == "") { 447 $("#loginbox input[name=username]").addClass("border-red"); 448 $("#msgdiv_username").html("ææºå·æé®ç®±ä¸è½ä¸ºç©º").show(); 449 } else if ($("#loginbox input[name=password]").val() == "") { 450 $("#loginbox input[name=password]").addClass("border-red"); 451 $("#msgdiv_password").html("å¯ç ä¸è½ä¸ºç©º").show(); 452 } else { 453 $.getJSON("//" + umsDomain + "/account/ajaxlogin?callback=?", { 454 "username": $("#loginbox input[name=username]").val(), 455 "password": $("#loginbox input[name=password]").val() 456 }, function (data) { 457 if (data && data["code"] == 0) { 458 $.getScript("//" + umsDomain + "/accountNavbarJs"); 459 if (typeof afterlogin == 'function') { 460 afterlogin.call(this, data); 461 $("#loginbox").hide(); 462 } else { 463 location.reload(); 464 } 465 } else { 466 $("#msgdiv_error").html("è´¦å·æå¯ç é误").show(); 467 } 468 }); 469 } 470 return false;
471} 472 473function _toLogin() { 474 var returnURL = window.location.href; 475 if (isMobile()) { 476 window.location.href = "//" + umsDomain + "/account/login?returnURL=" + returnURL; 477 } else { 478 var loginBox = $("#loginbox"); 479 if (!loginBox || loginBox.length == 0) { 480 $("body").append(_getLoginHtml(returnURL)); 481 loginBox = $("#loginbox"); 482 } 483 $("#loginbox .icon-close").click(function () { 484 $(this).parents("#loginbox").hide(); 485 }); 486 loginBox.show(); 487 } 488} 489 490function _showTip(title, content, delay, buttonName, fn) { 491 var tip = $("._js_tip"); 492 var html = []; 493 html.push('<div class="popups _js_tip" style="z-index:99999">'); 494 html.push(' <div class="popups_wrap popups_xs">'); 495 html.push(' <i class="icon icon-close"></i>'); 496 html.push(' <div class="popups_header">'); 497 html.push(' <h4>' + title + '</h4>'); 498 html.push(' </div>'); 499 html.push(' <div class="popups_body">'); 500 html.push(' <p class="graycolor">' + content + '</p>'); 501 html.push(' </div>'); 502 html.push(' <div class="popups_footer text-right">'); 503 html.push(' <button type="button" class="btn m_gnbtn js_close">' + (buttonName ? buttonName : "ç¡®å®") + '</button>'); 504 html.push(' </div>'); 505 html.push(' </div>'); 506 html.push('</div>'); 507 if (!tip || tip.length == 0) { 508 $("body").append(html.join('')); 509 tip = $("._js_tip"); 510 } else { 511 tip.remove(); 512 $("body").append(html.join('')); 513 } 514 $("._js_tip .icon-close").click(function () { 515 $(this).parents("._js_tip").hide(); 516 }); 517 $("._js_tip .js_close").click(function () { 518 $(this).parents("._js_tip").hide(); 519 if (typeof fn == 'function') { 520 fn.call(this); 521 } 522 }); 523 if (delay && delay > 0) { 524 setTimeout(function () { 525 $("._js_tip").hide(); 526 }, delay); 527 } 528} 529 530function _showToast(content, point, unit) { 531 if (!content) return; 532 var t = new Date().getTime(); 533 534 if ($("#toast_container").length == 0) { 535 $("body").append('<div id="toast_container" class="toast_container"></div>'); 536 } 537 var selecter = "#toast_" + t; 538 539 // var scrollTop = $(window).scrollTop(); 540 // $("#toast_container").css("top", scrollTop + 60); 541 542 if (document.body.clientWidth <= 1200) { 543 $("#toast_container").css("right", 0); 544 } else { 545 var right = (document.body.clientWidth - 1200) / 2; 546 $("#toast_container").css("right", right.toFixed(0)); 547 } 548 549 var toast = []; 550 toast.push('<div id="toast_' + t + '" class="toast toast_success">'); 551 toast.push('<i class="icon icon-close"></i>'); 552 toast.push(content); 553 if (point) { 554 toast.push('<small>+</small><span>' + point + '</span>'); 555 if (unit) { 556 toast.push(unit); 557 } 558 } 559 toast.push('</div>'); 560 561 $("#toast_container").prepend(toast.join('')); 562 563 $(selecter).fadeIn(600).delay(3600).fadeOut('slow', function () { 564 $(this).remove(); 565 }); 566 567 $(selecter).find(".icon-close").click(function () { 568 $(selecter).remove(); 569 }); 570}; 571 572//å°çªå£ 573function minPlayer(id, right, top, width) { 574 if (!isMobile()) { 575 var hasMin = false; 576 var selector = "#" + id; 577 $(window).scroll(function () { 578 var originWidth = $(selector).width(); 579 var originHeight = $(selector).height(); 580 var height = width * originHeight / originWidth; 581 var video = $(selector + " object"); 582 if (video.length == 0) { 583 video = $(selector + " .pv-video-wrap"); 584 } 585 if ($(this).scrollTop() >= originHeight) { 586 if (!hasMin) { 587 hasMin = true; 588 $(selector).css({ 589 "width": originWidth, 590 "height": originHeight 591 }); 592 video.css({ 593 "position": "fixed", 594 "z-index": "10000", 595 "right": right, 596 "top": top, 597 "width": width - 2,
598 "border": "1px solid #ccc", 599 "box-shadow": "0 0 14px 5px rgba(153, 153, 153, .45)", 600 "height": height 601 }); 602 } 603 } else { 604 if (hasMin) { 605 hasMin = false; 606 video.attr("style", ""); 607 video.css({ 608 "width": originWidth, 609 "height": originHeight 610 }); 611 } 612 } 613 }); 614 } 615} 616 617(function (window, undefined) { 618 var meiaShare = { 619 config: {}, 620 621 init: function (cfg) { 622 this.config.target = cfg ? cfg.target : "";//selector 623 this.config.event = cfg ? cfg.event : "click"; 624 this.config.shareImg = ""; 625 this.config.shareText = ""; 626 this.config.shareDesc = ""; 627 this.config.shareUrl = ""; 628 629 this._bindConfigEvent(); 630 }, 631 632 setShareInfo: function (img, text, desc, url) { 633 this.config.shareImg = img; 634 this.config.shareText = text; 635 this.config.shareDesc = desc; 636 this.config.shareUrl = url; 637 }, 638 639 _bindShareEvent: function () { 640 if (isWechat()) { 641 $(".bdsharebuttonbox a").each(function () { 642 var _this = $(this); 643 _this.click(function () { 644 var cmd = _this.data("cmd"); 645 switch (cmd) { 646 case 'weixin': 647 meiaShare._wechatShare(); 648 break; 649 case 'tsina': 650 break; 651 case 'sqq': 652 break; 653 case 'qzone': 654 break; 655 default: 656 break; 657 } 658 $.ajax({url: "/sharecallback"}) 659 }); 660 }); 661 } else { 662 //baidu share 663 window._bd_share_config = { 664 common: { 665 onBeforeClick: setShareUrl, 666 bdText: this.config.shareText, 667 bdDesc: this.config.shareDesc, 668 bdPic: this.config.shareImg, 669 bdUrl: this.config.shareUrl 670 }, share: [{ 671 onBeforeClick: setShareUrl, 672 "tag": "share_baidu", 673 bdText: this.config.shareText, 674 bdDesc: this.config.shareDesc, 675 bdPic: this.config.shareImg, 676 bdUrl: this.config.shareUrl 677 }] 678 }; 679 with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion=' + ~(-new Date() / 36e5)]; 680 //baidu share 681 var setShareUrl = function (cmd, config) { 682 $.ajax({url: "/sharecallback"}) 683 config.bdText = this.config.shareText; 684 config.bdDesc = this.config.shareDesc; 685 config.bdPic = this.config.shareImg; 686 config.bdUrl = this.config.shareUrl; 687 return config; 688 } 689 } 690 if (typeof ZeroClipboard == 'undefined') { 691 $.getScript("//cdn.meia.me/public/js/zeroclipboard/ZeroClipboard.min.js", function () { 692 var client = new ZeroClipboard($(".js_zeroclipboard")); 693 client.on("ready", function (readyEvent) { 694 client.on('copy', function (event) { 695 event.clipboardData.setData('text/plain', meiaShare.config.shareUrl); 696 }); 697 client.on("aftercopy", function (event) { 698 _showTip("ç¾åæç¤º", "å·²å¤å¶ <a target='_blank' href='" + event.data["text/plain"] + "'>" + event.data["text/plain"] + "</a> å°åªåæ¿"); 699 }); 700 }); 701 }); 702 } 703 }, 704 705 _bindConfigEvent: function () { 706 if (!this.config.event || this.config.event == '') return; 707 if (this.config.event == 'hover') { 708 $(this.config.target).each(function () { 709 var _this = $(this); 710 _this.hover(function () { 711 meiaShare.setShareInfo(_this.data("img"), _this.data("text"), _this.data("desc"), _this.data("url")); 712 if ($(".js_hover_share").length > 0) { 713 $(".js_hover_share").appendTo(_this); 714 } else { 715 _this.append(meiaShare._buildHoverBox()); 716 meiaShare._bindShareEvent(); 717 } 718 $(".js_hover_share").show(); 719 }, function (e) { 720 $(".js_hover_share").hide(); 721 }); 722 }) 723 } 724 }, 725 726 _buildHoverBox: function () { 727 var html = []; 728 html.push('<div class="js_hover_share share">'); 729 html.push(' <div class="bdsharebuttonbox" data-tag="share_baidu">'); 730 html.push(' <a class="icon icon-weixin-o" data-cmd="weixin" href="javascript:void(0);" title="å享å°å¾®ä¿¡"></a>'); 731 html.push(' <a class="icon icon-sina-o" data-cmd="tsina" href="javascript:void(0);" title="åäº«å°æ°æµªå¾®å"></a>'); 732 html.push(' <a class="icon icon-qq-o" data-cmd="sqq" href="javascript:void(0);" title="å享å°QQ"></a>'); 733 html.push(' <a class="icon icon-qzone-o" data-cmd="qzone" href="javascript:void(0);" title="å享å°QQ空é´"></a>'); 734 html.push(' <a class="icon icon-copy-o js_zeroclipboard" href="javascript:void(0);" title="å¤å¶é¾æ¥"></a>'); 735 html.push(' </div>'); 736 html.push('</div>'); 737 return html.join(""); 738 }, 739 740 _wechatShare: function () { 741 if ($(".wechat_mask").length == 0) { 742 var wechat_mask = '<div class="wechat_mask" style="display:none;">\ 743 <div class="share">\ 744 <img src="//cdn.meia.me/public/images/wechat-share.png" alt="">\ 745 </div>\ 746 </div>'; 747 $("body").append(wechat_mask); 748 $(".wechat_mask").click(function () { 749 $(this).hide(); 750 }) 751 } 752 $(".wechat_mask").show(); 753 } 754 } 755 window.meiaShare = meiaShare; 756})(window); 757 758function isSupportHTML5() { 759 return typeof(Worker) !== "undefined"; 760} 761 762//å ¬å ±æ¹æ³ 763function getTitle() { 764 var title = $("title").html() || "ç¾å-è§è¯è®¾è®¡çåé"; 765 if (typeof sharename != 'undefined' && sharename.trim() != '') { 766 title = sharename; 767 } 768 if (typeof shareText != 'undefined' && shareText.trim() != '') { 769 title = shareText; 770 } 771 return title; 772} 773 774function getDescription() { 775 var desc = $("meta[name=description]").attr("content") || "meia.meæ¯ä¸å½é¦ä¸ªåæè®¾è®¡ä¸æ¶å°ç¾å¦å¨çº¿æè²å¹³å°ãèéå ¨ç精彩çä½éªè®¾è®¡ã设计æç»´ãèºæ¯ãç¾å¦ç±»çæè½æå¦ãç¥è¯ç»æãä¸å®¶è§ç¹ã人ç©è®¿è°ã大å¸è®²åº§çç³»åè§é¢ï¼ä¸ºæ¨æä¾ä¸ä¸ªå¨çº¿å¦ä¹ ãä¸å®¶æå¯¼ãå®è·µç»ä¹ ãäºå¨äº¤æµçå¹³å°ï¼"; 776 if (typeof shareDesc != 'undefined' && shareDesc.trim() != '') { 777 desc = shareDesc; 778 } 779 return desc; 780} 781 782function getImage() { 783 var imgUrl = ""; 784 if (typeof courseImg != 'undefined') { 785 imgUrl = courseImg; 786 } else { 787 imgUrl = getShareImg(); 788 } 789 return imgUrl; 790} 791 792function showGift(jinqian) { 793 if (!jinqian) { 794 return; 795 } 796 if ($(".js_gift").length > 0) { 797 $(".js_gift .js_gift_jinqian ").html(jinqian + 'å '); 798 } else { 799 var html = '<div class="js_gift popups_act">\ 800 <div class="popups_wrap">\ 801 <div class="popups_slot">\
802 <span class="js_gift_jinqian">' + jinqian + 'å </span>\ 803 </div>\ 804 <a href="//' + umsDomain + '/ucenter/myticket" class="popups_invite">æ¥çæç伿 å¸></a>\ 805 <p class="popups_tip">å®æç§¯åä»»å¡ï¼è¿è½èµ é10å积åå¦ï¼</p>\ 806 </div>\ 807 </div>'; 808 $('body').append(html); 809 } 810 $(".js_gift").show(); 811 812 $(".js_gift").click(function (e) { 813 var _con = jQuery(".js_gift .popups_view"); 814 var _con1 = jQuery(".js_gift .popups_invite"); 815 if (!_con.is(e.target) && !_con.has(e.target).length > 0 816 && !_con1.is(e.target) && !_con1.has(e.target).length > 0) { 817 $(this).hide(); 818 } 819 }) 820} 821 822function openApp(courseid) { 823 var useragent = navigator.userAgent; 824 var isAndroid = (useragent.match(/(Android);?[\s\/]+([\d.]+)?/)) ? true : false; 825 var isIpad = (useragent.match(/(iPad).*OS\s([\d_]+)/)) ? true : false; 826 var isIphone = (!isIpad && useragent.match(/(iPhone\sOS)\s([\d_]+)/)) ? true : false; 827 var isSafari = (isIpad || isIphone) && useragent.match(/Safari/); 828 829 var url = ""; 830 831 if (isAndroid) { 832 //url = "intent://$util.eduDomain()/#Intent;scheme=openmeia/index;package=me.meia.app.meia;end"; 833 if (courseid) { 834 url = "meia://$util.eduDomain()?courseid=" + courseid; 835 } else { 836 url = "meia://$util.eduDomain()"; 837 } 838 } else if (isIpad || isIphone || isSafari) { 839 if (courseid) { 840 url = "usermeia://courseid=" + courseid; 841 } else { 842 url = "usermeia://meia=home"; 843 } 844 } 845 846 if (url != '') { 847 var t = 1000, isInstall = true; 848 setTimeout(function () { 849 if (isInstall) { 850 window.location = url; 851 } else { 852 window.location = "//a.app.qq.com/o/simple.jsp?pkgname=me.meia.app.meia"; 853 } 854 document.body.removeChild(ifr); 855 }, 2000) 856 857 var t1 = Date.now(); 858 var ifr = document.createElement("iframe"); 859 ifr.setAttribute('src', url); 860 ifr.setAttribute('style', 'display:none'); 861 document.body.appendChild(ifr); 862 setTimeout(function () { 863 var t2 = Date.now(); 864 if (!t1 || t2 - t1 < t + 100) { 865 isInstall = false; 866 } 867 }, t); 868 } else { 869 window.location = "//a.app.qq.com/o/simple.jsp?pkgname=me.meia.app.meia"; 870 } 871}
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.