PsychMentor

PsychMentor Notes

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name     PsychMentor
// @version  1.3
// @grant    none
// @include  https://www.mrcpsychmentor.com/review/textbook**
// @namespace psychmentor
// @description PsychMentor Notes
// ==/UserScript==



var pushTo = function(elem,id,host,loc){
var host = document.querySelector(host);
var x = document.createElement(elem);
x.id = id;
if(loc==1||loc==null||loc=='after'){host.appendChild(x);}
if(loc==0||loc=='before'){host.parentNode.insertBefore(x,host);}
}

var injectCss = function(css){
var head = document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = "text/css";
style.innerHTML = css;
head.insertBefore(style,head.childNodes[1]);
}



pushTo("button","mybtn",".nav-item",0)
let mybtn = document.getElementById("mybtn")

mybtn.innerHTML = "Run"

//Choose Title to be opened here N=0,1,2...
var select_title = document.querySelectorAll('[data-catid="1"]');
select_title[0].click();

mybtn.onclick = function(){
  let title = document.getElementById("passmedicine-title");
	title.setAttribute("style", "text-transform:capitalize");
  var str = title.innerHTML.replace(/(^\w{1})|(\s{1}\w{1})/g, match => match.toUpperCase());

  navigator.clipboard.writeText(str).then(function() {
    console.log('inside')
      var notes = document.querySelector("#passmedicinenotes")
  if(notes){
    console.log("notes detected..converting page")

    document.body.innerHTML = notes.innerHTML;

    window.print();

  }else{
    console.log("no notes")
  }
	}, function() {
  	console.log('outside')
	});

  


}