');
obj.html(str);
str=obj.text();
title=jQuery(this).parents('.data_for_links').find('.title_for_links h3').text();
if (jQuery(this).parents('.bl_news').length>0){
title=jQuery(this).parents('.bl_news').find('.bl_top h3 .show_title').text();
};
//обработка строк
title=title.replace(/[\n\r]/g,'').replace(/"/g,'').replace(/'/g,"");
str=str.replace(/[\n\r]/g,'').replace(/"/g,'').replace(/'/g,"");
limit=300;
if (str.length>limit){
copy_str=str.substr(0,limit);
reg=/[\wА-Яа-яЁё-]/;
//два граничащих символа не должны быть одновременно буквой, цифрой, - или _, иначе слово разорвано
if (str.charAt(limit).match(reg) && str.charAt(limit-1).match(reg)){
reg=/(.*[\wА-Яа-яЁё-])([^\wА-Яа-яЁё-]+[\wА-Яа-яЁё-]+)/;
arr=copy_str.match(reg);
copy_str=arr[1];
}
//последний символ должен быть буквой, цифрой, - или _
else {
reg=/[\wА-Яа-яЁё-]/;
if(!str.charAt(limit-1).match(reg)){
reg=/(.*[\wА-Яа-яЁё-])([^\wА-Яа-яЁё-]+)/;
arr=copy_str.match(reg);
copy_str=arr[1];
}
}
copy_str+='...';
str=copy_str;
}
text_head="
Поделиться с другом
";
text="
";
text+="";
addr="@trkterra";
//140 символов, допустимых в твиттере - это адрес, текст, 2 пробела и 20 символов на ссылку
tit_len=140-20-2-addr.length;
if (title.length > tit_len){
title_tw=title.substr(0,tit_len-3)+'...';
}
else{
title_tw=title;
}
text+="";
text+="
";
text+="";
text+="
";
//button_vk=VK.Share.button({url:url, title:title, description: title, image:'', noparse:true}, {type: 'custom', text: '
'});
//text+=button_vk;
text+="
";
lightAdd(text_head+text, "", "", "", "mixed", "form_share");
light_init(0);
open_light(0, "form_share", function(){
jQuery('.abs .to_shared').replaceWith(text);
});
return false;
})
})
Материалы по теме: