From f755a99ab8178071377faf70fc712c2b8fe8602c Mon Sep 17 00:00:00 2001
From: rugk <rugk@posteo.de>
Date: Mon, 12 Dec 2016 17:37:51 +0100
Subject: [PATCH] Add table class to parsed Markdown

Fixes https://github.com/PrivateBin/PrivateBin/issues/140
---
 js/privatebin.js            | 5 ++++-
 tpl/bootstrap-compact.php   | 2 +-
 tpl/bootstrap-dark-page.php | 2 +-
 tpl/bootstrap-dark.php      | 2 +-
 tpl/bootstrap-page.php      | 2 +-
 tpl/bootstrap.php           | 2 +-
 tpl/page.php                | 2 +-
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/js/privatebin.js b/js/privatebin.js
index 8bfd7f7..c6da759 100644
--- a/js/privatebin.js
+++ b/js/privatebin.js
@@ -655,9 +655,12 @@ $(function() {
                         this.clearText.html(
                             converter.makeHtml(text)
                         );
+                        // add table class from bootstrap css
+                        this.clearText.find('table').addClass('table');
+
                         this.clearText.removeClass('hidden');
+                        this.prettyMessage.addClass('hidden');
                     }
-                    this.prettyMessage.addClass('hidden');
                     break;
                 case 'syntaxhighlighting':
                     if (typeof prettyPrintOne === 'function')
diff --git a/tpl/bootstrap-compact.php b/tpl/bootstrap-compact.php
index fa937b5..4fb0e82 100644
--- a/tpl/bootstrap-compact.php
+++ b/tpl/bootstrap-compact.php
@@ -52,7 +52,7 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ofJ8kC2nFEP1Tb494qM7ne2kGL+vL1syZHhKDfGr8xtl6sfC0JOIBw8ypwv7bTfo8TqJh0rAI0ZblsjuFcFEXA==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ao3YcQBWhhrlLoJMy2dMMxquh20LgglSKMWcSIbrYm1CQR7LaKpTSelt9vuAPUMWovfBJ1uNIjgy+oNzgJFE7A==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
diff --git a/tpl/bootstrap-dark-page.php b/tpl/bootstrap-dark-page.php
index b1b92f8..7a22251 100644
--- a/tpl/bootstrap-dark-page.php
+++ b/tpl/bootstrap-dark-page.php
@@ -52,7 +52,7 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ofJ8kC2nFEP1Tb494qM7ne2kGL+vL1syZHhKDfGr8xtl6sfC0JOIBw8ypwv7bTfo8TqJh0rAI0ZblsjuFcFEXA==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ao3YcQBWhhrlLoJMy2dMMxquh20LgglSKMWcSIbrYm1CQR7LaKpTSelt9vuAPUMWovfBJ1uNIjgy+oNzgJFE7A==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
diff --git a/tpl/bootstrap-dark.php b/tpl/bootstrap-dark.php
index 1801fbd..d031c5d 100644
--- a/tpl/bootstrap-dark.php
+++ b/tpl/bootstrap-dark.php
@@ -52,7 +52,7 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ofJ8kC2nFEP1Tb494qM7ne2kGL+vL1syZHhKDfGr8xtl6sfC0JOIBw8ypwv7bTfo8TqJh0rAI0ZblsjuFcFEXA==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ao3YcQBWhhrlLoJMy2dMMxquh20LgglSKMWcSIbrYm1CQR7LaKpTSelt9vuAPUMWovfBJ1uNIjgy+oNzgJFE7A==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
diff --git a/tpl/bootstrap-page.php b/tpl/bootstrap-page.php
index 591cf68..5209d86 100644
--- a/tpl/bootstrap-page.php
+++ b/tpl/bootstrap-page.php
@@ -52,7 +52,7 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ofJ8kC2nFEP1Tb494qM7ne2kGL+vL1syZHhKDfGr8xtl6sfC0JOIBw8ypwv7bTfo8TqJh0rAI0ZblsjuFcFEXA==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ao3YcQBWhhrlLoJMy2dMMxquh20LgglSKMWcSIbrYm1CQR7LaKpTSelt9vuAPUMWovfBJ1uNIjgy+oNzgJFE7A==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index feffff8..2a1fd92 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -52,7 +52,7 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ofJ8kC2nFEP1Tb494qM7ne2kGL+vL1syZHhKDfGr8xtl6sfC0JOIBw8ypwv7bTfo8TqJh0rAI0ZblsjuFcFEXA==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ao3YcQBWhhrlLoJMy2dMMxquh20LgglSKMWcSIbrYm1CQR7LaKpTSelt9vuAPUMWovfBJ1uNIjgy+oNzgJFE7A==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
diff --git a/tpl/page.php b/tpl/page.php
index fabd17c..cc4c07c 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -47,7 +47,7 @@ if ($MARKDOWN):
 <?php
 endif;
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ofJ8kC2nFEP1Tb494qM7ne2kGL+vL1syZHhKDfGr8xtl6sfC0JOIBw8ypwv7bTfo8TqJh0rAI0ZblsjuFcFEXA==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-ao3YcQBWhhrlLoJMy2dMMxquh20LgglSKMWcSIbrYm1CQR7LaKpTSelt9vuAPUMWovfBJ1uNIjgy+oNzgJFE7A==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->