 //
-//  TestController.swift
+//  ReaderViewController.swift
 //  Settings
 //
 //  Created by Gary Griswold on 10/16/18.

        configuration.preferences.javaScriptEnabled = true
        let js = Note.decodeRange + Note.installEffect + Note.encodeRange
        let script = WKUserScript(source: js, injectionTime: .atDocumentStart, forMainFrameOnly: false)
        configuration.userContentController.addUserScript(script)
        self.webView = WKWebView(frame: self.view.bounds, configuration: configuration)
        self.webView.backgroundColor = AppFont.backgroundColor
        

        print("ERROR: Bible page load error \(withError)")
        NotificationCenter.default.post(name: ReaderPagesController.WEB_LOAD_DONE, object: nil)
    }
    
    //
    // WKScriptMessageHandler
    //
    func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
        if let noteId = message.body as? String {
            if message.name == "book" {
                print("click on book")
            }
            else if message.name == "note" {
                print("click on note")
            }
        }
    }
}
