rugk 2017-02-17 22:26:39 +01:00
parent b0876ea0e0
commit 52d1be1b54
No known key found for this signature in database
GPG Key ID: 05D40A636AFAB34D
2 changed files with 27 additions and 10 deletions

View File

@ -2560,6 +2560,8 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
*/ */
function rawText(event) function rawText(event)
{ {
TopNav.hideAllButtons();
Alert.showLoading('Showing raw text…', 0, 'time');
var paste = PasteViewer.getText(); var paste = PasteViewer.getText();
// push a new state to allow back navigation with browser back button // push a new state to allow back navigation with browser back button
@ -2573,11 +2575,14 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
// we use text/html instead of text/plain to avoid a bug when // we use text/html instead of text/plain to avoid a bug when
// reloading the raw text view (it reverts to type text/html) // reloading the raw text view (it reverts to type text/html)
var $head = $('head').children().not('noscript, script, link[type="text/css"]');
var newDoc = document.open('text/html', 'replace'); var newDoc = document.open('text/html', 'replace');
newDoc.write('<pre>' + Helper.htmlEntities(paste) + '</pre>'); newDoc.write('<!DOCTYPE html><html><head>');
for (var i = 0; i < $head.length; i++) {
newDoc.write($head[i].outerHTML);
}
newDoc.write('</head><body><pre>' + Helper.htmlEntities(paste) + '</pre></body></html>');
newDoc.close(); newDoc.close();
event.preventDefault();
} }
/** /**
@ -2643,7 +2648,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
/** /**
* Shows all elements belonging to viwing an existing pastes * Shows all elements belonging to viwing an existing pastes
* *
* @name TopNav.hideAllElem * @name TopNav.showViewButtons
* @function * @function
*/ */
me.showViewButtons = function() me.showViewButtons = function()
@ -2663,7 +2668,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
/** /**
* Hides all elements belonging to existing pastes * Hides all elements belonging to existing pastes
* *
* @name TopNav.hideAllElem * @name TopNav.hideViewButtons
* @function * @function
*/ */
me.hideViewButtons = function() me.hideViewButtons = function()
@ -2680,6 +2685,18 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
viewButtonsDisplayed = false; viewButtonsDisplayed = false;
}; };
/**
* Hides all elements belonging to existing pastes
*
* @name TopNav.hideAllButtons
* @function
*/
me.hideAllButtons = function()
{
me.hideViewButtons();
me.hideCreateButtons();
};
/** /**
* shows all elements needed when creating a new paste * shows all elements needed when creating a new paste
* *
@ -3393,7 +3410,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
Alert.setCustomHandler(DiscussionViewer.handleNotification); Alert.setCustomHandler(DiscussionViewer.handleNotification);
// UI loading state // UI loading state
TopNav.hideViewButtons(); TopNav.hideAllButtons();
Alert.showLoading('Sending comment…', 0, 'cloud-upload'); Alert.showLoading('Sending comment…', 0, 'cloud-upload');
// get data // get data
@ -3467,7 +3484,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
Controller.hideStatusMessages(); Controller.hideStatusMessages();
// UI loading state // UI loading state
TopNav.hideCreateButtons(); TopNav.hideAllButtons();
Alert.showLoading('Sending paste…', 0, 'cloud-upload'); Alert.showLoading('Sending paste…', 0, 'cloud-upload');
TopNav.collapseBar(); TopNav.collapseBar();
@ -3826,7 +3843,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
{ {
// Important: This *must not* run Alert.hideMessages() as previous // Important: This *must not* run Alert.hideMessages() as previous
// errors from viewing a paste should be shown. // errors from viewing a paste should be shown.
TopNav.hideViewButtons(); TopNav.hideAllButtons();
Alert.showLoading('Preparing new paste…', 0, 'time'); Alert.showLoading('Preparing new paste…', 0, 'time');
PasteStatus.hideMessages(); PasteStatus.hideMessages();
@ -3911,7 +3928,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
me.clonePaste = function(event) me.clonePaste = function(event)
{ {
TopNav.collapseBar(); TopNav.collapseBar();
TopNav.hideViewButtons(); TopNav.hideAllButtons();
Alert.showLoading('Cloning paste…', 0, 'transfer'); Alert.showLoading('Cloning paste…', 0, 'transfer');
// hide messages from previous paste // hide messages from previous paste

View File

@ -4,7 +4,7 @@ $isCpct = substr($template, 9, 8) === '-compact';
$isDark = substr($template, 9, 5) === '-dark'; $isDark = substr($template, 9, 5) === '-dark';
$isPage = substr($template, -5) === '-page'; $isPage = substr($template, -5) === '-page';
?><!DOCTYPE html> ?><!DOCTYPE html>
<html lang="en"> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">