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) {
add['texts.' + that.encode(args.text)] = Ox.map(textSettings, function(value, 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]
: value;
});

View File

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

View File

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