您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
给WordPress网站站长提供文章自动容灾备份的小脚本
当前为
// ==UserScript== // @name WordPress Post Backup // @namespace https://gitcafe.net // @version 0.3 // @description 给WordPress网站站长提供文章自动容灾备份的小脚本 // @author 云落 // @include */wp-admin/post* // @grant none // @charset UTF-8 // @run-at document-end // ==/UserScript== (function() { 'use strict'; /* 由于WordPress网站后台自带jQuery,所以这里不再重新载入 */ $(document).ready(function() { function getpostid(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } return null; } var postid = getpostid('post'); var TOKEN_KEY; if (postid) { TOKEN_KEY = postid; } else { TOKEN_KEY = 'newpost'; } //设置缓存 var setpostca =function (){ window.localStorage.setItem(TOKEN_KEY, $("#content").val()); } //删除缓存 var delpostca =function (){ window.localStorage.removeItem(TOKEN_KEY); } //输入内容更新缓存 $("#content").bind("input", setpostca ); //鼠标聚焦更新缓存 $("#content").focus( setpostca ); //保存草稿删除缓存 $('#save-post').on("click", delpostca ); //删除文章删除缓存 $('#delete-action').on("click", delpostca ); //发布文章删除缓存 $('#publish').on("click", delpostca ); //获取恢复 jQuery(document).on("click", "#get_localstorage", function() { var c = window.localStorage.getItem(TOKEN_KEY); $("#content").val(c); delpostca; }); //增加按钮 $("#wp-content-media-buttons").append(' <a class="button button-primary" id="get_localstorage" href="javascript:void(0);">↺ 一键恢复</a>'); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址