--- dreditor-button-to-prepend-1277974-86.patch 2013-08-12 21:38:29.000000000 -0700 +++ dreditor-button-to-prepend-1277974-88.patch 2013-08-12 21:54:14.000000000 -0700 @@ -1,20 +1,10 @@ -From 0d2951b1ac0fef2c9cb29c4ed09fad8f9848dc61 Mon Sep 17 00:00:00 2001 -From: Mark Carver -Date: Mon, 12 Aug 2013 23:38:22 -0500 -Subject: Issue #1277974 by Mark Carver, Cottser, YesCT, xjm, clemens.tolboom: - Button to prepend the 'Issue summary standard' template into Issue body. - ---- - dreditor.user.js | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 79 insertions(+) - diff --git a/dreditor.user.js b/dreditor.user.js -index c5fab56..fdce7b2 100644 +index 6a55788..dfaf64b 100644 --- a/dreditor.user.js +++ b/dreditor.user.js -@@ -1555,6 +1555,85 @@ Drupal.behaviors.dreditorIssueSummary = function (context) { +@@ -1555,6 +1555,98 @@ Drupal.behaviors.dreditorIssueSummary = function (context) { }; - + /** + * Adds a button to insert the issue summary template. + */ @@ -39,7 +29,19 @@ + .appendTo($label) + .click(function (e) { + // Load the issue summary instructions. -+ $.get('//drupal.org/node/1326662', function (data) { ++ if (!Drupal.storage.load('issueSummaryTemplate')) { ++ $.get('//drupal.org/node/1326662', function(data){ ++ Drupal.storage.save('issueSummaryTemplate', data); ++ dreditorIssueTemplateProcess(data); ++ }); ++ } ++ else { ++ var data = Drupal.storage.load('issueSummaryTemplate'); ++ dreditorIssueTemplateProcess(data); ++ } ++ ++ // Process the issue summary instructions. ++ function dreditorIssueTemplateProcess(data) { + // Retrieve the template. + var $template = $('
').html($(data).find('#node-1326662 code').text()); + // On node add, remove the "Original report by" section. @@ -79,7 +81,8 @@ + } + // Prepend text to current body. + $body.val($template.html().replace(/<\/em>/g, "\n\n").replace(/<\/h3>/g, "\n\n") + $body.val()); -+ }); ++ } ++ + // Prevent default "click" event. + e.preventDefault(); + }); @@ -98,6 +101,3 @@ * Streamline issue comment form. * * Altering of the form makes certain browsers (such as Firefox) no longer find --- -1.8.3.4 -