From ba65700aad24f1306f1ac9b44c5ababc3bafcc2d Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 31 May 2014 23:46:34 +0200 Subject: [PATCH] Use textarea value for log posting --- couchpotato/core/plugins/log/static/log.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/log/static/log.js b/couchpotato/core/plugins/log/static/log.js index 8b97dab..11acb5c 100644 --- a/couchpotato/core/plugins/log/static/log.js +++ b/couchpotato/core/plugins/log/static/log.js @@ -210,7 +210,8 @@ Running on: ...\n\ version = Updater.getInfo(), body = self.report_text .replace('{issue}', text) - .replace('{version}', version ? version.version.repr : '...'); + .replace('{version}', version ? version.version.repr : '...'), + textarea; var overlay = new Element('div.report', { 'method': 'post', @@ -243,7 +244,7 @@ Running on: ...\n\ 'text': ' before posting, then copy the text below' }) ), - new Element('textarea', { + textarea = new Element('textarea', { 'text': body, 'events': { 'click': function(){ @@ -254,7 +255,17 @@ Running on: ...\n\ new Element('a.button', { 'target': '_blank', 'text': 'Create a new issue on GitHub with the text above', - 'href': 'https://github.com/RuudBurger/CouchPotatoServer/issues/new?body=' + (body.length < 2000 ? encodeURIComponent(body) : 'Paste the text here') + 'href': 'https://github.com/RuudBurger/CouchPotatoServer/issues/new', + 'events': { + 'click': function(e){ + (e).stop(); + + var body = textarea.get('value'), + bdy = '?body=' + (body.length < 2000 ? encodeURIComponent(body) : 'Paste the text here'), + win = window.open(e.target.get('href') + bdy, '_blank'); + win.focus(); + } + } }) ) );