From fdef8bc5be89bbd82ad00af9794748893301c290 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 29 Jan 2017 14:31:44 +0100 Subject: [PATCH 1/3] starting to work on JSVerify & Mocha based unit tests for our JS code base --- .gitattributes | 4 +++ .gitignore | 1 + js/.istanbul.yml | 7 +++++ js/test.js | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ tst/README.md | 48 +++++++++++++++++++++++++---- tst/phpunit.xml | 2 +- 6 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 js/.istanbul.yml create mode 100644 js/test.js diff --git a/.gitattributes b/.gitattributes index e26be35..daef8b1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,9 @@ doc/ export-ignore tst/ export-ignore +js/.istanbul.yml export-ignore +js/test.js export-ignore +js/mocha-3.2.0.js export-ignore +css/mocha-3.2.0.css export-ignore .codeclimate.yml export-ignore .csslintrc export-ignore .dockerignore export-ignore diff --git a/.gitignore b/.gitignore index dfecbe3..9bfc991 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ vendor/**/build_phar.php composer.lock # Ignore unit testing logs, api docs and eclipse project files +js/node_modules/ tst/log/ .settings .buildpath diff --git a/js/.istanbul.yml b/js/.istanbul.yml new file mode 100644 index 0000000..bf6e067 --- /dev/null +++ b/js/.istanbul.yml @@ -0,0 +1,7 @@ +--- +instrumentation: + excludes: + - jquery-3.1.1.js + baseline-file: ../tst/log/js-coverage-baseline.json +reporting: + dir: ../tst/log/js-coverage-report diff --git a/js/test.js b/js/test.js new file mode 100644 index 0000000..399a856 --- /dev/null +++ b/js/test.js @@ -0,0 +1,78 @@ +'use strict'; +var jsc = require('jsverify'); + +before(function () { + this.jsdom = require('jsdom-global')(); + global.$ = global.jQuery = require('./jquery-3.1.1'); + global.sjcl = require('./sjcl-1.0.4'); + global.Base64 = require('./base64-2.1.9'); + global.RawDeflate = require('./rawdeflate-0.5'); + require('./rawinflate-0.3'); + require('./privatebin'); +}) + +after(function () { + this.jsdom(); +}) + +describe('helper', function () { + describe('secondsToHuman', function () { + jsc.property('returns an array with a number and a word', 'integer', function (number) { + var result = $.PrivateBin.helper.secondsToHuman(number); + return Array.isArray(result) && + result.length === 2 && + result[0] === parseInt(result[0], 10) && + typeof result[1] === 'string'; + }); + jsc.property('returns seconds on the first array position', 'integer 59', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[0] === number; + }); + jsc.property('returns seconds on the second array position', 'integer 59', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[1] === 'second'; + }); + jsc.property('returns minutes on the first array position', 'integer 60 3599', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[0] === Math.floor(number / 60); + }); + jsc.property('returns minutes on the second array position', 'integer 60 3599', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[1] === 'minute'; + }); + jsc.property('returns hours on the first array position', 'integer 3600 86399', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[0] === Math.floor(number / (60 * 60)); + }); + jsc.property('returns hours on the second array position', 'integer 3600 86399', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[1] === 'hour'; + }); + jsc.property('returns days on the first array position', 'integer 86400 5184000', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[0] === Math.floor(number / (60 * 60 * 24)); + }); + jsc.property('returns days on the second array position', 'integer 86400 5184000', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[1] === 'day'; + }); + // max safe integer as per http://ecma262-5.com/ELS5_HTML.htm#Section_8.5 + jsc.property('returns months on the first array position', 'integer 5184000 9007199254740991', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[0] === Math.floor(number / (60 * 60 * 24 * 30)); + }); + jsc.property('returns months on the second array position', 'integer 5184000 9007199254740991', function (number) { + return $.PrivateBin.helper.secondsToHuman(number)[1] === 'month'; + }); + }); + + describe('hashToParameterString', function () { + jsc.property('returns strings', 'dict nestring', function (dict) { + return typeof $.PrivateBin.helper.hashToParameterString(dict) === 'string'; + }); + }); + + describe('parameterStringToHash', function () { + jsc.property('returns objects', 'string', function (string) { + return typeof $.PrivateBin.helper.parameterStringToHash(string) === 'object'; + }); + jsc.property('decodes hashes generated with hashToParameterString', 'dict nestring', function (dict) { + var result = $.PrivateBin.helper.parameterStringToHash($.PrivateBin.helper.hashToParameterString(dict)); + // padding for URL shorteners + dict.p = 'p'; + return JSON.stringify(result) === JSON.stringify(dict); + }); + }); +}); + diff --git a/tst/README.md b/tst/README.md index 07564fc..76e69ee 100644 --- a/tst/README.md +++ b/tst/README.md @@ -1,20 +1,56 @@ -Running unit tests -================== +Running PHP unit tests +====================== In order to run these tests, you will need to install the following packages and its dependencies: * phpunit * php-gd * php-sqlite3 -* php-xdebug +* php-xdebug (for code coverage reports) Example for Debian and Ubuntu: -```sh -$ sudo aptitude install phpunit php-gd php-sqlite php-xdebug +```console +$ sudo apt install phpunit php-gd php-sqlite php-xdebug ``` To run the tests, just change into this directory and run phpunit: -```sh +```console $ cd PrivateBin/tst $ phpunit ``` + +Running JavaScript unit tests +============================= + +In order to run these tests, you will need to install the following packages +and its dependencies: +* npm + +Then you can use the node package manager to install the latest stable release +of mocha and istanbul (for code coverage reports) globally and jsVerify, jsdom +and jsdom-global locally: + +```console +$ npm install -g mocha istanbul +$ cd PrivateBin/js +$ npm install jsverify jsdom jsdom-global +``` + +Example for Debian and Ubuntu, including steps to allow current user to install +node modules globally: +```console +$ sudo apt install npm +$ sudo mkdir /usr/local/lib/node_modules +$ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} +$ ln -s /usr/bin/nodejs /usr/local/bin/node +$ npm install -g mocha istanbul +$ cd PrivateBin/js +$ npm install jsverify jsdom jsdom-global +``` + +To run the tests, just change into the `js` directory and run istanbul: +```console +$ cd PrivateBin/js +$ istanbul cover _mocha +``` + diff --git a/tst/phpunit.xml b/tst/phpunit.xml index 32cb66e..cb5606b 100644 --- a/tst/phpunit.xml +++ b/tst/phpunit.xml @@ -13,7 +13,7 @@ - + From d678f5dada0f4cb8555ebce50ca88f051b2fd1b3 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 29 Jan 2017 14:32:55 +0100 Subject: [PATCH 2/3] fixing inconsistency found in unit test --- js/privatebin.js | 163 +++++++++++++++++++++++----------------------- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 85 insertions(+), 82 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 5941751..d9eeda1 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -83,7 +83,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { var parameterString = ''; for (var key in hashMap) { - if(parameterString === '') + if (parameterString === '') { parameterString = encodeURIComponent(key); parameterString += '=' + encodeURIComponent(hashMap[key]); @@ -95,7 +95,10 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { } } // padding for URL shorteners - parameterString += '&p=p'; + if (parameterString.length > 0) { + parameterString += '&'; + } + parameterString += 'p=p'; return parameterString; }, @@ -112,14 +115,15 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { { var parameterHash = {}; var parameterArray = parameterString.split('&'); - for (var i = 0; i < parameterArray.length; i++) - { - var pair = parameterArray[i].split('='); - var key = decodeURIComponent(pair[0]); - var value = decodeURIComponent(pair[1]); - parameterHash[key] = value; + if (parameterArray[0] != '') { + for (var i = 0; i < parameterArray.length; i++) + { + var pair = parameterArray[i].split('='); + var key = decodeURIComponent(pair[0]); + var value = decodeURIComponent(pair[1]); + parameterHash[key] = value; + } } - return parameterHash; }, @@ -602,14 +606,14 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * PrivateBin logic * - * @name privatebin + * @name controller * @class */ - var privatebin = { + var controller = { /** * headers to send in AJAX requests * - * @name privatebin.headers + * @name controller.headers * @enum {Object} */ headers: {'X-Requested-With': 'JSONHttpRequest'}, @@ -617,7 +621,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * URL shortners create address * - * @name privatebin.shortenerUrl + * @name controller.shortenerUrl * @prop {string} */ shortenerUrl: '', @@ -625,7 +629,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * URL of newly created paste * - * @name privatebin.createdPasteUrl + * @name controller.createdPasteUrl * @prop {string} */ createdPasteUrl: '', @@ -634,7 +638,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { * get the current script location (without search or hash part of the URL), * eg. http://example.com/zero/?aaaa#bbbb --> http://example.com/zero/ * - * @name privatebin.scriptLocation + * @name controller.scriptLocation * @function * @return {string} current script location */ @@ -654,7 +658,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { * get the pastes unique identifier from the URL, * eg. http://example.com/zero/?c05354954c49a487#c05354954c49a487 returns c05354954c49a487 * - * @name privatebin.pasteID + * @name controller.pasteID * @function * @return {string} unique identifier */ @@ -666,7 +670,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * return the deciphering key stored in anchor part of the URL * - * @name privatebin.pageKey + * @name controller.pageKey * @function * @return {string} key */ @@ -703,7 +707,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * ask the user for the password and set it * - * @name privatebin.requestPassword + * @name controller.requestPassword * @function */ requestPassword: function() @@ -729,7 +733,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * use given format on paste, defaults to plain text * - * @name privatebin.formatPaste + * @name controller.formatPaste * @function * @param {string} format * @param {string} text @@ -789,7 +793,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * show decrypted text in the display area, including discussion (if open) * - * @name privatebin.displayMessages + * @name controller.displayMessages * @function * @param {Object} [paste] - (optional) object including comments to display (items = array with keys ('data','meta')) */ @@ -893,7 +897,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { headers: this.headers }) .fail(function() { - privatebin.showError(i18n._('Could not delete the paste, it was not stored in burn after reading mode.')); + controller.showError(i18n._('Could not delete the paste, it was not stored in burn after reading mode.')); }); helper.setMessage(this.remainingTime, i18n._( 'FOR YOUR EYES ONLY. Don\'t close this window, this message can\'t be displayed again.' @@ -970,7 +974,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * open the comment entry when clicking the "Reply" button of a comment * - * @name privatebin.openReply + * @name controller.openReply * @function * @param {Event} event */ @@ -999,7 +1003,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * send a reply in a discussion * - * @name privatebin.sendComment + * @name controller.sendComment * @function * @param {Event} event */ @@ -1040,51 +1044,51 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { { if (data.status === 0) { - privatebin.showStatus(i18n._('Comment posted.')); + controller.showStatus(i18n._('Comment posted.')); $.ajax({ type: 'GET', - url: privatebin.scriptLocation() + '?' + privatebin.pasteID(), + url: controller.scriptLocation() + '?' + controller.pasteID(), dataType: 'json', - headers: privatebin.headers, + headers: controller.headers, success: function(data) { if (data.status === 0) { - privatebin.displayMessages(data); + controller.displayMessages(data); } else if (data.status === 1) { - privatebin.showError(i18n._('Could not refresh display: %s', data.message)); + controller.showError(i18n._('Could not refresh display: %s', data.message)); } else { - privatebin.showError(i18n._('Could not refresh display: %s', i18n._('unknown status'))); + controller.showError(i18n._('Could not refresh display: %s', i18n._('unknown status'))); } } }) .fail(function() { - privatebin.showError(i18n._('Could not refresh display: %s', i18n._('server error or not responding'))); + controller.showError(i18n._('Could not refresh display: %s', i18n._('server error or not responding'))); }); } else if (data.status === 1) { - privatebin.showError(i18n._('Could not post comment: %s', data.message)); + controller.showError(i18n._('Could not post comment: %s', data.message)); } else { - privatebin.showError(i18n._('Could not post comment: %s', i18n._('unknown status'))); + controller.showError(i18n._('Could not post comment: %s', i18n._('unknown status'))); } } }) .fail(function() { - privatebin.showError(i18n._('Could not post comment: %s', i18n._('server error or not responding'))); + controller.showError(i18n._('Could not post comment: %s', i18n._('server error or not responding'))); }); }, /** * send a new paste to server * - * @name privatebin.sendData + * @name controller.sendData * @function * @param {Event} event */ @@ -1128,7 +1132,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { reader.onload = (function(theFile) { return function(e) { - privatebin.sendDataContinue( + controller.sendDataContinue( randomkey, filter.cipher(randomkey, password, e.target.result), filter.cipher(randomkey, password, theFile.name) @@ -1154,7 +1158,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * send a new paste to server, step 2 * - * @name privatebin.sendDataContinue + * @name controller.sendDataContinue * @function * @param {string} randomkey * @param {string} cipherdata_attachment @@ -1187,49 +1191,49 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { success: function(data) { if (data.status === 0) { - privatebin.stateExistingPaste(); - var url = privatebin.scriptLocation() + '?' + data.id + '#' + randomkey; - var deleteUrl = privatebin.scriptLocation() + '?pasteid=' + data.id + '&deletetoken=' + data.deletetoken; - privatebin.showStatus(''); - privatebin.errorMessage.addClass('hidden'); + controller.stateExistingPaste(); + var url = controller.scriptLocation() + '?' + data.id + '#' + randomkey; + var deleteUrl = controller.scriptLocation() + '?pasteid=' + data.id + '&deletetoken=' + data.deletetoken; + controller.showStatus(''); + controller.errorMessage.addClass('hidden'); $('#pastelink').html( i18n._( 'Your paste is %s (Hit [Ctrl]+[c] to copy)', url, url - ) + privatebin.shortenUrl(url) + ) + controller.shortenUrl(url) ); var shortenButton = $('#shortenbutton'); if (shortenButton) { - shortenButton.click($.proxy(privatebin.sendToShortener, privatebin)); + shortenButton.click($.proxy(controller.sendToShortener, privatebin)); } $('#deletelink').html('' + i18n._('Delete data') + ''); - privatebin.pasteResult.removeClass('hidden'); + controller.pasteResult.removeClass('hidden'); // we pre-select the link so that the user only has to [Ctrl]+[c] the link helper.selectText('pasteurl'); - privatebin.showStatus(''); - privatebin.formatPaste(data_to_send.formatter, privatebin.message.val()); + controller.showStatus(''); + controller.formatPaste(data_to_send.formatter, controller.message.val()); } else if (data.status === 1) { - privatebin.showError(i18n._('Could not create paste: %s', data.message)); + controller.showError(i18n._('Could not create paste: %s', data.message)); } else { - privatebin.showError(i18n._('Could not create paste: %s', i18n._('unknown status'))); + controller.showError(i18n._('Could not create paste: %s', i18n._('unknown status'))); } } }) .fail(function() { - privatebin.showError(i18n._('Could not create paste: %s', i18n._('server error or not responding'))); + controller.showError(i18n._('Could not create paste: %s', i18n._('server error or not responding'))); }); }, /** * check if a URL shortener was defined and create HTML containing a link to it * - * @name privatebin.shortenUrl + * @name controller.shortenUrl * @function * @param {string} url * @return {string} html @@ -1248,7 +1252,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * put the screen in "New paste" mode * - * @name privatebin.stateNewPaste + * @name controller.stateNewPaste * @function */ stateNewPaste: function() @@ -1278,7 +1282,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * put the screen in "Existing paste" mode * - * @name privatebin.stateExistingPaste + * @name controller.stateExistingPaste * @function * @param {boolean} [preview=false] - (optional) tell if the preview tabs should be displayed, defaults to false */ @@ -1318,7 +1322,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * when "burn after reading" is checked, disable discussion * - * @name privatebin.changeBurnAfterReading + * @name controller.changeBurnAfterReading * @function */ changeBurnAfterReading: function() @@ -1338,7 +1342,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * when discussion is checked, disable "burn after reading" * - * @name privatebin.changeOpenDisc + * @name controller.changeOpenDisc * @function */ changeOpenDisc: function() @@ -1358,7 +1362,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * forward to URL shortener * - * @name privatebin.sendToShortener + * @name controller.sendToShortener * @function * @param {Event} event */ @@ -1371,7 +1375,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * reload the page * - * @name privatebin.reloadPage + * @name controller.reloadPage * @function * @param {Event} event */ @@ -1384,7 +1388,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * return raw text * - * @name privatebin.rawText + * @name controller.rawText * @function * @param {Event} event */ @@ -1407,7 +1411,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * clone the current paste * - * @name privatebin.clonePaste + * @name controller.clonePaste * @function * @param {Event} event */ @@ -1435,7 +1439,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * set the expiration on bootstrap templates * - * @name privatebin.setExpiration + * @name controller.setExpiration * @function * @param {Event} event */ @@ -1450,7 +1454,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * set the format on bootstrap templates * - * @name privatebin.setFormat + * @name controller.setFormat * @function * @param {Event} event */ @@ -1469,7 +1473,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * set the language in a cookie and reload the page * - * @name privatebin.setLanguage + * @name controller.setLanguage * @function * @param {Event} event */ @@ -1482,7 +1486,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * support input of tab character * - * @name privatebin.supportTabs + * @name controller.supportTabs * @function * @param {Event} event */ @@ -1508,7 +1512,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * view the editor tab * - * @name privatebin.viewEditor + * @name controller.viewEditor * @function * @param {Event} event */ @@ -1524,7 +1528,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * view the preview tab * - * @name privatebin.viewPreview + * @name controller.viewPreview * @function * @param {Event} event */ @@ -1541,7 +1545,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * create a new paste * - * @name privatebin.newPaste + * @name controller.newPaste * @function */ newPaste: function() @@ -1556,7 +1560,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * removes an attachment * - * @name privatebin.removeAttachment + * @name controller.removeAttachment * @function */ removeAttachment: function() @@ -1572,7 +1576,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * decrypt using the password from the modal dialog * - * @name privatebin.decryptPasswordModal + * @name controller.decryptPasswordModal * @function */ decryptPasswordModal: function() @@ -1584,7 +1588,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * submit a password in the modal dialog * - * @name privatebin.submitPasswordModal + * @name controller.submitPasswordModal * @function * @param {Event} event */ @@ -1598,7 +1602,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { * display an error message, * we use the same function for paste and reply to comments * - * @name privatebin.showError + * @name controller.showError * @function * @param {string} message - text to display */ @@ -1631,7 +1635,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { * display a status message, * we use the same function for paste and reply to comments * - * @name privatebin.showStatus + * @name controller.showStatus * @function * @param {string} message - text to display * @param {boolean} [spin=false] - (optional) tell if the "spinning" animation should be displayed, defaults to false @@ -1665,7 +1669,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * bind events to DOM elements * - * @name privatebin.bindEvents + * @name controller.bindEvents * @function */ bindEvents: function() @@ -1698,7 +1702,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { /** * main application * - * @name privatebin.init + * @name controller.init * @function */ init: function() @@ -1782,17 +1786,16 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { } } + /** + * main application start, called when DOM is fully loaded + * runs privatebin when translations were loaded + */ + $(i18n.loadTranslations($.proxy(controller.init, controller))); + return { helper: helper, i18n: i18n, filter: filter, - privatebin: privatebin + controller: controller }; }(jQuery, sjcl, Base64, RawDeflate); - -/** - * main application start, called when DOM is fully loaded - * runs privatebin when translations were loaded - */ -jQuery(jQuery.PrivateBin.i18n.loadTranslations(jQuery.proxy(jQuery.PrivateBin.privatebin.init, jQuery.PrivateBin.privatebin))); - diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 3d51379..c6a5661 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -69,7 +69,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 40c3e12..98d7f32 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -47,7 +47,7 @@ if ($MARKDOWN): - + From cae5a7115136f68a5e07e2263d84a15397b42418 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 29 Jan 2017 14:48:56 +0100 Subject: [PATCH 3/3] fix missing class renaming --- js/privatebin.js | 6 +++--- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index d9eeda1..e8ba71f 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -1205,7 +1205,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { ); var shortenButton = $('#shortenbutton'); if (shortenButton) { - shortenButton.click($.proxy(controller.sendToShortener, privatebin)); + shortenButton.click($.proxy(controller.sendToShortener, controller)); } $('#deletelink').html('' + i18n._('Delete data') + ''); controller.pasteResult.removeClass('hidden'); @@ -1787,8 +1787,8 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { } /** - * main application start, called when DOM is fully loaded - * runs privatebin when translations were loaded + * main application start, called when DOM is fully loaded and + * runs controller initalization after translations are loaded */ $(i18n.loadTranslations($.proxy(controller.init, controller))); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index c6a5661..69d0e01 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -69,7 +69,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 98d7f32..4860f8c 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -47,7 +47,7 @@ if ($MARKDOWN): - +