homepagePHP/www/Public/static/default/dist/js/app.js

202 lines
5.1 KiB
JavaScript
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******/ (function() { // webpackBootstrap
var __webpack_exports__ = {};
/*!*************************************************!*\
!*** ./www/Public/static/default/src/js/app.js ***!
\*************************************************/
//import("vars.js");
//import("utils.js");
//import("functions.js");
//import("common.js");
//编辑器设置
var editorInit = {
toolbars: [['undo',
//撤销
'redo',
//重做
'bold',
//加粗
'italic',
//斜体
'underline',
//下划线
'paragraph',
//段落格式
'simpleupload',
//单图上传
'insertimage',
//多图上传
'justifyleft',
//居左对齐
'justifyright',
//居右对齐
'justifycenter',
//居中对齐
'justifyjustify',
//两端对齐
'insertorderedlist',
//有序列表
'insertunorderedlist',
//无序列表
'fullscreen' //全屏
]],
topOffset: 0,
pasteplain: true,
//是否默认为纯文本粘贴。false为不使用纯文本粘贴true为使用纯文本粘贴
retainOnlyLabelPasted: true //粘贴只保留标签,去除标签所有属性
};
var swiperDefaultConf = {
autoplay: {
delay: 3000,
stopOnLastSlide: false,
disableOnInteraction: true
},
pagination: {
clickable: true,
el: '.swiper-pagination'
},
loop: true
};
function initSwiper(container) {
var confObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var $container = $(container),
conf = {},
pagination = {};
confObj.pagination = confObj.pagination || {};
Object.assign(pagination, swiperDefaultConf.pagination, confObj.pagination);
Object.assign(conf, swiperDefaultConf, confObj);
conf.pagination = pagination;
if (!$container.length) {
return false;
}
var mySwiper = new Swiper(container, conf);
// $(container).mouseleave(function () {
// mySwiper.autoplay.start();
// });
return mySwiper;
}
window.initSwiper = initSwiper;
function addSpanSearch(keyword, searchClass, spanClass) {
keyword = String(keyword).trim();
if (!keyword) {
return false;
}
$(searchClass).each(function () {
var $dom = $(this);
var regString = /(\$|\^|\*|\\|\+|\?\.)/gi;
var oldKeyWord = keyword;
keyword = keyword.replace(regString, '\\' + '$1');
var reg = new RegExp('(' + keyword + ')', 'g');
if ($dom.text().indexOf(oldKeyWord) !== -1) {
$dom.children().each(function () {
$(this).find('[data-highlight]').each(function () {
var newHtml = $(this).text().replace(reg, '<span class="' + spanClass + '">$1</span>');
$(this).html(newHtml);
});
});
}
});
}
window.addSpanSearch = addSpanSearch;
function loadMore(contentEle, url) {
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var $el = $(contentEle);
var defParams = {
page: 2,
per_page: 10
};
params = Object.assign({}, defParams, params);
return function (cb) {
$el.siblings('.show-more-data').find('.more-handle').hide().siblings('.loading').show();
$.ajax({
type: 'GET',
url: url,
data: params,
success: function success(res) {
if (!$(res).find(contentEle).children().length) {
$(contentEle).siblings('.show-more-data').text('暂无数据');
return false;
}
params.page++;
$el.append($(res).find(contentEle).html());
$el.siblings('.show-more-data').find('.more-handle').show().siblings('.loading').hide();
if (cb) {
cb();
}
},
error: function error(e) {
console.log('error', e);
}
});
};
}
window.loadMore = loadMore;
function setIframe() {
var maxWidth = $('.article-content').width();
$('.article-content iframe').each(function () {
console.log($(this));
var i_width = Number($(this)[0].width);
var i_height = Number($(this)[0].height);
var ratio = maxWidth / i_width;
if (i_width > maxWidth) {
i_width = maxWidth;
i_height = Math.floor(ratio * i_height);
$(this)[0].width = i_width;
$(this)[0].height = i_height;
}
});
}
window.setIframe = setIframe;
$(function () {
$('.menu-item').on('mouseover', function () {
$(this).find('.child-menu').show();
});
$('.menu-item').on('mouseout', function () {
$(this).find('.child-menu').hide();
});
$('.attention-us-item').hover(function () {
$(this).find('.qrcode-box').show();
}, function () {
$(this).find('.qrcode-box').hide();
});
$(window).scroll(function () {
var top1 = $(this).scrollTop();
if (top1 > 200) {
$('.fly-up-box').stop().fadeIn();
} else {
$('.fly-up-box').stop().fadeOut();
}
});
$('.show-more-data .more-handle').click(function () {
$(this).hide().siblings().show();
});
$('.fly-up-box').click(function () {
$('body , html').animate({
scrollTop: 0
}, 300);
});
setIframe();
});
var __webpack_export_target__ = window;
for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
/******/ })()
;
//# sourceMappingURL=app.js.map