知识库功能增强

帆软知识库

// ==UserScript==
// @name         知识库功能增强
// @namespace    armstrong@fanruan.com
// @version      1.0.7
// @description  帆软知识库
// @author       Armstrong
// @include       http://knowledge.fanruan.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...
if(window.location.href.indexOf("index.php")!=-1)//在搜索页
{
var inputString=$('#search-box').attr("value");
var qa='<li id="qa" class="null">问答</li>';
var crm='<li id="crm" class="null">crm通用查询</li>'
$('.search_tab li').eq(3).after(qa)
$('.search_tab li').eq(4).after(crm)
$('#qa').click(function(){
  $('.search_tab li').removeClass("choose")
  var self=$(this);
  setTimeout(function(){
    self.addClass("choose");},50)//样式
$('#all').css("display","none")
$('#fr').css("display","none")
$('#bi').css("display","none")
$('#knowledge').css("display","none")
var r=confirm("是否打开页面搜索"+inputString+"相关问答");
if (r==true)
{
    window.open('https://kms.fineres.com/dosearchsite.action?cql=siteSearch+~+"'+inputString+'"+and+type+%3D+%22com.elitesoftsp.confluence.tiny.question.answer.plugins%3Aquestion%22')
}
else
{
    console.log("取消操作");
}

})
$('#crm').click(function(){
  $('.search_tab li').removeClass("choose")
  var self=$(this);
  setTimeout(function(){
    self.addClass("choose");},50)//样式
$('#all').css("display","none")
$('#fr').css("display","none")
$('#bi').css("display","none")
$('#knowledge').css("display","none")
var q=confirm("是否打开crm通用查询页面,搜索"+inputString);
if(q==true){
window.open('https://crm.finereporthelp.com/WebReport/decision/view/report?viewlet=jira%252Fcurrency_search.cpt&op=view&keyword='+inputString)
}
else
{
  console.log("取消操作");
}
})
$('.search_tab li').click(function(){
  $('#qa').removeClass("choose");
  $('#crm').removeClass("choose");//点击其他tab时去除选中效果
})
}
else//不在搜索页,在首页或者文档页
{
   if(window.location.href=='http://knowledge.fanruan.com/')//在首页
  {
    console.log("在首页,生成一个新tab")
    setTimeout(function(){var newTab='<div>&nbsp;</div><div id="zmr"><a style="font-size:16px;font-family:PingFangSC-Regular" href="http://knowledge.fanruan.com/index.php?search-fulltext-title-%E9%80%9A%E7%94%A8%E6%9F%A5%E8%AF%A2" title="全面查询">全面查询</a> </div>'
$('#Quater_bar').append(newTab)},1000)
  }
  setTimeout(function(){
$('.full-list').children().children().mouseover(function(){var txt=$(this).text();$(this).attr("title",txt)})
},1000)
}
})();