Здравствуйте, помогите исправить код. Нужно в строке 109
' <a href="'+(item.origLink || item.link[0].href || item.link)+'" target="_blank">[читать]</a>'
установить href атрибута используя Attr().
/* Configuration: */
var tabs = {
"@vgs" : {
"feed" : "",
"function" : rss
}
}
var totalTabs;
$(document).ready(function(){
totalTabs=0;
$.each(tabs,function(){totalTabs++;})
$('#feedWidget').show().mouseleave(function(){
$('.dropDownList').remove();
$('#activeTab').removeClass('hover');
}).mouseenter(function(){
if(totalTabs>1) $('#activeTab').addClass('hover');
});
$('#activeTab').click(showDropDown);
$('.dropDownList div').live('click',function(){
showDropDown();
showTab($(this).text());
});
showTab('@vgs');
});
function showTab(key)
{
var obj = tabs[key];
if(!obj) return false;
var stage = $('#tabContent');
var query = "select * from feed where url='"+obj.feed+"' LIMIT 10";
var url = "https://***/v1/public/yql?q="+encodeURIComponent(query)+"&format=json&callback=?";
$.getJSON(url,function(data){
stage.empty();
$.each(data.query.results.item || data.query.results.entry,function(){
try{
stage.append(obj['function'](this));
}
catch(e){
var f_name =obj['function'].toString().match(/function\s+(\w+)\(/i);
if(f_name) f_name = f_name[1];
stage.append('<div>There is a problem with your '+f_name+ ' function</div>');
return false;
}
})
});
$('#activeTab').text(key);
}
function showDropDown()
{
if(totalTabs<2) return false;
if($('#feedWidget .dropDownList').length)
{
$('.dropDownList').slideUp('fast',function(){ $(this).remove(); })
return false;
}
var activeTab = $('#activeTab');
var offsetTop = (activeTab.offset().top - $('#feedWidget').offset().top )+activeTab.outerHeight() - 5;
var dropDown = $('<div>').addClass('dropDownList').css({
'top' : offsetTop,
'width' : activeTab.width()
}).hide().appendTo('#feedWidget')
$.each(tabs,function(j){
if(j==activeTab.text()) return true;
$('<div>').text(j).appendTo(dropDown);
})
dropDown.slideDown('fast');
}
function rss(item)
{
return $('<div>').html(
formatString(item.title.content || item.title)+
' <a href="'+(item.origLink || item.link[0].href || item.link)+'" target="_blank">[читать]</a>'
);
}
function formatString(str)
{
str = str.replace(/<[^>]+>/ig,'');
str=' '+str;
return str;
}