Refactors PDFLinkService.

# Conflicts:
#	web/viewer.js
This commit is contained in:
Yury Delendik 2015-04-27 10:25:32 -05:00
parent 73545fbb92
commit 0ef6212b64
7 changed files with 389 additions and 246 deletions

View file

@ -179,6 +179,21 @@ function watchScroll(viewAreaElement, callback) {
return state;
}
/**
* Helper function to parse query string (e.g. ?param1=value&parm2=...).
*/
function parseQueryString(query) {
var parts = query.split('&');
var params = {};
for (var i = 0, ii = parts.length; i < ii; ++i) {
var param = parts[i].split('=');
var key = param[0].toLowerCase();
var value = param.length > 1 ? param[1] : null;
params[decodeURIComponent(key)] = decodeURIComponent(value);
}
return params;
}
/**
* Use binary search to find the index of the first item in a given array which
* passes a given condition. The items are expected to be sorted in the sense