Skip to main content
added 386 characters in body
Source Link
Doorknob
  • 1.3k
  • 8
  • 19
// ==UserScript==
// @name       Edit summary options
// @description  Gives you little checkboxes above the edit summary with preset options like "formatted code" or "removed signature."
// @version    1.0
// @match      http://*.askubuntu.com/*
// @match      http://*.mathoverflow.net/*
// @match      http://*.onstartups.com/*
// @match      http://*.serverfault.com/*
// @match      http://*.stackapps.com/*
// @match      http://*.stackexchange.com/*
// @match      http://*.stackoverflow.com/*
// @match      http://*.superuser.com/*
// @copyright  Public Domain (no copyright)
// ==/UserScript==

$('.edit-post').click(function() {
  var iconfig = 0
  var configlocalStorage.__edit_summary_opts_config =|| {
    Grammar: 'fixed grammar',
    Spelling: 'fixed spelling',
    Format: 'formatting',
    'Code Format': 'formatted code',
    Dethank: 'removed thanks',
    Desig: 'removed signature',
    Degreet: 'removed greeting'
  }

$('.edit-post').click(function() {
  var intr = setInterval(function() {
    var ec = $('.edit-comment')
    if (ec.length) {
      clearInterval(intr)
      ec.css('opacity', '1')
      for (var x ini config)= {0
      var summaryDiv = ec.parents().eq(4)
      for (var x in config) {
        summaryDiv.before($('<input>').attr({type: 'checkbox', id: 'cb' + i})
                                              .change((function(x) { return function() {
                                                if (this.checked) {
                                                  ec.val(ec.val() ? ec.val() + ', ' + config[x] : config[x])
                                                } else {
                                                  ec.val(ec.val().replace(new RegExp(config[x] + '(, )?|, ' + config[x] + '$'), ''))
                                        }
        }
                              }})(x)))
                }})  .before(x)$('<label>').attr({for: 'cb' + i++})
                          .before($('<label>')            .attrcss({forpadding: 'cb' + i++'5px'})
                                      .text(x))
      }
      summaryDiv.cssafter({padding:$('<button>').text('Edit')
 '5px'}                                   .click(function() {
                                      config = localStorage.__edit_summary_opts_config = JSON.parse(prompt('Enter JSON, formatted like {"checkbox name": "value", ...}', JSON.textstringify(xconfig)) || JSON.stringify(config))
                                    }))
    }
  }, 100)
})
// ==UserScript==
// @name       Edit summary options
// @description  Gives you little checkboxes above the edit summary with preset options like "formatted code" or "removed signature."
// @version    1.0
// @match      http://*.askubuntu.com/*
// @match      http://*.mathoverflow.net/*
// @match      http://*.onstartups.com/*
// @match      http://*.serverfault.com/*
// @match      http://*.stackapps.com/*
// @match      http://*.stackexchange.com/*
// @match      http://*.stackoverflow.com/*
// @match      http://*.superuser.com/*
// @copyright  Public Domain (no copyright)
// ==/UserScript==

$('.edit-post').click(function() {
  var i = 0
  var config = {
    Grammar: 'fixed grammar',
    Spelling: 'fixed spelling',
    Format: 'formatting',
    'Code Format': 'formatted code',
    Dethank: 'removed thanks',
    Desig: 'removed signature',
    Degreet: 'removed greeting'
  }
  var intr = setInterval(function() {
    var ec = $('.edit-comment')
    if (ec.length) {
      clearInterval(intr)
      ec.css('opacity', '1')
      for (var x in config) {
        ec.parents().eq(4).before($('<input>').attr({type: 'checkbox', id: 'cb' + i})
                                              .change((function(x) { return function() {
                                                if (this.checked) {
                                                  ec.val(ec.val() ? ec.val() + ', ' + config[x] : config[x])
                                                } else {
                                                  ec.val(ec.val().replace(new RegExp(config[x] + '(, )?|, ' + config[x] + '$'), ''))
                                                }
                                              }})(x)))
                          .before($('<label>').attr({for: 'cb' + i++})
                                              .css({padding: '5px'})
                                              .text(x))
      }
    }
  }, 100)
})
  • Make config... well... configurable, so user can set his/her own options (save with localStorage)
  • Make it work for suggested edits too
  • Text in the edit summary is a bit messed up when you click edit a second time on a different post on the same page
// ==UserScript==
// @name       Edit summary options
// @description  Gives you little checkboxes above the edit summary with preset options like "formatted code" or "removed signature."
// @version    1.0
// @match      http://*.askubuntu.com/*
// @match      http://*.mathoverflow.net/*
// @match      http://*.onstartups.com/*
// @match      http://*.serverfault.com/*
// @match      http://*.stackapps.com/*
// @match      http://*.stackexchange.com/*
// @match      http://*.stackoverflow.com/*
// @match      http://*.superuser.com/*
// @copyright  Public Domain (no copyright)
// ==/UserScript==

