use pandora.UI.encode, fix span parsing for texts

This commit is contained in:
j 2013-09-08 17:31:15 +00:00
parent 41a1a1f94f
commit dcf0893ea1
4 changed files with 7 additions and 7 deletions

View file

@ -174,7 +174,7 @@ pandora.UI = (function() {
if (args.text) { if (args.text) {
add['texts.' + that.encode(args.text)] = Ox.map(textSettings, function(value, key) { add['texts.' + that.encode(args.text)] = Ox.map(textSettings, function(value, key) {
var textsKey = 'texts.' + that.encode(args.text) + '.' + key; var textsKey = 'texts.' + that.encode(args.text) + '.' + key;
return textsKey in args ? args[editextsKeytsKey] return textsKey in args ? args[textsKey]
: pandora.user.ui.texts[args.text] ? pandora.user.ui.texts[args.text][key] : pandora.user.ui.texts[args.text] ? pandora.user.ui.texts[args.text][key]
: value; : value;
}); });

View file

@ -65,8 +65,8 @@ pandora.URL = (function() {
: [] : []
); );
} else if (pandora.user.ui.section == 'texts') { } else if (pandora.user.ui.section == 'texts') {
var position = pandora.user.ui.texts[state.text] var position = pandora.user.ui.texts[state.item]
? pandora.user.ui.texts[state.text].position ? pandora.user.ui.texts[state.item].position
: 0; : 0;
if (position) { if (position) {
state.span = position; state.span = position;
@ -199,7 +199,7 @@ pandora.URL = (function() {
} else if (state.type == 'edits') { } else if (state.type == 'edits') {
if (state.span) { if (state.span) {
var key = 'edits.' + state.item.replace(/\./g, '\\.'); var key = 'edits.' + pandora.UI.encode(state.item);
set[key] = {}; set[key] = {};
if (Ox.isArray(state.span)) { if (Ox.isArray(state.span)) {
set[key + '.clip'] = ''; set[key + '.clip'] = '';
@ -217,7 +217,7 @@ pandora.URL = (function() {
} else if (state.type == 'texts') { } else if (state.type == 'texts') {
if (state.span) { if (state.span) {
set['texts.' + state.item.replace(/\./g, '\\.') + '.position'] = state.span; set['texts.' + pandora.UI.encode(state.item) + '.position'] = state.span;
} }
} }

View file

@ -365,7 +365,7 @@ pandora.ui.textPDF = function(text) {
}); });
}).open(); }).open();
} else if (event == 'page') { } else if (event == 'page') {
pandora.UI.set('texts.' + pandora.user.ui.text.replace(/\./g, '\\.') + '.position', [data.page]); pandora.UI.set('texts.' + pandora.UI.encode(pandora.user.ui.text) + '.position', [data.page]);
} }
}) })
.appendTo(that); .appendTo(that);

View file

@ -2,7 +2,7 @@ Ox.load(function() {
window.addEventListener('hashchange', function() { window.addEventListener('hashchange', function() {
var page = document.location.hash.substring(1).split('=')[1]; var page = document.location.hash.substring(1).split('=')[1];
page && Ox.$parent.postMessage('page', { page && Ox.$parent.postMessage('page', {
page: page page: Math.round(page)
}); });
}); });
Ox.$parent.onMessage(function(event, data, oxid) { Ox.$parent.onMessage(function(event, data, oxid) {