NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Voat - edit empty message // @namespace https://voat.co/ // @version 0.1 // @description Allows editing empty messages // @author kashka (https://voat.co/user/kashka) // @include https://voat.co/v/*/comments/* // @include https://voat.co/v/*/comments/*/* // @include https://www.voat.co/v/*/comments/* // @include https://www.voat.co/v/*/comments/*/* // @grant none // @run-at load // @updateURL https://openuserjs.org/install/kashka/Voat_-_edit_empty_message.meta.js // @downloadURL https://openuserjs.org/install/kashka/Voat_-_edit_empty_message.user.js // ==/UserScript== (function() { 'use strict'; var username = $('a[title="Profile"]').text(); // Is user logged in? if(username) { var submittedBy = $(".submission a.author").text(); // Did the user submit this? if(username == submittedBy) { var domain = $(".submission .domain > a").attr("href"); // Is this a self post? if(domain.match(/^\/v\//)) { // Is the submission empty? if($(".submission .md").length === 0) { // Replace the edit button with a "make editable" button var editBtn = $('.submission li > a[onclick^="return editsubmission"]'); var id = parseInt(editBtn.attr("onclick").match(/.*\((\d+)\)/)[1], 10); editBtn.text("make editable"); editBtn.removeAttr("onclick"); editBtn.click(function() { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", // Add a space to the empty message, this enables the edit form data: JSON.stringify({"SubmissionId": id, "SubmissionContent": " "}), url: "/editsubmission", datatype: "json", success: function(t) { location.reload(); } }); return false; }); } } } } })();