var config = localStorage.__edit_summary_opts_config || {
  Grammar: 'fixed grammar',
  Spelling: 'fixed spelling',
  Format: 'formatting',
  'Code Format': 'formatted code',
  Dethank: 'removed thanks',
  Desig: 'removed signature',
  Degreet: 'removed greeting'
}

$('.edit-post').click(function() {
  var intr = setInterval(function() {
    var ec = $('.edit-comment')
    if (ec.length) {
      clearInterval(intr)
      ec.css('opacity', '1')
      var i = 0
      var summaryDiv = ec.parents().eq(4)
      for (var x in config) {
        summaryDiv.before($('<input>').attr({type: 'checkbox', id: 'cb' + i})
                                      .change((function(x) { return function() {
                                        if (this.checked) {
                                          ec.val(ec.val() ? ec.val() + ', ' + config[x] : config[x])
                                        } else {
                                          ec.val(ec.val().replace(new RegExp(config[x] + '(, )?|, ' + config[x] + '$'), ''))
                                        }
                                      }})(x)))
                  .before($('<label>').attr({for: 'cb' + i++})
                                      .css({padding: '5px'})
                                      .text(x))
      }
      summaryDiv.after($('<button>').text('Edit')
                                    .click(function() {
                                      config = localStorage.__edit_summary_opts_config = JSON.parse(prompt('Enter JSON, formatted like {"checkbox name": "value", ...}', JSON.stringify(config)) || JSON.stringify(config))
                                    }))
    }
  }, 100)
})
  • Make config... well... configurable, so user can set his/her own options (save with localStorage)
  • Make it work for suggested edits too
  • Text in the edit summary is a bit messed up when you click edit a second time on a different post on the same page
added 82 characters in body
Source Link
Doorknob
  • 1.3k
  • 8
  • 19
  • Make config... well... configurable, so user can set his/her own options (save with localStorage)
  • Make it work for suggested edits too
  • Text in the edit summary is a bit messed up when you click edit a second time on a different post on the same page
  • Make config... well... configurable, so user can set his/her own options (save with localStorage)
  • Text in the edit summary is a bit messed up when you click edit a second time on a different post on the same page
  • Make config... well... configurable, so user can set his/her own options (save with localStorage)
  • Make it work for suggested edits too
  • Text in the edit summary is a bit messed up when you click edit a second time on a different post on the same page
Source Link
Doorknob
  • 1.3k
  • 8
  • 19

Edit summary options

Description

Gives you little checkboxes above the edit summary with preset options like "formatted code" or "removed signature."

Screenshots

screenshot1

screenshot2

Userscript

http://userscripts.org/scripts/show/184914

Code

// ==UserScript==
// @name       Edit summary options
// @description  Gives you little checkboxes above the edit summary with preset options like "formatted code" or "removed signature."
// @version    1.0
// @match      http://*.askubuntu.com/*
// @match      http://*.mathoverflow.net/*
// @match      http://*.onstartups.com/*
// @match      http://*.serverfault.com/*
// @match      http://*.stackapps.com/*
// @match      http://*.stackexchange.com/*
// @match      http://*.stackoverflow.com/*
// @match      http://*.superuser.com/*
// @copyright  Public Domain (no copyright)
// ==/UserScript==

$('.edit-post').click(function() {
  var i = 0
  var config = {
    Grammar: 'fixed grammar',
    Spelling: 'fixed spelling',
    Format: 'formatting',
    'Code Format': 'formatted code',
    Dethank: 'removed thanks',
    Desig: 'removed signature',
    Degreet: 'removed greeting'
  }
  var intr = setInterval(function() {
    var ec = $('.edit-comment')
    if (ec.length) {
      clearInterval(intr)
      ec.css('opacity', '1')
      for (var x in config) {
        ec.parents().eq(4).before($('<input>').attr({type: 'checkbox', id: 'cb' + i})
                                              .change((function(x) { return function() {
                                                if (this.checked) {
                                                  ec.val(ec.val() ? ec.val() + ', ' + config[x] : config[x])
                                                } else {
                                                  ec.val(ec.val().replace(new RegExp(config[x] + '(, )?|, ' + config[x] + '$'), ''))
                                                }
                                              }})(x)))
                          .before($('<label>').attr({for: 'cb' + i++})
                                              .css({padding: '5px'})
                                              .text(x))
      }
    }
  }, 100)
})

Issues

  • Make config... well... configurable, so user can set his/her own options (save with localStorage)
  • Text in the edit summary is a bit messed up when you click edit a second time on a different post on the same page