cms management

cms内部管理

目前为 2022-04-02 提交的版本,查看 最新版本

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