Skip to content
This repository has been archived by the owner on Oct 2, 2018. It is now read-only.

Commit

Permalink
Fix #234
Browse files Browse the repository at this point in the history
  • Loading branch information
ferndot committed Feb 4, 2015
1 parent 9748be6 commit 9c20a33
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 165 deletions.
24 changes: 5 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ <h2 data-l10n-id="other">Other</h2>
data-swipe-right="sidebar" data-swipe-right-id="main" data-swipe-right-state="close"
data-click="sidebar" data-click-id="main" data-click-state="close">
<header class="edit-header">
<button data-click="closeFile"><span class="icon icon-close"></span></button>
<button data-click="closeFile" class="no-zen"><span class="icon icon-close"></span></button>
<menu type="toolbar">
<button data-click="saveFromEditor" id="editorSaveButton"><span class="icon icon-save"></span></button>
<button data-click="fullscreen"><span class="icon icon-fs"></span></button>
<button data-click="sidebar" data-click-id="main" class="menu drawerEnabled"><span class="icon icon-menu"></span></button>
<button data-click="saveFromEditor" class="no-zen" id="editorSaveButton"><span class="icon icon-save"></span></button>
<button data-click="fullscreen" class="desktop-only" id="editor-zen-button"><span class="icon icon-fs"></span></button>
<button data-click="sidebar" data-click-id="main" class="menu drawerEnabled no-zen"><span class="icon icon-menu"></span></button>
</menu>
<h1 id="fileName"><span id="currentFileLocation" style="display:none;"></span><span id="currentFileDirectory" style="display:none;"></span><span id="currentFileName"></span><span id="currentFileType"></span></h1>
<h1 id="fileName" class="no-zen"><span id="currentFileLocation" style="display:none;"></span><span id="currentFileDirectory" style="display:none;"></span><span id="currentFileName"></span><span id="currentFileType"></span></h1>
<div class="tabBar">
<div data-click="tab" data-click-name="design" data-l10n-id="design" role="tab-button" data-tab-id="design">Design</div>
<div data-click="tab" data-click-name="raw" data-l10n-id="raw" role="tab-button" data-tab-id="raw">Raw</div>
Expand All @@ -281,11 +281,6 @@ <h1 id="fileName"><span id="currentFileLocation" style="display:none;"></span><s
<code class="prettyprint lang-html" id="rawEditor" data-focus="hideToolbar" data-blur="showToolbar"></code>
</div>
</ul>
<div class="tabToolbar" id="tabToolbarRight">
<button data-click="saveFromEditor" id="zenSaveButton" class="icon-save"></button>
<button data-click="fullscreen" data-click-state="off" class="icon-efs"></button>
<button data-click="sidebar" data-click-id="main" class="icon-menu drawerEnabled"></button>
</div>
</div>
<button class="icon-more" id="hide-keyboard-button"></button>
<section role="status" id="save-banner" hidden>
Expand Down Expand Up @@ -585,15 +580,6 @@ <h2 data-l10n-id="privacy">Privacy</h2>
</ul>
<h2 data-l10n-id="visual">Visual</h2>
<ul>
<li class="noLink" id="autozen-enabled">
<aside class="pack-end">
<label class="pack-switch">
<input type="checkbox" id="autozen-enabled-switch">
<span></span>
</label>
</aside>
<p class="label" data-l10n-id="edit-with-zen-mode">Edit with <b>Zen Mode</b></p>
</li>
<li class="noLink">
<aside class="pack-end">
<label class="pack-switch">
Expand Down
1 change: 0 additions & 1 deletion locales/en-US/app.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ documents-dropbox=Documents on your Dropbox
done=Done
dropbox-full=Your Dropbox is full. Refreshing will not help.
edit-docs=Edit docs
edit-with-zen-mode.innerHTML=Edit with <b>zen mode</b>
editing=Editing
elements=Elements
enable-autosave.innerHTML=Enable <b>autosave</b>
Expand Down
26 changes: 9 additions & 17 deletions scripts/firetext.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ firetext.isInitialized = false;
var html = document.getElementsByTagName('html')[0], head = document.getElementsByTagName("head")[0];
var themeColor = document.getElementById("theme-color");
var loadSpinner, editor, toolbar, toolbarInterval, editWindow, editState, rawEditor, tabRaw, tabDesign;
var deviceType, fileChanged, saveTimeout, saving, tempAutozen, urls={}, version = '0.4';
var deviceType, fileChanged, saveTimeout, saving, urls={}, version = '0.4';
var bold, boldCheckbox, italic, italicCheckbox, justifySelect, strikethrough, strikethroughCheckbox;
var underline, underlineCheckbox;
var locationLegend, locationSelect, locationDevice, locationDropbox;
Expand Down Expand Up @@ -1118,10 +1118,8 @@ function processActions(eventAttribute, target) {
clearCreateForm();
} else if (calledFunction == 'fullscreen') {
if (target.getAttribute(eventAttribute + '-state') == 'off') {
tempAutozen = false;
editFullScreen(false);
} else {
tempAutozen = true;
editFullScreen();
}
} else if (calledFunction == 'browser') {
Expand Down Expand Up @@ -1160,7 +1158,7 @@ function processActions(eventAttribute, target) {
}
formatDoc('justify'+justifyDirection);
} else if (calledFunction == 'hideToolbar') {
if (deviceType != 'desktop' || html.classList.contains('fullscreen')) {
if (deviceType != 'desktop') {
if (document.getElementById('currentFileType').textContent != '.txt' &&
target.id === 'editor') {
document.getElementById('edit-bar').style.display = 'none';
Expand Down Expand Up @@ -1338,7 +1336,9 @@ function spinner(state) {
}

function editFullScreen(enter) {
if (enter != false) { // current working methods
if (enter === true ||
enter != false &&
!html.classList.contains('fullscreen')) { // current working methods
// Make app fullscreen
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
Expand Down Expand Up @@ -1366,29 +1366,21 @@ function onFullScreenChange() {
document.webkitFullscreenElement
) {
// Special editor UI
document.querySelector('#edit header:first-child').style.display = 'none';
document.getElementById('editTabs').setAttribute('data-items', '4.1');
document.querySelector('#editTabs #tabToolbarLeft').classList.add('visible');
document.querySelector('#editTabs #tabToolbarRight').classList.add('visible');
html.classList.add('fullscreen');
document.querySelector('#editor-zen-button span').classList.remove('icon-fs');
document.querySelector('#editor-zen-button span').classList.add('icon-efs');
} else {
// Regular editor UI
document.querySelector('#edit header:first-child').style.display = 'block';
document.getElementById('editTabs').setAttribute('data-items', '2');
document.querySelector('#editTabs #tabToolbarLeft').classList.remove('visible');
document.querySelector('#editTabs #tabToolbarRight').classList.remove('visible');
html.classList.remove('fullscreen');
document.querySelector('#editor-zen-button span').classList.remove('icon-efs');
document.querySelector('#editor-zen-button span').classList.add('icon-fs');
}
}

document.addEventListener('fullscreenchange', onFullScreenChange);
document.addEventListener('mozfullscreenchange', onFullScreenChange);
document.addEventListener('webkitfullscreenchange', onFullScreenChange);

function onFullScreenError() {
tempAutozen = false;
}

document.addEventListener('fullscreenerror', onFullScreenError);
document.addEventListener('mozfullscreenerror', onFullScreenError);
document.addEventListener('webkitfullscreenerror', onFullScreenError);
Expand Down
2 changes: 0 additions & 2 deletions scripts/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,8 @@ function loadToEditor(directory, filename, filetype, location, editable) {
// Hide save button if autosave is enabled
if (firetext.settings.get('autosave') != 'false') {
document.getElementById('editorSaveButton').style.display = 'none';
document.getElementById('zenSaveButton').style.display = 'none';
} else {
document.getElementById('editorSaveButton').style.display = 'inline-block';
document.getElementById('zenSaveButton').style.display = 'inline-block';
}
})
} else {
Expand Down
13 changes: 1 addition & 12 deletions scripts/regions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,7 @@ function nav2() {
tempElement.classList.add('current');

/* Remove this section when porting to other projects */
if (tempLoc == 'edit') {
if (tempAutozen !== false && deviceType === 'mobile') {
// Start Zen Mode if autozen == true
if (firetext.settings.get('autozen') == 'true' ||
tempAutozen === true) {
editFullScreen(true);
}
}

if (tempLoc == 'edit') {
// Save edit status
firetext.settings.save('autoload.wasEditing', 'true');
firetext.settings.save('autoload.dir', document.getElementById('currentFileDirectory').textContent);
Expand All @@ -77,9 +69,6 @@ function nav2() {
}
} else {
if (tempElement.getAttribute('role') === 'region') {
// No zen mode if region
editFullScreen(false);

// Not editing if region
firetext.settings.save('autoload.wasEditing', 'false');
}
Expand Down
16 changes: 0 additions & 16 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ firetext.settings.init = function () {
// Select elements
var autoloadEnabled = document.querySelector('#autoload-enabled-switch');
var autosaveEnabled = document.querySelector('#autosave-enabled-switch');
var autozenEnabled = document.querySelector('#autozen-enabled-switch');
var dropboxEnabled = document.querySelector('#dropbox-enabled-switch');
var languageSelect = document.querySelector('#language-select');
var nightmodeSelect = document.querySelector('#nightmode-select');
Expand Down Expand Up @@ -50,26 +49,11 @@ firetext.settings.init = function () {
firetext.settings.save('autosave', this.checked);
if (firetext.settings.get('autosave') != 'false') {
document.getElementById('editorSaveButton').style.display = 'none';
document.getElementById('zenSaveButton').style.display = 'none';
} else {
document.getElementById('editorSaveButton').style.display = 'inline-block';
document.getElementById('zenSaveButton').style.display = 'inline-block';
}
}

// Autozen
if (firetext.settings.get('autozen') == 'false') {
autozenEnabled.removeAttribute('checked');
} else {
autozenEnabled.setAttribute('checked', '');
if (!firetext.settings.get('autozen')) {
firetext.settings.save('autozen', 'true');
}
}
autozenEnabled.onchange = function () {
firetext.settings.save('autozen', this.checked);
}

// Dropbox
if (firetext.settings.get('dropbox.enabled') == 'true') {
dropboxEnabled.setAttribute('checked', '');
Expand Down
79 changes: 53 additions & 26 deletions style/desktop.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
html {
font-size: 8px;
font-size: 9px;
}

.mobile-only {
display: none !important;
}

/* Regions */
Expand Down Expand Up @@ -208,31 +212,6 @@ section[data-type="sidebar"] [role="toolbar"] button.active {
left: 9px;
margin-left: 0;
}

/* Settings */
#settings #autozen-enabled {
display: none;
}

/* Zen mode */
.fullscreen #hide-keyboard-button {
top: 5rem;
}

.fullscreen #edit-bar {
width: auto;
left: auto;
top: 4rem;
right: 0;
}

.fullscreen #edit-bar .icon-more {
-moz-transform: rotate(0.5turn);
-webkit-transform: rotate(0.5turn);
-o-transform: rotate(0.5turn);
-ms-transform: rotate(0.5turn);
transform: rotate(0.5turn);
}

/* Editor */
#fileName {
Expand Down Expand Up @@ -264,3 +243,51 @@ section[data-type="sidebar"] [role="toolbar"] button.active {
-ms-transform: rotate(0.5turn);
transform: rotate(0.5turn);
}

/* Zen mode */
.fullscreen .edit-header {
right: 0.5rem;
top: 0.5rem;
background-color: transparent;
position: absolute;
border: none;
}

.fullscreen .no-zen {
display: none !important;
}

.fullscreen #edit-bar {
background-color: transparent;
width: auto;
top: 6rem;
left: auto;
right: 0;
}

.fullscreen #edit-bar li {
float: none;
margin: 0;
padding: 0.5rem;
}

.fullscreen #edit-bar button:active,
.fullscreen #edit-bar button.active {
background-color: #fff;
}

.fullscreen #edit-bar .icon-more {
-moz-transform: rotate(-.25turn);
-webkit-transform: rotate(-.25turn);
-o-transform: rotate(-.25turn);
-ms-transform: rotate(-.25turn);
transform: rotate(-.25turn);
}

.fullscreen .editor-container {
height: 100%;
}

.fullscreen #rawEditor {
padding-top: 7rem;
}
61 changes: 0 additions & 61 deletions style/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -289,67 +289,6 @@ aside select.dummy {
width: 80%;
}


/* Tab Toolbar */
.tabToolbar {
text-align: right;
opacity: 0;
visibility: hidden;
height: 4rem;
transition: opacity .3s;
-moz-transition: opacity .3s;
-webkit-transition: opacity .3s;
-o-transition: opacity .3s;
white-space: nowrap;
}

.tabToolbar.visible {
opacity: 1;
visibility: visible;
}

.tabToolbar button,
.tabToolbar .button,
.tabToolbar input[type="button"] {
height: 100%;
background: transparent;
border: none;
font-size: 0;
border-radius: 0;
width: 4rem;
padding: 0 1rem;
}

.tabToolbar button:active,
.tabToolbar .button:active,
.tabToolbar input[type="button"]:active {
background-color: #dfdfdf;
transition: background 0.2s ease;
-moz-transition: background 0.2s ease;
-webkit-transition: background 0.2s ease;
-o-transition: background 0.2s ease;
}

.tabToolbar button[class*=" icon-"],
.tabToolbar button[class^="icon-"],
.tabToolbar .button[class*=" icon-"],
.tabToolbar .button[class^="icon-"],
.tabToolbar input[type="button"][class*=" icon-"],
.tabToolbar input[type="button"][class^="icon-"] {
font-size: 2.5rem;
text-shadow: none;
}

#tabToolbarLeft {
width: 0;
float: left;
}

#tabToolbarLeft.visible {
width: auto;
}


/* Spinner (Throbber) */
.spinner {
border-radius: 100%;
Expand Down
4 changes: 4 additions & 0 deletions style/mobile.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.desktop-only {
display: none !important;
}

/* Regions */
section[role="region"] {
-moz-transform: translateX(-100%);
Expand Down
11 changes: 0 additions & 11 deletions style/night.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
border-color: #2C2C2C;
}

.night .tabToolbar button:active {
background-color: #111;
}

.night section > header:first-child h1.firetext {
color: inherit;
}
Expand Down Expand Up @@ -279,13 +275,6 @@
color: #dfdfdf;
}

/* Tab Toolbar */
.night .tabToolbar button,
.night .tabToolbar .button,
.night .tabToolbar input[type="button"] {
color: #dfdfdf;
}

/* Status */
.night section[role="status"] {
background: #222;
Expand Down

0 comments on commit 9c20a33

Please sign in to comment.