Просмотр исходного кода

started making pdf viewer conditional - work in progress

Brian Gough 12 лет назад
Родитель
Сommit
57b09e1d60

+ 2 - 2
services/web/.gitignore

@@ -46,10 +46,10 @@ TpdsWorker.js
 BackgroundJobsWorker.js
 
 public/js/history/versiondetail.js
-!public/js/libs/*
+!public/js/libs/
 public/js/*
 !public/js/ace/*
-!public/js/libs/*
+!public/js/libs/
 public/js/editor.js
 public/js/home.js
 public/js/forms.js

+ 3 - 1
services/web/app/coffee/models/User.coffee

@@ -35,7 +35,9 @@ UserSchema = new Schema
 							compileTimeout: { type:Number, default: Settings.defaultFeatures.compileTimeout }
 							compileGroup:  { type:String,  default: Settings.defaultFeatures.compileGroup }
 						}
-	featureSwitches	  : {}
+	featureSwitches	  : {
+		pdfng: { type: Boolean }
+	}
 	referal_id : {type:String, default:() -> uuid.v4().split("-")[0]}
 	refered_users: [ type:ObjectId, ref:'User' ]
 	refered_user_count: { type:Number, default: 0 }

+ 4 - 2
services/web/app/views/project/editor.jade

@@ -112,8 +112,10 @@ block content
 
 	- locals.suppressDefaultJs = true
 
-	- var fingerprintedPath = fingerprint(jsPath+'libs/pdf.worker.js')
-	- var pdfJsWorkerPath = jsPath+'libs/pdf.worker.js?fingerprint='+fingerprintedPath
+	- var pdfPath = 'libs/pdf.worker.js'
+	- if (user.featureSwitches && user.featureSwitches.pdfng) { pdfPath = 'libs/pdfjs-1.0.712/pdf.worker.js'; }
+	- var fingerprintedPath = fingerprint(jsPath+pdfPath)
+	- var pdfJsWorkerPath = jsPath+pdfPath+'?fingerprint='+fingerprintedPath
 	script(type='text/javascript').
 		window.pdfJsWorkerPath = "#{pdfJsWorkerPath}";
 

+ 1 - 1
services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee

@@ -6,7 +6,7 @@ define [
 	"ide/pdfng/directives/pdfRenderer"
 	"ide/pdfng/directives/pdfPage"
 	"ide/pdfng/directives/pdfViewer"
-	"libs/pdf"
+	"libs/pdfjs-1.0.712/pdf"
 	"text!libs/pdfListView/TextLayer.css"
 	"text!libs/pdfListView/AnnotationsLayer.css"
 	"text!libs/pdfListView/HighlightsLayer.css"