Bước tới nội dung

Thành viên:NgocAnMaster/HarvErrors.js

Bách khoa toàn thư mở Wikipedia

Chú ý: Sau khi lưu thay đổi trang, bạn phải xóa bộ nhớ đệm của trình duyệt để nhìn thấy các thay đổi. Google Chrome, Firefox, Internet ExplorerSafari: Giữ phím ⇧ Shift và nhấn nút Reload/Tải lại trên thanh công cụ của trình duyệt. Để biết chi tiết và hướng dẫn cho các trình duyệt khác, xem Trợ giúp:Xóa bộ nhớ đệm.

// Usage: add importScript(User:NgocAnMaster/HarvErrors.js); to Special:Mypage/skin.js
// See also Wikipedia:Centralized discussion/Citation discussion#Technical discussion regarding Harvard Refs
// This script works fine for Harvard references in <ref> tags, but for inline Harv. refs,
// the error message shows up at the end of the paragraph in which the error is
error = " <strong class=error>Lỗi Harv: liên kết này không trỏ tới bất kỳ chú thích nào.</strong>";

jQuery(document).ready(function($) {
 links = document.links;
 for (i=0; i < links.length; i++)
 {
  href = links[i].getAttribute('href');
  if (href.indexOf('#CITEREF') == 0)
   if (document.getElementById(href.substring(1)) == null)
    links[i].parentNode.innerHTML += error;
 }
});