forked from 0x2620/pandora
move enhancement of links into utils
This commit is contained in:
parent
d30c2ba78e
commit
30db2b8b63
4 changed files with 26 additions and 31 deletions
|
@ -109,7 +109,7 @@ window.onerror = function(error, url, line) {
|
|||
gradient.style.background = theme == 'classic'
|
||||
? '-webkit-linear-gradient(top, rgba(224, 224, 224, 0.75), rgba(224, 224, 224, 1), rgba(224, 224, 224, 1))'
|
||||
: '-webkit-linear-gradient(top, rgba(32, 32, 32, 0.75), rgba(32, 32, 32, 1), rgba(32, 32, 32, 1))';
|
||||
loadingScreen = document.createElement('div');
|
||||
var loadingScreen = document.createElement('div');
|
||||
loadingScreen.setAttribute('id', 'loadingScreen');
|
||||
loadingScreen.className = 'OxScreen';
|
||||
loadingScreen.style.position = 'absolute';
|
||||
|
|
|
@ -111,16 +111,6 @@ pandora.ui.infoView = function(data) {
|
|||
right: margin + statisticsWidth + margin + 'px',
|
||||
//background: 'green'
|
||||
})
|
||||
.bind({
|
||||
click: function() {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.bindEvent({
|
||||
singleclick: function(e) {
|
||||
$(e.target).is('a') && clickLink(e);
|
||||
}
|
||||
})
|
||||
.appendTo($data.$element),
|
||||
|
||||
$statistics = $('<div>')
|
||||
|
@ -134,6 +124,8 @@ pandora.ui.infoView = function(data) {
|
|||
|
||||
$browserImages = [];
|
||||
|
||||
pandora.createLinks($text);
|
||||
|
||||
// Title -------------------------------------------------------------------
|
||||
|
||||
$('<div>')
|
||||
|
@ -174,7 +166,7 @@ pandora.ui.infoView = function(data) {
|
|||
})
|
||||
.append(
|
||||
Ox.Editable({
|
||||
clickLink: clickLink,
|
||||
clickLink: pandora.clickLink,
|
||||
editable: isEditable,
|
||||
format: function(value) {
|
||||
return value
|
||||
|
@ -212,7 +204,7 @@ pandora.ui.infoView = function(data) {
|
|||
.html(formatKey(key).replace('</span>', ' </span>'))
|
||||
.appendTo($div);
|
||||
Ox.Editable({
|
||||
clickLink: clickLink,
|
||||
clickLink: pandora.clickLink,
|
||||
format: function(value) {
|
||||
return value
|
||||
? formatValue(value.split(', '), key)
|
||||
|
@ -490,15 +482,6 @@ pandora.ui.infoView = function(data) {
|
|||
renderList();
|
||||
}
|
||||
|
||||
function clickLink(e) {
|
||||
if (e.target.hostname == document.location.hostname) {
|
||||
pandora.URL.push(e.target.pathname);
|
||||
} else {
|
||||
document.location.href = '/url=' + encodeURIComponent(e.target.href);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function editMetadata(key, value) {
|
||||
if (value != data[key]) {
|
||||
var edit = {id: data.id};
|
||||
|
|
|
@ -15,12 +15,13 @@ pandora.ui.siteDialog = function(section) {
|
|||
pandora.api.getPage({name: id}, function(result) {
|
||||
Ox.print('DATA::', result.data)
|
||||
Ox.Editable({
|
||||
clickLink: pandora.clickLink,
|
||||
editable: pandora.site.capabilities.canEditSitePages[pandora.user.level],
|
||||
tooltip: 'Doubleclick to edit',
|
||||
type: 'textarea',
|
||||
value: result.data.body
|
||||
})
|
||||
.css({width: '100%'})
|
||||
.css({width: '100%'/*, height: '100%'*/})
|
||||
.bindEvent({
|
||||
submit: function(data) {
|
||||
Ox.Request.clearCache('getPage');
|
||||
|
|
|
@ -134,15 +134,26 @@ pandora.addList = function() {
|
|||
}
|
||||
};
|
||||
|
||||
pandora.clickLink = function(e) {
|
||||
if (e.target.hostname == document.location.hostname) {
|
||||
pandora.URL.push(e.target.pathname);
|
||||
} else {
|
||||
document.location.href = '/url=' + encodeURIComponent(e.target.href);
|
||||
}
|
||||
};
|
||||
|
||||
pandora.createLinks = function($element) {
|
||||
$element.find('a').click(function(event) {
|
||||
if (event.target.hostname == document.location.hostname) {
|
||||
pandora.URL.push(event.target.pathname);
|
||||
} else {
|
||||
document.location.href = '/url=' + encodeURIComponent(event.target.href);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$element
|
||||
.bind({
|
||||
click: function() {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.bindEvent({
|
||||
singleclick: function(e) {
|
||||
$(e.target).is('a') && pandora.clickLink(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
pandora.enableDragAndDrop = function($list, canMove) {
|
||||
|
|
Loading…
Reference in a new issue