Merge branch 'historyupdate'
Conflicts: tpl/bootstrap.php tpl/page.php And update SRI. @elrido also did not properly merge this branch. Doing it now…
This commit is contained in:
commit
e483d60eed
|
@ -1125,6 +1125,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
||||||
deleteUrl = helper.scriptLocation() + '?pasteid=' + data.id + '&deletetoken=' + data.deletetoken;
|
deleteUrl = helper.scriptLocation() + '?pasteid=' + data.id + '&deletetoken=' + data.deletetoken;
|
||||||
controller.showStatus('');
|
controller.showStatus('');
|
||||||
controller.errorMessage.addClass('hidden');
|
controller.errorMessage.addClass('hidden');
|
||||||
|
// show new URL in browser bar
|
||||||
history.pushState({type: 'newpaste'}, document.title, url);
|
history.pushState({type: 'newpaste'}, document.title, url);
|
||||||
|
|
||||||
$('#pastelink').html(
|
$('#pastelink').html(
|
||||||
|
@ -1133,6 +1134,11 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
||||||
url, url
|
url, url
|
||||||
) + controller.shortenUrl(url)
|
) + controller.shortenUrl(url)
|
||||||
);
|
);
|
||||||
|
// save newly created element
|
||||||
|
controller.pasteUrl = $('#pasteurl');
|
||||||
|
// and add click event
|
||||||
|
controller.pasteUrl.click($.proxy(controller.pasteLinkClick, controller));
|
||||||
|
|
||||||
var shortenButton = $('#shortenbutton');
|
var shortenButton = $('#shortenbutton');
|
||||||
if (shortenButton) {
|
if (shortenButton) {
|
||||||
shortenButton.click($.proxy(controller.sendToShortener, controller));
|
shortenButton.click($.proxy(controller.sendToShortener, controller));
|
||||||
|
@ -1532,6 +1538,25 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forces opening the paste if the link does not do this automatically.
|
||||||
|
*
|
||||||
|
* This is necessary as browsers will not reload the page when it is
|
||||||
|
* already loaded (which is fake as it is set via history.pushState()).
|
||||||
|
*
|
||||||
|
* @name controller.pasteLinkClick
|
||||||
|
* @function
|
||||||
|
* @param {Event} event
|
||||||
|
*/
|
||||||
|
pasteLinkClick: function(event)
|
||||||
|
{
|
||||||
|
// check if location is (already) shown in URL bar
|
||||||
|
if (window.location.href === this.pasteUrl.attr('href')) {
|
||||||
|
// if so we need to load link by reloading the site
|
||||||
|
this.reloadPage(event);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create a new paste
|
* create a new paste
|
||||||
*
|
*
|
||||||
|
@ -1733,6 +1758,8 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
||||||
this.passwordForm = $('#passwordform');
|
this.passwordForm = $('#passwordform');
|
||||||
this.passwordDecrypt = $('#passworddecrypt');
|
this.passwordDecrypt = $('#passworddecrypt');
|
||||||
this.pasteResult = $('#pasteresult');
|
this.pasteResult = $('#pasteresult');
|
||||||
|
// this.pasteUrl is saved in sendDataContinue() if/after it is
|
||||||
|
// actually created
|
||||||
this.prettyMessage = $('#prettymessage');
|
this.prettyMessage = $('#prettymessage');
|
||||||
this.prettyPrint = $('#prettyprint');
|
this.prettyPrint = $('#prettyprint');
|
||||||
this.preview = $('#preview');
|
this.preview = $('#preview');
|
||||||
|
|
19
js/test.js
19
js/test.js
|
@ -91,14 +91,14 @@ describe('helper', function () {
|
||||||
jsc.array(jsc.elements(queryString)),
|
jsc.array(jsc.elements(queryString)),
|
||||||
'string',
|
'string',
|
||||||
function (schema, address, query, fragment) {
|
function (schema, address, query, fragment) {
|
||||||
var query = query.join(''),
|
var queryString = query.join(''),
|
||||||
clean = jsdom('', {
|
clean = jsdom('', {
|
||||||
url: schema.join('') + '://' + address.join('') +
|
url: schema.join('') + '://' + address.join('') +
|
||||||
'/?' + query + '#' + fragment
|
'/?' + queryString + '#' + fragment
|
||||||
}),
|
}),
|
||||||
result = $.PrivateBin.helper.pasteId();
|
result = $.PrivateBin.helper.pasteId();
|
||||||
clean();
|
clean();
|
||||||
return query === result;
|
return queryString === result;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -111,14 +111,14 @@ describe('helper', function () {
|
||||||
jsc.array(jsc.elements(queryString)),
|
jsc.array(jsc.elements(queryString)),
|
||||||
jsc.array(jsc.elements(base64String)),
|
jsc.array(jsc.elements(base64String)),
|
||||||
function (schema, address, query, fragment) {
|
function (schema, address, query, fragment) {
|
||||||
var fragment = fragment.join(''),
|
var fragmentString = fragment.join(''),
|
||||||
clean = jsdom('', {
|
clean = jsdom('', {
|
||||||
url: schema.join('') + '://' + address.join('') +
|
url: schema.join('') + '://' + address.join('') +
|
||||||
'/?' + query.join('') + '#' + fragment
|
'/?' + query.join('') + '#' + fragmentString
|
||||||
}),
|
}),
|
||||||
result = $.PrivateBin.helper.pageKey();
|
result = $.PrivateBin.helper.pageKey();
|
||||||
clean();
|
clean();
|
||||||
return fragment === result;
|
return fragmentString === result;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
jsc.property(
|
jsc.property(
|
||||||
|
@ -129,14 +129,14 @@ describe('helper', function () {
|
||||||
jsc.array(jsc.elements(base64String)),
|
jsc.array(jsc.elements(base64String)),
|
||||||
jsc.array(jsc.elements(queryString)),
|
jsc.array(jsc.elements(queryString)),
|
||||||
function (schema, address, query, fragment, trail) {
|
function (schema, address, query, fragment, trail) {
|
||||||
var fragment = fragment.join(''),
|
var fragmentString = fragment.join(''),
|
||||||
clean = jsdom('', {
|
clean = jsdom('', {
|
||||||
url: schema.join('') + '://' + address.join('') + '/?' +
|
url: schema.join('') + '://' + address.join('') + '/?' +
|
||||||
query.join('') + '#' + fragment + '&' + trail.join('')
|
query.join('') + '#' + fragmentString + '&' + trail.join('')
|
||||||
}),
|
}),
|
||||||
result = $.PrivateBin.helper.pageKey();
|
result = $.PrivateBin.helper.pageKey();
|
||||||
clean();
|
clean();
|
||||||
return fragment === result;
|
return fragmentString === result;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -156,4 +156,3 @@ describe('helper', function () {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-U3vFk3jjVZbBFNUfv20uP9Qef6aGt3MbbiXGqHvH/ngJhGEWZKXQc6MhVNlHD2taiz3mm2PhtRbh8bwm9UmrKA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-oojW5CP3H92XSLVeiMzHPgDrhxptPF8XzaQQrGp9SbGlBM9nDSlYMNtE2vH7wwXjYX+iL58pUCct29uEQtMvNw==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
|
@ -47,7 +47,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-U3vFk3jjVZbBFNUfv20uP9Qef6aGt3MbbiXGqHvH/ngJhGEWZKXQc6MhVNlHD2taiz3mm2PhtRbh8bwm9UmrKA==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-oojW5CP3H92XSLVeiMzHPgDrhxptPF8XzaQQrGp9SbGlBM9nDSlYMNtE2vH7wwXjYX+iL58pUCct29uEQtMvNw==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
Loading…
Reference in New Issue