cms backend management

cms内部管理

目前為 2022-04-06 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

/*
 * @Description: File Description
 * @FilePath: /study/temperMonkey/backend_cms_mangement/index.js
 * @LastEditors: zzz
 * @LastEditTime: 2022-04-06 11:49:09
 */
// ==UserScript==
// @name         cms backend management
// @name:zh-CN   cms内部管理
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  cms内部管理
// @author       zzailianlian
// @match        http://backend.meitun-test.com/index
// @icon         https://www.google.com/s2/favicons?sz=64&domain=meitun-test.com
// @license      MIT
// @run-at document-idle
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function () {
  'use strict';
  window.onload=function(){
    const wrapperToolsContainer = $('<div id="wrapperToolsContainer"></div>')
    wrapperToolsContainer.css({
      position: 'fixed',
      top: 50,
      right: 100,
      padding: '12px',
      background: '#3498db',
      borderRadius: '4px',
      fontSize: '14px',
      zIndex: 999,
      opacity: 0.1,
    });
    wrapperToolsContainer.hover(function () { $(this).css({ opacity: 1 }); }, function () { $(this).css({ opacity: .1 }); })
    const initCMSModule = $('<div>初始化cms页面</div>')
    initCMSModule.css({
      padding: '12px',
      color: 'white',
      background: '#2ecc71',
      borderRadius: '4px',
      fontSize: '14px',
      border: '1px solid #27ae60',
      zIndex: 999,
      marginBottom: '24px',
      cursor:'pointer'
    });
  
    const syncConfig = $('<div>同步配置到页面</div>')
    syncConfig.css({
      padding: '12px',
      color: 'white',
      background: '#2ecc71',
      borderRadius: '4px',
      fontSize: '14px',
      border: '1px solid #27ae60',
      zIndex: 999,
      cursor:'pointer'
  
    });
  
    $('body').append(wrapperToolsContainer)
    wrapperToolsContainer.append(initCMSModule).append(syncConfig)
  
    const CMS_PAGE = 'CMS_PAGE'
    initCMSModule.on('click', () => {
      // 初始化cms管理tab
      $("a:contains('v2.0CMS页面管理')").click()
      // GM_setValue(CMS_PAGE, $('#menubar_tabs').find('h3').last().find('a').attr('id'));
      console.log('---',$("a:contains('v2.0CMS页面管理')").attr('id'),$("a:contains('v2.0CMS页面管理')"),$("a:contains('v2.0CMS系统模板')").click)
      $("a:contains('v2.0CMS系统模板')").click()
    })
  
    syncConfig.on('click', () => {
      // 同步配置模板到页面
      console.log('我是同步',$("input[value='保      存']"))
      // $("input[value='保      存']").click()
      // $('#menubar_tabs').find('a:contains("v2.0CMS页面管理")').click()
      // $(document.getElementById('mainIframe_tabli_780').contentWindow.document.body).find('tr').find('td:contains("783")').parent().find('button:contains("编辑")').click()
      // setTimeout(function () {
      //   $(document.getElementById('mainIframe_modifyPage783').contentWindow.document.body).find('input[value="下一步"]').last().click()
      //   setTimeout(function () {
      //     $(document.getElementById('mainIframe_modifyPage783').contentWindow.document.body).find('input[value="保存"]').last().click()
      //     setTimeout(function () {
      //       $(document.getElementById('mainIframe_tabli_780').contentWindow.document.body).find('tr').find('td:contains("783")').parent().find('button:contains("同步线上")').click()
      //     }, 2000)
      //   }, 2000);
      // }, 2000)
    })
  }
  



})();