Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial Commit

  • Loading branch information...
commit da5fca51c769402d76b870b401b5f213844785f3 0 parents
Mark authored June 28, 2011
4  README.md
Source Rendered
... ...
@@ -0,0 +1,4 @@
  1
+StackOverflow Edit Context Tab Remover
  2
+--------------------------------------
  3
+
  4
+Adds a simple button (\t) to stip tabs from the post material for easier editing. The button applies only to the edit context.
31  SOTabRemover.user.js
... ...
@@ -0,0 +1,31 @@
  1
+// ==UserScript==
  2
+// @name           StackOverflow Edit Context Tab Remover
  3
+// @author         Mark Elliot
  4
+// @description    Adds a button in the SO edit context to replace tab literals (\t) with 4 spaces
  5
+// @include        http://stackoverflow.com/posts/*/edit*
  6
+// @match          http://stackoverflow.com/posts/*/edit*
  7
+// ==/UserScript==
  8
+
  9
+// This work is licensed under the Creative Commons Attribution 3.0 Unported License. 
  10
+// To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/.
  11
+
  12
+function with_jquery(f) {
  13
+    var script = document.createElement("script");
  14
+    script.type = "text/javascript";
  15
+    script.textContent = "(" + f.toString() + ")(jQuery)";
  16
+    document.body.appendChild(script);
  17
+};
  18
+	
  19
+with_jquery(function($){
  20
+
  21
+	$(function(){
  22
+		$('ul#wmd-button-row li:last')
  23
+			.before('<li class="wmd-button" id="fix-tabs" style="left: 400px; font-family: monospace; padding-top: 3px; font-size: 11px; hover:">\\t</li>')
  24
+			.before('<li class="wmd-spacer" style="left: 375px;"></li>');
  25
+
  26
+		$('li#fix-tabs').click(function(){
  27
+			$('textarea#wmd-input.processed').val($('textarea#wmd-input.processed').text().replace(/\t/g, '    '));
  28
+		});
  29
+	});
  30
+	
  31
+});

0 notes on commit da5fca5

Please sign in to comment.
Something went wrong with that request. Please try again.