From d73c68ad85c60a036d05e13d7fd4327aa4fe2ae5 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 25 May 2019 10:10:59 +0200 Subject: [PATCH] insert Paste class to wrap the data, to be able to extend the paste with getters and format version handling --- js/privatebin.js | 17 ++++++++++++++++- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 0e5b1b55..8f559233 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -39,6 +39,21 @@ jQuery.PrivateBin = (function($, RawDeflate) { */ let z; + /** + * Paste class + * + * bundles helper fuctions around the paste formats + * + * @name Paste + * @class + */ + function Paste(data) { + // store all keys in the default locations for drop-in replacement + for (let key in data) { + this[key] = raw[key]; + } + } + /** * static Helper methods * @@ -4518,7 +4533,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { ); }); ServerInteraction.setSuccess(function (status, data) { - PasteDecrypter.run(data); + PasteDecrypter.run(new Paste(data)); // restore position window.scrollTo(0, orgPosition); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 031fca67..c89a172f 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -72,7 +72,7 @@ if ($MARKDOWN): endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index aabfe894..14aed276 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -50,7 +50,7 @@ if ($MARKDOWN): endif; ?> - +