Анвар, да одна дефолтная ссылка визуально чего стоит - ужас ужас ). Я не спорю, отказываться по сути не хочу. Тем более на форуме есть самописные вещи, уже завязанные на нестандартные ссылки. Но присутствие на форуме ссылок того и другого вида напрягает, тем более если человек залил фото и вставил дефолтную ссылку - она и индексируется как дефолтная, что не гут. Может взглянете на портянку? Там есть формирование ссылки, но как поправить я не понимаю:
Код: Выделить всё
<!-- IF PAI_ENABLED and (S_VIEWTOPIC or S_IN_POSTING or S_COMPOSE_PM) -->
<script type="text/javascript">
// <![CDATA[
var max_width = '{PAI_MAX_WIDTH}';
var max_height = '{PAI_MAX_HEIGHT}';
var onclick_event = (typeof hs !== 'undefined') ? "return hs.expand(this);" : "window.open(this.href); return false;";
// The "callback" argument is called with either true or false
// depending on whether the image at "url" exists or not.
function imageExists(url, callback) {
var img = new Image();
img.onload = function() { callback(true); };
img.onerror = function() { callback(false); };
img.src = url;
}
(function($) {
$.fn.nextElementInDom = function(selector, options) {
var defaults = {stopAt : 'body'};
options = $.extend(defaults, options);
var parent = $(this).parent();
var found = parent.find(selector);
switch(true) {
case (found.length > 0):
return found;
case (parent.length === 0 || parent.is(options.stopAt)):
return $([]);
default:
return parent.nextElementInDom(selector);
}
};
})(jQuery);
if (typeof phpbb.plupload !== 'undefined')
{
phpbb.plupload.updateRow = function(index, downloadUrl) {
var attach = phpbb.plupload.data[index],
row = $('[data-attach-id="' + attach.attach_id + '"]');
// Add the link to the file
if (typeof downloadUrl !== 'undefined' && typeof downloadUrl[index] !== 'undefined') {
var url = downloadUrl[index].replace('&', '&'),
link = $('<a></a>');
imageExists(url, function(exists) {
if (exists)
{
link.attr('onclick', onclick_event);
link.attr('href', url).html("<img src='" + url + "' style='max-width: " + max_width + "px; max-height: " + max_height + "px;' alt='" + attach.real_filename + "' />");
row.find('.attach-controls').prepend("<div style='margin-bottom: 5px;'><a href='" + url + "' onclick='window.open(this.href); return false;'>" + attach.real_filename + "</a></div>");
}
else
{
link.attr('href', url).html(attach.real_filename);
}
});
row.find('.file-name').html(link)
}
row.find('textarea').attr('rows', '3');
row.find('textarea').attr('name', 'comment_list[' + index + ']');
phpbb.plupload.updateHiddenData(row, attach, index);
};
}
$('a[href^="./download/file.php?mode=view&id="]').each(function() {
var link = $(this);
var url = $(this).attr('href');
var real_filename = this.innerHTML;
link.removeAttr("target");
imageExists(url, function(exists) {
if (exists)
{
link.attr('onclick', onclick_event);
link.attr('href', url).html("<img src='" + url + "' style='max-width: " + max_width + "px; max-height: " + max_height + "px;' alt='" + real_filename + "' />");
link.nextElementInDom(".attach-controls").prepend("<div style='margin-bottom: 5px;'><a href='" + url + "' onclick='window.open(this.href); return false;'>" + real_filename + "</a></div>");
}
else
{
link.attr('href', url).html(real_filename);
}
});
});
$('textarea[name^="comment_list"]').each(function() {
$(this).attr('rows', '3');
});
// ]]>
</script>
<!-- ENDIF -->