//内容
var innerhtml = $('.reading_box_m').html().replace(/ tag="?[一二三四五六七八九十]+"?/ig, "");
var innerhtml = innerhtml.replace(/ id="?\d+"?/ig, "");
//初步匹配篇 章 节
var regALl_Rge1 = new RegExp('<(div|p)\\s+class="?(ue_codeTitle|ue_chapterTitle|ue_sectionTitle)"?>([^<]+)</\\1>', 'ig');
var titleLis = innerhtml.match(regALl_Rge1); innerhtml.replace(regALl_Rge1, function () {
lip = lip + 1;
//篇
var format_1_children = $('<li><a href="#"></a></li>');
//章
var format_2_children = $('<li><a href="#"></a></li>');
//节
var format_3_children = $('<li><a href="#"></a></li>');
var args = arguments;
//篇
if (args[2] == 'ue_codeTitle') {
format_1_children.children('a').prepend('<input type="button" >').attr('href', '#' + lip).append(args[3]);
format_1.append(format_1_children);
//当前篇
currF1 = format_1.children('li').last();
f = f + 1;
}
//章
else if (args[2] == 'ue_chapterTitle') {
if (f == 0 || f != lastF) {
format_2_children.children('a').prepend('<input type="button" >').attr('href', '#' + lip).append(args[3]);
//当前章
currF2 = $("<ul id='general' class='manual_book' style='display: none;'></ul>");
currF2.append(format_2_children);
//如果没有篇
if (!currF1) {
format_1.append(format_1_children);
//当前篇
currF1 = format_1.children('li').last();
currF1.children('a').after(currF2).remove();
currF2.show();
f = 1;
}
else {
currF1.children('a').after(currF2);
}
}
else {
format_2_children.children('a').prepend('<input type="button" >').attr('href', '#' + lip).append(args[3]);
currF1.children('ul').append(format_2_children);
}
f2 = f2 + 1;
lastF = f;
}
//节
else if (args[2] == 'ue_sectionTitle') {
format_3_children.children('a').prepend('<input type="button" >').attr('href', '#' + lip).append(args[3]);
if (f2 == 0 || f2 != lastF2) {
//当前节
currF3 = $("<ul id='manual_1' class='list' style='display: none;' style='display: block;'></ul>");
currF2.children('li').last().children('a').end().append(currF3);
}
currF3.append(format_3_children);
lastF2 = f2;
}
}); /*********收索关键字变色开始***********/
function HightLight(searchList) {
var arrStyle = [
{ style: "color:red;padding:0px 2px;" },
{ style: "color:orange;padding:0px 2px;" },
{ style: "color:yellow;padding:0px 2px;" },
{ style: "color:green;padding:0px 2px;" },
{ style: "color:aqua;padding:0px 2px;" },
{ style: "color:blue;padding:0px 2px;" },
{ style: "color:purple;padding:0px 2px;" }
];
searchList = decodeURIComponent(searchList);
if (!searchList) return;
for (var j = 0; j < searchList.split(',').length ; j++) {
var kyesVal = searchList.split(',')[j];
$(".reading_box_m p").filter(function (i) {
if ($(this).text().indexOf(kyesVal) != -1) {
var r = RegExp(kyesVal, 'ig');
$(this).html($(this).html().replace(r, '<span keys style=' + arrStyle[j % 7].style + ' >' + kyesVal + '</span>'));
}
});
} }
/*********收索关键字变色结束***********/ //关键字搜索
function Sercah() {
var kyesVal = $.trim(document.getElementById('txtMenKey').value);
//if (keys_test != "" && keys_test == kyesVal) { return; }//waitmsg("已找到对应的" + g_keys_count + "处关键字!", 1);相同关键字查询时返回
$(".reading").children('reading_box_m p').css({ 'background': "#FFF" })
$('span[keys]').removeAttr('style').removeAttr("id");
g_keys = 0;
var lip = 0;
if (kyesVal != '' && kyesVal != '关键字查询') {
$(".reading_box_m p").filter(function (i) {
if ($(this).text().indexOf(kyesVal) != -1) {
var r = RegExp(kyesVal, 'ig');
$(this).html($(this).text().replace(r, function () {
var arg = arguments;
lip++;
return '<span title=第' + lip + '处 id=keys' + lip + ' keys style="background:yellow; color:red">' + kyesVal + '</span>';
}))
}
});
keys_test = kyesVal; //关键字记录赋值
g_keys_count = lip; //关键字次数
if (arguments.length > 0 && arguments[0] == '0') {//有参数表示按钮点击没有查询到提示
if (lip == 0)
waitmsg("没有找到对应的关键字!", 4);
else {
waitmsg("已找到对应的" + g_keys_count + "处关键字!", 1);
PositionKeys('down', 0);//有参数是跳转到第一个查询位置
}
}
} else {
if (arguments.length > 0 && arguments[0] == '0')//有参数表示按钮点击没有查询到提示
$('#txtMenKey').val('关键字查询');
keys_test = '';
waitmsg("请输入查询关键字!", 4);
};
}; //定位关键字
function PositionKeys(t, c) { var countkey = parseInt(g_keys_count);
if (countkey == 0) {
waitmsg("没有找到对应的关键字!", 4);
return;
}
if (t == "down") {
g_keys = g_keys + 1;
if (g_keys > countkey) {
g_keys = 1;
}
}
else if (t == "up") {
g_keys = g_keys - 1;
if (g_keys <= 0) {
g_keys = countkey;
}
}
$("span[id^='keys']").css("border", "none");
$("#keys" + g_keys).css("border", "red 1px solid");
var topVal = $('.reading_box').scrollTop() + parseInt($("#keys" + g_keys).offset().top);
$('.reading_box').stop(true).animate({ scrollTop: (topVal - 30) }, 500);
};

最新文章

  1. 第一章-第二题Unity3D游戏引擎相关--By林培文
  2. Linux下的百度云客户端
  3. python入门教程链接
  4. C# WinFrom 跨线程访问控件
  5. springMVC导出 CSV案例
  6. JavaScript —— 局部变量和全局变量
  7. (转)十分钟搞定CSS选择器
  8. Hibernate(八)一对多单向关联映射
  9. 用VUEJS做一个猫眼电影web app
  10. Phpcms 详情页显示所属栏目的同级栏目
  11. Windows Developer Day - Windows AI Platform
  12. 【一天一道LeetCode】#90. Subsets II
  13. Mysql 账号过期问题
  14. 应用打开其xlspptdoc等
  15. objelement = event.target || event.srcElement;
  16. show user profile synchronization tools
  17. 理解JAVASCRIPT 中hasOwnProperty()和isPrototypeOf的作用
  18. measure layout onMeasure() onLayout()
  19. 基于easyUI实现权限管理系统(四)——用户管理
  20. tomcat学习篇

热门文章

  1. [Nowcoder] 中位数
  2. The packaging for this project did not assign a file to the build artifact
  3. JVM内核-原理、诊断与优化学习笔记(二):JVM运行机制
  4. 中断控制及basepri 与 basepri_max
  5. Android笔记之RoundedImageView
  6. [转载]Spring AOP 深入剖析
  7. Ansible的copy模块批量下发文件
  8. mysql-connetor-c 自动创建数据库、数据库表的命令
  9. 从别人git下载项目下来然后运行
  10. 尝试 zabbix 小记