Amboss Copier

Copy article informations from Miamed Amboss.

当前为 2016-09-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Amboss Copier
  3. // @namespace http://oix.cc/gm
  4. // @description Copy article informations from Miamed Amboss.
  5. // @author Bin Zhang
  6. // @icon https://amboss.miamed.de/favicon-192x192.png
  7. // @homepageURL http://oix.cc/amboss
  8. // @version 0.0.2
  9. // @match https://amboss.miamed.de/library
  10. // @include /^https?://amboss-miamed-de\.ezproxy\..*/library$/
  11. // @run-at document-idle
  12. // ==/UserScript==
  13.  
  14. (function(){
  15.  
  16. var loadingWatcher;
  17.  
  18. if (typeof angular !== 'undefined' || typeof angular.element('#LibraryContent').scope() !== 'undefined') {
  19. setwatcher();
  20. window.addEventListener("hashchange", setwatcher);
  21. }
  22.  
  23. function setwatcher() {
  24. loadingWatcher = setInterval(checkloading, 20);
  25. }
  26. function checkloading() {
  27. //console.log('watch');
  28. //console.log(angular.element('#LibraryContent').scope().$root.loading);
  29.  
  30. if (angular.element('#LibraryContent').scope().$root.loading !== true) {
  31. //console.log(typeof angular.element('#LibraryContent').scope().$root.loading);
  32. clearInterval(loadingWatcher);
  33. loaded();
  34. }
  35. }
  36.  
  37. function loaded () {
  38. //console.log('loaded');
  39. if ($('#LibraryContent').find('table.LibraryList').length > 0) {
  40. console.log('list');
  41. }
  42. else if ($('#LibraryContent').find('article.LearningCard').length > 0) {
  43. console.log('card');
  44. }
  45. }
  46.  
  47. }());