Sort out fingerprints and pdf.js worker path

This commit is contained in:
James Allen 2014-07-16 11:28:52 +01:00
parent eb818be2df
commit 8f08823d34
6 changed files with 13 additions and 14 deletions

View file

@ -217,12 +217,7 @@ module.exports = ProjectController =
autoComplete: user.ace.autoComplete
pdfViewer : user.ace.pdfViewer
}
sharelatex : {
siteUrl: Settings.siteUrl,
jsPath: res.locals.jsPath
}
privilegeLevel: privilegeLevel
loadPdfjs: (user.ace.pdfViewer == "pdfjs")
chatUrl: Settings.apis.chat.url
anonymous: anonymous
languages: Settings.languages

View file

@ -17,12 +17,10 @@ logger.log "Generating file fingerprints..."
for path in [
"#{jsPath}libs/require.js",
"#{jsPath}ide.js",
"#{jsPath}app/main.js",
"#{jsPath}list.js",
"#{jsPath}main.js",
"#{jsPath}libs/pdf.js",
"#{jsPath}libs/pdf.worker.js",
"/stylesheets/style.css",
"/brand/plans.css"
"/stylesheets/style.css"
]
filePath = Path.join __dirname, "../../../", "public#{path}"
exists = fs.existsSync filePath

View file

@ -80,7 +80,10 @@ html(itemscope, itemtype='http://schema.org/Product')
};
script.
window.sharelatex = {}
window.sharelatex = {
siteUrl: '#{settings.siteUrl}',
jsPath: '#{jsPath}'
};
- if (typeof(settings.algolia) != "undefined")
script.

View file

@ -82,7 +82,6 @@ block content
//- and doesn't prematurely end the script tag.
script(type='text/javascript').
window.project_id = "!{project_id}"
window.sharelatex = !{JSON.stringify(sharelatex).replace(/\//g, '\\/')};
window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')};
window.user = !{JSON.stringify(user).replace(/\//g, '\\/')};
window.csrfToken = "!{csrfToken}";
@ -99,6 +98,9 @@ block content
},
"libs/pdf": {
deps: ["libs/compatibility"]
},
"ace/ext-searchbox": {
deps: ["ace/ace"]
}
}
};
@ -112,7 +114,7 @@ block content
- var fingerprintedPath = fingerprint(jsPath+'libs/pdf.worker.js')
- var pdfJsWorkerPath = jsPath+'libs/pdf.worker.js?fingerprint='+fingerprintedPath
script(type='text/javascript').
window.sharelatex.pdfJsWorkerPath = "#{pdfJsWorkerPath}"
window.pdfJsWorkerPath = "#{pdfJsWorkerPath}";
script(
data-main=jsPath+'ide.js',

View file

@ -66,7 +66,7 @@ define [
name: "find",
bindKey: win: "Ctrl-F", mac: "Command-F"
exec: (editor) ->
Ace.require("ace/ext/searchbox").Search(editor, true)
ace.require("ace/ext/searchbox").Search(editor, true)
readOnly: true
editor.commands.removeCommand "replace"

View file

@ -17,8 +17,9 @@ define [
annotationsLayerCss
highlightsLayerCss
) ->
console.log "SETTING workerSrc", PDFJS, window.pdfJsWorkerPath
if PDFJS?
PDFJS.workerSrc = "#{window.sharelatex.pdfJsWorkerPath}"
PDFJS.workerSrc = window.pdfJsWorkerPath
style = $("<style/>")
style.text(textLayerCss + "\n" + annotationsLayerCss + "\n" + highlightsLayerCss)