네이버 블로그 문서 구성 요약

네이버 블로그로 작성된 문서 구성을 간략하게 확인할 수 있습니다.

  1. // ==UserScript==
  2. // @namespace https://tampermonkey.myso.kr/
  3. // @name 네이버 블로그 문서 구성 요약
  4. // @description 네이버 블로그로 작성된 문서 구성을 간략하게 확인할 수 있습니다.
  5. // @copyright 2021, myso (https://tampermonkey.myso.kr)
  6. // @license Apache-2.0
  7. // @version 1.0.9
  8. // @author Won Choi
  9. // @connect naver.com
  10. // @match *://blog.naver.com/PostView*
  11. // @grant GM_addStyle
  12. // @grant GM_xmlhttpRequest
  13. // @require https://cdn.jsdelivr.net/npm/kr.myso.tampermonkey@1.0.25/assets/vendor/gm-app.js
  14. // @require https://cdn.jsdelivr.net/npm/kr.myso.tampermonkey@1.0.25/assets/vendor/gm-add-style.js
  15. // @require https://cdn.jsdelivr.net/npm/kr.myso.tampermonkey@1.0.25/assets/vendor/gm-add-script.js
  16. // @require https://cdn.jsdelivr.net/npm/kr.myso.tampermonkey@1.0.25/assets/vendor/gm-xmlhttp-request-async.js
  17. // @require https://cdn.jsdelivr.net/npm/kr.myso.tampermonkey@1.0.25/assets/donation.js
  18. // @require https://cdn.jsdelivr.net/npm/kr.myso.tampermonkey@1.0.25/assets/lib/naver-blog.js
  19. // @require https://cdn.jsdelivr.net/npm/kr.myso.tampermonkey@1.0.25/assets/lib/smart-editor-one.js
  20. // @require https://cdnjs.cloudflare.com/ajax/libs/uuid/8.3.2/uuidv4.min.js
  21. // @require https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.7.2/bluebird.min.js
  22. // @require https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js
  23. // @require https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js
  24. // ==/UserScript==
  25.  
  26. // ==OpenUserJS==
  27. // @author myso
  28. // ==/OpenUserJS==
  29. // ---------------------
  30. GM_App(async function main() {
  31. GM_donation('#viewTypeSelector, #postListBody, #wrap_blog_rabbit, #writeTopArea, #editor_frame', 0);
  32. GM_addStyle(`
  33. .cursor-help { cursor: help; }
  34. .content-analysis-flex-row { flex-direction: row; }
  35. .content-analysis-flex-column { flex-direction: column; }
  36. .content-analysis {
  37. position: fixed; z-index: 100000;
  38. margin:auto; left: 0; top: 0; right: auto; bottom: 0;
  39. width:300px; height: 80%; background: #fff; color: #333;
  40. display: flex; flex-direction: column;
  41. border: 1px solid rgba(0, 0, 0, 0.4);
  42. box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
  43. }
  44. .content-analysis:hover { width: 560px; }
  45. .content-analysis-body {
  46. flex-grow: 1; overflow-y: auto;
  47. }
  48. .content-analysis-subhead { background: #52565e; color:#fff; font-weight:bold; position: sticky; top: 0; font-size:12px; height: 30px; padding: 5px 15px; display: flex; align-items: center; justify-content: center; }
  49. .content-analysis-listview {}
  50. .content-analysis-listview li { display: flex; font-size:12px; height: 30px; padding: 5px 15px; align-items: center; justify-content: center; }
  51. .content-analysis-listview li > * { }
  52. .content-analysis-listview li > *:nth-child(1) { flex-grow:1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
  53. .content-analysis-listview li > *:nth-child(2) { min-width: 90px; display: flex; flex-direction: column; text-align: right; line-height: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
  54. .content-analysis-listitem { }
  55. .content-analysis-listitem:hover { background: #efefef; }
  56. .content-analysis-listhead { background: #279b37; color:#fff; font-weight:bold; position: sticky; top: 40px; }
  57. .content-analysis-listhead-title { background: #74d2e7; color:#fff; }
  58. .content-analysis-listhead-text { background: #48a9c5; color:#fff; }
  59. .content-analysis-listhead-image { background: #0085ad; color:#fff; }
  60. .content-analysis-listhead-video { background: #8db9ca; color:#fff; }
  61. .content-analysis-listhead-line { background: #4298b5; color:#fff; }
  62. .content-analysis-listhead-sticker { background: #005670; color:#fff; }
  63. .content-analysis-listhead-quotation { background: #00205b; color:#fff; }
  64. .content-analysis-listhead-places { background: #009f4d; color:#fff; }
  65. .content-analysis-listhead-link { background: #84bd00; color:#fff; }
  66. .content-analysis-listhead-file { background: #efdf00; color:#fff; }
  67. .content-analysis-listhead-schedule { background: #fe5000; color:#fff; }
  68. .content-analysis-listhead-code { background: #e4002b; color:#fff; }
  69. .content-analysis-listhead-table { background: #da1884; color:#fff; }
  70. .content-analysis-listhead-formula { background: #a51890; color:#fff; }
  71. .content-analysis-listhead-talktalk { background: #0077c8; color:#fff; }
  72. .content-analysis-listhead-material { background: #008eaa; color:#fff; }
  73.  
  74. @keyframes blinker {
  75. from { opacity: 1.0; outline: 0px solid #f00; }
  76. to { opacity: 0.3; outline: 1px solid #f00; }
  77. }
  78. .content-analysis-highlight {
  79. animation: blinker 0.3s linear 5;
  80. }
  81. `);
  82. const se = SE_parse(document); if(!se.content) return;
  83. const wrap = document.querySelector('#content-analaysis') || document.createElement('div'); wrap.id = 'content-analaysis'; document.body.prepend(wrap);
  84. Handlebars.registerHelper('size', (obj) => _.size(obj));
  85. Handlebars.registerHelper('length', (section) => SE_componentContent([section]).replace(/[\r\n]+/g, '').length);
  86. Handlebars.registerHelper('lengthTrim', (section) => SE_componentContent([section]).replace(/[\r\n\s]+/g, '').length);
  87. GM_addScript(() => {
  88. function toggle(index, state) {
  89. let docs = document;
  90. const clipContent = docs.querySelector('#__clipContent'); if(clipContent) { docs = new DOMParser().parseFromString(clipContent.textContent, 'text/html'); }
  91. const sectionsV2 = Array.from(docs.querySelectorAll('.post_tit_area + #viewTypeSelector > *, body.se2_inputarea > *'));
  92. const sectionsV3 = Array.from(docs.querySelectorAll('#viewTypeSelector .se_component, .se_doc_viewer .se_component, .editor-canvas-wrap .se_component, #se_canvas_wrapper .se_component, .se_card_container .se_component'));
  93. const sectionsV4 = Array.from(docs.querySelectorAll('#viewTypeSelector .se-component, .se-viewer .se-component, .se-main-container .se-component, .se-container .se-component'));
  94. const sections = [sectionsV2, sectionsV3, sectionsV4].flat();
  95. const component = sections[index];
  96. if(component) {
  97. event.preventDefault();
  98. component.scrollIntoView({behavior: "smooth", block: "center", inline: "nearest"});
  99. component.classList.remove('content-analysis-highlight');
  100. void component.offsetWidth;
  101. if(state) component.classList.add('content-analysis-highlight');
  102. }
  103. }
  104. window.content_analysis_focus = function content_analysis_focus(index) { toggle(index, true); };
  105. window.content_analysis_focusout = function content_analysis_focusout(index) { toggle(index, false); }
  106. });
  107. const tmpl = Handlebars.compile(`
  108. <div class="content-analysis">
  109. <div class="content-analysis-body">
  110. <h3 class="content-analysis-subhead content-analysis-flex-column">
  111. <span>총 {{size sections}}개의 구성요소</span>
  112. <small>글자수: {{contentLength}}자 (공백제외: {{contentLengthTrim}}자)</small>
  113. </h3>
  114. <ul class="content-analysis-listview">
  115. {{#each sections}}
  116. <li class="content-analysis-listhead content-analysis-listhead-{{type}} cursor-help" onmouseover="content_analysis_focus({{offset}})" onmouseout="content_analysis_focusout({{offset}})">
  117. <h4>{{type}}</h4>
  118. <div>
  119. <span class="content-analysis-value">글자수: {{length this}}자 (공백제외: {{lengthTrim this}}자)</span>
  120. </div>
  121. </li>
  122. {{/each}}
  123. </ul>
  124. </div>
  125. </div>
  126. `);
  127. wrap.innerHTML = tmpl(se);
  128. });

QingJ © 2025

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