TTS Reader Extension

Cleans up https://ttsreader.com tts app for cleaner experience

目前為 2019-03-07 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name TTS Reader Extension
  3. // @namespace https://github.com/Amourspirit/TTS-Reader-Extension
  4. // @version 0.3.0
  5. // @description Cleans up https://ttsreader.com tts app for cleaner experience
  6. // @run-at document-end
  7. // @match http://ttsreader.com/
  8. // @match https://ttsreader.com/
  9. // @match http://ttsreader.com/online-reader/
  10. // @match https://ttsreader.com/online-reader/
  11. // @grant none
  12. // @noframes
  13. // @license MIT
  14. // @homepageURL https://github.com/Amourspirit/TTS-Reader-Extension
  15. // @update https://github.com/Amourspirit/TTS-Reader-Extension/raw/master/TTS_Reader_Extension.user.js
  16. // @contributionURL https://github.com/Amourspirit/TTS-Reader-Extension/
  17. // ==/UserScript==
  18. (function() {
  19. 'use strict';
  20.  
  21. document.getElementById('app_ad_banner_right').style.display = 'none';
  22. document.getElementById('app_ad_banner_left').style.display = 'none';
  23. document.getElementById('app_container').style.position = 'static';
  24. document.getElementById('goPremiumBtn').style.display = 'none';
  25.  
  26. setUiNotFullScreen();
  27.  
  28. var appC = document.getElementById('app_container');
  29. appC.style.right = '0px';
  30. appC.style.left = '0px';
  31. appC.style.width = '100%';
  32.  
  33. var appP = document.getElementById('app_panel');
  34. appP.style.top = '70px';
  35.  
  36. $('#fullScreenBtn').off('click');
  37. $("#fullScreenBtn").on("click", function () {
  38. toggleFullScreen();
  39. });
  40. if (!isPremium()) {
  41. // localStorage.setItem("isPremium","true");
  42. $('.ad').hide();
  43. if (document.getElementById('removeAdsBtn')) {
  44. document.getElementById('removeAdsBtn').style.display = "none";
  45. }
  46. $('#app_panel').css('top', '67px');
  47. $('#app_panel').css('bottom', '0');
  48. }
  49. if ($('#helpBtn').length) {
  50. $('#helpBtn').off('click');
  51. $('#helpBtn').on('click', function () {
  52. if (isFullScreen) {
  53. toggleFullScreen();
  54. }
  55. invokeHelpDialog();
  56. });
  57. }
  58.  
  59. function setUiNotFullScreen() {
  60. var app = $('#application');
  61. app.css('background-image', "url('../img/app/desk.jpeg')");
  62. app.css('background-size', "cover");
  63. app.css('height', "700px");
  64. app.css('width', "100%");
  65. app.css('max-height', "80vh");
  66. app.css('max-width', "100%");
  67. app.css('padding','0px');
  68. app.css('margin', '0px');
  69. app.css('left', '0px');
  70. app.css('right', '0px');
  71. }
  72.  
  73. function toggleFullScreen() {
  74. var app = document.getElementById("application");
  75. if (!isFullScreen) {
  76. var reqF = app.requestFullScreen || app.webkitRequestFullScreen || app.mozRequestFullScreen || app.msRequestFullscreen;
  77. reqF.call(app);
  78. $(app).css('background', "white");
  79. $(app).css('height', "100vh");
  80. $(app).css('width', "100vh");
  81. $(app).css('max-height', "100vh");
  82. } else {
  83. var reqE = document.exitFullscreen || document.webkitExitFullscreen || document.mozCancelFullScreen || document.msExitFullscreen ;
  84. reqE.call(document);
  85. setUiNotFullScreen();
  86. }
  87. isFullScreen = !isFullScreen;
  88. }
  89. })();