mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Avoid duplicating code
This commit is contained in:
parent
d51549c4f0
commit
849c5253c7
3 changed files with 19 additions and 18 deletions
|
@ -106,7 +106,7 @@ div.full-size.pdf(ng-controller="PdfController")
|
||||||
| #{translate("code_check_failed")}
|
| #{translate("code_check_failed")}
|
||||||
a(
|
a(
|
||||||
href,
|
href,
|
||||||
ng-click="switchToFlatLayout()"
|
ng-click="switchToFlatLayout('pdf')"
|
||||||
ng-show="ui.pdfLayout == 'sideBySide'"
|
ng-show="ui.pdfLayout == 'sideBySide'"
|
||||||
tooltip=translate('full_screen')
|
tooltip=translate('full_screen')
|
||||||
tooltip-placement="bottom"
|
tooltip-placement="bottom"
|
||||||
|
@ -116,7 +116,7 @@ div.full-size.pdf(ng-controller="PdfController")
|
||||||
i.full-screen
|
i.full-screen
|
||||||
a(
|
a(
|
||||||
href,
|
href,
|
||||||
ng-click="switchToSideBySideLayout()"
|
ng-click="switchToSideBySideLayout('editor')"
|
||||||
ng-show="ui.pdfLayout == 'flat'"
|
ng-show="ui.pdfLayout == 'flat'"
|
||||||
tooltip=translate('split_screen')
|
tooltip=translate('split_screen')
|
||||||
tooltip-placement="bottom"
|
tooltip-placement="bottom"
|
||||||
|
|
|
@ -190,6 +190,23 @@ define [
|
||||||
ide.localStorage = localStorage
|
ide.localStorage = localStorage
|
||||||
|
|
||||||
ide.browserIsSafari = false
|
ide.browserIsSafari = false
|
||||||
|
|
||||||
|
$scope.switchToFlatLayout = (view) ->
|
||||||
|
$scope.ui.pdfLayout = 'flat'
|
||||||
|
$scope.ui.view = view
|
||||||
|
ide.localStorage "pdf.layout", "flat"
|
||||||
|
|
||||||
|
$scope.switchToSideBySideLayout = (view) ->
|
||||||
|
$scope.ui.pdfLayout = 'sideBySide'
|
||||||
|
$scope.ui.view = view
|
||||||
|
localStorage "pdf.layout", "split"
|
||||||
|
|
||||||
|
if pdfLayout = localStorage("pdf.layout")
|
||||||
|
$scope.switchToSideBySideLayout() if pdfLayout == "split"
|
||||||
|
$scope.switchToFlatLayout() if pdfLayout == "flat"
|
||||||
|
else
|
||||||
|
$scope.switchToSideBySideLayout()
|
||||||
|
|
||||||
try
|
try
|
||||||
userAgent = navigator.userAgent
|
userAgent = navigator.userAgent
|
||||||
ide.browserIsSafari = (
|
ide.browserIsSafari = (
|
||||||
|
|
|
@ -588,22 +588,6 @@ define [
|
||||||
{doc, line} = data
|
{doc, line} = data
|
||||||
ide.editorManager.openDoc(doc, gotoLine: line)
|
ide.editorManager.openDoc(doc, gotoLine: line)
|
||||||
|
|
||||||
$scope.switchToFlatLayout = () ->
|
|
||||||
$scope.ui.pdfLayout = 'flat'
|
|
||||||
$scope.ui.view = 'pdf'
|
|
||||||
ide.localStorage "pdf.layout", "flat"
|
|
||||||
|
|
||||||
$scope.switchToSideBySideLayout = () ->
|
|
||||||
$scope.ui.pdfLayout = 'sideBySide'
|
|
||||||
$scope.ui.view = 'editor'
|
|
||||||
localStorage "pdf.layout", "split"
|
|
||||||
|
|
||||||
if pdfLayout = localStorage("pdf.layout")
|
|
||||||
$scope.switchToSideBySideLayout() if pdfLayout == "split"
|
|
||||||
$scope.switchToFlatLayout() if pdfLayout == "flat"
|
|
||||||
else
|
|
||||||
$scope.switchToSideBySideLayout()
|
|
||||||
|
|
||||||
App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) ->
|
App.factory "synctex", ["ide", "$http", "$q", (ide, $http, $q) ->
|
||||||
# enable per-user containers by default
|
# enable per-user containers by default
|
||||||
perUserCompile = true
|
perUserCompile = true
|
||||||
|
|
Loading…
Reference in a new issue