JavBus 添加跳转在线观看

在影片详情页添加跳转到在线观看网站的按钮,并检查对应是否存在资源,如果对应网站上存在该资源则为绿色,否则显示红色,顺便检测有无中文字幕。

< Feedback on JavBus 添加跳转在线观看

Review: Good - script works

§
Posted: 2024.03.11.

好评, 给个建议: exclude 列表页

在列表页会报错, 如 https://www.javbus.com/star/2rt

Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
    at query (JavBus 添加跳转在线观看.user.js:231:52)
    at serachPageParser (JavBus 添加跳转在线观看.user.js:244:12)
    at onload (JavBus 添加跳转在线观看.user.js:275:72)

使用 @exclude 或者用代码过滤

@exclude

// @exclude https://www.javbus.com/star/*
// @exclude https://www.javbus.com/genre/*
// @exclude https://www.javbus.com/series/*
// @exclude https://www.javbus.com/studio/*
// @exclude https://www.javbus.com/label/*
// @exclude https://www.javbus.com/director/*
// @exclude https://www.javbus.com/search/*
// 
// @exclude https://www.javbus.com/uncensored/star/*
// @exclude https://www.javbus.com/uncensored/genre/*
// @exclude https://www.javbus.com/uncensored/series/*
// @exclude https://www.javbus.com/uncensored/studio/*
// @exclude https://www.javbus.com/uncensored/label/*
// @exclude https://www.javbus.com/uncensored/director/*
// @exclude https://www.javbus.com/uncensored/search/*

或者用代码过滤列表页

function getTrimedPath(path = location.pathname) {
  // locale
  if (path.startsWith('/en/') || path.startsWith('/ja/') || path.startsWith('/ko/')) {
    path = path.slice(3) // rm `/en` but not `/en/`
  }

  if (path.startsWith('/uncensored')) {
    path = path.slice('/uncensored'.length)
  }

  return path
}


const path = getTrimedPath();
if (
  path.startsWith("/star/") || // 女优
  path.startsWith("/genre/") || // 分类即 tag
  path.startsWith("/series/") || // 系列
  path.startsWith("/studio/") || // 製作商
  path.startsWith("/label/") || // 發行商
  path.startsWith("/director/") ||  // 導演
  path.startsWith("/search")  // 搜索
) {
  return
}

Post reply

Sign in to post a reply.