diff --git a/dreditor.user.js b/dreditor.user.js
index 7c38513..0fa0203 100644
--- a/dreditor.user.js
+++ b/dreditor.user.js
@@ -101,34 +101,34 @@ jQuery.fn.debug = jQuery.debug;
 var sortOrder;
 
 if ( document.documentElement.compareDocumentPosition ) {
-	sortOrder = function( a, b ) {
-		var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
-		if ( ret === 0 ) {
-			hasDuplicate = true;
-		}
-		return ret;
-	};
+    sortOrder = function( a, b ) {
+        var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
+        if ( ret === 0 ) {
+            hasDuplicate = true;
+        }
+        return ret;
+    };
 } else if ( "sourceIndex" in document.documentElement ) {
-	sortOrder = function( a, b ) {
-		var ret = a.sourceIndex - b.sourceIndex;
-		if ( ret === 0 ) {
-			hasDuplicate = true;
-		}
-		return ret;
-	};
+    sortOrder = function( a, b ) {
+        var ret = a.sourceIndex - b.sourceIndex;
+        if ( ret === 0 ) {
+            hasDuplicate = true;
+        }
+        return ret;
+    };
 } else if ( document.createRange ) {
-	sortOrder = function( a, b ) {
-		var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
-		aRange.selectNode(a);
-		aRange.collapse(true);
-		bRange.selectNode(b);
-		bRange.collapse(true);
-		var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
-		if ( ret === 0 ) {
-			hasDuplicate = true;
-		}
-		return ret;
-	};
+    sortOrder = function( a, b ) {
+        var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
+        aRange.selectNode(a);
+        aRange.collapse(true);
+        bRange.selectNode(b);
+        bRange.collapse(true);
+        var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
+        if ( ret === 0 ) {
+            hasDuplicate = true;
+        }
+        return ret;
+    };
 }
 // end sortOrder
 
@@ -2295,6 +2295,39 @@ Drupal.behaviors.dreditorIssuesFilterFormReset = function (context) {
 };
 
 /**
+ * Attach clone issue to issues.
+ */
+Drupal.behaviors.dreditorIssueClone = function (context) {
+  $('#comment-form:has(#edit-category)', context).once('dreditor-clone-button', function () {
+    var $form = $(this);
+    // Attach a button
+    var $button = $('<button id="dreditor-clone-button">Clone issue</button>');
+    $button.prependTo($('#project-issue-summary-links'));
+    $button.bind('click.dreditor-clone', function () {
+      // open new window
+      var project = /[^/]*$/.exec($('div.breadcrumb').find('a').attr('href'))[0];
+      var w = window.open('//drupal.org/node/add/project-issue/' + project, '_blank');
+
+      setTimeout(function() {
+          $(w).ready(function() {
+            console.log(w.name)
+            var $doc = $(w.document);
+            $doc.find('#edit-title').val('Copy of ' + $form.find('#edit-title').val());
+            $doc.find('#edit-rid').val($form.find('#edit-project-info-rid').val());
+            $doc.find('#edit-component').val($form.find('#edit-project-info-component').val());
+            $doc.find('#edit-category').val($form.find('#edit-category').val());
+            $doc.find('#edit-priority').val($form.find('#edit-priority').val());
+            $doc.find('#edit-assigned').val($form.find('#edit-project-info-assigned').val());
+            $doc.find('#edit-taxonomy-tags-9').val($form.find('#edit-taxonomy-tags-9').val());
+            var matches = window.location.href.match('^https?://drupal.org/node/([0-9]+)');
+            $doc.find('#edit-body').val('Follow up for [#' + matches[1] + ']\n\n<h3 id="summary-problem-motivation">Problem/Motivation</h3>\n(why the issue was filed, steps to reproduce the problem, etc.)\n\n<h3 id="summary-proposed-resolution">Proposed resolution</h3>\n(description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch)\n\n<h3 id="summary-remaining-tasks">Remaining tasks</h3>\n(reviews needed, tests to be written or run, documentation to be written, etc.)\n\n<h3 id="summary-ui-changes">User interface changes</h3>\n(new or changed features/functionality in the user interface, modules added or removed, changes to URL paths, changes to user interface text)\n\n<h3 id="summary-api-changes">API changes</h3>\n(API changes/additions that would affect module, install profile, and theme developers, including examples of before/after code if appropriate)\n\n<h3 id="summary-original-report">Original report by [username]</h3>\n// Text of original report here.\n(for legacy issues whose initial post was not the issue summary)');
+          });
+      }, 3000);
+    });
+  });
+};
+
+/**
  * Initialize Dreditor.
  */
 jQuery(document).ready(function () {
