parse document position
This commit is contained in:
parent
af0affb7bf
commit
a7d70c15ea
3 changed files with 23 additions and 6 deletions
|
|
@ -1994,9 +1994,11 @@ pandora.getSpan = function(state, val, callback) {
|
|||
if (Ox.contains(['epub', 'pdf', 'txt'], extension)) {
|
||||
state.span = Ox.limit(parseInt(val), 1, dimensions);
|
||||
} else if (Ox.contains(['html'], extension)) {
|
||||
//fixme: allow numbers or check names?
|
||||
//state.span = Ox.limit(parseInt(val), 0, 100);
|
||||
state.span = val
|
||||
if (pandora.isNumericalSpan(val)) {
|
||||
state.span = Ox.limit(parseInt(val), 0, 100);
|
||||
} else {
|
||||
state.span = val;
|
||||
}
|
||||
} else if (Ox.contains(['gif', 'jpg', 'png'], extension)) {
|
||||
values = val.split(',');
|
||||
if (values.length == 4) {
|
||||
|
|
@ -2443,6 +2445,12 @@ pandora.isLicensed = function() {
|
|||
return !pandora.site.license || pandora.site.license > +new Date();
|
||||
};
|
||||
|
||||
pandora.isNumericalSpan = function(str) {
|
||||
return str.split(',').every(function(str) {
|
||||
return /^[0-9-\.:]+$/.test(str);
|
||||
});
|
||||
}
|
||||
|
||||
pandora.isPrintURL = function(url) {
|
||||
url = url || document.location.href;
|
||||
var hash = Ox.parseURL(url).hash;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue