Greasy Fork镜像 支持简体中文。

HPMOR Checklist

Adds a checkbox to each chapter. Stores checked history.

  1. // ==UserScript==
  2. // @name HPMOR Checklist
  3. // @namespace http://jaredtylermiller.com
  4. // @description Adds a checkbox to each chapter. Stores checked history.
  5. // @include http://hpmor.com/
  6. // @include http://hpmor.com/chapter/*
  7. // @require https://code.jquery.com/jquery-1.11.2.min.js
  8. // @require http://cdnjs.cloudflare.com/ajax/libs/store.js/1.3.14/store.min.js
  9. // @version 1.0
  10. // ==/UserScript==
  11.  
  12.  
  13. // Grab chapter from URL if possible
  14. var chapterPath = window.location.pathname.split("/")
  15.  
  16. // If so, let's store that we've read it in DB
  17. if (chapterPath.length === 3) {
  18. var chapter = chapterPath[chapterPath.length -1]
  19. store.set(chapter, true)
  20. }
  21.  
  22. // Add a checkbox to every chapter and check if it needed
  23. $(".toclist a").each(function() {
  24. var link = $(this),
  25. chapter = link.closest("li").index()+1
  26.  
  27. link.before("<input type='checkbox'>")
  28. saved = store.get(chapter)
  29.  
  30. if (typeof saved !== "undefined") {
  31. link.siblings("input").prop("checked", saved)
  32. }
  33. })
  34.  
  35. // Store in DB if we click a link
  36. $(".toclist a").click(function(e) {
  37. e.preventDefault()
  38. var chapter = $(this).closest("li").index()+1,
  39. checkbox = $(this).find("input"),
  40. checked = checkbox.prop("checked")
  41.  
  42. store.set(chapter, !checked)
  43. checkbox.prop("checked", !checked)
  44. window.location.href = $(this).attr("href")
  45. })
  46.  
  47. // Store when clicking checkboxes
  48. $(".toclist input").click(function(e) {
  49. var chapter = $(this).closest("li").index()+1,
  50. checked = $(this).prop("checked")
  51.  
  52. store.set(chapter, checked)
  53. })

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址