').appendTo($tocWrapper); $('
目錄
').prependTo($pageCatalog); var $catalogItemWrapper = $('
').appendTo($pageCatalog); var minLevel = 6; $headers.each(function () { var headerLevel = parseInt($(this)[0].tagName.match(/\d/)[0], 10); minLevel = Math.min(minLevel, headerLevel); if (minLevel === 2) { return false; } }); $headers.each(function () { var headerLevel = parseInt($(this)[0].tagName.match(/\d/)[0], 10); var indentation = headerLevel - minLevel; var $item = $('
  • ').appendTo($catalogItemWrapper).css({ paddingLeft: indentation + 'em' }); if (headerLevel === 2) { $item.addClass('bold-title'); } var docContent = $(this).text(); var anchor = '#' + $(this).attr('id'); $('').text(docContent).appendTo($item); }); showHighLightTitle(); bindTOCEvents($pageCatalog); } function showHighLightTitle() { var activeIndex = -1; $(":header:not('h1')", ".fx-markdown-body").each(function (index) { if ($(this).offset().top - $(window).scrollTop() <= 65) { activeIndex = index; $('a', '.template-toc-wrapper .page-catalog') .removeClass('active') .eq(index).addClass('active'); } }); if (activeIndex === -1) { $('a', '.template-toc-wrapper .page-catalog').removeClass('active') } } function bindTOCEvents($element) { $('a[href*="#"]', $element).click(function (e) { e.preventDefault(); var href = $(e.currentTarget).attr('href'); var id = href.substring(1, href.length); var $target = document.getElementById(id); if ($target) { $('html, body').animate({ scrollTop: $($target).offset().top - 60 }, 400); } return false; }); $(window).scroll(function () { showHighLightTitle(); }); } function highlightLastActiveItem(itemWrapperSelector, itemSelector) { itemWrapperSelector = typeof itemWrapperSelector === "string" ? itemWrapperSelector : ""; itemSelector = typeof itemSelector === "string" ? itemSelector : ""; $(itemWrapperSelector).hover( function () { $(".default-active").removeClass("default-active"); }, function () { $(".last-active").addClass("default-active"); } ); $(itemWrapperSelector + " " + itemSelector).hover( function () { $(".last-active").removeClass("last-active"); $(this).addClass("active"); }, function () { $(this).addClass("last-active"); $(this).removeClass("active"); } ); } /** * 生成骨架屏加載器 * @param $el * @param options */ function createSkeletonSpin($el, options) { var $spinMask = $('
    '); if ($el) { $spinMask.appendTo($el); } var o = $.extend( { hasTitle: false, rowNum: -1, }, options ); if (o.theme) { $spinMask.addClass("style-theme-" + o.theme); } if (o.hasTitle) { $('
    ').appendTo($spinMask); } var rn = 0; if (o.rowNum === -1) { //自動計算后填充滿 var height = $spinMask.height() - 15; if (o.hasTitle) { height -= 30; } rn = parseInt(height / 40); } else { rn = o.rowNum; } for (var i = 0; i < rn; i++) { $('
    ').appendTo($spinMask); } return $spinMask; }; /** * 復制鏈接至剪貼板 * * @param url * @param copySuccessMsg */ function copyUrl(url, copySuccessMsg) { if (url && url.length) { const textarea = document.createElement('textarea'); textarea.style.background = 'transparent'; textarea.style.color = 'transparent'; textarea.value = url; document.body.appendChild(textarea); textarea.select(); let success; try { success = document.execCommand('copy'); } catch (err) { success = false; } document.body.removeChild(textarea); if (success) { toast({"msg":"復制成功"}) } } }; function toast (options) { var self = this; var opts = $.extend({ msg: '', type: 'success', //warning, success, error, loading timeout: 300 }, options); if (isEmpty(opts.msg)) { return; } var iconCls = ''; switch (opts.type) { case 'success': iconCls = 'iconicon_gou'; break; case 'warning': iconCls = 'icon-warning-circle'; break; case 'error': iconCls = 'icon-close-circle'; break; case 'loading': default: break; } var $toastWrapper; if ($('.x-msg-toast-wrapper').length > 0) { $toastWrapper = $('.x-msg-toast-wrapper'); } else { $toastWrapper = $('
    ').appendTo('body'); } if ($('.x-msg-toast').length > 2) { $('.x-msg-toast').first().remove(); } var $toast = $('
    ').appendTo($toastWrapper); var $content = $('
    ').addClass(opts.type).appendTo($toast); var $icon = $('
    ').append($('').addClass(iconCls)).appendTo($content); $('
    ').text(opts.msg).appendTo($content); var close = function () { $toast.fadeOut(opts.timeout, function () { $toast.remove(); if ($toastWrapper.children().length < 1) { $toastWrapper.remove(); } }); var height = $toast.outerHeight(true); var $otherToast = $($toast).nextAll(); $otherToast.animate({'top': '-' + height + 'px'}, opts.timeout, function () { $otherToast.css('top', '0'); }); }; var duration; if (opts.type === 'success') { duration = 2000; } else if (opts.type === 'loading') { duration = 0; } else { duration = 4000; } $toast.fadeIn(opts.timeout, function () { if (duration > 0) { var intervalid = setTimeout(close, duration); } $toast.click(function () { clearTimeout(intervalid); close(); }); }); return close; }; /** * 判斷是否是字符串類型 * @static * @param {Object} obj 判斷對象 * @returns {Boolean} 返回是否是字符串類型 */ function isString(obj) { return typeof obj == "string"; }; /** * 判斷是否是數字類型 * @static * @param {Object} obj 判斷對象 * @returns {Boolean} 返回是否是數字類型 */ function isNumber(obj) { return $.isNumeric(obj); }; /** * 判斷是否是日期類型 * @param obj * @returns {boolean} */ function isDate(obj) { return obj instanceof Date; } /** * 判斷一個指定對象是否為一個數組對象 * @static * @param {Object} obj 指定對象 * @return {Boolean} 返回是否是數組類型 */ function isArray(obj) { return $.isArray(obj); }; /** * 判斷值是否為空 * @static * @param {Object} value 值對象 * @returns {Boolean} 返回是否為空 */ function isEmpty(value) { return value === "" || isNull(value); }; /** * 判斷對象是否為空 * @param {Object} o 對象 * @returns {boolean} 是否為空 */ function isNull(o) { return o == null; }; function isObjectEmpty(obj) { // 目標為 null if (obj == null) return true; // 目標為有長度類型 if (obj.length > 0) return false; if (obj.length === 0) return true; // 目標對象有屬性 for (var key in obj) { if (hasOwnProperty.call(obj, key)) return false; } return isNaN(obj); } function trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } function dateFormat(time, fmt) { var date = new Date(time); var o = { "M+": date.getMonth() + 1, //月份 "d+": date.getDate(), //日 "h+": date.getHours(), //小時 "m+": date.getMinutes(), //分 "s+": date.getSeconds(), //秒 "q+": Math.floor((date.getMonth() + 3) / 3), //季度 "S": date.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); } for (var k in o) { if (new RegExp("(" + k + ")").test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); } } return fmt; } function btnClickDt($element,value) { var path = window.location.href; var text = $element.text(); var className = $element.attr('class'); var p2Value = isEmpty(text) ? value ? value : className : text; dt('landing_button_clk', { ext: { p1: path, p2: p2Value } }) } function pagePreviewTimeDt() { var startTime = new Date().getTime(); var path = window.location.href; window.onbeforeunload = function() { var leaveTime = new Date().getTime(); var timeInMs = (leaveTime - startTime) / 1000; var stayTime = Number(timeInMs.toFixed(2)); var uuid = getCookie('fx-user-cookie'); dt('page_preview_time',{ ext: { p1: path, p2: stayTime, }, username: uuid }); } } function showRegisterDrawer($parent) { $('.mask-register', $parent).click(function (e) { $('.register-mask-wrapper', $parent).toggleClass('animate-show'); $('html').css({overflow: 'hidden'}); var iframe = $('#iframe-top', $parent); var iframeContent = iframe.contents(); var inputInner = iframeContent.find('.input-inner')[0]; if (iframe && iframeContent && inputInner) { inputInner.focus(); } var $target = $(e.target); btnClickDt($target, $target.val()); }) $('.register-mask-wrapper', $parent).click(function () { $(this).toggleClass('animate-show'); $('html').css({overflow: 'auto'}); }) }日韩无码一区二区三区
    日本三级片网站| AV免费观看| 黄色网站在线| 黄色网站在线| 男人的天堂av| 亚洲图片小说| 免费AV在线| 黄色视频在线免费观看| 黄瓜视频在线观看| 插插插综合| 中文字幕av| 五月天黄色网站| 午夜视频在线观看| 亚洲男人天堂| 精品人妻一区二区三区| 黄色视频在线免费观看|9oy482 亚洲图片小说|my9935 免费的黄色网站|gyx52 在线观看黄片|w9f304 高清无码在线观看|cla300 菠萝蜜视频在线观看|9gd358 亚洲精品无码|7zd358 台湾中文娱乐网|ua7193 亚洲性爱视频|xtk841 人妻中文字幕|tk8717 超碰人人操|sok820 男人的天堂av|o8e345 在线观看黄片|jkg935 丝瓜视频成人|8sj724 免费AV网站|io8897 97在线观看|lcy979