Commit cb7a3ad8 by Miles Steele Committed by Carlos Andrés Rocha

switch from log_event to Logger.log

keep log_event for compatibility
parent 5692867b
......@@ -42,5 +42,7 @@ class @Logger
page: window.location.href
async: false
# Keeping this for compatibility issue only.
# log_event exists for compatibility reasons
# and will soon be deprecated.
@log_event = Logger.log
......@@ -157,7 +157,7 @@ PDFJS.disableWorker = true;
}
// Update logging:
log_event("book", { "type" : "gotopage", "old" : pageNum, "new" : num });
Logger.log("book", { "type" : "gotopage", "old" : pageNum, "new" : num });
parentElement = viewerElement;
while (parentElement.hasChildNodes())
......@@ -207,7 +207,7 @@ PDFJS.disableWorker = true;
if (pageNum <= 1)
return;
renderPage(pageNum - 1);
log_event("book", { "type" : "prevpage", "new" : pageNum });
Logger.log("book", { "type" : "prevpage", "new" : pageNum });
}
// Go to next page
......@@ -215,7 +215,7 @@ PDFJS.disableWorker = true;
if (pageNum >= pdfDocument.numPages)
return;
renderPage(pageNum + 1);
log_event("book", { "type" : "nextpage", "new" : pageNum });
Logger.log("book", { "type" : "nextpage", "new" : pageNum });
}
selectScaleOption = function(value) {
......
......@@ -57,8 +57,7 @@ describe 'Navigation', ->
describe 'log', ->
beforeEach ->
window.log_event = ->
spyOn window, 'log_event'
spyOn Logger, 'log'
it 'submit event log', ->
@navigation.log {}, {
......@@ -68,6 +67,6 @@ describe 'Navigation', ->
text: -> "old"
}
expect(window.log_event).toHaveBeenCalledWith 'accordion',
expect(Logger.log).toHaveBeenCalledWith 'accordion',
newheader: 'new'
oldheader: 'old'
......@@ -20,7 +20,7 @@ class @Navigation
$('#accordion a').click @setChapter
log: (event, ui) ->
log_event 'accordion',
Logger.log 'accordion',
newheader: ui.newHeader.text()
oldheader: ui.oldHeader.text()
......
......@@ -25,7 +25,7 @@ $(document).ready(function(){
});
function goto_page(n) {
log_event("book", {"type":"gotopage","old":page,"new":n});
Logger.log("book", {"type":"gotopage","old":page,"new":n});
page=n;
var prefix = "";
if(n<100) {
......@@ -42,14 +42,14 @@ function prev_page() {
var newpage=page-1;
if(newpage< ${start_page}) newpage=${start_page};
goto_page(newpage);
log_event("book", {"type":"prevpage","new":page});
Logger.log("book", {"type":"prevpage","new":page});
}
function next_page() {
var newpage=page+1;
if(newpage> ${end_page}) newpage=${end_page};
goto_page(newpage);
log_event("book", {"type":"nextpage","new":page});
Logger.log("book", {"type":"nextpage","new":page});
}
$("#open_close_accordion a").click(function(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment