From be91afa042cc7078607ecf192edb7277d989d9bf Mon Sep 17 00:00:00 2001 From: El RIDO Date: Thu, 27 Aug 2015 23:58:28 +0200 Subject: [PATCH] - fixing JS errors when syntax highlighting is disabled (point 1. #15) - fixing missing url conversion in highlighted text (point 2. # 15) --- js/zerobin.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/zerobin.js b/js/zerobin.js index 6d11c00b..2b1389cd 100644 --- a/js/zerobin.js +++ b/js/zerobin.js @@ -192,8 +192,10 @@ function displayMessages(key, comments) { } setElementText($('#cleartext'), cleartext); setElementText($('#prettyprint'), cleartext); - urls2links($('#cleartext')); // Convert URLs to clickable links. - prettyPrint(); + // Convert URLs to clickable links. + urls2links($('#cleartext')); + urls2links($('#prettyprint')); + if (typeof prettyPrint == 'function') prettyPrint(); // Display paste expiration. if (comments[0].meta.expire_date) $('#remainingtime').removeClass('foryoureyesonly').text('This document will expire in '+secondsToHuman(comments[0].meta.remaining_time)+'.').removeClass('hidden'); @@ -354,9 +356,11 @@ function send_data() { setElementText($('#cleartext'), $('#message').val()); setElementText($('#prettyprint'), $('#message').val()); + // Convert URLs to clickable links. urls2links($('#cleartext')); + urls2links($('#prettyprint')); showStatus(''); - prettyPrint(); + if (typeof prettyPrint == 'function') prettyPrint(); } else if (data.status==1) { showError('Could not create paste: '+data.message);