修改KE贴吧等地图片显示不出来的问题

This commit is contained in:
yuanke 2016-03-14 17:16:11 +08:00
parent 006731ea61
commit 465a236049
2 changed files with 21 additions and 2 deletions

View File

@ -61,7 +61,7 @@
<%= link_to @memo.author.name, user_path(@memo.author), :class => "linkBlue2", :target=> "_blank"%></div>
<div class="postDetailDate mb5"><%= format_date( @memo.created_at)%></div>
<div class="cl"></div>
<div class="homepagePostIntro memo-content" id="message_description_<%= @memo.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<div class="homepagePostIntro memo-content" id="activity_description_<%= @memo.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @memo.content.html_safe%>
</div>
<div class="cl"></div>
@ -126,7 +126,7 @@
</div>
<script type="text/javascript">
$(function(){
$("#message_description_<%= @memo.id %> p,#message_description_<%= @memo.id %> span,#message_description_<%= @memo.id %> em").each(function(){
$("#activity_description_<%= @memo.id %> p,#activity_description__<%= @memo.id %> span,#activity_description_<%= @memo.id %> em").each(function(){
var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," ");
postContent= postContent.replace(/ {2}/g,"&nbsp; ");
@ -134,5 +134,6 @@
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
$(this).html(postContent);
});
description_show_hide(<%= @memo.id %>);
});
</script>

View File

@ -1011,8 +1011,11 @@ function showNormalImage(id) {
if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]);
var _path = getRootPath();
//如果图片是视频图片,不处理。
if($(image).hasClass("mediaIco")){
var _src = _path+"/"+$(image).attr('src');
$(image).attr('src',_src);
return;
}
var element=$("<a></a>").attr("href",image.attr('src'));
@ -1024,6 +1027,7 @@ function showNormalImage(id) {
}
//文件、帖子、通知分享
function org_id_click(){
var sendText = $("input[name='org_id']:checked").next().text();
@ -1156,3 +1160,17 @@ function disable_down(source, des, hint){
}
}
function getRootPath(){
//获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp
var curWwwPath=window.document.location.href;
//获取主机地址之后的目录,如: uimcardprj/share/meun.jsp
var pathName=window.document.location.pathname;
var pos=curWwwPath.indexOf(pathName);
//获取主机地址,如: http://localhost:8083
var localhostPaht=curWwwPath.substring(0,pos);
//获取带"/"的项目名,如:/uimcardprj
var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
return(localhostPaht+projectName);
}