cms backend management

cms内部管理

当前为 2022-04-06 提交的版本,查看 最新版本

  1. /*
  2. * @Description: File Description
  3. * @FilePath: /study/temperMonkey/backend_cms_mangement/index.js
  4. * @LastEditors: zzz
  5. * @LastEditTime: 2022-04-06 11:24:35
  6. */
  7. // ==UserScript==
  8. // @name cms backend management
  9. // @name:zh-CN cms内部管理
  10. // @namespace http://tampermonkey.net/
  11. // @version 0.3
  12. // @description cms内部管理
  13. // @author zzailianlian
  14. // @match http://backend.meitun-test.com/index
  15. // @require https://code.jquery.com/jquery-3.5.1.min.js
  16. // @icon https://www.google.com/s2/favicons?sz=64&domain=meitun-test.com
  17. // @license MIT
  18. // @run-at document-idle
  19. // @grant GM_setValue
  20. // @grant GM_getValue
  21. // ==/UserScript==
  22.  
  23. (function () {
  24. 'use strict';
  25. window.onload=function(){
  26. const wrapperToolsContainer = $('<div id="wrapperToolsContainer"></div>')
  27. wrapperToolsContainer.css({
  28. position: 'fixed',
  29. top: 50,
  30. right: 100,
  31. padding: '12px',
  32. background: '#3498db',
  33. borderRadius: '4px',
  34. fontSize: '14px',
  35. zIndex: 999,
  36. opacity: 0.1,
  37. });
  38. wrapperToolsContainer.hover(function () { $(this).css({ opacity: 1 }); }, function () { $(this).css({ opacity: .1 }); })
  39. const initCMSModule = $('<div>初始化cms页面</div>')
  40. initCMSModule.css({
  41. padding: '12px',
  42. color: 'white',
  43. background: '#2ecc71',
  44. borderRadius: '4px',
  45. fontSize: '14px',
  46. border: '1px solid #27ae60',
  47. zIndex: 999,
  48. marginBottom: '24px',
  49. cursor:'pointer'
  50. });
  51. const syncConfig = $('<div>同步配置到页面</div>')
  52. syncConfig.css({
  53. padding: '12px',
  54. color: 'white',
  55. background: '#2ecc71',
  56. borderRadius: '4px',
  57. fontSize: '14px',
  58. border: '1px solid #27ae60',
  59. zIndex: 999,
  60. cursor:'pointer'
  61. });
  62. $('body').append(wrapperToolsContainer)
  63. wrapperToolsContainer.append(initCMSModule).append(syncConfig)
  64. const CMS_PAGE = 'CMS_PAGE'
  65. initCMSModule.on('click', () => {
  66. // 初始化cms管理tab
  67. $("a:contains('v2.0CMS页面管理')").click()
  68. // GM_setValue(CMS_PAGE, $('#menubar_tabs').find('h3').last().find('a').attr('id'));
  69. console.log('---',$("a:contains('v2.0CMS页面管理')").attr('id'))
  70. $("a:contains('v2.0CMS系统模板')").click()
  71. })
  72. syncConfig.on('click', () => {
  73. // 同步配置模板到页面
  74. console.log('我是同步',$("input[value='保 存']"))
  75. // $("input[value='保 存']").click()
  76. // $('#menubar_tabs').find('a:contains("v2.0CMS页面管理")').click()
  77. // $(document.getElementById('mainIframe_tabli_780').contentWindow.document.body).find('tr').find('td:contains("783")').parent().find('button:contains("编辑")').click()
  78. // setTimeout(function () {
  79. // $(document.getElementById('mainIframe_modifyPage783').contentWindow.document.body).find('input[value="下一步"]').last().click()
  80. // setTimeout(function () {
  81. // $(document.getElementById('mainIframe_modifyPage783').contentWindow.document.body).find('input[value="保存"]').last().click()
  82. // setTimeout(function () {
  83. // $(document.getElementById('mainIframe_tabli_780').contentWindow.document.body).find('tr').find('td:contains("783")').parent().find('button:contains("同步线上")').click()
  84. // }, 2000)
  85. // }, 2000);
  86. // }, 2000)
  87. })
  88. }
  89.  
  90.  
  91.  
  92. })();