您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirects the new post page to the classic post page
当前为
// ==UserScript== // @name WordPress.com edit post redirects // @namespace tpenguinltg // @description Redirects the new post page to the classic post page // @include https://wordpress.com/post/* // @version 0.1.0 // @grant none // @license MPLv2.0; http://mozilla.org/MPL/2.0/ // @copyright 2015, tPenguinLTG (http://tpenguinltg.wordpress.com/) // @run-at document-start // ==/UserScript== var blogid=window.location.pathname.match(/\d+/)[0]; var postid=window.location.pathname.match(/\d+\/(\d+|new)/)[1]; // Function by dystroy. From http://stackoverflow.com/a/14388512 function fetchJSONFile(path, callback) { var httpRequest = new XMLHttpRequest(); httpRequest.onreadystatechange = function() { if (httpRequest.readyState === 4) { if (httpRequest.status === 200) { var data = JSON.parse(httpRequest.responseText); if (callback) callback(data); }//end if }//end if };//end onreadystatechange() httpRequest.open('GET', path); httpRequest.send(); } // Redirect to post URL based on API results fetchJSONFile("https://public-api.wordpress.com/rest/v1.1/sites/"+blogid, function(data) { var postURL; if(postid == "new") { postURL=data.URL+"/wp-admin/post-new.php"; }//if else { postURL=data.URL+"/wp-admin/post.php?post="+postid+"&action=edit"; }//end if window.location.replace(postURL); });